diff --git a/google/cloud/aiplatform_v1/services/dataset_service/async_client.py b/google/cloud/aiplatform_v1/services/dataset_service/async_client.py index 84687fa09c..6de1c71606 100644 --- a/google/cloud/aiplatform_v1/services/dataset_service/async_client.py +++ b/google/cloud/aiplatform_v1/services/dataset_service/async_client.py @@ -13,6 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging as std_logging from collections import OrderedDict import re from typing import ( @@ -69,6 +70,15 @@ from .transports.grpc_asyncio import DatasetServiceGrpcAsyncIOTransport from .client import DatasetServiceClient +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 DatasetServiceAsyncClient: """The service that manages Vertex AI Dataset and its child @@ -290,6 +300,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.aiplatform_v1.DatasetServiceAsyncClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DatasetService", + "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.aiplatform.v1.DatasetService", + "credentialsType": None, + }, + ) + async def create_dataset( self, request: Optional[Union[dataset_service.CreateDatasetRequest, dict]] = None, @@ -298,7 +330,7 @@ async def create_dataset( dataset: Optional[gca_dataset.Dataset] = 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"""Creates a Dataset. @@ -358,8 +390,10 @@ async def sample_create_dataset(): 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: @@ -433,7 +467,7 @@ async def get_dataset( 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]]] = (), ) -> dataset.Dataset: r"""Gets a Dataset. @@ -478,8 +512,10 @@ async def sample_get_dataset(): 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.aiplatform_v1.types.Dataset: @@ -541,7 +577,7 @@ async def update_dataset( 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]]] = (), ) -> gca_dataset.Dataset: r"""Updates a Dataset. @@ -603,8 +639,10 @@ async def sample_update_dataset(): 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.aiplatform_v1.types.Dataset: @@ -669,7 +707,7 @@ async def list_datasets( 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.ListDatasetsAsyncPager: r"""Lists Datasets in a Location. @@ -714,8 +752,10 @@ async def sample_list_datasets(): 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.aiplatform_v1.services.dataset_service.pagers.ListDatasetsAsyncPager: @@ -790,7 +830,7 @@ async def delete_dataset( 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"""Deletes a Dataset. @@ -839,8 +879,10 @@ async def sample_delete_dataset(): 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: @@ -920,7 +962,7 @@ async def import_data( import_configs: Optional[MutableSequence[dataset.ImportDataConfig]] = 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"""Imports data into a Dataset. @@ -981,8 +1023,10 @@ async def sample_import_data(): 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: @@ -1056,7 +1100,7 @@ async def export_data( export_config: Optional[dataset.ExportDataConfig] = 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"""Exports data from a Dataset. @@ -1115,8 +1159,10 @@ async def sample_export_data(): 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: @@ -1192,7 +1238,7 @@ async def create_dataset_version( dataset_version: Optional[gca_dataset_version.DatasetVersion] = 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 version from a Dataset. @@ -1254,8 +1300,10 @@ async def sample_create_dataset_version(): 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: @@ -1332,7 +1380,7 @@ async def update_dataset_version( 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]]] = (), ) -> gca_dataset_version.DatasetVersion: r"""Updates a DatasetVersion. @@ -1390,8 +1438,10 @@ async def sample_update_dataset_version(): 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.aiplatform_v1.types.DatasetVersion: @@ -1456,7 +1506,7 @@ async def delete_dataset_version( 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"""Deletes a Dataset version. @@ -1505,8 +1555,10 @@ async def sample_delete_dataset_version(): 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: @@ -1585,7 +1637,7 @@ async def get_dataset_version( 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]]] = (), ) -> dataset_version.DatasetVersion: r"""Gets a Dataset version. @@ -1631,8 +1683,10 @@ async def sample_get_dataset_version(): 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.aiplatform_v1.types.DatasetVersion: @@ -1693,7 +1747,7 @@ async def list_dataset_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.ListDatasetVersionsAsyncPager: r"""Lists DatasetVersions in a Dataset. @@ -1739,8 +1793,10 @@ async def sample_list_dataset_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.aiplatform_v1.services.dataset_service.pagers.ListDatasetVersionsAsyncPager: @@ -1817,7 +1873,7 @@ async def restore_dataset_version( 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"""Restores a dataset version. @@ -1866,8 +1922,10 @@ async def sample_restore_dataset_version(): 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: @@ -1939,7 +1997,7 @@ async def list_data_items( 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.ListDataItemsAsyncPager: r"""Lists DataItems in a Dataset. @@ -1985,8 +2043,10 @@ async def sample_list_data_items(): 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.aiplatform_v1.services.dataset_service.pagers.ListDataItemsAsyncPager: @@ -2060,7 +2120,7 @@ async def search_data_items( *, 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.SearchDataItemsAsyncPager: r"""Searches DataItems in a Dataset. @@ -2099,8 +2159,10 @@ async def sample_search_data_items(): 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.aiplatform_v1.services.dataset_service.pagers.SearchDataItemsAsyncPager: @@ -2161,7 +2223,7 @@ async def list_saved_queries( 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.ListSavedQueriesAsyncPager: r"""Lists SavedQueries in a Dataset. @@ -2207,8 +2269,10 @@ async def sample_list_saved_queries(): 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.aiplatform_v1.services.dataset_service.pagers.ListSavedQueriesAsyncPager: @@ -2283,7 +2347,7 @@ async def delete_saved_query( 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"""Deletes a SavedQuery. @@ -2332,8 +2396,10 @@ async def sample_delete_saved_query(): 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: @@ -2412,7 +2478,7 @@ async def get_annotation_spec( 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]]] = (), ) -> annotation_spec.AnnotationSpec: r"""Gets an AnnotationSpec. @@ -2457,8 +2523,10 @@ async def sample_get_annotation_spec(): 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.aiplatform_v1.types.AnnotationSpec: @@ -2519,7 +2587,7 @@ async def list_annotations( 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.ListAnnotationsAsyncPager: r"""Lists Annotations belongs to a dataitem This RPC is only available in InternalDatasetService. It @@ -2568,8 +2636,10 @@ async def sample_list_annotations(): 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.aiplatform_v1.services.dataset_service.pagers.ListAnnotationsAsyncPager: @@ -2643,7 +2713,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. @@ -2654,8 +2724,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. @@ -2696,7 +2768,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. @@ -2707,8 +2779,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. @@ -2749,7 +2823,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. @@ -2765,8 +2839,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 """ @@ -2803,7 +2879,7 @@ async def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -2818,8 +2894,10 @@ async def cancel_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 """ @@ -2856,7 +2934,7 @@ async def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -2873,8 +2951,10 @@ async def wait_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. @@ -2915,7 +2995,7 @@ async def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -2928,8 +3008,10 @@ async def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -3034,7 +3116,7 @@ async def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -3048,8 +3130,10 @@ async def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -3154,7 +3238,7 @@ async def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -3169,8 +3253,10 @@ async def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -3214,7 +3300,7 @@ async def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -3225,8 +3311,10 @@ async def get_location( 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: ~.location_pb2.Location: Location object. @@ -3267,7 +3355,7 @@ async def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -3278,8 +3366,10 @@ async def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1/services/dataset_service/client.py b/google/cloud/aiplatform_v1/services/dataset_service/client.py index 0b3724e1cf..36099764f8 100644 --- a/google/cloud/aiplatform_v1/services/dataset_service/client.py +++ b/google/cloud/aiplatform_v1/services/dataset_service/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 ( @@ -48,6 +49,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 as gac_operation # type: ignore from google.api_core import operation_async # type: ignore from google.cloud.aiplatform_v1.services.dataset_service import pagers @@ -735,6 +745,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( @@ -825,6 +839,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.aiplatform_v1.DatasetServiceClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DatasetService", + "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.aiplatform.v1.DatasetService", + "credentialsType": None, + }, + ) + def create_dataset( self, request: Optional[Union[dataset_service.CreateDatasetRequest, dict]] = None, @@ -833,7 +870,7 @@ def create_dataset( dataset: Optional[gca_dataset.Dataset] = 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]]] = (), ) -> gac_operation.Operation: r"""Creates a Dataset. @@ -893,8 +930,10 @@ def sample_create_dataset(): 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: @@ -965,7 +1004,7 @@ def get_dataset( 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]]] = (), ) -> dataset.Dataset: r"""Gets a Dataset. @@ -1010,8 +1049,10 @@ def sample_get_dataset(): 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.aiplatform_v1.types.Dataset: @@ -1070,7 +1111,7 @@ def update_dataset( 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]]] = (), ) -> gca_dataset.Dataset: r"""Updates a Dataset. @@ -1132,8 +1173,10 @@ def sample_update_dataset(): 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.aiplatform_v1.types.Dataset: @@ -1195,7 +1238,7 @@ def list_datasets( 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.ListDatasetsPager: r"""Lists Datasets in a Location. @@ -1240,8 +1283,10 @@ def sample_list_datasets(): 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.aiplatform_v1.services.dataset_service.pagers.ListDatasetsPager: @@ -1313,7 +1358,7 @@ def delete_dataset( 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]]] = (), ) -> gac_operation.Operation: r"""Deletes a Dataset. @@ -1362,8 +1407,10 @@ def sample_delete_dataset(): 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: @@ -1440,7 +1487,7 @@ def import_data( import_configs: Optional[MutableSequence[dataset.ImportDataConfig]] = 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]]] = (), ) -> gac_operation.Operation: r"""Imports data into a Dataset. @@ -1501,8 +1548,10 @@ def sample_import_data(): 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: @@ -1573,7 +1622,7 @@ def export_data( export_config: Optional[dataset.ExportDataConfig] = 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]]] = (), ) -> gac_operation.Operation: r"""Exports data from a Dataset. @@ -1632,8 +1681,10 @@ def sample_export_data(): 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: @@ -1706,7 +1757,7 @@ def create_dataset_version( dataset_version: Optional[gca_dataset_version.DatasetVersion] = 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]]] = (), ) -> gac_operation.Operation: r"""Create a version from a Dataset. @@ -1768,8 +1819,10 @@ def sample_create_dataset_version(): 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: @@ -1843,7 +1896,7 @@ def update_dataset_version( 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]]] = (), ) -> gca_dataset_version.DatasetVersion: r"""Updates a DatasetVersion. @@ -1901,8 +1954,10 @@ def sample_update_dataset_version(): 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.aiplatform_v1.types.DatasetVersion: @@ -1964,7 +2019,7 @@ def delete_dataset_version( 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]]] = (), ) -> gac_operation.Operation: r"""Deletes a Dataset version. @@ -2013,8 +2068,10 @@ def sample_delete_dataset_version(): 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: @@ -2090,7 +2147,7 @@ def get_dataset_version( 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]]] = (), ) -> dataset_version.DatasetVersion: r"""Gets a Dataset version. @@ -2136,8 +2193,10 @@ def sample_get_dataset_version(): 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.aiplatform_v1.types.DatasetVersion: @@ -2195,7 +2254,7 @@ def list_dataset_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.ListDatasetVersionsPager: r"""Lists DatasetVersions in a Dataset. @@ -2241,8 +2300,10 @@ def sample_list_dataset_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.aiplatform_v1.services.dataset_service.pagers.ListDatasetVersionsPager: @@ -2316,7 +2377,7 @@ def restore_dataset_version( 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]]] = (), ) -> gac_operation.Operation: r"""Restores a dataset version. @@ -2365,8 +2426,10 @@ def sample_restore_dataset_version(): 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: @@ -2435,7 +2498,7 @@ def list_data_items( 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.ListDataItemsPager: r"""Lists DataItems in a Dataset. @@ -2481,8 +2544,10 @@ def sample_list_data_items(): 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.aiplatform_v1.services.dataset_service.pagers.ListDataItemsPager: @@ -2553,7 +2618,7 @@ def search_data_items( *, 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.SearchDataItemsPager: r"""Searches DataItems in a Dataset. @@ -2592,8 +2657,10 @@ def sample_search_data_items(): 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.aiplatform_v1.services.dataset_service.pagers.SearchDataItemsPager: @@ -2652,7 +2719,7 @@ def list_saved_queries( 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.ListSavedQueriesPager: r"""Lists SavedQueries in a Dataset. @@ -2698,8 +2765,10 @@ def sample_list_saved_queries(): 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.aiplatform_v1.services.dataset_service.pagers.ListSavedQueriesPager: @@ -2771,7 +2840,7 @@ def delete_saved_query( 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]]] = (), ) -> gac_operation.Operation: r"""Deletes a SavedQuery. @@ -2820,8 +2889,10 @@ def sample_delete_saved_query(): 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: @@ -2897,7 +2968,7 @@ def get_annotation_spec( 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]]] = (), ) -> annotation_spec.AnnotationSpec: r"""Gets an AnnotationSpec. @@ -2942,8 +3013,10 @@ def sample_get_annotation_spec(): 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.aiplatform_v1.types.AnnotationSpec: @@ -3001,7 +3074,7 @@ def list_annotations( 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.ListAnnotationsPager: r"""Lists Annotations belongs to a dataitem This RPC is only available in InternalDatasetService. It @@ -3050,8 +3123,10 @@ def sample_list_annotations(): 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.aiplatform_v1.services.dataset_service.pagers.ListAnnotationsPager: @@ -3135,7 +3210,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. @@ -3146,8 +3221,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. @@ -3188,7 +3265,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. @@ -3199,8 +3276,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. @@ -3241,7 +3320,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. @@ -3257,8 +3336,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 """ @@ -3295,7 +3376,7 @@ def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -3310,8 +3391,10 @@ def cancel_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 """ @@ -3348,7 +3431,7 @@ def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -3365,8 +3448,10 @@ def wait_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. @@ -3407,7 +3492,7 @@ def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -3420,8 +3505,10 @@ def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -3526,7 +3613,7 @@ def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -3540,8 +3627,10 @@ def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -3646,7 +3735,7 @@ def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -3661,8 +3750,10 @@ def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -3704,7 +3795,7 @@ def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -3715,8 +3806,10 @@ def get_location( 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: ~.location_pb2.Location: Location object. @@ -3757,7 +3850,7 @@ def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -3768,8 +3861,10 @@ def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1/services/dataset_service/pagers.py b/google/cloud/aiplatform_v1/services/dataset_service/pagers.py index fd0eab5fa9..ea491f086a 100644 --- a/google/cloud/aiplatform_v1/services/dataset_service/pagers.py +++ b/google/cloud/aiplatform_v1/services/dataset_service/pagers.py @@ -71,7 +71,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. @@ -85,8 +85,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 = dataset_service.ListDatasetsRequest(request) @@ -145,7 +147,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. @@ -159,8 +161,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 = dataset_service.ListDatasetsRequest(request) @@ -223,7 +227,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. @@ -237,8 +241,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 = dataset_service.ListDatasetVersionsRequest(request) @@ -297,7 +303,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. @@ -311,8 +317,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 = dataset_service.ListDatasetVersionsRequest(request) @@ -375,7 +383,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. @@ -389,8 +397,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 = dataset_service.ListDataItemsRequest(request) @@ -449,7 +459,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. @@ -463,8 +473,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 = dataset_service.ListDataItemsRequest(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 = dataset_service.SearchDataItemsRequest(request) @@ -601,7 +615,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. @@ -615,8 +629,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 = dataset_service.SearchDataItemsRequest(request) @@ -679,7 +695,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. @@ -693,8 +709,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 = dataset_service.ListSavedQueriesRequest(request) @@ -753,7 +771,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. @@ -767,8 +785,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 = dataset_service.ListSavedQueriesRequest(request) @@ -831,7 +851,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. @@ -845,8 +865,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 = dataset_service.ListAnnotationsRequest(request) @@ -905,7 +927,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. @@ -919,8 +941,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 = dataset_service.ListAnnotationsRequest(request) diff --git a/google/cloud/aiplatform_v1/services/dataset_service/transports/grpc.py b/google/cloud/aiplatform_v1/services/dataset_service/transports/grpc.py index a3dc7c5849..2ad15b38e4 100644 --- a/google/cloud/aiplatform_v1/services/dataset_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1/services/dataset_service/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 import warnings from typing import Callable, Dict, Optional, Sequence, Tuple, Union @@ -22,8 +25,11 @@ import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from google.cloud.aiplatform_v1.types import annotation_spec from google.cloud.aiplatform_v1.types import dataset @@ -37,6 +43,81 @@ from google.longrunning import operations_pb2 # type: ignore from .base import DatasetServiceTransport, DEFAULT_CLIENT_INFO +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.aiplatform.v1.DatasetService", + "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.aiplatform.v1.DatasetService", + "rpcName": client_call_details.method, + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class DatasetServiceGrpcTransport(DatasetServiceTransport): """gRPC backend transport for DatasetService. @@ -192,7 +273,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 @@ -256,7 +342,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 @@ -280,7 +368,7 @@ def create_dataset( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_dataset" not in self._stubs: - self._stubs["create_dataset"] = self.grpc_channel.unary_unary( + self._stubs["create_dataset"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.DatasetService/CreateDataset", request_serializer=dataset_service.CreateDatasetRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -306,7 +394,7 @@ def get_dataset( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_dataset" not in self._stubs: - self._stubs["get_dataset"] = self.grpc_channel.unary_unary( + self._stubs["get_dataset"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.DatasetService/GetDataset", request_serializer=dataset_service.GetDatasetRequest.serialize, response_deserializer=dataset.Dataset.deserialize, @@ -332,7 +420,7 @@ def update_dataset( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_dataset" not in self._stubs: - self._stubs["update_dataset"] = self.grpc_channel.unary_unary( + self._stubs["update_dataset"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.DatasetService/UpdateDataset", request_serializer=dataset_service.UpdateDatasetRequest.serialize, response_deserializer=gca_dataset.Dataset.deserialize, @@ -360,7 +448,7 @@ def list_datasets( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_datasets" not in self._stubs: - self._stubs["list_datasets"] = self.grpc_channel.unary_unary( + self._stubs["list_datasets"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.DatasetService/ListDatasets", request_serializer=dataset_service.ListDatasetsRequest.serialize, response_deserializer=dataset_service.ListDatasetsResponse.deserialize, @@ -386,7 +474,7 @@ def delete_dataset( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_dataset" not in self._stubs: - self._stubs["delete_dataset"] = self.grpc_channel.unary_unary( + self._stubs["delete_dataset"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.DatasetService/DeleteDataset", request_serializer=dataset_service.DeleteDatasetRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -412,7 +500,7 @@ def import_data( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "import_data" not in self._stubs: - self._stubs["import_data"] = self.grpc_channel.unary_unary( + self._stubs["import_data"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.DatasetService/ImportData", request_serializer=dataset_service.ImportDataRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -438,7 +526,7 @@ def export_data( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "export_data" not in self._stubs: - self._stubs["export_data"] = self.grpc_channel.unary_unary( + self._stubs["export_data"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.DatasetService/ExportData", request_serializer=dataset_service.ExportDataRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -466,7 +554,7 @@ def create_dataset_version( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_dataset_version" not in self._stubs: - self._stubs["create_dataset_version"] = self.grpc_channel.unary_unary( + self._stubs["create_dataset_version"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.DatasetService/CreateDatasetVersion", request_serializer=dataset_service.CreateDatasetVersionRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -495,7 +583,7 @@ def update_dataset_version( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_dataset_version" not in self._stubs: - self._stubs["update_dataset_version"] = self.grpc_channel.unary_unary( + self._stubs["update_dataset_version"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.DatasetService/UpdateDatasetVersion", request_serializer=dataset_service.UpdateDatasetVersionRequest.serialize, response_deserializer=gca_dataset_version.DatasetVersion.deserialize, @@ -523,7 +611,7 @@ def delete_dataset_version( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_dataset_version" not in self._stubs: - self._stubs["delete_dataset_version"] = self.grpc_channel.unary_unary( + self._stubs["delete_dataset_version"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.DatasetService/DeleteDatasetVersion", request_serializer=dataset_service.DeleteDatasetVersionRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -551,7 +639,7 @@ def get_dataset_version( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_dataset_version" not in self._stubs: - self._stubs["get_dataset_version"] = self.grpc_channel.unary_unary( + self._stubs["get_dataset_version"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.DatasetService/GetDatasetVersion", request_serializer=dataset_service.GetDatasetVersionRequest.serialize, response_deserializer=dataset_version.DatasetVersion.deserialize, @@ -580,7 +668,7 @@ def list_dataset_versions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_dataset_versions" not in self._stubs: - self._stubs["list_dataset_versions"] = self.grpc_channel.unary_unary( + self._stubs["list_dataset_versions"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.DatasetService/ListDatasetVersions", request_serializer=dataset_service.ListDatasetVersionsRequest.serialize, response_deserializer=dataset_service.ListDatasetVersionsResponse.deserialize, @@ -608,7 +696,7 @@ def restore_dataset_version( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "restore_dataset_version" not in self._stubs: - self._stubs["restore_dataset_version"] = self.grpc_channel.unary_unary( + self._stubs["restore_dataset_version"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.DatasetService/RestoreDatasetVersion", request_serializer=dataset_service.RestoreDatasetVersionRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -636,7 +724,7 @@ def list_data_items( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_data_items" not in self._stubs: - self._stubs["list_data_items"] = self.grpc_channel.unary_unary( + self._stubs["list_data_items"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.DatasetService/ListDataItems", request_serializer=dataset_service.ListDataItemsRequest.serialize, response_deserializer=dataset_service.ListDataItemsResponse.deserialize, @@ -665,7 +753,7 @@ def search_data_items( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "search_data_items" not in self._stubs: - self._stubs["search_data_items"] = self.grpc_channel.unary_unary( + self._stubs["search_data_items"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.DatasetService/SearchDataItems", request_serializer=dataset_service.SearchDataItemsRequest.serialize, response_deserializer=dataset_service.SearchDataItemsResponse.deserialize, @@ -694,7 +782,7 @@ def list_saved_queries( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_saved_queries" not in self._stubs: - self._stubs["list_saved_queries"] = self.grpc_channel.unary_unary( + self._stubs["list_saved_queries"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.DatasetService/ListSavedQueries", request_serializer=dataset_service.ListSavedQueriesRequest.serialize, response_deserializer=dataset_service.ListSavedQueriesResponse.deserialize, @@ -720,7 +808,7 @@ def delete_saved_query( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_saved_query" not in self._stubs: - self._stubs["delete_saved_query"] = self.grpc_channel.unary_unary( + self._stubs["delete_saved_query"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.DatasetService/DeleteSavedQuery", request_serializer=dataset_service.DeleteSavedQueryRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -748,7 +836,7 @@ def get_annotation_spec( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_annotation_spec" not in self._stubs: - self._stubs["get_annotation_spec"] = self.grpc_channel.unary_unary( + self._stubs["get_annotation_spec"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.DatasetService/GetAnnotationSpec", request_serializer=dataset_service.GetAnnotationSpecRequest.serialize, response_deserializer=annotation_spec.AnnotationSpec.deserialize, @@ -780,7 +868,7 @@ def list_annotations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_annotations" not in self._stubs: - self._stubs["list_annotations"] = self.grpc_channel.unary_unary( + self._stubs["list_annotations"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.DatasetService/ListAnnotations", request_serializer=dataset_service.ListAnnotationsRequest.serialize, response_deserializer=dataset_service.ListAnnotationsResponse.deserialize, @@ -788,7 +876,7 @@ def list_annotations( return self._stubs["list_annotations"] def close(self): - self.grpc_channel.close() + self._logged_channel.close() @property def delete_operation( @@ -800,7 +888,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, @@ -817,7 +905,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -834,7 +922,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -851,7 +939,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, @@ -870,7 +958,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, @@ -889,7 +977,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -906,7 +994,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -931,7 +1019,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -957,7 +1045,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -986,7 +1074,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1/services/dataset_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1/services/dataset_service/transports/grpc_asyncio.py index 30d9cf6e6a..c4632d9e27 100644 --- a/google/cloud/aiplatform_v1/services/dataset_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1/services/dataset_service/transports/grpc_asyncio.py @@ -14,6 +14,9 @@ # limitations under the License. # import inspect +import json +import pickle +import logging as std_logging import warnings from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union @@ -24,8 +27,11 @@ from google.api_core import operations_v1 from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from grpc.experimental import aio # type: ignore from google.cloud.aiplatform_v1.types import annotation_spec @@ -41,6 +47,82 @@ from .base import DatasetServiceTransport, DEFAULT_CLIENT_INFO from .grpc import DatasetServiceGrpcTransport +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.aiplatform.v1.DatasetService", + "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.aiplatform.v1.DatasetService", + "rpcName": str(client_call_details.method), + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class DatasetServiceGrpcAsyncIOTransport(DatasetServiceTransport): """gRPC AsyncIO backend transport for DatasetService. @@ -239,10 +321,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 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. @@ -292,7 +377,7 @@ def create_dataset( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_dataset" not in self._stubs: - self._stubs["create_dataset"] = self.grpc_channel.unary_unary( + self._stubs["create_dataset"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.DatasetService/CreateDataset", request_serializer=dataset_service.CreateDatasetRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -318,7 +403,7 @@ def get_dataset( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_dataset" not in self._stubs: - self._stubs["get_dataset"] = self.grpc_channel.unary_unary( + self._stubs["get_dataset"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.DatasetService/GetDataset", request_serializer=dataset_service.GetDatasetRequest.serialize, response_deserializer=dataset.Dataset.deserialize, @@ -346,7 +431,7 @@ def update_dataset( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_dataset" not in self._stubs: - self._stubs["update_dataset"] = self.grpc_channel.unary_unary( + self._stubs["update_dataset"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.DatasetService/UpdateDataset", request_serializer=dataset_service.UpdateDatasetRequest.serialize, response_deserializer=gca_dataset.Dataset.deserialize, @@ -375,7 +460,7 @@ def list_datasets( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_datasets" not in self._stubs: - self._stubs["list_datasets"] = self.grpc_channel.unary_unary( + self._stubs["list_datasets"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.DatasetService/ListDatasets", request_serializer=dataset_service.ListDatasetsRequest.serialize, response_deserializer=dataset_service.ListDatasetsResponse.deserialize, @@ -403,7 +488,7 @@ def delete_dataset( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_dataset" not in self._stubs: - self._stubs["delete_dataset"] = self.grpc_channel.unary_unary( + self._stubs["delete_dataset"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.DatasetService/DeleteDataset", request_serializer=dataset_service.DeleteDatasetRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -431,7 +516,7 @@ def import_data( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "import_data" not in self._stubs: - self._stubs["import_data"] = self.grpc_channel.unary_unary( + self._stubs["import_data"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.DatasetService/ImportData", request_serializer=dataset_service.ImportDataRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -459,7 +544,7 @@ def export_data( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "export_data" not in self._stubs: - self._stubs["export_data"] = self.grpc_channel.unary_unary( + self._stubs["export_data"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.DatasetService/ExportData", request_serializer=dataset_service.ExportDataRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -488,7 +573,7 @@ def create_dataset_version( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_dataset_version" not in self._stubs: - self._stubs["create_dataset_version"] = self.grpc_channel.unary_unary( + self._stubs["create_dataset_version"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.DatasetService/CreateDatasetVersion", request_serializer=dataset_service.CreateDatasetVersionRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -517,7 +602,7 @@ def update_dataset_version( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_dataset_version" not in self._stubs: - self._stubs["update_dataset_version"] = self.grpc_channel.unary_unary( + self._stubs["update_dataset_version"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.DatasetService/UpdateDatasetVersion", request_serializer=dataset_service.UpdateDatasetVersionRequest.serialize, response_deserializer=gca_dataset_version.DatasetVersion.deserialize, @@ -546,7 +631,7 @@ def delete_dataset_version( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_dataset_version" not in self._stubs: - self._stubs["delete_dataset_version"] = self.grpc_channel.unary_unary( + self._stubs["delete_dataset_version"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.DatasetService/DeleteDatasetVersion", request_serializer=dataset_service.DeleteDatasetVersionRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -575,7 +660,7 @@ def get_dataset_version( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_dataset_version" not in self._stubs: - self._stubs["get_dataset_version"] = self.grpc_channel.unary_unary( + self._stubs["get_dataset_version"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.DatasetService/GetDatasetVersion", request_serializer=dataset_service.GetDatasetVersionRequest.serialize, response_deserializer=dataset_version.DatasetVersion.deserialize, @@ -604,7 +689,7 @@ def list_dataset_versions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_dataset_versions" not in self._stubs: - self._stubs["list_dataset_versions"] = self.grpc_channel.unary_unary( + self._stubs["list_dataset_versions"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.DatasetService/ListDatasetVersions", request_serializer=dataset_service.ListDatasetVersionsRequest.serialize, response_deserializer=dataset_service.ListDatasetVersionsResponse.deserialize, @@ -633,7 +718,7 @@ def restore_dataset_version( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "restore_dataset_version" not in self._stubs: - self._stubs["restore_dataset_version"] = self.grpc_channel.unary_unary( + self._stubs["restore_dataset_version"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.DatasetService/RestoreDatasetVersion", request_serializer=dataset_service.RestoreDatasetVersionRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -662,7 +747,7 @@ def list_data_items( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_data_items" not in self._stubs: - self._stubs["list_data_items"] = self.grpc_channel.unary_unary( + self._stubs["list_data_items"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.DatasetService/ListDataItems", request_serializer=dataset_service.ListDataItemsRequest.serialize, response_deserializer=dataset_service.ListDataItemsResponse.deserialize, @@ -691,7 +776,7 @@ def search_data_items( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "search_data_items" not in self._stubs: - self._stubs["search_data_items"] = self.grpc_channel.unary_unary( + self._stubs["search_data_items"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.DatasetService/SearchDataItems", request_serializer=dataset_service.SearchDataItemsRequest.serialize, response_deserializer=dataset_service.SearchDataItemsResponse.deserialize, @@ -720,7 +805,7 @@ def list_saved_queries( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_saved_queries" not in self._stubs: - self._stubs["list_saved_queries"] = self.grpc_channel.unary_unary( + self._stubs["list_saved_queries"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.DatasetService/ListSavedQueries", request_serializer=dataset_service.ListSavedQueriesRequest.serialize, response_deserializer=dataset_service.ListSavedQueriesResponse.deserialize, @@ -748,7 +833,7 @@ def delete_saved_query( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_saved_query" not in self._stubs: - self._stubs["delete_saved_query"] = self.grpc_channel.unary_unary( + self._stubs["delete_saved_query"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.DatasetService/DeleteSavedQuery", request_serializer=dataset_service.DeleteSavedQueryRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -777,7 +862,7 @@ def get_annotation_spec( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_annotation_spec" not in self._stubs: - self._stubs["get_annotation_spec"] = self.grpc_channel.unary_unary( + self._stubs["get_annotation_spec"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.DatasetService/GetAnnotationSpec", request_serializer=dataset_service.GetAnnotationSpecRequest.serialize, response_deserializer=annotation_spec.AnnotationSpec.deserialize, @@ -809,7 +894,7 @@ def list_annotations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_annotations" not in self._stubs: - self._stubs["list_annotations"] = self.grpc_channel.unary_unary( + self._stubs["list_annotations"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.DatasetService/ListAnnotations", request_serializer=dataset_service.ListAnnotationsRequest.serialize, response_deserializer=dataset_service.ListAnnotationsResponse.deserialize, @@ -972,7 +1057,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: @@ -988,7 +1073,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 +1090,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -1022,7 +1107,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -1039,7 +1124,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, @@ -1058,7 +1143,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, @@ -1077,7 +1162,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -1094,7 +1179,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -1119,7 +1204,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -1145,7 +1230,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -1174,7 +1259,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1/services/dataset_service/transports/rest.py b/google/cloud/aiplatform_v1/services/dataset_service/transports/rest.py index 1b7ed2ca06..e4a8863afc 100644 --- a/google/cloud/aiplatform_v1/services/dataset_service/transports/rest.py +++ b/google/cloud/aiplatform_v1/services/dataset_service/transports/rest.py @@ -13,9 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging +import json # type: ignore from google.auth.transport.requests import AuthorizedSession # type: ignore -import json # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.api_core import exceptions as core_exceptions from google.api_core import retry as retries @@ -52,6 +53,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, @@ -236,8 +245,10 @@ def post_update_dataset_version(self, response): def pre_create_dataset( self, request: dataset_service.CreateDatasetRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[dataset_service.CreateDatasetRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + dataset_service.CreateDatasetRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for create_dataset Override in a subclass to manipulate the request or metadata @@ -259,8 +270,11 @@ def post_create_dataset( def pre_create_dataset_version( self, request: dataset_service.CreateDatasetVersionRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[dataset_service.CreateDatasetVersionRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + dataset_service.CreateDatasetVersionRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for create_dataset_version Override in a subclass to manipulate the request or metadata @@ -282,8 +296,10 @@ def post_create_dataset_version( def pre_delete_dataset( self, request: dataset_service.DeleteDatasetRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[dataset_service.DeleteDatasetRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + dataset_service.DeleteDatasetRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for delete_dataset Override in a subclass to manipulate the request or metadata @@ -305,8 +321,11 @@ def post_delete_dataset( def pre_delete_dataset_version( self, request: dataset_service.DeleteDatasetVersionRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[dataset_service.DeleteDatasetVersionRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + dataset_service.DeleteDatasetVersionRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for delete_dataset_version Override in a subclass to manipulate the request or metadata @@ -328,8 +347,10 @@ def post_delete_dataset_version( def pre_delete_saved_query( self, request: dataset_service.DeleteSavedQueryRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[dataset_service.DeleteSavedQueryRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + dataset_service.DeleteSavedQueryRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for delete_saved_query Override in a subclass to manipulate the request or metadata @@ -351,8 +372,10 @@ def post_delete_saved_query( def pre_export_data( self, request: dataset_service.ExportDataRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[dataset_service.ExportDataRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + dataset_service.ExportDataRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for export_data Override in a subclass to manipulate the request or metadata @@ -374,8 +397,11 @@ def post_export_data( def pre_get_annotation_spec( self, request: dataset_service.GetAnnotationSpecRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[dataset_service.GetAnnotationSpecRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + dataset_service.GetAnnotationSpecRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for get_annotation_spec Override in a subclass to manipulate the request or metadata @@ -397,8 +423,10 @@ def post_get_annotation_spec( def pre_get_dataset( self, request: dataset_service.GetDatasetRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[dataset_service.GetDatasetRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + dataset_service.GetDatasetRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_dataset Override in a subclass to manipulate the request or metadata @@ -418,8 +446,11 @@ def post_get_dataset(self, response: dataset.Dataset) -> dataset.Dataset: def pre_get_dataset_version( self, request: dataset_service.GetDatasetVersionRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[dataset_service.GetDatasetVersionRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + dataset_service.GetDatasetVersionRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for get_dataset_version Override in a subclass to manipulate the request or metadata @@ -441,8 +472,10 @@ def post_get_dataset_version( def pre_import_data( self, request: dataset_service.ImportDataRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[dataset_service.ImportDataRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + dataset_service.ImportDataRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for import_data Override in a subclass to manipulate the request or metadata @@ -464,8 +497,10 @@ def post_import_data( def pre_list_annotations( self, request: dataset_service.ListAnnotationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[dataset_service.ListAnnotationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + dataset_service.ListAnnotationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_annotations Override in a subclass to manipulate the request or metadata @@ -487,8 +522,10 @@ def post_list_annotations( def pre_list_data_items( self, request: dataset_service.ListDataItemsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[dataset_service.ListDataItemsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + dataset_service.ListDataItemsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_data_items Override in a subclass to manipulate the request or metadata @@ -510,8 +547,10 @@ def post_list_data_items( def pre_list_datasets( self, request: dataset_service.ListDatasetsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[dataset_service.ListDatasetsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + dataset_service.ListDatasetsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_datasets Override in a subclass to manipulate the request or metadata @@ -533,8 +572,11 @@ def post_list_datasets( def pre_list_dataset_versions( self, request: dataset_service.ListDatasetVersionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[dataset_service.ListDatasetVersionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + dataset_service.ListDatasetVersionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for list_dataset_versions Override in a subclass to manipulate the request or metadata @@ -556,8 +598,10 @@ def post_list_dataset_versions( def pre_list_saved_queries( self, request: dataset_service.ListSavedQueriesRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[dataset_service.ListSavedQueriesRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + dataset_service.ListSavedQueriesRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_saved_queries Override in a subclass to manipulate the request or metadata @@ -579,8 +623,11 @@ def post_list_saved_queries( def pre_restore_dataset_version( self, request: dataset_service.RestoreDatasetVersionRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[dataset_service.RestoreDatasetVersionRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + dataset_service.RestoreDatasetVersionRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for restore_dataset_version Override in a subclass to manipulate the request or metadata @@ -602,8 +649,10 @@ def post_restore_dataset_version( def pre_search_data_items( self, request: dataset_service.SearchDataItemsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[dataset_service.SearchDataItemsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + dataset_service.SearchDataItemsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for search_data_items Override in a subclass to manipulate the request or metadata @@ -625,8 +674,10 @@ def post_search_data_items( def pre_update_dataset( self, request: dataset_service.UpdateDatasetRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[dataset_service.UpdateDatasetRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + dataset_service.UpdateDatasetRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for update_dataset Override in a subclass to manipulate the request or metadata @@ -646,8 +697,11 @@ def post_update_dataset(self, response: gca_dataset.Dataset) -> gca_dataset.Data def pre_update_dataset_version( self, request: dataset_service.UpdateDatasetVersionRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[dataset_service.UpdateDatasetVersionRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + dataset_service.UpdateDatasetVersionRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for update_dataset_version Override in a subclass to manipulate the request or metadata @@ -669,8 +723,10 @@ def post_update_dataset_version( def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -692,8 +748,10 @@ def post_get_location( def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -715,8 +773,10 @@ def post_list_locations( def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -736,8 +796,10 @@ def post_get_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -757,8 +819,11 @@ def post_set_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -780,8 +845,10 @@ def post_test_iam_permissions( def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -801,8 +868,10 @@ def post_cancel_operation(self, response: None) -> None: 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 +891,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 +916,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 @@ -868,8 +941,10 @@ def post_list_operations( def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -2891,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]]] = (), ) -> operations_pb2.Operation: r"""Call the create dataset method over HTTP. @@ -2902,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: ~.operations_pb2.Operation: @@ -2916,6 +2993,7 @@ def __call__( http_options = ( _BaseDatasetServiceRestTransport._BaseCreateDataset._get_http_options() ) + request, metadata = self._interceptor.pre_create_dataset(request, metadata) transcoded_request = _BaseDatasetServiceRestTransport._BaseCreateDataset._get_transcoded_request( http_options, request @@ -2930,6 +3008,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.aiplatform_v1.DatasetServiceClient.CreateDataset", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DatasetService", + "rpcName": "CreateDataset", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = DatasetServiceRestTransport._CreateDataset._get_response( self._host, @@ -2949,7 +3054,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_dataset(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.aiplatform_v1.DatasetServiceClient.create_dataset", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DatasetService", + "rpcName": "CreateDataset", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _CreateDatasetVersion( @@ -2989,7 +3116,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 dataset version method over HTTP. @@ -3000,8 +3127,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: @@ -3014,6 +3143,7 @@ def __call__( http_options = ( _BaseDatasetServiceRestTransport._BaseCreateDatasetVersion._get_http_options() ) + request, metadata = self._interceptor.pre_create_dataset_version( request, metadata ) @@ -3030,6 +3160,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.aiplatform_v1.DatasetServiceClient.CreateDatasetVersion", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DatasetService", + "rpcName": "CreateDatasetVersion", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = DatasetServiceRestTransport._CreateDatasetVersion._get_response( self._host, @@ -3049,7 +3206,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_dataset_version(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.aiplatform_v1.DatasetServiceClient.create_dataset_version", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DatasetService", + "rpcName": "CreateDatasetVersion", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _DeleteDataset( @@ -3087,7 +3266,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 dataset method over HTTP. @@ -3098,8 +3277,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: @@ -3112,6 +3293,7 @@ def __call__( http_options = ( _BaseDatasetServiceRestTransport._BaseDeleteDataset._get_http_options() ) + request, metadata = self._interceptor.pre_delete_dataset(request, metadata) transcoded_request = _BaseDatasetServiceRestTransport._BaseDeleteDataset._get_transcoded_request( http_options, request @@ -3122,6 +3304,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.aiplatform_v1.DatasetServiceClient.DeleteDataset", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DatasetService", + "rpcName": "DeleteDataset", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = DatasetServiceRestTransport._DeleteDataset._get_response( self._host, @@ -3140,7 +3349,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_dataset(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.aiplatform_v1.DatasetServiceClient.delete_dataset", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DatasetService", + "rpcName": "DeleteDataset", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _DeleteDatasetVersion( @@ -3179,7 +3410,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 dataset version method over HTTP. @@ -3190,8 +3421,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: @@ -3204,6 +3437,7 @@ def __call__( http_options = ( _BaseDatasetServiceRestTransport._BaseDeleteDatasetVersion._get_http_options() ) + request, metadata = self._interceptor.pre_delete_dataset_version( request, metadata ) @@ -3216,6 +3450,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.aiplatform_v1.DatasetServiceClient.DeleteDatasetVersion", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DatasetService", + "rpcName": "DeleteDatasetVersion", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = DatasetServiceRestTransport._DeleteDatasetVersion._get_response( self._host, @@ -3234,7 +3495,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_dataset_version(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.aiplatform_v1.DatasetServiceClient.delete_dataset_version", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DatasetService", + "rpcName": "DeleteDatasetVersion", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _DeleteSavedQuery( @@ -3272,7 +3555,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 saved query method over HTTP. @@ -3283,8 +3566,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: @@ -3297,6 +3582,7 @@ def __call__( http_options = ( _BaseDatasetServiceRestTransport._BaseDeleteSavedQuery._get_http_options() ) + request, metadata = self._interceptor.pre_delete_saved_query( request, metadata ) @@ -3309,6 +3595,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.aiplatform_v1.DatasetServiceClient.DeleteSavedQuery", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DatasetService", + "rpcName": "DeleteSavedQuery", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = DatasetServiceRestTransport._DeleteSavedQuery._get_response( self._host, @@ -3327,7 +3640,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_saved_query(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.aiplatform_v1.DatasetServiceClient.delete_saved_query", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DatasetService", + "rpcName": "DeleteSavedQuery", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ExportData( @@ -3366,7 +3701,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 export data method over HTTP. @@ -3377,8 +3712,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: @@ -3391,6 +3728,7 @@ def __call__( http_options = ( _BaseDatasetServiceRestTransport._BaseExportData._get_http_options() ) + request, metadata = self._interceptor.pre_export_data(request, metadata) transcoded_request = _BaseDatasetServiceRestTransport._BaseExportData._get_transcoded_request( http_options, request @@ -3409,6 +3747,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.aiplatform_v1.DatasetServiceClient.ExportData", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DatasetService", + "rpcName": "ExportData", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = DatasetServiceRestTransport._ExportData._get_response( self._host, @@ -3428,7 +3793,29 @@ def __call__( # Return the response resp = operations_pb2.Operation() json_format.Parse(response.content, resp, ignore_unknown_fields=True) + resp = self._interceptor.post_export_data(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.aiplatform_v1.DatasetServiceClient.export_data", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DatasetService", + "rpcName": "ExportData", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _GetAnnotationSpec( @@ -3466,7 +3853,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]]] = (), ) -> annotation_spec.AnnotationSpec: r"""Call the get annotation spec method over HTTP. @@ -3477,8 +3864,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: ~.annotation_spec.AnnotationSpec: @@ -3490,6 +3879,7 @@ def __call__( http_options = ( _BaseDatasetServiceRestTransport._BaseGetAnnotationSpec._get_http_options() ) + request, metadata = self._interceptor.pre_get_annotation_spec( request, metadata ) @@ -3502,6 +3892,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.aiplatform_v1.DatasetServiceClient.GetAnnotationSpec", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DatasetService", + "rpcName": "GetAnnotationSpec", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = DatasetServiceRestTransport._GetAnnotationSpec._get_response( self._host, @@ -3522,7 +3939,29 @@ def __call__( pb_resp = annotation_spec.AnnotationSpec.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_annotation_spec(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = annotation_spec.AnnotationSpec.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.aiplatform_v1.DatasetServiceClient.get_annotation_spec", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DatasetService", + "rpcName": "GetAnnotationSpec", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _GetDataset( @@ -3560,7 +3999,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]]] = (), ) -> dataset.Dataset: r"""Call the get dataset method over HTTP. @@ -3572,8 +4011,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: ~.dataset.Dataset: @@ -3585,6 +4026,7 @@ def __call__( http_options = ( _BaseDatasetServiceRestTransport._BaseGetDataset._get_http_options() ) + request, metadata = self._interceptor.pre_get_dataset(request, metadata) transcoded_request = _BaseDatasetServiceRestTransport._BaseGetDataset._get_transcoded_request( http_options, request @@ -3597,6 +4039,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 = 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.aiplatform_v1.DatasetServiceClient.GetDataset", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DatasetService", + "rpcName": "GetDataset", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = DatasetServiceRestTransport._GetDataset._get_response( self._host, @@ -3617,7 +4086,29 @@ def __call__( pb_resp = dataset.Dataset.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_dataset(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = dataset.Dataset.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.aiplatform_v1.DatasetServiceClient.get_dataset", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DatasetService", + "rpcName": "GetDataset", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _GetDatasetVersion( @@ -3655,7 +4146,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]]] = (), ) -> dataset_version.DatasetVersion: r"""Call the get dataset version method over HTTP. @@ -3667,8 +4158,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: ~.dataset_version.DatasetVersion: @@ -3678,6 +4171,7 @@ def __call__( http_options = ( _BaseDatasetServiceRestTransport._BaseGetDatasetVersion._get_http_options() ) + request, metadata = self._interceptor.pre_get_dataset_version( request, metadata ) @@ -3690,6 +4184,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.aiplatform_v1.DatasetServiceClient.GetDatasetVersion", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DatasetService", + "rpcName": "GetDatasetVersion", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = DatasetServiceRestTransport._GetDatasetVersion._get_response( self._host, @@ -3710,7 +4231,29 @@ def __call__( pb_resp = dataset_version.DatasetVersion.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_dataset_version(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = dataset_version.DatasetVersion.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.aiplatform_v1.DatasetServiceClient.get_dataset_version", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DatasetService", + "rpcName": "GetDatasetVersion", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ImportData( @@ -3749,7 +4292,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 import data method over HTTP. @@ -3760,8 +4303,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: @@ -3774,6 +4319,7 @@ def __call__( http_options = ( _BaseDatasetServiceRestTransport._BaseImportData._get_http_options() ) + request, metadata = self._interceptor.pre_import_data(request, metadata) transcoded_request = _BaseDatasetServiceRestTransport._BaseImportData._get_transcoded_request( http_options, request @@ -3792,6 +4338,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.aiplatform_v1.DatasetServiceClient.ImportData", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DatasetService", + "rpcName": "ImportData", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = DatasetServiceRestTransport._ImportData._get_response( self._host, @@ -3811,7 +4384,29 @@ def __call__( # Return the response resp = operations_pb2.Operation() json_format.Parse(response.content, resp, ignore_unknown_fields=True) + resp = self._interceptor.post_import_data(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.aiplatform_v1.DatasetServiceClient.import_data", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DatasetService", + "rpcName": "ImportData", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListAnnotations( @@ -3849,7 +4444,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]]] = (), ) -> dataset_service.ListAnnotationsResponse: r"""Call the list annotations method over HTTP. @@ -3860,8 +4455,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: ~.dataset_service.ListAnnotationsResponse: @@ -3873,6 +4470,7 @@ def __call__( http_options = ( _BaseDatasetServiceRestTransport._BaseListAnnotations._get_http_options() ) + request, metadata = self._interceptor.pre_list_annotations( request, metadata ) @@ -3885,6 +4483,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.aiplatform_v1.DatasetServiceClient.ListAnnotations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DatasetService", + "rpcName": "ListAnnotations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = DatasetServiceRestTransport._ListAnnotations._get_response( self._host, @@ -3905,7 +4530,31 @@ def __call__( pb_resp = dataset_service.ListAnnotationsResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_annotations(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = dataset_service.ListAnnotationsResponse.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.aiplatform_v1.DatasetServiceClient.list_annotations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DatasetService", + "rpcName": "ListAnnotations", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListDataItems( @@ -3943,7 +4592,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]]] = (), ) -> dataset_service.ListDataItemsResponse: r"""Call the list data items method over HTTP. @@ -3954,8 +4603,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: ~.dataset_service.ListDataItemsResponse: @@ -3967,6 +4618,7 @@ def __call__( http_options = ( _BaseDatasetServiceRestTransport._BaseListDataItems._get_http_options() ) + request, metadata = self._interceptor.pre_list_data_items(request, metadata) transcoded_request = _BaseDatasetServiceRestTransport._BaseListDataItems._get_transcoded_request( http_options, request @@ -3977,6 +4629,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.aiplatform_v1.DatasetServiceClient.ListDataItems", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DatasetService", + "rpcName": "ListDataItems", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = DatasetServiceRestTransport._ListDataItems._get_response( self._host, @@ -3997,7 +4676,31 @@ def __call__( pb_resp = dataset_service.ListDataItemsResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_data_items(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = dataset_service.ListDataItemsResponse.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.aiplatform_v1.DatasetServiceClient.list_data_items", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DatasetService", + "rpcName": "ListDataItems", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListDatasets( @@ -4035,7 +4738,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]]] = (), ) -> dataset_service.ListDatasetsResponse: r"""Call the list datasets method over HTTP. @@ -4046,8 +4749,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: ~.dataset_service.ListDatasetsResponse: @@ -4059,6 +4764,7 @@ def __call__( http_options = ( _BaseDatasetServiceRestTransport._BaseListDatasets._get_http_options() ) + request, metadata = self._interceptor.pre_list_datasets(request, metadata) transcoded_request = _BaseDatasetServiceRestTransport._BaseListDatasets._get_transcoded_request( http_options, request @@ -4069,6 +4775,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.aiplatform_v1.DatasetServiceClient.ListDatasets", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DatasetService", + "rpcName": "ListDatasets", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = DatasetServiceRestTransport._ListDatasets._get_response( self._host, @@ -4089,7 +4822,31 @@ def __call__( pb_resp = dataset_service.ListDatasetsResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_datasets(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = dataset_service.ListDatasetsResponse.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.aiplatform_v1.DatasetServiceClient.list_datasets", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DatasetService", + "rpcName": "ListDatasets", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListDatasetVersions( @@ -4128,7 +4885,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]]] = (), ) -> dataset_service.ListDatasetVersionsResponse: r"""Call the list dataset versions method over HTTP. @@ -4139,8 +4896,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: ~.dataset_service.ListDatasetVersionsResponse: @@ -4152,6 +4911,7 @@ def __call__( http_options = ( _BaseDatasetServiceRestTransport._BaseListDatasetVersions._get_http_options() ) + request, metadata = self._interceptor.pre_list_dataset_versions( request, metadata ) @@ -4164,6 +4924,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.aiplatform_v1.DatasetServiceClient.ListDatasetVersions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DatasetService", + "rpcName": "ListDatasetVersions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = DatasetServiceRestTransport._ListDatasetVersions._get_response( self._host, @@ -4184,7 +4971,31 @@ def __call__( pb_resp = dataset_service.ListDatasetVersionsResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_dataset_versions(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + dataset_service.ListDatasetVersionsResponse.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.aiplatform_v1.DatasetServiceClient.list_dataset_versions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DatasetService", + "rpcName": "ListDatasetVersions", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListSavedQueries( @@ -4222,7 +5033,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]]] = (), ) -> dataset_service.ListSavedQueriesResponse: r"""Call the list saved queries method over HTTP. @@ -4233,8 +5044,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: ~.dataset_service.ListSavedQueriesResponse: @@ -4246,6 +5059,7 @@ def __call__( http_options = ( _BaseDatasetServiceRestTransport._BaseListSavedQueries._get_http_options() ) + request, metadata = self._interceptor.pre_list_saved_queries( request, metadata ) @@ -4258,6 +5072,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.aiplatform_v1.DatasetServiceClient.ListSavedQueries", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DatasetService", + "rpcName": "ListSavedQueries", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = DatasetServiceRestTransport._ListSavedQueries._get_response( self._host, @@ -4278,7 +5119,31 @@ def __call__( pb_resp = dataset_service.ListSavedQueriesResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_saved_queries(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = dataset_service.ListSavedQueriesResponse.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.aiplatform_v1.DatasetServiceClient.list_saved_queries", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DatasetService", + "rpcName": "ListSavedQueries", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _RestoreDatasetVersion( @@ -4317,7 +5182,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 restore dataset version method over HTTP. @@ -4328,8 +5193,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: @@ -4342,6 +5209,7 @@ def __call__( http_options = ( _BaseDatasetServiceRestTransport._BaseRestoreDatasetVersion._get_http_options() ) + request, metadata = self._interceptor.pre_restore_dataset_version( request, metadata ) @@ -4354,6 +5222,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.aiplatform_v1.DatasetServiceClient.RestoreDatasetVersion", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DatasetService", + "rpcName": "RestoreDatasetVersion", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = DatasetServiceRestTransport._RestoreDatasetVersion._get_response( self._host, @@ -4372,7 +5267,29 @@ def __call__( # Return the response resp = operations_pb2.Operation() json_format.Parse(response.content, resp, ignore_unknown_fields=True) + resp = self._interceptor.post_restore_dataset_version(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.aiplatform_v1.DatasetServiceClient.restore_dataset_version", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DatasetService", + "rpcName": "RestoreDatasetVersion", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _SearchDataItems( @@ -4410,7 +5327,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]]] = (), ) -> dataset_service.SearchDataItemsResponse: r"""Call the search data items method over HTTP. @@ -4421,8 +5338,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: ~.dataset_service.SearchDataItemsResponse: @@ -4434,6 +5353,7 @@ def __call__( http_options = ( _BaseDatasetServiceRestTransport._BaseSearchDataItems._get_http_options() ) + request, metadata = self._interceptor.pre_search_data_items( request, metadata ) @@ -4446,6 +5366,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.aiplatform_v1.DatasetServiceClient.SearchDataItems", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DatasetService", + "rpcName": "SearchDataItems", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = DatasetServiceRestTransport._SearchDataItems._get_response( self._host, @@ -4466,7 +5413,31 @@ def __call__( pb_resp = dataset_service.SearchDataItemsResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_search_data_items(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = dataset_service.SearchDataItemsResponse.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.aiplatform_v1.DatasetServiceClient.search_data_items", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DatasetService", + "rpcName": "SearchDataItems", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _UpdateDataset( @@ -4505,7 +5476,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]]] = (), ) -> gca_dataset.Dataset: r"""Call the update dataset method over HTTP. @@ -4516,8 +5487,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: ~.gca_dataset.Dataset: @@ -4529,6 +5502,7 @@ def __call__( http_options = ( _BaseDatasetServiceRestTransport._BaseUpdateDataset._get_http_options() ) + request, metadata = self._interceptor.pre_update_dataset(request, metadata) transcoded_request = _BaseDatasetServiceRestTransport._BaseUpdateDataset._get_transcoded_request( http_options, request @@ -4543,6 +5517,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.aiplatform_v1.DatasetServiceClient.UpdateDataset", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DatasetService", + "rpcName": "UpdateDataset", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = DatasetServiceRestTransport._UpdateDataset._get_response( self._host, @@ -4564,7 +5565,29 @@ def __call__( pb_resp = gca_dataset.Dataset.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_update_dataset(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gca_dataset.Dataset.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.aiplatform_v1.DatasetServiceClient.update_dataset", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DatasetService", + "rpcName": "UpdateDataset", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _UpdateDatasetVersion( @@ -4604,7 +5627,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]]] = (), ) -> gca_dataset_version.DatasetVersion: r"""Call the update dataset version method over HTTP. @@ -4615,8 +5638,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: ~.gca_dataset_version.DatasetVersion: @@ -4626,6 +5651,7 @@ def __call__( http_options = ( _BaseDatasetServiceRestTransport._BaseUpdateDatasetVersion._get_http_options() ) + request, metadata = self._interceptor.pre_update_dataset_version( request, metadata ) @@ -4642,6 +5668,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.aiplatform_v1.DatasetServiceClient.UpdateDatasetVersion", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DatasetService", + "rpcName": "UpdateDatasetVersion", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = DatasetServiceRestTransport._UpdateDatasetVersion._get_response( self._host, @@ -4663,7 +5716,31 @@ def __call__( pb_resp = gca_dataset_version.DatasetVersion.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_update_dataset_version(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gca_dataset_version.DatasetVersion.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.aiplatform_v1.DatasetServiceClient.update_dataset_version", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DatasetService", + "rpcName": "UpdateDatasetVersion", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp @property @@ -4886,7 +5963,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]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -4897,8 +5974,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: locations_pb2.Location: Response from GetLocation method. @@ -4907,6 +5986,7 @@ def __call__( http_options = ( _BaseDatasetServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = self._interceptor.pre_get_location(request, metadata) transcoded_request = _BaseDatasetServiceRestTransport._BaseGetLocation._get_transcoded_request( http_options, request @@ -4917,6 +5997,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.aiplatform_v1.DatasetServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DatasetService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = DatasetServiceRestTransport._GetLocation._get_response( self._host, @@ -4936,6 +6043,27 @@ def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_location(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.aiplatform_v1.DatasetServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DatasetService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4977,7 +6105,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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -4988,8 +6116,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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -4998,6 +6128,7 @@ def __call__( http_options = ( _BaseDatasetServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = self._interceptor.pre_list_locations(request, metadata) transcoded_request = _BaseDatasetServiceRestTransport._BaseListLocations._get_transcoded_request( http_options, request @@ -5008,6 +6139,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.aiplatform_v1.DatasetServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DatasetService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = DatasetServiceRestTransport._ListLocations._get_response( self._host, @@ -5027,6 +6185,27 @@ def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_list_locations(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.aiplatform_v1.DatasetServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DatasetService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5068,7 +6247,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]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -5079,8 +6258,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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -5089,6 +6270,7 @@ def __call__( http_options = ( _BaseDatasetServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_get_iam_policy(request, metadata) transcoded_request = _BaseDatasetServiceRestTransport._BaseGetIamPolicy._get_transcoded_request( http_options, request @@ -5099,6 +6281,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.aiplatform_v1.DatasetServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DatasetService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = DatasetServiceRestTransport._GetIamPolicy._get_response( self._host, @@ -5118,6 +6327,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_iam_policy(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.aiplatform_v1.DatasetServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DatasetService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5160,7 +6390,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]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -5171,8 +6401,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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -5181,6 +6413,7 @@ def __call__( http_options = ( _BaseDatasetServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_set_iam_policy(request, metadata) transcoded_request = _BaseDatasetServiceRestTransport._BaseSetIamPolicy._get_transcoded_request( http_options, request @@ -5195,6 +6428,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.aiplatform_v1.DatasetServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DatasetService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = DatasetServiceRestTransport._SetIamPolicy._get_response( self._host, @@ -5215,6 +6475,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_set_iam_policy(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.aiplatform_v1.DatasetServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DatasetService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5256,7 +6537,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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -5267,8 +6548,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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -5277,6 +6560,7 @@ def __call__( http_options = ( _BaseDatasetServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -5289,6 +6573,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.aiplatform_v1.DatasetServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DatasetService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = DatasetServiceRestTransport._TestIamPermissions._get_response( self._host, @@ -5308,6 +6619,27 @@ def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_test_iam_permissions(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.aiplatform_v1.DatasetServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DatasetService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5349,7 +6681,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 cancel operation method over HTTP. @@ -5360,13 +6692,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 = ( _BaseDatasetServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = self._interceptor.pre_cancel_operation( request, metadata ) @@ -5379,6 +6714,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.aiplatform_v1.DatasetServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DatasetService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = DatasetServiceRestTransport._CancelOperation._get_response( self._host, @@ -5435,7 +6797,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. @@ -5446,13 +6808,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 = ( _BaseDatasetServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = self._interceptor.pre_delete_operation( request, metadata ) @@ -5465,6 +6830,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.aiplatform_v1.DatasetServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DatasetService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = DatasetServiceRestTransport._DeleteOperation._get_response( self._host, @@ -5521,7 +6913,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. @@ -5532,8 +6924,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. @@ -5542,6 +6936,7 @@ def __call__( http_options = ( _BaseDatasetServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = self._interceptor.pre_get_operation(request, metadata) transcoded_request = _BaseDatasetServiceRestTransport._BaseGetOperation._get_transcoded_request( http_options, request @@ -5552,6 +6947,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.aiplatform_v1.DatasetServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DatasetService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = DatasetServiceRestTransport._GetOperation._get_response( self._host, @@ -5571,6 +6993,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.aiplatform_v1.DatasetServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DatasetService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5612,7 +7055,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. @@ -5623,8 +7066,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. @@ -5633,6 +7078,7 @@ def __call__( http_options = ( _BaseDatasetServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = self._interceptor.pre_list_operations(request, metadata) transcoded_request = _BaseDatasetServiceRestTransport._BaseListOperations._get_transcoded_request( http_options, request @@ -5643,6 +7089,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.aiplatform_v1.DatasetServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DatasetService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = DatasetServiceRestTransport._ListOperations._get_response( self._host, @@ -5662,6 +7135,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.aiplatform_v1.DatasetServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DatasetService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5703,7 +7197,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 wait operation method over HTTP. @@ -5714,8 +7208,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 WaitOperation method. @@ -5724,6 +7220,7 @@ def __call__( http_options = ( _BaseDatasetServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = self._interceptor.pre_wait_operation(request, metadata) transcoded_request = _BaseDatasetServiceRestTransport._BaseWaitOperation._get_transcoded_request( http_options, request @@ -5734,6 +7231,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.aiplatform_v1.DatasetServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DatasetService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = DatasetServiceRestTransport._WaitOperation._get_response( self._host, @@ -5753,6 +7277,27 @@ def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = self._interceptor.post_wait_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.aiplatform_v1.DatasetServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DatasetService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1/services/dataset_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1/services/dataset_service/transports/rest_asyncio.py index 1dc495fdb7..2ac56fb4af 100644 --- a/google/cloud/aiplatform_v1/services/dataset_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1/services/dataset_service/transports/rest_asyncio.py @@ -63,6 +63,18 @@ from .base import DEFAULT_CLIENT_INFO as BASE_DEFAULT_CLIENT_INFO + +import logging + +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__) + try: OptionalRetry = Union[retries.AsyncRetry, gapic_v1.method._MethodDefault, None] except AttributeError: # pragma: NO COVER @@ -251,8 +263,10 @@ async def post_update_dataset_version(self, response): async def pre_create_dataset( self, request: dataset_service.CreateDatasetRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[dataset_service.CreateDatasetRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + dataset_service.CreateDatasetRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for create_dataset Override in a subclass to manipulate the request or metadata @@ -274,8 +288,11 @@ async def post_create_dataset( async def pre_create_dataset_version( self, request: dataset_service.CreateDatasetVersionRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[dataset_service.CreateDatasetVersionRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + dataset_service.CreateDatasetVersionRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for create_dataset_version Override in a subclass to manipulate the request or metadata @@ -297,8 +314,10 @@ async def post_create_dataset_version( async def pre_delete_dataset( self, request: dataset_service.DeleteDatasetRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[dataset_service.DeleteDatasetRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + dataset_service.DeleteDatasetRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for delete_dataset Override in a subclass to manipulate the request or metadata @@ -320,8 +339,11 @@ async def post_delete_dataset( async def pre_delete_dataset_version( self, request: dataset_service.DeleteDatasetVersionRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[dataset_service.DeleteDatasetVersionRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + dataset_service.DeleteDatasetVersionRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for delete_dataset_version Override in a subclass to manipulate the request or metadata @@ -343,8 +365,10 @@ async def post_delete_dataset_version( async def pre_delete_saved_query( self, request: dataset_service.DeleteSavedQueryRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[dataset_service.DeleteSavedQueryRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + dataset_service.DeleteSavedQueryRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for delete_saved_query Override in a subclass to manipulate the request or metadata @@ -366,8 +390,10 @@ async def post_delete_saved_query( async def pre_export_data( self, request: dataset_service.ExportDataRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[dataset_service.ExportDataRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + dataset_service.ExportDataRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for export_data Override in a subclass to manipulate the request or metadata @@ -389,8 +415,11 @@ async def post_export_data( async def pre_get_annotation_spec( self, request: dataset_service.GetAnnotationSpecRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[dataset_service.GetAnnotationSpecRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + dataset_service.GetAnnotationSpecRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for get_annotation_spec Override in a subclass to manipulate the request or metadata @@ -412,8 +441,10 @@ async def post_get_annotation_spec( async def pre_get_dataset( self, request: dataset_service.GetDatasetRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[dataset_service.GetDatasetRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + dataset_service.GetDatasetRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_dataset Override in a subclass to manipulate the request or metadata @@ -433,8 +464,11 @@ async def post_get_dataset(self, response: dataset.Dataset) -> dataset.Dataset: async def pre_get_dataset_version( self, request: dataset_service.GetDatasetVersionRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[dataset_service.GetDatasetVersionRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + dataset_service.GetDatasetVersionRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for get_dataset_version Override in a subclass to manipulate the request or metadata @@ -456,8 +490,10 @@ async def post_get_dataset_version( async def pre_import_data( self, request: dataset_service.ImportDataRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[dataset_service.ImportDataRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + dataset_service.ImportDataRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for import_data Override in a subclass to manipulate the request or metadata @@ -479,8 +515,10 @@ async def post_import_data( async def pre_list_annotations( self, request: dataset_service.ListAnnotationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[dataset_service.ListAnnotationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + dataset_service.ListAnnotationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_annotations Override in a subclass to manipulate the request or metadata @@ -502,8 +540,10 @@ async def post_list_annotations( async def pre_list_data_items( self, request: dataset_service.ListDataItemsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[dataset_service.ListDataItemsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + dataset_service.ListDataItemsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_data_items Override in a subclass to manipulate the request or metadata @@ -525,8 +565,10 @@ async def post_list_data_items( async def pre_list_datasets( self, request: dataset_service.ListDatasetsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[dataset_service.ListDatasetsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + dataset_service.ListDatasetsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_datasets Override in a subclass to manipulate the request or metadata @@ -548,8 +590,11 @@ async def post_list_datasets( async def pre_list_dataset_versions( self, request: dataset_service.ListDatasetVersionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[dataset_service.ListDatasetVersionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + dataset_service.ListDatasetVersionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for list_dataset_versions Override in a subclass to manipulate the request or metadata @@ -571,8 +616,10 @@ async def post_list_dataset_versions( async def pre_list_saved_queries( self, request: dataset_service.ListSavedQueriesRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[dataset_service.ListSavedQueriesRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + dataset_service.ListSavedQueriesRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_saved_queries Override in a subclass to manipulate the request or metadata @@ -594,8 +641,11 @@ async def post_list_saved_queries( async def pre_restore_dataset_version( self, request: dataset_service.RestoreDatasetVersionRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[dataset_service.RestoreDatasetVersionRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + dataset_service.RestoreDatasetVersionRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for restore_dataset_version Override in a subclass to manipulate the request or metadata @@ -617,8 +667,10 @@ async def post_restore_dataset_version( async def pre_search_data_items( self, request: dataset_service.SearchDataItemsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[dataset_service.SearchDataItemsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + dataset_service.SearchDataItemsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for search_data_items Override in a subclass to manipulate the request or metadata @@ -640,8 +692,10 @@ async def post_search_data_items( async def pre_update_dataset( self, request: dataset_service.UpdateDatasetRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[dataset_service.UpdateDatasetRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + dataset_service.UpdateDatasetRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for update_dataset Override in a subclass to manipulate the request or metadata @@ -663,8 +717,11 @@ async def post_update_dataset( async def pre_update_dataset_version( self, request: dataset_service.UpdateDatasetVersionRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[dataset_service.UpdateDatasetVersionRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + dataset_service.UpdateDatasetVersionRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for update_dataset_version Override in a subclass to manipulate the request or metadata @@ -686,8 +743,10 @@ async def post_update_dataset_version( async def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -709,8 +768,10 @@ async def post_get_location( async def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -732,8 +793,10 @@ async def post_list_locations( async def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -755,8 +818,10 @@ async def post_get_iam_policy( async def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -778,8 +843,11 @@ async def post_set_iam_policy( async def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -801,8 +869,10 @@ async def post_test_iam_permissions( async def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -822,8 +892,10 @@ async def post_cancel_operation(self, response: None) -> None: async 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 @@ -843,8 +915,10 @@ async def post_delete_operation(self, response: None) -> None: async 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 @@ -866,8 +940,10 @@ async def post_get_operation( async 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 @@ -889,8 +965,10 @@ async def post_list_operations( async def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -1166,7 +1244,7 @@ async 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 dataset method over HTTP. @@ -1177,8 +1255,10 @@ async def __call__( 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: @@ -1191,6 +1271,7 @@ async def __call__( http_options = ( _BaseDatasetServiceRestTransport._BaseCreateDataset._get_http_options() ) + request, metadata = await self._interceptor.pre_create_dataset( request, metadata ) @@ -1207,6 +1288,33 @@ async 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.aiplatform_v1.DatasetServiceClient.CreateDataset", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DatasetService", + "rpcName": "CreateDataset", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncDatasetServiceRestTransport._CreateDataset._get_response( @@ -1237,6 +1345,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_create_dataset(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.DatasetServiceAsyncClient.create_dataset", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DatasetService", + "rpcName": "CreateDataset", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _CreateDatasetVersion( @@ -1276,7 +1406,7 @@ async 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 dataset version method over HTTP. @@ -1287,8 +1417,10 @@ async def __call__( 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: @@ -1301,6 +1433,7 @@ async def __call__( http_options = ( _BaseDatasetServiceRestTransport._BaseCreateDatasetVersion._get_http_options() ) + request, metadata = await self._interceptor.pre_create_dataset_version( request, metadata ) @@ -1317,6 +1450,33 @@ async 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.aiplatform_v1.DatasetServiceClient.CreateDatasetVersion", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DatasetService", + "rpcName": "CreateDatasetVersion", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncDatasetServiceRestTransport._CreateDatasetVersion._get_response( self._host, @@ -1345,6 +1505,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_create_dataset_version(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.DatasetServiceAsyncClient.create_dataset_version", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DatasetService", + "rpcName": "CreateDatasetVersion", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _DeleteDataset( @@ -1382,7 +1564,7 @@ async 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 dataset method over HTTP. @@ -1393,8 +1575,10 @@ async def __call__( 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: @@ -1407,6 +1591,7 @@ async def __call__( http_options = ( _BaseDatasetServiceRestTransport._BaseDeleteDataset._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_dataset( request, metadata ) @@ -1419,6 +1604,33 @@ async 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.aiplatform_v1.DatasetServiceClient.DeleteDataset", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DatasetService", + "rpcName": "DeleteDataset", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncDatasetServiceRestTransport._DeleteDataset._get_response( @@ -1448,6 +1660,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_delete_dataset(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.DatasetServiceAsyncClient.delete_dataset", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DatasetService", + "rpcName": "DeleteDataset", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _DeleteDatasetVersion( @@ -1486,7 +1720,7 @@ async 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 dataset version method over HTTP. @@ -1497,8 +1731,10 @@ async def __call__( 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: @@ -1511,6 +1747,7 @@ async def __call__( http_options = ( _BaseDatasetServiceRestTransport._BaseDeleteDatasetVersion._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_dataset_version( request, metadata ) @@ -1523,6 +1760,33 @@ async 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.aiplatform_v1.DatasetServiceClient.DeleteDatasetVersion", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DatasetService", + "rpcName": "DeleteDatasetVersion", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncDatasetServiceRestTransport._DeleteDatasetVersion._get_response( self._host, @@ -1550,6 +1814,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_delete_dataset_version(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.DatasetServiceAsyncClient.delete_dataset_version", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DatasetService", + "rpcName": "DeleteDatasetVersion", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _DeleteSavedQuery( @@ -1588,7 +1874,7 @@ async 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 saved query method over HTTP. @@ -1599,8 +1885,10 @@ async def __call__( 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: @@ -1613,6 +1901,7 @@ async def __call__( http_options = ( _BaseDatasetServiceRestTransport._BaseDeleteSavedQuery._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_saved_query( request, metadata ) @@ -1625,6 +1914,33 @@ async 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.aiplatform_v1.DatasetServiceClient.DeleteSavedQuery", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DatasetService", + "rpcName": "DeleteSavedQuery", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncDatasetServiceRestTransport._DeleteSavedQuery._get_response( @@ -1654,6 +1970,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_delete_saved_query(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.DatasetServiceAsyncClient.delete_saved_query", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DatasetService", + "rpcName": "DeleteSavedQuery", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ExportData( @@ -1692,7 +2030,7 @@ async 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 export data method over HTTP. @@ -1703,8 +2041,10 @@ async def __call__( 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: @@ -1717,6 +2057,7 @@ async def __call__( http_options = ( _BaseDatasetServiceRestTransport._BaseExportData._get_http_options() ) + request, metadata = await self._interceptor.pre_export_data( request, metadata ) @@ -1737,6 +2078,33 @@ async 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.aiplatform_v1.DatasetServiceClient.ExportData", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DatasetService", + "rpcName": "ExportData", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncDatasetServiceRestTransport._ExportData._get_response( self._host, @@ -1765,6 +2133,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_export_data(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.DatasetServiceAsyncClient.export_data", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DatasetService", + "rpcName": "ExportData", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _GetAnnotationSpec( @@ -1803,7 +2193,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> annotation_spec.AnnotationSpec: r"""Call the get annotation spec method over HTTP. @@ -1814,8 +2204,10 @@ async def __call__( 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: ~.annotation_spec.AnnotationSpec: @@ -1827,6 +2219,7 @@ async def __call__( http_options = ( _BaseDatasetServiceRestTransport._BaseGetAnnotationSpec._get_http_options() ) + request, metadata = await self._interceptor.pre_get_annotation_spec( request, metadata ) @@ -1839,6 +2232,33 @@ async 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.aiplatform_v1.DatasetServiceClient.GetAnnotationSpec", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DatasetService", + "rpcName": "GetAnnotationSpec", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncDatasetServiceRestTransport._GetAnnotationSpec._get_response( @@ -1868,6 +2288,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_get_annotation_spec(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = annotation_spec.AnnotationSpec.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.DatasetServiceAsyncClient.get_annotation_spec", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DatasetService", + "rpcName": "GetAnnotationSpec", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _GetDataset( @@ -1905,7 +2347,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> dataset.Dataset: r"""Call the get dataset method over HTTP. @@ -1917,8 +2359,10 @@ async def __call__( 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: ~.dataset.Dataset: @@ -1930,6 +2374,7 @@ async def __call__( http_options = ( _BaseDatasetServiceRestTransport._BaseGetDataset._get_http_options() ) + request, metadata = await self._interceptor.pre_get_dataset( request, metadata ) @@ -1944,6 +2389,33 @@ async 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 = 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.aiplatform_v1.DatasetServiceClient.GetDataset", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DatasetService", + "rpcName": "GetDataset", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncDatasetServiceRestTransport._GetDataset._get_response( self._host, @@ -1971,6 +2443,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_get_dataset(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = dataset.Dataset.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.DatasetServiceAsyncClient.get_dataset", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DatasetService", + "rpcName": "GetDataset", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _GetDatasetVersion( @@ -2009,7 +2503,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> dataset_version.DatasetVersion: r"""Call the get dataset version method over HTTP. @@ -2021,8 +2515,10 @@ async def __call__( 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: ~.dataset_version.DatasetVersion: @@ -2032,6 +2528,7 @@ async def __call__( http_options = ( _BaseDatasetServiceRestTransport._BaseGetDatasetVersion._get_http_options() ) + request, metadata = await self._interceptor.pre_get_dataset_version( request, metadata ) @@ -2044,6 +2541,33 @@ async 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.aiplatform_v1.DatasetServiceClient.GetDatasetVersion", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DatasetService", + "rpcName": "GetDatasetVersion", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncDatasetServiceRestTransport._GetDatasetVersion._get_response( @@ -2073,6 +2597,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_get_dataset_version(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = dataset_version.DatasetVersion.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.DatasetServiceAsyncClient.get_dataset_version", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DatasetService", + "rpcName": "GetDatasetVersion", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ImportData( @@ -2111,7 +2657,7 @@ async 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 import data method over HTTP. @@ -2122,8 +2668,10 @@ async def __call__( 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: @@ -2136,6 +2684,7 @@ async def __call__( http_options = ( _BaseDatasetServiceRestTransport._BaseImportData._get_http_options() ) + request, metadata = await self._interceptor.pre_import_data( request, metadata ) @@ -2156,6 +2705,33 @@ async 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.aiplatform_v1.DatasetServiceClient.ImportData", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DatasetService", + "rpcName": "ImportData", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncDatasetServiceRestTransport._ImportData._get_response( self._host, @@ -2184,6 +2760,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_import_data(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.DatasetServiceAsyncClient.import_data", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DatasetService", + "rpcName": "ImportData", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ListAnnotations( @@ -2222,7 +2820,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> dataset_service.ListAnnotationsResponse: r"""Call the list annotations method over HTTP. @@ -2233,8 +2831,10 @@ async def __call__( 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: ~.dataset_service.ListAnnotationsResponse: @@ -2246,6 +2846,7 @@ async def __call__( http_options = ( _BaseDatasetServiceRestTransport._BaseListAnnotations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_annotations( request, metadata ) @@ -2258,6 +2859,33 @@ async 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.aiplatform_v1.DatasetServiceClient.ListAnnotations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DatasetService", + "rpcName": "ListAnnotations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncDatasetServiceRestTransport._ListAnnotations._get_response( @@ -2287,6 +2915,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_list_annotations(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = dataset_service.ListAnnotationsResponse.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.DatasetServiceAsyncClient.list_annotations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DatasetService", + "rpcName": "ListAnnotations", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ListDataItems( @@ -2324,7 +2976,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> dataset_service.ListDataItemsResponse: r"""Call the list data items method over HTTP. @@ -2335,8 +2987,10 @@ async def __call__( 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: ~.dataset_service.ListDataItemsResponse: @@ -2348,6 +3002,7 @@ async def __call__( http_options = ( _BaseDatasetServiceRestTransport._BaseListDataItems._get_http_options() ) + request, metadata = await self._interceptor.pre_list_data_items( request, metadata ) @@ -2360,6 +3015,33 @@ async 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.aiplatform_v1.DatasetServiceClient.ListDataItems", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DatasetService", + "rpcName": "ListDataItems", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncDatasetServiceRestTransport._ListDataItems._get_response( @@ -2389,6 +3071,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_list_data_items(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = dataset_service.ListDataItemsResponse.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.DatasetServiceAsyncClient.list_data_items", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DatasetService", + "rpcName": "ListDataItems", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ListDatasets( @@ -2426,7 +3132,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> dataset_service.ListDatasetsResponse: r"""Call the list datasets method over HTTP. @@ -2437,8 +3143,10 @@ async def __call__( 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: ~.dataset_service.ListDatasetsResponse: @@ -2450,6 +3158,7 @@ async def __call__( http_options = ( _BaseDatasetServiceRestTransport._BaseListDatasets._get_http_options() ) + request, metadata = await self._interceptor.pre_list_datasets( request, metadata ) @@ -2462,6 +3171,33 @@ async 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.aiplatform_v1.DatasetServiceClient.ListDatasets", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DatasetService", + "rpcName": "ListDatasets", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncDatasetServiceRestTransport._ListDatasets._get_response( @@ -2491,6 +3227,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_list_datasets(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = dataset_service.ListDatasetsResponse.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.DatasetServiceAsyncClient.list_datasets", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DatasetService", + "rpcName": "ListDatasets", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ListDatasetVersions( @@ -2529,7 +3289,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> dataset_service.ListDatasetVersionsResponse: r"""Call the list dataset versions method over HTTP. @@ -2540,8 +3300,10 @@ async def __call__( 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: ~.dataset_service.ListDatasetVersionsResponse: @@ -2553,6 +3315,7 @@ async def __call__( http_options = ( _BaseDatasetServiceRestTransport._BaseListDatasetVersions._get_http_options() ) + request, metadata = await self._interceptor.pre_list_dataset_versions( request, metadata ) @@ -2565,6 +3328,33 @@ async 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.aiplatform_v1.DatasetServiceClient.ListDatasetVersions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DatasetService", + "rpcName": "ListDatasetVersions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncDatasetServiceRestTransport._ListDatasetVersions._get_response( self._host, @@ -2592,6 +3382,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_list_dataset_versions(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + dataset_service.ListDatasetVersionsResponse.to_json(response) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.DatasetServiceAsyncClient.list_dataset_versions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DatasetService", + "rpcName": "ListDatasetVersions", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ListSavedQueries( @@ -2630,7 +3444,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> dataset_service.ListSavedQueriesResponse: r"""Call the list saved queries method over HTTP. @@ -2641,8 +3455,10 @@ async def __call__( 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: ~.dataset_service.ListSavedQueriesResponse: @@ -2654,6 +3470,7 @@ async def __call__( http_options = ( _BaseDatasetServiceRestTransport._BaseListSavedQueries._get_http_options() ) + request, metadata = await self._interceptor.pre_list_saved_queries( request, metadata ) @@ -2666,6 +3483,33 @@ async 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.aiplatform_v1.DatasetServiceClient.ListSavedQueries", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DatasetService", + "rpcName": "ListSavedQueries", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncDatasetServiceRestTransport._ListSavedQueries._get_response( @@ -2695,6 +3539,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_list_saved_queries(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = dataset_service.ListSavedQueriesResponse.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.DatasetServiceAsyncClient.list_saved_queries", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DatasetService", + "rpcName": "ListSavedQueries", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _RestoreDatasetVersion( @@ -2733,7 +3601,7 @@ async 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 restore dataset version method over HTTP. @@ -2744,8 +3612,10 @@ async def __call__( 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: @@ -2758,6 +3628,7 @@ async def __call__( http_options = ( _BaseDatasetServiceRestTransport._BaseRestoreDatasetVersion._get_http_options() ) + request, metadata = await self._interceptor.pre_restore_dataset_version( request, metadata ) @@ -2770,6 +3641,33 @@ async 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.aiplatform_v1.DatasetServiceClient.RestoreDatasetVersion", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DatasetService", + "rpcName": "RestoreDatasetVersion", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncDatasetServiceRestTransport._RestoreDatasetVersion._get_response( self._host, @@ -2797,6 +3695,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_restore_dataset_version(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.DatasetServiceAsyncClient.restore_dataset_version", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DatasetService", + "rpcName": "RestoreDatasetVersion", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _SearchDataItems( @@ -2835,7 +3755,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> dataset_service.SearchDataItemsResponse: r"""Call the search data items method over HTTP. @@ -2846,8 +3766,10 @@ async def __call__( 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: ~.dataset_service.SearchDataItemsResponse: @@ -2859,6 +3781,7 @@ async def __call__( http_options = ( _BaseDatasetServiceRestTransport._BaseSearchDataItems._get_http_options() ) + request, metadata = await self._interceptor.pre_search_data_items( request, metadata ) @@ -2871,6 +3794,33 @@ async 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.aiplatform_v1.DatasetServiceClient.SearchDataItems", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DatasetService", + "rpcName": "SearchDataItems", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncDatasetServiceRestTransport._SearchDataItems._get_response( @@ -2900,6 +3850,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_search_data_items(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = dataset_service.SearchDataItemsResponse.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.DatasetServiceAsyncClient.search_data_items", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DatasetService", + "rpcName": "SearchDataItems", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _UpdateDataset( @@ -2938,7 +3912,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> gca_dataset.Dataset: r"""Call the update dataset method over HTTP. @@ -2949,8 +3923,10 @@ async def __call__( 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: ~.gca_dataset.Dataset: @@ -2962,6 +3938,7 @@ async def __call__( http_options = ( _BaseDatasetServiceRestTransport._BaseUpdateDataset._get_http_options() ) + request, metadata = await self._interceptor.pre_update_dataset( request, metadata ) @@ -2978,6 +3955,33 @@ async 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.aiplatform_v1.DatasetServiceClient.UpdateDataset", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DatasetService", + "rpcName": "UpdateDataset", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncDatasetServiceRestTransport._UpdateDataset._get_response( @@ -3008,6 +4012,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_update_dataset(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gca_dataset.Dataset.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.DatasetServiceAsyncClient.update_dataset", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DatasetService", + "rpcName": "UpdateDataset", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _UpdateDatasetVersion( @@ -3047,7 +4073,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> gca_dataset_version.DatasetVersion: r"""Call the update dataset version method over HTTP. @@ -3058,8 +4084,10 @@ async def __call__( 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: ~.gca_dataset_version.DatasetVersion: @@ -3069,6 +4097,7 @@ async def __call__( http_options = ( _BaseDatasetServiceRestTransport._BaseUpdateDatasetVersion._get_http_options() ) + request, metadata = await self._interceptor.pre_update_dataset_version( request, metadata ) @@ -3085,6 +4114,33 @@ async 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.aiplatform_v1.DatasetServiceClient.UpdateDatasetVersion", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DatasetService", + "rpcName": "UpdateDatasetVersion", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncDatasetServiceRestTransport._UpdateDatasetVersion._get_response( self._host, @@ -3113,6 +4169,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_update_dataset_version(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gca_dataset_version.DatasetVersion.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.DatasetServiceAsyncClient.update_dataset_version", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DatasetService", + "rpcName": "UpdateDatasetVersion", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp @property @@ -5174,7 +6254,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -5185,8 +6265,10 @@ async def __call__( 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: locations_pb2.Location: Response from GetLocation method. @@ -5195,6 +6277,7 @@ async def __call__( http_options = ( _BaseDatasetServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_location( request, metadata ) @@ -5207,6 +6290,33 @@ async 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.aiplatform_v1.DatasetServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DatasetService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncDatasetServiceRestTransport._GetLocation._get_response( @@ -5234,6 +6344,27 @@ async def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_location(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.aiplatform_v1.DatasetServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DatasetService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5275,7 +6406,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -5286,8 +6417,10 @@ async def __call__( 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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -5296,6 +6429,7 @@ async def __call__( http_options = ( _BaseDatasetServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_locations( request, metadata ) @@ -5308,6 +6442,33 @@ async 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.aiplatform_v1.DatasetServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DatasetService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncDatasetServiceRestTransport._ListLocations._get_response( @@ -5335,6 +6496,27 @@ async def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_list_locations(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.aiplatform_v1.DatasetServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DatasetService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5376,7 +6558,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -5387,8 +6569,10 @@ async def __call__( 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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -5397,6 +6581,7 @@ async def __call__( http_options = ( _BaseDatasetServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_get_iam_policy( request, metadata ) @@ -5409,6 +6594,33 @@ async 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.aiplatform_v1.DatasetServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DatasetService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncDatasetServiceRestTransport._GetIamPolicy._get_response( @@ -5436,6 +6648,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_iam_policy(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.aiplatform_v1.DatasetServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DatasetService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5478,7 +6711,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -5489,8 +6722,10 @@ async def __call__( 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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -5499,6 +6734,7 @@ async def __call__( http_options = ( _BaseDatasetServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_set_iam_policy( request, metadata ) @@ -5515,6 +6751,33 @@ async 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.aiplatform_v1.DatasetServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DatasetService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncDatasetServiceRestTransport._SetIamPolicy._get_response( @@ -5543,6 +6806,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_set_iam_policy(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.aiplatform_v1.DatasetServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DatasetService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5585,7 +6869,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -5596,8 +6880,10 @@ async def __call__( 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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -5606,6 +6892,7 @@ async def __call__( http_options = ( _BaseDatasetServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = await self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -5618,6 +6905,33 @@ async 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.aiplatform_v1.DatasetServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DatasetService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncDatasetServiceRestTransport._TestIamPermissions._get_response( self._host, @@ -5643,6 +6957,27 @@ async def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_test_iam_permissions(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.aiplatform_v1.DatasetServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DatasetService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5685,7 +7020,7 @@ async 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 cancel operation method over HTTP. @@ -5696,13 +7031,16 @@ async def __call__( 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`. """ http_options = ( _BaseDatasetServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_cancel_operation( request, metadata ) @@ -5715,6 +7053,33 @@ async 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.aiplatform_v1.DatasetServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DatasetService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncDatasetServiceRestTransport._CancelOperation._get_response( @@ -5780,7 +7145,7 @@ async 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. @@ -5791,13 +7156,16 @@ async def __call__( 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`. """ http_options = ( _BaseDatasetServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_operation( request, metadata ) @@ -5810,6 +7178,33 @@ async 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.aiplatform_v1.DatasetServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DatasetService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncDatasetServiceRestTransport._DeleteOperation._get_response( @@ -5874,7 +7269,7 @@ async 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. @@ -5885,8 +7280,10 @@ async def __call__( 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: Response from GetOperation method. @@ -5895,6 +7292,7 @@ async def __call__( http_options = ( _BaseDatasetServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_operation( request, metadata ) @@ -5907,6 +7305,33 @@ async 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.aiplatform_v1.DatasetServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DatasetService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncDatasetServiceRestTransport._GetOperation._get_response( @@ -5934,6 +7359,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1.DatasetServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DatasetService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5976,7 +7422,7 @@ async 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. @@ -5987,8 +7433,10 @@ async def __call__( 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 from ListOperations method. @@ -5997,6 +7445,7 @@ async def __call__( http_options = ( _BaseDatasetServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_operations( request, metadata ) @@ -6009,6 +7458,33 @@ async 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.aiplatform_v1.DatasetServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DatasetService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncDatasetServiceRestTransport._ListOperations._get_response( @@ -6036,6 +7512,27 @@ async def __call__( resp = operations_pb2.ListOperationsResponse() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1.DatasetServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DatasetService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -6077,7 +7574,7 @@ async 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 wait operation method over HTTP. @@ -6088,8 +7585,10 @@ async def __call__( 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: Response from WaitOperation method. @@ -6098,6 +7597,7 @@ async def __call__( http_options = ( _BaseDatasetServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_wait_operation( request, metadata ) @@ -6110,6 +7610,33 @@ async 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.aiplatform_v1.DatasetServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DatasetService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncDatasetServiceRestTransport._WaitOperation._get_response( @@ -6137,6 +7664,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_wait_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.aiplatform_v1.DatasetServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DatasetService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1/services/deployment_resource_pool_service/async_client.py b/google/cloud/aiplatform_v1/services/deployment_resource_pool_service/async_client.py index ebe3a4dd59..92c31a5ef4 100644 --- a/google/cloud/aiplatform_v1/services/deployment_resource_pool_service/async_client.py +++ b/google/cloud/aiplatform_v1/services/deployment_resource_pool_service/async_client.py @@ -13,6 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging as std_logging from collections import OrderedDict import re from typing import ( @@ -66,6 +67,15 @@ from .transports.grpc_asyncio import DeploymentResourcePoolServiceGrpcAsyncIOTransport from .client import DeploymentResourcePoolServiceClient +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 DeploymentResourcePoolServiceAsyncClient: """A service that manages the DeploymentResourcePool resource.""" @@ -301,6 +311,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.aiplatform_v1.DeploymentResourcePoolServiceAsyncClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DeploymentResourcePoolService", + "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.aiplatform.v1.DeploymentResourcePoolService", + "credentialsType": None, + }, + ) + async def create_deployment_resource_pool( self, request: Optional[ @@ -317,7 +349,7 @@ async def create_deployment_resource_pool( deployment_resource_pool_id: 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"""Create a DeploymentResourcePool. @@ -389,8 +421,10 @@ async def sample_create_deployment_resource_pool(): 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: @@ -479,7 +513,7 @@ async def get_deployment_resource_pool( 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]]] = (), ) -> deployment_resource_pool.DeploymentResourcePool: r"""Get a DeploymentResourcePool. @@ -524,8 +558,10 @@ async def sample_get_deployment_resource_pool(): 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.aiplatform_v1.types.DeploymentResourcePool: @@ -597,7 +633,7 @@ async def list_deployment_resource_pools( 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.ListDeploymentResourcePoolsAsyncPager: r"""List DeploymentResourcePools in a location. @@ -643,8 +679,10 @@ async def sample_list_deployment_resource_pools(): 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.aiplatform_v1.services.deployment_resource_pool_service.pagers.ListDeploymentResourcePoolsAsyncPager: @@ -733,7 +771,7 @@ async def update_deployment_resource_pool( 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 a DeploymentResourcePool. @@ -794,8 +832,10 @@ async def sample_update_deployment_resource_pool(): 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: @@ -888,7 +928,7 @@ async def delete_deployment_resource_pool( 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 a DeploymentResourcePool. @@ -937,8 +977,10 @@ async def sample_delete_deployment_resource_pool(): 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: @@ -1026,7 +1068,7 @@ async def query_deployed_models( deployment_resource_pool: 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.QueryDeployedModelsAsyncPager: r"""List DeployedModels that have been deployed on this DeploymentResourcePool. @@ -1073,8 +1115,10 @@ async def sample_query_deployed_models(): 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.aiplatform_v1.services.deployment_resource_pool_service.pagers.QueryDeployedModelsAsyncPager: @@ -1154,7 +1198,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. @@ -1165,8 +1209,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. @@ -1207,7 +1253,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. @@ -1218,8 +1264,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. @@ -1260,7 +1308,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. @@ -1276,8 +1324,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 """ @@ -1314,7 +1364,7 @@ async def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -1329,8 +1379,10 @@ async def cancel_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 """ @@ -1367,7 +1419,7 @@ async def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -1384,8 +1436,10 @@ async def wait_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. @@ -1426,7 +1480,7 @@ async def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -1439,8 +1493,10 @@ async def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -1545,7 +1601,7 @@ async def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -1559,8 +1615,10 @@ async def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -1665,7 +1723,7 @@ async def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -1680,8 +1738,10 @@ async def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -1725,7 +1785,7 @@ async def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -1736,8 +1796,10 @@ async def get_location( 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: ~.location_pb2.Location: Location object. @@ -1778,7 +1840,7 @@ async def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -1789,8 +1851,10 @@ async def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1/services/deployment_resource_pool_service/client.py b/google/cloud/aiplatform_v1/services/deployment_resource_pool_service/client.py index 9d2b31e473..13313ad94e 100644 --- a/google/cloud/aiplatform_v1/services/deployment_resource_pool_service/client.py +++ b/google/cloud/aiplatform_v1/services/deployment_resource_pool_service/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 ( @@ -48,6 +49,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 as gac_operation # type: ignore from google.api_core import operation_async # type: ignore from google.cloud.aiplatform_v1.services.deployment_resource_pool_service import pagers @@ -690,6 +700,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( @@ -785,6 +799,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.aiplatform_v1.DeploymentResourcePoolServiceClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DeploymentResourcePoolService", + "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.aiplatform.v1.DeploymentResourcePoolService", + "credentialsType": None, + }, + ) + def create_deployment_resource_pool( self, request: Optional[ @@ -801,7 +838,7 @@ def create_deployment_resource_pool( deployment_resource_pool_id: 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]]] = (), ) -> gac_operation.Operation: r"""Create a DeploymentResourcePool. @@ -873,8 +910,10 @@ def sample_create_deployment_resource_pool(): 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: @@ -962,7 +1001,7 @@ def get_deployment_resource_pool( 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]]] = (), ) -> deployment_resource_pool.DeploymentResourcePool: r"""Get a DeploymentResourcePool. @@ -1007,8 +1046,10 @@ def sample_get_deployment_resource_pool(): 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.aiplatform_v1.types.DeploymentResourcePool: @@ -1079,7 +1120,7 @@ def list_deployment_resource_pools( 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.ListDeploymentResourcePoolsPager: r"""List DeploymentResourcePools in a location. @@ -1125,8 +1166,10 @@ def sample_list_deployment_resource_pools(): 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.aiplatform_v1.services.deployment_resource_pool_service.pagers.ListDeploymentResourcePoolsPager: @@ -1214,7 +1257,7 @@ def update_deployment_resource_pool( 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]]] = (), ) -> gac_operation.Operation: r"""Update a DeploymentResourcePool. @@ -1275,8 +1318,10 @@ def sample_update_deployment_resource_pool(): 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: @@ -1368,7 +1413,7 @@ def delete_deployment_resource_pool( 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]]] = (), ) -> gac_operation.Operation: r"""Delete a DeploymentResourcePool. @@ -1417,8 +1462,10 @@ def sample_delete_deployment_resource_pool(): 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: @@ -1505,7 +1552,7 @@ def query_deployed_models( deployment_resource_pool: 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.QueryDeployedModelsPager: r"""List DeployedModels that have been deployed on this DeploymentResourcePool. @@ -1552,8 +1599,10 @@ def sample_query_deployed_models(): 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.aiplatform_v1.services.deployment_resource_pool_service.pagers.QueryDeployedModelsPager: @@ -1643,7 +1692,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. @@ -1654,8 +1703,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. @@ -1696,7 +1747,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. @@ -1707,8 +1758,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. @@ -1749,7 +1802,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. @@ -1765,8 +1818,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 """ @@ -1803,7 +1858,7 @@ def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -1818,8 +1873,10 @@ def cancel_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 """ @@ -1856,7 +1913,7 @@ def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -1873,8 +1930,10 @@ def wait_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. @@ -1915,7 +1974,7 @@ def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -1928,8 +1987,10 @@ def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -2034,7 +2095,7 @@ def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -2048,8 +2109,10 @@ def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -2154,7 +2217,7 @@ def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -2169,8 +2232,10 @@ def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -2212,7 +2277,7 @@ def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -2223,8 +2288,10 @@ def get_location( 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: ~.location_pb2.Location: Location object. @@ -2265,7 +2332,7 @@ def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -2276,8 +2343,10 @@ def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1/services/deployment_resource_pool_service/pagers.py b/google/cloud/aiplatform_v1/services/deployment_resource_pool_service/pagers.py index 84c391309c..9a9ac24f75 100644 --- a/google/cloud/aiplatform_v1/services/deployment_resource_pool_service/pagers.py +++ b/google/cloud/aiplatform_v1/services/deployment_resource_pool_service/pagers.py @@ -70,7 +70,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. @@ -84,8 +84,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 = ( @@ -153,7 +155,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. @@ -167,8 +169,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 = ( @@ -241,7 +245,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. @@ -255,8 +259,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 = deployment_resource_pool_service.QueryDeployedModelsRequest( @@ -321,7 +327,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. @@ -335,8 +341,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 = deployment_resource_pool_service.QueryDeployedModelsRequest( diff --git a/google/cloud/aiplatform_v1/services/deployment_resource_pool_service/transports/grpc.py b/google/cloud/aiplatform_v1/services/deployment_resource_pool_service/transports/grpc.py index ab6b4e70f5..695e775b19 100644 --- a/google/cloud/aiplatform_v1/services/deployment_resource_pool_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1/services/deployment_resource_pool_service/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 import warnings from typing import Callable, Dict, Optional, Sequence, Tuple, Union @@ -22,8 +25,11 @@ import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from google.cloud.aiplatform_v1.types import deployment_resource_pool from google.cloud.aiplatform_v1.types import deployment_resource_pool_service @@ -33,6 +39,81 @@ from google.longrunning import operations_pb2 # type: ignore from .base import DeploymentResourcePoolServiceTransport, DEFAULT_CLIENT_INFO +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.aiplatform.v1.DeploymentResourcePoolService", + "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.aiplatform.v1.DeploymentResourcePoolService", + "rpcName": client_call_details.method, + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class DeploymentResourcePoolServiceGrpcTransport( DeploymentResourcePoolServiceTransport @@ -189,7 +270,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 @@ -253,7 +339,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 @@ -283,7 +371,7 @@ def create_deployment_resource_pool( if "create_deployment_resource_pool" not in self._stubs: self._stubs[ "create_deployment_resource_pool" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.DeploymentResourcePoolService/CreateDeploymentResourcePool", request_serializer=deployment_resource_pool_service.CreateDeploymentResourcePoolRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -312,7 +400,9 @@ def get_deployment_resource_pool( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_deployment_resource_pool" not in self._stubs: - self._stubs["get_deployment_resource_pool"] = self.grpc_channel.unary_unary( + self._stubs[ + "get_deployment_resource_pool" + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.DeploymentResourcePoolService/GetDeploymentResourcePool", request_serializer=deployment_resource_pool_service.GetDeploymentResourcePoolRequest.serialize, response_deserializer=deployment_resource_pool.DeploymentResourcePool.deserialize, @@ -343,7 +433,7 @@ def list_deployment_resource_pools( if "list_deployment_resource_pools" not in self._stubs: self._stubs[ "list_deployment_resource_pools" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.DeploymentResourcePoolService/ListDeploymentResourcePools", request_serializer=deployment_resource_pool_service.ListDeploymentResourcePoolsRequest.serialize, response_deserializer=deployment_resource_pool_service.ListDeploymentResourcePoolsResponse.deserialize, @@ -375,7 +465,7 @@ def update_deployment_resource_pool( if "update_deployment_resource_pool" not in self._stubs: self._stubs[ "update_deployment_resource_pool" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.DeploymentResourcePoolService/UpdateDeploymentResourcePool", request_serializer=deployment_resource_pool_service.UpdateDeploymentResourcePoolRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -407,7 +497,7 @@ def delete_deployment_resource_pool( if "delete_deployment_resource_pool" not in self._stubs: self._stubs[ "delete_deployment_resource_pool" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.DeploymentResourcePoolService/DeleteDeploymentResourcePool", request_serializer=deployment_resource_pool_service.DeleteDeploymentResourcePoolRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -437,7 +527,7 @@ def query_deployed_models( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "query_deployed_models" not in self._stubs: - self._stubs["query_deployed_models"] = self.grpc_channel.unary_unary( + self._stubs["query_deployed_models"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.DeploymentResourcePoolService/QueryDeployedModels", request_serializer=deployment_resource_pool_service.QueryDeployedModelsRequest.serialize, response_deserializer=deployment_resource_pool_service.QueryDeployedModelsResponse.deserialize, @@ -445,7 +535,7 @@ def query_deployed_models( return self._stubs["query_deployed_models"] def close(self): - self.grpc_channel.close() + self._logged_channel.close() @property def delete_operation( @@ -457,7 +547,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, @@ -474,7 +564,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -491,7 +581,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -508,7 +598,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, @@ -527,7 +617,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, @@ -546,7 +636,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -563,7 +653,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -588,7 +678,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -614,7 +704,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -643,7 +733,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1/services/deployment_resource_pool_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1/services/deployment_resource_pool_service/transports/grpc_asyncio.py index 26646f4e82..1ea68ac5dd 100644 --- a/google/cloud/aiplatform_v1/services/deployment_resource_pool_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1/services/deployment_resource_pool_service/transports/grpc_asyncio.py @@ -14,6 +14,9 @@ # limitations under the License. # import inspect +import json +import pickle +import logging as std_logging import warnings from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union @@ -24,8 +27,11 @@ from google.api_core import operations_v1 from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from grpc.experimental import aio # type: ignore from google.cloud.aiplatform_v1.types import deployment_resource_pool @@ -37,6 +43,82 @@ from .base import DeploymentResourcePoolServiceTransport, DEFAULT_CLIENT_INFO from .grpc import DeploymentResourcePoolServiceGrpcTransport +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.aiplatform.v1.DeploymentResourcePoolService", + "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.aiplatform.v1.DeploymentResourcePoolService", + "rpcName": str(client_call_details.method), + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class DeploymentResourcePoolServiceGrpcAsyncIOTransport( DeploymentResourcePoolServiceTransport @@ -236,10 +318,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 @@ -262,7 +347,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. @@ -293,7 +378,7 @@ def create_deployment_resource_pool( if "create_deployment_resource_pool" not in self._stubs: self._stubs[ "create_deployment_resource_pool" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.DeploymentResourcePoolService/CreateDeploymentResourcePool", request_serializer=deployment_resource_pool_service.CreateDeploymentResourcePoolRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -322,7 +407,9 @@ def get_deployment_resource_pool( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_deployment_resource_pool" not in self._stubs: - self._stubs["get_deployment_resource_pool"] = self.grpc_channel.unary_unary( + self._stubs[ + "get_deployment_resource_pool" + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.DeploymentResourcePoolService/GetDeploymentResourcePool", request_serializer=deployment_resource_pool_service.GetDeploymentResourcePoolRequest.serialize, response_deserializer=deployment_resource_pool.DeploymentResourcePool.deserialize, @@ -353,7 +440,7 @@ def list_deployment_resource_pools( if "list_deployment_resource_pools" not in self._stubs: self._stubs[ "list_deployment_resource_pools" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.DeploymentResourcePoolService/ListDeploymentResourcePools", request_serializer=deployment_resource_pool_service.ListDeploymentResourcePoolsRequest.serialize, response_deserializer=deployment_resource_pool_service.ListDeploymentResourcePoolsResponse.deserialize, @@ -385,7 +472,7 @@ def update_deployment_resource_pool( if "update_deployment_resource_pool" not in self._stubs: self._stubs[ "update_deployment_resource_pool" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.DeploymentResourcePoolService/UpdateDeploymentResourcePool", request_serializer=deployment_resource_pool_service.UpdateDeploymentResourcePoolRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -417,7 +504,7 @@ def delete_deployment_resource_pool( if "delete_deployment_resource_pool" not in self._stubs: self._stubs[ "delete_deployment_resource_pool" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.DeploymentResourcePoolService/DeleteDeploymentResourcePool", request_serializer=deployment_resource_pool_service.DeleteDeploymentResourcePoolRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -447,7 +534,7 @@ def query_deployed_models( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "query_deployed_models" not in self._stubs: - self._stubs["query_deployed_models"] = self.grpc_channel.unary_unary( + self._stubs["query_deployed_models"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.DeploymentResourcePoolService/QueryDeployedModels", request_serializer=deployment_resource_pool_service.QueryDeployedModelsRequest.serialize, response_deserializer=deployment_resource_pool_service.QueryDeployedModelsResponse.deserialize, @@ -545,7 +632,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: @@ -561,7 +648,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, @@ -578,7 +665,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -595,7 +682,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -612,7 +699,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, @@ -631,7 +718,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, @@ -650,7 +737,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -667,7 +754,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -692,7 +779,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -718,7 +805,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -747,7 +834,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1/services/deployment_resource_pool_service/transports/rest.py b/google/cloud/aiplatform_v1/services/deployment_resource_pool_service/transports/rest.py index 6a36767cae..350ff26032 100644 --- a/google/cloud/aiplatform_v1/services/deployment_resource_pool_service/transports/rest.py +++ b/google/cloud/aiplatform_v1/services/deployment_resource_pool_service/transports/rest.py @@ -13,9 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging +import json # type: ignore from google.auth.transport.requests import AuthorizedSession # type: ignore -import json # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.api_core import exceptions as core_exceptions from google.api_core import retry as retries @@ -48,6 +49,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, @@ -128,10 +137,10 @@ def post_update_deployment_resource_pool(self, response): def pre_create_deployment_resource_pool( self, request: deployment_resource_pool_service.CreateDeploymentResourcePoolRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ deployment_resource_pool_service.CreateDeploymentResourcePoolRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for create_deployment_resource_pool @@ -154,10 +163,10 @@ def post_create_deployment_resource_pool( def pre_delete_deployment_resource_pool( self, request: deployment_resource_pool_service.DeleteDeploymentResourcePoolRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ deployment_resource_pool_service.DeleteDeploymentResourcePoolRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for delete_deployment_resource_pool @@ -180,10 +189,10 @@ def post_delete_deployment_resource_pool( def pre_get_deployment_resource_pool( self, request: deployment_resource_pool_service.GetDeploymentResourcePoolRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ deployment_resource_pool_service.GetDeploymentResourcePoolRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for get_deployment_resource_pool @@ -206,10 +215,10 @@ def post_get_deployment_resource_pool( def pre_list_deployment_resource_pools( self, request: deployment_resource_pool_service.ListDeploymentResourcePoolsRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ deployment_resource_pool_service.ListDeploymentResourcePoolsRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for list_deployment_resource_pools @@ -233,10 +242,10 @@ def post_list_deployment_resource_pools( def pre_query_deployed_models( self, request: deployment_resource_pool_service.QueryDeployedModelsRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ deployment_resource_pool_service.QueryDeployedModelsRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for query_deployed_models @@ -259,10 +268,10 @@ def post_query_deployed_models( def pre_update_deployment_resource_pool( self, request: deployment_resource_pool_service.UpdateDeploymentResourcePoolRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ deployment_resource_pool_service.UpdateDeploymentResourcePoolRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for update_deployment_resource_pool @@ -285,8 +294,10 @@ def post_update_deployment_resource_pool( def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -308,8 +319,10 @@ def post_get_location( def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -331,8 +344,10 @@ def post_list_locations( def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -352,8 +367,10 @@ def post_get_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -373,8 +390,11 @@ def post_set_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -396,8 +416,10 @@ def post_test_iam_permissions( def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -417,8 +439,10 @@ def post_cancel_operation(self, response: None) -> None: 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 @@ -438,8 +462,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 @@ -461,8 +487,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 @@ -484,8 +512,10 @@ def post_list_operations( def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -2513,7 +2543,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 deployment resource pool method over HTTP. @@ -2525,8 +2555,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: @@ -2539,6 +2571,7 @@ def __call__( http_options = ( _BaseDeploymentResourcePoolServiceRestTransport._BaseCreateDeploymentResourcePool._get_http_options() ) + request, metadata = self._interceptor.pre_create_deployment_resource_pool( request, metadata ) @@ -2555,6 +2588,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.aiplatform_v1.DeploymentResourcePoolServiceClient.CreateDeploymentResourcePool", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DeploymentResourcePoolService", + "rpcName": "CreateDeploymentResourcePool", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = DeploymentResourcePoolServiceRestTransport._CreateDeploymentResourcePool._get_response( self._host, @@ -2574,7 +2634,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_deployment_resource_pool(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.aiplatform_v1.DeploymentResourcePoolServiceClient.create_deployment_resource_pool", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DeploymentResourcePoolService", + "rpcName": "CreateDeploymentResourcePool", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _DeleteDeploymentResourcePool( @@ -2615,7 +2697,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 deployment resource pool method over HTTP. @@ -2627,8 +2709,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: @@ -2641,6 +2725,7 @@ def __call__( http_options = ( _BaseDeploymentResourcePoolServiceRestTransport._BaseDeleteDeploymentResourcePool._get_http_options() ) + request, metadata = self._interceptor.pre_delete_deployment_resource_pool( request, metadata ) @@ -2653,6 +2738,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.aiplatform_v1.DeploymentResourcePoolServiceClient.DeleteDeploymentResourcePool", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DeploymentResourcePoolService", + "rpcName": "DeleteDeploymentResourcePool", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = DeploymentResourcePoolServiceRestTransport._DeleteDeploymentResourcePool._get_response( self._host, @@ -2671,7 +2783,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_deployment_resource_pool(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.aiplatform_v1.DeploymentResourcePoolServiceClient.delete_deployment_resource_pool", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DeploymentResourcePoolService", + "rpcName": "DeleteDeploymentResourcePool", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _GetDeploymentResourcePool( @@ -2712,7 +2846,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]]] = (), ) -> deployment_resource_pool.DeploymentResourcePool: r"""Call the get deployment resource pool method over HTTP. @@ -2724,8 +2858,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: ~.deployment_resource_pool.DeploymentResourcePool: @@ -2739,6 +2875,7 @@ def __call__( http_options = ( _BaseDeploymentResourcePoolServiceRestTransport._BaseGetDeploymentResourcePool._get_http_options() ) + request, metadata = self._interceptor.pre_get_deployment_resource_pool( request, metadata ) @@ -2751,6 +2888,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.aiplatform_v1.DeploymentResourcePoolServiceClient.GetDeploymentResourcePool", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DeploymentResourcePoolService", + "rpcName": "GetDeploymentResourcePool", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = DeploymentResourcePoolServiceRestTransport._GetDeploymentResourcePool._get_response( self._host, @@ -2771,7 +2935,33 @@ def __call__( pb_resp = deployment_resource_pool.DeploymentResourcePool.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_deployment_resource_pool(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + deployment_resource_pool.DeploymentResourcePool.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.aiplatform_v1.DeploymentResourcePoolServiceClient.get_deployment_resource_pool", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DeploymentResourcePoolService", + "rpcName": "GetDeploymentResourcePool", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListDeploymentResourcePools( @@ -2812,7 +3002,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]]] = (), ) -> deployment_resource_pool_service.ListDeploymentResourcePoolsResponse: r"""Call the list deployment resource pools method over HTTP. @@ -2824,8 +3014,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: ~.deployment_resource_pool_service.ListDeploymentResourcePoolsResponse: @@ -2837,6 +3029,7 @@ def __call__( http_options = ( _BaseDeploymentResourcePoolServiceRestTransport._BaseListDeploymentResourcePools._get_http_options() ) + request, metadata = self._interceptor.pre_list_deployment_resource_pools( request, metadata ) @@ -2849,6 +3042,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.aiplatform_v1.DeploymentResourcePoolServiceClient.ListDeploymentResourcePools", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DeploymentResourcePoolService", + "rpcName": "ListDeploymentResourcePools", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = DeploymentResourcePoolServiceRestTransport._ListDeploymentResourcePools._get_response( self._host, @@ -2875,7 +3095,31 @@ def __call__( ) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_deployment_resource_pools(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = deployment_resource_pool_service.ListDeploymentResourcePoolsResponse.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.aiplatform_v1.DeploymentResourcePoolServiceClient.list_deployment_resource_pools", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DeploymentResourcePoolService", + "rpcName": "ListDeploymentResourcePools", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _QueryDeployedModels( @@ -2916,7 +3160,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]]] = (), ) -> deployment_resource_pool_service.QueryDeployedModelsResponse: r"""Call the query deployed models method over HTTP. @@ -2927,8 +3171,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: ~.deployment_resource_pool_service.QueryDeployedModelsResponse: @@ -2940,6 +3186,7 @@ def __call__( http_options = ( _BaseDeploymentResourcePoolServiceRestTransport._BaseQueryDeployedModels._get_http_options() ) + request, metadata = self._interceptor.pre_query_deployed_models( request, metadata ) @@ -2952,6 +3199,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.aiplatform_v1.DeploymentResourcePoolServiceClient.QueryDeployedModels", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DeploymentResourcePoolService", + "rpcName": "QueryDeployedModels", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = DeploymentResourcePoolServiceRestTransport._QueryDeployedModels._get_response( self._host, @@ -2974,7 +3248,31 @@ def __call__( ) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_query_deployed_models(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = deployment_resource_pool_service.QueryDeployedModelsResponse.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.aiplatform_v1.DeploymentResourcePoolServiceClient.query_deployed_models", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DeploymentResourcePoolService", + "rpcName": "QueryDeployedModels", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _UpdateDeploymentResourcePool( @@ -3016,7 +3314,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 deployment resource pool method over HTTP. @@ -3028,8 +3326,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: @@ -3042,6 +3342,7 @@ def __call__( http_options = ( _BaseDeploymentResourcePoolServiceRestTransport._BaseUpdateDeploymentResourcePool._get_http_options() ) + request, metadata = self._interceptor.pre_update_deployment_resource_pool( request, metadata ) @@ -3058,6 +3359,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.aiplatform_v1.DeploymentResourcePoolServiceClient.UpdateDeploymentResourcePool", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DeploymentResourcePoolService", + "rpcName": "UpdateDeploymentResourcePool", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = DeploymentResourcePoolServiceRestTransport._UpdateDeploymentResourcePool._get_response( self._host, @@ -3077,7 +3405,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_deployment_resource_pool(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.aiplatform_v1.DeploymentResourcePoolServiceClient.update_deployment_resource_pool", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DeploymentResourcePoolService", + "rpcName": "UpdateDeploymentResourcePool", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp @property @@ -3186,7 +3536,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]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -3197,8 +3547,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: locations_pb2.Location: Response from GetLocation method. @@ -3207,6 +3559,7 @@ def __call__( http_options = ( _BaseDeploymentResourcePoolServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = self._interceptor.pre_get_location(request, metadata) transcoded_request = _BaseDeploymentResourcePoolServiceRestTransport._BaseGetLocation._get_transcoded_request( http_options, request @@ -3217,6 +3570,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.aiplatform_v1.DeploymentResourcePoolServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DeploymentResourcePoolService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( DeploymentResourcePoolServiceRestTransport._GetLocation._get_response( @@ -3238,6 +3618,27 @@ def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_location(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.aiplatform_v1.DeploymentResourcePoolServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DeploymentResourcePoolService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3280,7 +3681,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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -3291,8 +3692,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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -3301,6 +3704,7 @@ def __call__( http_options = ( _BaseDeploymentResourcePoolServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = self._interceptor.pre_list_locations(request, metadata) transcoded_request = _BaseDeploymentResourcePoolServiceRestTransport._BaseListLocations._get_transcoded_request( http_options, request @@ -3311,6 +3715,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.aiplatform_v1.DeploymentResourcePoolServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DeploymentResourcePoolService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( DeploymentResourcePoolServiceRestTransport._ListLocations._get_response( @@ -3332,6 +3763,27 @@ def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_list_locations(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.aiplatform_v1.DeploymentResourcePoolServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DeploymentResourcePoolService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3374,7 +3826,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]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -3385,8 +3837,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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -3395,6 +3849,7 @@ def __call__( http_options = ( _BaseDeploymentResourcePoolServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_get_iam_policy(request, metadata) transcoded_request = _BaseDeploymentResourcePoolServiceRestTransport._BaseGetIamPolicy._get_transcoded_request( http_options, request @@ -3405,6 +3860,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.aiplatform_v1.DeploymentResourcePoolServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DeploymentResourcePoolService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( DeploymentResourcePoolServiceRestTransport._GetIamPolicy._get_response( @@ -3426,6 +3908,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_iam_policy(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.aiplatform_v1.DeploymentResourcePoolServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DeploymentResourcePoolService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3469,7 +3972,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]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -3480,8 +3983,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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -3490,6 +3995,7 @@ def __call__( http_options = ( _BaseDeploymentResourcePoolServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_set_iam_policy(request, metadata) transcoded_request = _BaseDeploymentResourcePoolServiceRestTransport._BaseSetIamPolicy._get_transcoded_request( http_options, request @@ -3504,6 +4010,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.aiplatform_v1.DeploymentResourcePoolServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DeploymentResourcePoolService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( DeploymentResourcePoolServiceRestTransport._SetIamPolicy._get_response( @@ -3526,6 +4059,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_set_iam_policy(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.aiplatform_v1.DeploymentResourcePoolServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DeploymentResourcePoolService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3568,7 +4122,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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -3579,8 +4133,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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -3589,6 +4145,7 @@ def __call__( http_options = ( _BaseDeploymentResourcePoolServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -3601,6 +4158,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.aiplatform_v1.DeploymentResourcePoolServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DeploymentResourcePoolService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = DeploymentResourcePoolServiceRestTransport._TestIamPermissions._get_response( self._host, @@ -3620,6 +4204,27 @@ def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_test_iam_permissions(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.aiplatform_v1.DeploymentResourcePoolServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DeploymentResourcePoolService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3662,7 +4267,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 cancel operation method over HTTP. @@ -3673,13 +4278,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 = ( _BaseDeploymentResourcePoolServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = self._interceptor.pre_cancel_operation( request, metadata ) @@ -3692,6 +4300,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.aiplatform_v1.DeploymentResourcePoolServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DeploymentResourcePoolService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = DeploymentResourcePoolServiceRestTransport._CancelOperation._get_response( self._host, @@ -3749,7 +4384,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. @@ -3760,13 +4395,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 = ( _BaseDeploymentResourcePoolServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = self._interceptor.pre_delete_operation( request, metadata ) @@ -3779,6 +4417,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.aiplatform_v1.DeploymentResourcePoolServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DeploymentResourcePoolService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = DeploymentResourcePoolServiceRestTransport._DeleteOperation._get_response( self._host, @@ -3836,7 +4501,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. @@ -3847,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: operations_pb2.Operation: Response from GetOperation method. @@ -3857,6 +4524,7 @@ def __call__( http_options = ( _BaseDeploymentResourcePoolServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = self._interceptor.pre_get_operation(request, metadata) transcoded_request = _BaseDeploymentResourcePoolServiceRestTransport._BaseGetOperation._get_transcoded_request( http_options, request @@ -3867,6 +4535,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.aiplatform_v1.DeploymentResourcePoolServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DeploymentResourcePoolService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( DeploymentResourcePoolServiceRestTransport._GetOperation._get_response( @@ -3888,6 +4583,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.aiplatform_v1.DeploymentResourcePoolServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DeploymentResourcePoolService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3930,7 +4646,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. @@ -3941,8 +4657,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. @@ -3951,6 +4669,7 @@ def __call__( http_options = ( _BaseDeploymentResourcePoolServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = self._interceptor.pre_list_operations(request, metadata) transcoded_request = _BaseDeploymentResourcePoolServiceRestTransport._BaseListOperations._get_transcoded_request( http_options, request @@ -3961,6 +4680,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.aiplatform_v1.DeploymentResourcePoolServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DeploymentResourcePoolService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = DeploymentResourcePoolServiceRestTransport._ListOperations._get_response( self._host, @@ -3980,6 +4726,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.aiplatform_v1.DeploymentResourcePoolServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DeploymentResourcePoolService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4022,7 +4789,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 wait operation method over HTTP. @@ -4033,8 +4800,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 WaitOperation method. @@ -4043,6 +4812,7 @@ def __call__( http_options = ( _BaseDeploymentResourcePoolServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = self._interceptor.pre_wait_operation(request, metadata) transcoded_request = _BaseDeploymentResourcePoolServiceRestTransport._BaseWaitOperation._get_transcoded_request( http_options, request @@ -4053,6 +4823,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.aiplatform_v1.DeploymentResourcePoolServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DeploymentResourcePoolService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( DeploymentResourcePoolServiceRestTransport._WaitOperation._get_response( @@ -4074,6 +4871,27 @@ def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = self._interceptor.post_wait_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.aiplatform_v1.DeploymentResourcePoolServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DeploymentResourcePoolService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1/services/deployment_resource_pool_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1/services/deployment_resource_pool_service/transports/rest_asyncio.py index 8afb94b17d..8a50343c91 100644 --- a/google/cloud/aiplatform_v1/services/deployment_resource_pool_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1/services/deployment_resource_pool_service/transports/rest_asyncio.py @@ -59,6 +59,18 @@ from .base import DEFAULT_CLIENT_INFO as BASE_DEFAULT_CLIENT_INFO + +import logging + +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__) + try: OptionalRetry = Union[retries.AsyncRetry, gapic_v1.method._MethodDefault, None] except AttributeError: # pragma: NO COVER @@ -143,10 +155,10 @@ async def post_update_deployment_resource_pool(self, response): async def pre_create_deployment_resource_pool( self, request: deployment_resource_pool_service.CreateDeploymentResourcePoolRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ deployment_resource_pool_service.CreateDeploymentResourcePoolRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for create_deployment_resource_pool @@ -169,10 +181,10 @@ async def post_create_deployment_resource_pool( async def pre_delete_deployment_resource_pool( self, request: deployment_resource_pool_service.DeleteDeploymentResourcePoolRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ deployment_resource_pool_service.DeleteDeploymentResourcePoolRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for delete_deployment_resource_pool @@ -195,10 +207,10 @@ async def post_delete_deployment_resource_pool( async def pre_get_deployment_resource_pool( self, request: deployment_resource_pool_service.GetDeploymentResourcePoolRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ deployment_resource_pool_service.GetDeploymentResourcePoolRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for get_deployment_resource_pool @@ -221,10 +233,10 @@ async def post_get_deployment_resource_pool( async def pre_list_deployment_resource_pools( self, request: deployment_resource_pool_service.ListDeploymentResourcePoolsRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ deployment_resource_pool_service.ListDeploymentResourcePoolsRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for list_deployment_resource_pools @@ -248,10 +260,10 @@ async def post_list_deployment_resource_pools( async def pre_query_deployed_models( self, request: deployment_resource_pool_service.QueryDeployedModelsRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ deployment_resource_pool_service.QueryDeployedModelsRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for query_deployed_models @@ -274,10 +286,10 @@ async def post_query_deployed_models( async def pre_update_deployment_resource_pool( self, request: deployment_resource_pool_service.UpdateDeploymentResourcePoolRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ deployment_resource_pool_service.UpdateDeploymentResourcePoolRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for update_deployment_resource_pool @@ -300,8 +312,10 @@ async def post_update_deployment_resource_pool( async def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -323,8 +337,10 @@ async def post_get_location( async def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -346,8 +362,10 @@ async def post_list_locations( async def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -369,8 +387,10 @@ async def post_get_iam_policy( async def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -392,8 +412,11 @@ async def post_set_iam_policy( async def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -415,8 +438,10 @@ async def post_test_iam_permissions( async def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -436,8 +461,10 @@ async def post_cancel_operation(self, response: None) -> None: async 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 @@ -457,8 +484,10 @@ async def post_delete_operation(self, response: None) -> None: async 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 @@ -480,8 +509,10 @@ async def post_get_operation( async 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 @@ -503,8 +534,10 @@ async def post_list_operations( async def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -721,7 +754,7 @@ async 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 deployment resource pool method over HTTP. @@ -733,8 +766,10 @@ async def __call__( 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: @@ -747,6 +782,7 @@ async def __call__( http_options = ( _BaseDeploymentResourcePoolServiceRestTransport._BaseCreateDeploymentResourcePool._get_http_options() ) + ( request, metadata, @@ -766,6 +802,33 @@ async 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.aiplatform_v1.DeploymentResourcePoolServiceClient.CreateDeploymentResourcePool", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DeploymentResourcePoolService", + "rpcName": "CreateDeploymentResourcePool", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncDeploymentResourcePoolServiceRestTransport._CreateDeploymentResourcePool._get_response( self._host, @@ -794,6 +857,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_create_deployment_resource_pool(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.DeploymentResourcePoolServiceAsyncClient.create_deployment_resource_pool", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DeploymentResourcePoolService", + "rpcName": "CreateDeploymentResourcePool", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _DeleteDeploymentResourcePool( @@ -834,7 +919,7 @@ async 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 deployment resource pool method over HTTP. @@ -846,8 +931,10 @@ async def __call__( 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: @@ -860,6 +947,7 @@ async def __call__( http_options = ( _BaseDeploymentResourcePoolServiceRestTransport._BaseDeleteDeploymentResourcePool._get_http_options() ) + ( request, metadata, @@ -875,6 +963,33 @@ async 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.aiplatform_v1.DeploymentResourcePoolServiceClient.DeleteDeploymentResourcePool", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DeploymentResourcePoolService", + "rpcName": "DeleteDeploymentResourcePool", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncDeploymentResourcePoolServiceRestTransport._DeleteDeploymentResourcePool._get_response( self._host, @@ -902,6 +1017,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_delete_deployment_resource_pool(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.DeploymentResourcePoolServiceAsyncClient.delete_deployment_resource_pool", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DeploymentResourcePoolService", + "rpcName": "DeleteDeploymentResourcePool", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _GetDeploymentResourcePool( @@ -942,7 +1079,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> deployment_resource_pool.DeploymentResourcePool: r"""Call the get deployment resource pool method over HTTP. @@ -954,8 +1091,10 @@ async def __call__( 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: ~.deployment_resource_pool.DeploymentResourcePool: @@ -969,6 +1108,7 @@ async def __call__( http_options = ( _BaseDeploymentResourcePoolServiceRestTransport._BaseGetDeploymentResourcePool._get_http_options() ) + ( request, metadata, @@ -984,6 +1124,33 @@ async 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.aiplatform_v1.DeploymentResourcePoolServiceClient.GetDeploymentResourcePool", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DeploymentResourcePoolService", + "rpcName": "GetDeploymentResourcePool", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncDeploymentResourcePoolServiceRestTransport._GetDeploymentResourcePool._get_response( self._host, @@ -1011,6 +1178,32 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_get_deployment_resource_pool(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + deployment_resource_pool.DeploymentResourcePool.to_json( + response + ) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.DeploymentResourcePoolServiceAsyncClient.get_deployment_resource_pool", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DeploymentResourcePoolService", + "rpcName": "GetDeploymentResourcePool", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ListDeploymentResourcePools( @@ -1051,7 +1244,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> deployment_resource_pool_service.ListDeploymentResourcePoolsResponse: r"""Call the list deployment resource pools method over HTTP. @@ -1063,8 +1256,10 @@ async def __call__( 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: ~.deployment_resource_pool_service.ListDeploymentResourcePoolsResponse: @@ -1076,6 +1271,7 @@ async def __call__( http_options = ( _BaseDeploymentResourcePoolServiceRestTransport._BaseListDeploymentResourcePools._get_http_options() ) + ( request, metadata, @@ -1091,6 +1287,33 @@ async 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.aiplatform_v1.DeploymentResourcePoolServiceClient.ListDeploymentResourcePools", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DeploymentResourcePoolService", + "rpcName": "ListDeploymentResourcePools", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncDeploymentResourcePoolServiceRestTransport._ListDeploymentResourcePools._get_response( self._host, @@ -1124,6 +1347,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_list_deployment_resource_pools(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = deployment_resource_pool_service.ListDeploymentResourcePoolsResponse.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.DeploymentResourcePoolServiceAsyncClient.list_deployment_resource_pools", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DeploymentResourcePoolService", + "rpcName": "ListDeploymentResourcePools", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _QueryDeployedModels( @@ -1164,7 +1411,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> deployment_resource_pool_service.QueryDeployedModelsResponse: r"""Call the query deployed models method over HTTP. @@ -1175,8 +1422,10 @@ async def __call__( 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: ~.deployment_resource_pool_service.QueryDeployedModelsResponse: @@ -1188,6 +1437,7 @@ async def __call__( http_options = ( _BaseDeploymentResourcePoolServiceRestTransport._BaseQueryDeployedModels._get_http_options() ) + request, metadata = await self._interceptor.pre_query_deployed_models( request, metadata ) @@ -1200,6 +1450,33 @@ async 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.aiplatform_v1.DeploymentResourcePoolServiceClient.QueryDeployedModels", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DeploymentResourcePoolService", + "rpcName": "QueryDeployedModels", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncDeploymentResourcePoolServiceRestTransport._QueryDeployedModels._get_response( self._host, @@ -1229,6 +1506,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_query_deployed_models(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = deployment_resource_pool_service.QueryDeployedModelsResponse.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.DeploymentResourcePoolServiceAsyncClient.query_deployed_models", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DeploymentResourcePoolService", + "rpcName": "QueryDeployedModels", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _UpdateDeploymentResourcePool( @@ -1270,7 +1571,7 @@ async 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 deployment resource pool method over HTTP. @@ -1282,8 +1583,10 @@ async def __call__( 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: @@ -1296,6 +1599,7 @@ async def __call__( http_options = ( _BaseDeploymentResourcePoolServiceRestTransport._BaseUpdateDeploymentResourcePool._get_http_options() ) + ( request, metadata, @@ -1315,6 +1619,33 @@ async 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.aiplatform_v1.DeploymentResourcePoolServiceClient.UpdateDeploymentResourcePool", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DeploymentResourcePoolService", + "rpcName": "UpdateDeploymentResourcePool", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncDeploymentResourcePoolServiceRestTransport._UpdateDeploymentResourcePool._get_response( self._host, @@ -1343,6 +1674,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_update_deployment_resource_pool(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.DeploymentResourcePoolServiceAsyncClient.update_deployment_resource_pool", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DeploymentResourcePoolService", + "rpcName": "UpdateDeploymentResourcePool", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp @property @@ -3316,7 +3669,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -3327,8 +3680,10 @@ async def __call__( 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: locations_pb2.Location: Response from GetLocation method. @@ -3337,6 +3692,7 @@ async def __call__( http_options = ( _BaseDeploymentResourcePoolServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_location( request, metadata ) @@ -3349,6 +3705,33 @@ async 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.aiplatform_v1.DeploymentResourcePoolServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DeploymentResourcePoolService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncDeploymentResourcePoolServiceRestTransport._GetLocation._get_response( self._host, @@ -3374,6 +3757,27 @@ async def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_location(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.aiplatform_v1.DeploymentResourcePoolServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DeploymentResourcePoolService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3416,7 +3820,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -3427,8 +3831,10 @@ async def __call__( 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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -3437,6 +3843,7 @@ async def __call__( http_options = ( _BaseDeploymentResourcePoolServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_locations( request, metadata ) @@ -3449,6 +3856,33 @@ async 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.aiplatform_v1.DeploymentResourcePoolServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DeploymentResourcePoolService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncDeploymentResourcePoolServiceRestTransport._ListLocations._get_response( self._host, @@ -3474,6 +3908,27 @@ async def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_list_locations(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.aiplatform_v1.DeploymentResourcePoolServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DeploymentResourcePoolService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3516,7 +3971,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -3527,8 +3982,10 @@ async def __call__( 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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -3537,6 +3994,7 @@ async def __call__( http_options = ( _BaseDeploymentResourcePoolServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_get_iam_policy( request, metadata ) @@ -3549,6 +4007,33 @@ async 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.aiplatform_v1.DeploymentResourcePoolServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DeploymentResourcePoolService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncDeploymentResourcePoolServiceRestTransport._GetIamPolicy._get_response( self._host, @@ -3574,6 +4059,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_iam_policy(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.aiplatform_v1.DeploymentResourcePoolServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DeploymentResourcePoolService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3617,7 +4123,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -3628,8 +4134,10 @@ async def __call__( 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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -3638,6 +4146,7 @@ async def __call__( http_options = ( _BaseDeploymentResourcePoolServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_set_iam_policy( request, metadata ) @@ -3654,6 +4163,33 @@ async 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.aiplatform_v1.DeploymentResourcePoolServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DeploymentResourcePoolService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncDeploymentResourcePoolServiceRestTransport._SetIamPolicy._get_response( self._host, @@ -3680,6 +4216,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_set_iam_policy(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.aiplatform_v1.DeploymentResourcePoolServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DeploymentResourcePoolService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3724,7 +4281,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -3735,8 +4292,10 @@ async def __call__( 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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -3745,6 +4304,7 @@ async def __call__( http_options = ( _BaseDeploymentResourcePoolServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = await self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -3757,6 +4317,33 @@ async 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.aiplatform_v1.DeploymentResourcePoolServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DeploymentResourcePoolService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncDeploymentResourcePoolServiceRestTransport._TestIamPermissions._get_response( self._host, @@ -3782,6 +4369,27 @@ async def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_test_iam_permissions(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.aiplatform_v1.DeploymentResourcePoolServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DeploymentResourcePoolService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3826,7 +4434,7 @@ async 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 cancel operation method over HTTP. @@ -3837,13 +4445,16 @@ async def __call__( 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`. """ http_options = ( _BaseDeploymentResourcePoolServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_cancel_operation( request, metadata ) @@ -3856,6 +4467,33 @@ async 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.aiplatform_v1.DeploymentResourcePoolServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DeploymentResourcePoolService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncDeploymentResourcePoolServiceRestTransport._CancelOperation._get_response( self._host, @@ -3921,7 +4559,7 @@ async 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. @@ -3932,13 +4570,16 @@ async def __call__( 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`. """ http_options = ( _BaseDeploymentResourcePoolServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_operation( request, metadata ) @@ -3951,6 +4592,33 @@ async 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.aiplatform_v1.DeploymentResourcePoolServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DeploymentResourcePoolService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncDeploymentResourcePoolServiceRestTransport._DeleteOperation._get_response( self._host, @@ -4014,7 +4682,7 @@ async 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. @@ -4025,8 +4693,10 @@ async def __call__( 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: Response from GetOperation method. @@ -4035,6 +4705,7 @@ async def __call__( http_options = ( _BaseDeploymentResourcePoolServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_operation( request, metadata ) @@ -4047,6 +4718,33 @@ async 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.aiplatform_v1.DeploymentResourcePoolServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DeploymentResourcePoolService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncDeploymentResourcePoolServiceRestTransport._GetOperation._get_response( self._host, @@ -4072,6 +4770,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1.DeploymentResourcePoolServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DeploymentResourcePoolService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4116,7 +4835,7 @@ async 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. @@ -4127,8 +4846,10 @@ async def __call__( 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 from ListOperations method. @@ -4137,6 +4858,7 @@ async def __call__( http_options = ( _BaseDeploymentResourcePoolServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_operations( request, metadata ) @@ -4149,6 +4871,33 @@ async 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.aiplatform_v1.DeploymentResourcePoolServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DeploymentResourcePoolService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncDeploymentResourcePoolServiceRestTransport._ListOperations._get_response( self._host, @@ -4174,6 +4923,27 @@ async def __call__( resp = operations_pb2.ListOperationsResponse() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1.DeploymentResourcePoolServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DeploymentResourcePoolService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4216,7 +4986,7 @@ async 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 wait operation method over HTTP. @@ -4227,8 +4997,10 @@ async def __call__( 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: Response from WaitOperation method. @@ -4237,6 +5009,7 @@ async def __call__( http_options = ( _BaseDeploymentResourcePoolServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_wait_operation( request, metadata ) @@ -4249,6 +5022,33 @@ async 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.aiplatform_v1.DeploymentResourcePoolServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DeploymentResourcePoolService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncDeploymentResourcePoolServiceRestTransport._WaitOperation._get_response( self._host, @@ -4274,6 +5074,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_wait_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.aiplatform_v1.DeploymentResourcePoolServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.DeploymentResourcePoolService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1/services/endpoint_service/async_client.py b/google/cloud/aiplatform_v1/services/endpoint_service/async_client.py index 1cb5b63ca2..5beb64dfde 100644 --- a/google/cloud/aiplatform_v1/services/endpoint_service/async_client.py +++ b/google/cloud/aiplatform_v1/services/endpoint_service/async_client.py @@ -13,6 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging as std_logging from collections import OrderedDict import re from typing import ( @@ -63,6 +64,15 @@ from .transports.grpc_asyncio import EndpointServiceGrpcAsyncIOTransport from .client import EndpointServiceClient +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 EndpointServiceAsyncClient: """A service for managing Vertex AI's Endpoints.""" @@ -288,6 +298,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.aiplatform_v1.EndpointServiceAsyncClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1.EndpointService", + "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.aiplatform.v1.EndpointService", + "credentialsType": None, + }, + ) + async def create_endpoint( self, request: Optional[Union[endpoint_service.CreateEndpointRequest, dict]] = None, @@ -297,7 +329,7 @@ async def create_endpoint( endpoint_id: 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"""Creates an Endpoint. @@ -378,8 +410,10 @@ async def sample_create_endpoint(): 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: @@ -454,7 +488,7 @@ async def get_endpoint( 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]]] = (), ) -> endpoint.Endpoint: r"""Gets an Endpoint. @@ -498,8 +532,10 @@ async def sample_get_endpoint(): 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.aiplatform_v1.types.Endpoint: @@ -561,7 +597,7 @@ async def list_endpoints( 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.ListEndpointsAsyncPager: r"""Lists Endpoints in a Location. @@ -607,8 +643,10 @@ async def sample_list_endpoints(): 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.aiplatform_v1.services.endpoint_service.pagers.ListEndpointsAsyncPager: @@ -684,7 +722,7 @@ async def update_endpoint( 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]]] = (), ) -> gca_endpoint.Endpoint: r"""Updates an Endpoint. @@ -738,8 +776,10 @@ async def sample_update_endpoint(): 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.aiplatform_v1.types.Endpoint: @@ -807,7 +847,7 @@ async def update_endpoint_long_running( endpoint: Optional[gca_endpoint.Endpoint] = 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"""Updates an Endpoint with a long running operation. @@ -860,8 +900,10 @@ async def sample_update_endpoint_long_running(): 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: @@ -934,7 +976,7 @@ async def delete_endpoint( 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"""Deletes an Endpoint. @@ -983,8 +1025,10 @@ async def sample_delete_endpoint(): 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: @@ -1065,7 +1109,7 @@ async def deploy_model( traffic_split: Optional[MutableMapping[str, int]] = 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"""Deploys a Model into this Endpoint, creating a DeployedModel within it. @@ -1151,8 +1195,10 @@ async def sample_deploy_model(): 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: @@ -1230,7 +1276,7 @@ async def undeploy_model( traffic_split: Optional[MutableMapping[str, int]] = 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"""Undeploys a Model from an Endpoint, removing a DeployedModel from it, and freeing all resources it's @@ -1303,8 +1349,10 @@ async def sample_undeploy_model(): 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: @@ -1384,7 +1432,7 @@ async def mutate_deployed_model( 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"""Updates an existing deployed model. Updatable fields include ``min_replica_count``, ``max_replica_count``, @@ -1467,8 +1515,10 @@ async def sample_mutate_deployed_model(): 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: @@ -1542,7 +1592,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. @@ -1553,8 +1603,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. @@ -1595,7 +1647,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. @@ -1606,8 +1658,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. @@ -1648,7 +1702,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. @@ -1664,8 +1718,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 """ @@ -1702,7 +1758,7 @@ async def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -1717,8 +1773,10 @@ async def cancel_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 """ @@ -1755,7 +1813,7 @@ async def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -1772,8 +1830,10 @@ async def wait_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. @@ -1814,7 +1874,7 @@ async def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -1827,8 +1887,10 @@ async def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -1933,7 +1995,7 @@ async def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -1947,8 +2009,10 @@ async def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -2053,7 +2117,7 @@ async def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -2068,8 +2132,10 @@ async def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -2113,7 +2179,7 @@ async def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -2124,8 +2190,10 @@ async def get_location( 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: ~.location_pb2.Location: Location object. @@ -2166,7 +2234,7 @@ async def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -2177,8 +2245,10 @@ async def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1/services/endpoint_service/client.py b/google/cloud/aiplatform_v1/services/endpoint_service/client.py index 0cbbd43f57..8185697f63 100644 --- a/google/cloud/aiplatform_v1/services/endpoint_service/client.py +++ b/google/cloud/aiplatform_v1/services/endpoint_service/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 ( @@ -48,6 +49,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 as gac_operation # type: ignore from google.api_core import operation_async # type: ignore from google.cloud.aiplatform_v1.services.endpoint_service import pagers @@ -714,6 +724,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( @@ -804,6 +818,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.aiplatform_v1.EndpointServiceClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1.EndpointService", + "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.aiplatform.v1.EndpointService", + "credentialsType": None, + }, + ) + def create_endpoint( self, request: Optional[Union[endpoint_service.CreateEndpointRequest, dict]] = None, @@ -813,7 +850,7 @@ def create_endpoint( endpoint_id: 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]]] = (), ) -> gac_operation.Operation: r"""Creates an Endpoint. @@ -894,8 +931,10 @@ def sample_create_endpoint(): 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: @@ -967,7 +1006,7 @@ def get_endpoint( 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]]] = (), ) -> endpoint.Endpoint: r"""Gets an Endpoint. @@ -1011,8 +1050,10 @@ def sample_get_endpoint(): 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.aiplatform_v1.types.Endpoint: @@ -1071,7 +1112,7 @@ def list_endpoints( 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.ListEndpointsPager: r"""Lists Endpoints in a Location. @@ -1117,8 +1158,10 @@ def sample_list_endpoints(): 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.aiplatform_v1.services.endpoint_service.pagers.ListEndpointsPager: @@ -1191,7 +1234,7 @@ def update_endpoint( 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]]] = (), ) -> gca_endpoint.Endpoint: r"""Updates an Endpoint. @@ -1245,8 +1288,10 @@ def sample_update_endpoint(): 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.aiplatform_v1.types.Endpoint: @@ -1311,7 +1356,7 @@ def update_endpoint_long_running( endpoint: Optional[gca_endpoint.Endpoint] = 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]]] = (), ) -> gac_operation.Operation: r"""Updates an Endpoint with a long running operation. @@ -1364,8 +1409,10 @@ def sample_update_endpoint_long_running(): 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: @@ -1437,7 +1484,7 @@ def delete_endpoint( 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]]] = (), ) -> gac_operation.Operation: r"""Deletes an Endpoint. @@ -1486,8 +1533,10 @@ def sample_delete_endpoint(): 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: @@ -1565,7 +1614,7 @@ def deploy_model( traffic_split: Optional[MutableMapping[str, int]] = 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]]] = (), ) -> gac_operation.Operation: r"""Deploys a Model into this Endpoint, creating a DeployedModel within it. @@ -1651,8 +1700,10 @@ def sample_deploy_model(): 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: @@ -1726,7 +1777,7 @@ def undeploy_model( traffic_split: Optional[MutableMapping[str, int]] = 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]]] = (), ) -> gac_operation.Operation: r"""Undeploys a Model from an Endpoint, removing a DeployedModel from it, and freeing all resources it's @@ -1799,8 +1850,10 @@ def sample_undeploy_model(): 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: @@ -1876,7 +1929,7 @@ def mutate_deployed_model( 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]]] = (), ) -> gac_operation.Operation: r"""Updates an existing deployed model. Updatable fields include ``min_replica_count``, ``max_replica_count``, @@ -1959,8 +2012,10 @@ def sample_mutate_deployed_model(): 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: @@ -2044,7 +2099,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. @@ -2055,8 +2110,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. @@ -2097,7 +2154,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. @@ -2108,8 +2165,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. @@ -2150,7 +2209,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. @@ -2166,8 +2225,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 """ @@ -2204,7 +2265,7 @@ def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -2219,8 +2280,10 @@ def cancel_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 """ @@ -2257,7 +2320,7 @@ def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -2274,8 +2337,10 @@ def wait_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. @@ -2316,7 +2381,7 @@ def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -2329,8 +2394,10 @@ def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -2435,7 +2502,7 @@ def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -2449,8 +2516,10 @@ def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -2555,7 +2624,7 @@ def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -2570,8 +2639,10 @@ def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -2613,7 +2684,7 @@ def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -2624,8 +2695,10 @@ def get_location( 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: ~.location_pb2.Location: Location object. @@ -2666,7 +2739,7 @@ def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -2677,8 +2750,10 @@ def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1/services/endpoint_service/pagers.py b/google/cloud/aiplatform_v1/services/endpoint_service/pagers.py index 1b9c72c5f8..68933ca1ea 100644 --- a/google/cloud/aiplatform_v1/services/endpoint_service/pagers.py +++ b/google/cloud/aiplatform_v1/services/endpoint_service/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 = endpoint_service.ListEndpointsRequest(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 = endpoint_service.ListEndpointsRequest(request) diff --git a/google/cloud/aiplatform_v1/services/endpoint_service/transports/grpc.py b/google/cloud/aiplatform_v1/services/endpoint_service/transports/grpc.py index 660c27776f..7e9bad2b07 100644 --- a/google/cloud/aiplatform_v1/services/endpoint_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1/services/endpoint_service/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 import warnings from typing import Callable, Dict, Optional, Sequence, Tuple, Union @@ -22,8 +25,11 @@ import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from google.cloud.aiplatform_v1.types import endpoint from google.cloud.aiplatform_v1.types import endpoint as gca_endpoint @@ -34,6 +40,81 @@ from google.longrunning import operations_pb2 # type: ignore from .base import EndpointServiceTransport, DEFAULT_CLIENT_INFO +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.aiplatform.v1.EndpointService", + "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.aiplatform.v1.EndpointService", + "rpcName": client_call_details.method, + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class EndpointServiceGrpcTransport(EndpointServiceTransport): """gRPC backend transport for EndpointService. @@ -188,7 +269,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 @@ -252,7 +338,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 @@ -276,7 +364,7 @@ def create_endpoint( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_endpoint" not in self._stubs: - self._stubs["create_endpoint"] = self.grpc_channel.unary_unary( + self._stubs["create_endpoint"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.EndpointService/CreateEndpoint", request_serializer=endpoint_service.CreateEndpointRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -302,7 +390,7 @@ def get_endpoint( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_endpoint" not in self._stubs: - self._stubs["get_endpoint"] = self.grpc_channel.unary_unary( + self._stubs["get_endpoint"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.EndpointService/GetEndpoint", request_serializer=endpoint_service.GetEndpointRequest.serialize, response_deserializer=endpoint.Endpoint.deserialize, @@ -330,7 +418,7 @@ def list_endpoints( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_endpoints" not in self._stubs: - self._stubs["list_endpoints"] = self.grpc_channel.unary_unary( + self._stubs["list_endpoints"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.EndpointService/ListEndpoints", request_serializer=endpoint_service.ListEndpointsRequest.serialize, response_deserializer=endpoint_service.ListEndpointsResponse.deserialize, @@ -356,7 +444,7 @@ def update_endpoint( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_endpoint" not in self._stubs: - self._stubs["update_endpoint"] = self.grpc_channel.unary_unary( + self._stubs["update_endpoint"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.EndpointService/UpdateEndpoint", request_serializer=endpoint_service.UpdateEndpointRequest.serialize, response_deserializer=gca_endpoint.Endpoint.deserialize, @@ -384,7 +472,9 @@ def update_endpoint_long_running( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_endpoint_long_running" not in self._stubs: - self._stubs["update_endpoint_long_running"] = self.grpc_channel.unary_unary( + self._stubs[ + "update_endpoint_long_running" + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.EndpointService/UpdateEndpointLongRunning", request_serializer=endpoint_service.UpdateEndpointLongRunningRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -410,7 +500,7 @@ def delete_endpoint( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_endpoint" not in self._stubs: - self._stubs["delete_endpoint"] = self.grpc_channel.unary_unary( + self._stubs["delete_endpoint"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.EndpointService/DeleteEndpoint", request_serializer=endpoint_service.DeleteEndpointRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -437,7 +527,7 @@ def deploy_model( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "deploy_model" not in self._stubs: - self._stubs["deploy_model"] = self.grpc_channel.unary_unary( + self._stubs["deploy_model"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.EndpointService/DeployModel", request_serializer=endpoint_service.DeployModelRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -465,7 +555,7 @@ def undeploy_model( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "undeploy_model" not in self._stubs: - self._stubs["undeploy_model"] = self.grpc_channel.unary_unary( + self._stubs["undeploy_model"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.EndpointService/UndeployModel", request_serializer=endpoint_service.UndeployModelRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -496,7 +586,7 @@ def mutate_deployed_model( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "mutate_deployed_model" not in self._stubs: - self._stubs["mutate_deployed_model"] = self.grpc_channel.unary_unary( + self._stubs["mutate_deployed_model"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.EndpointService/MutateDeployedModel", request_serializer=endpoint_service.MutateDeployedModelRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -504,7 +594,7 @@ def mutate_deployed_model( return self._stubs["mutate_deployed_model"] def close(self): - self.grpc_channel.close() + self._logged_channel.close() @property def delete_operation( @@ -516,7 +606,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, @@ -533,7 +623,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -550,7 +640,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -567,7 +657,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, @@ -586,7 +676,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, @@ -605,7 +695,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -622,7 +712,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -647,7 +737,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -673,7 +763,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -702,7 +792,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1/services/endpoint_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1/services/endpoint_service/transports/grpc_asyncio.py index 71097803dc..f56c525b8a 100644 --- a/google/cloud/aiplatform_v1/services/endpoint_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1/services/endpoint_service/transports/grpc_asyncio.py @@ -14,6 +14,9 @@ # limitations under the License. # import inspect +import json +import pickle +import logging as std_logging import warnings from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union @@ -24,8 +27,11 @@ from google.api_core import operations_v1 from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from grpc.experimental import aio # type: ignore from google.cloud.aiplatform_v1.types import endpoint @@ -38,6 +44,82 @@ from .base import EndpointServiceTransport, DEFAULT_CLIENT_INFO from .grpc import EndpointServiceGrpcTransport +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.aiplatform.v1.EndpointService", + "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.aiplatform.v1.EndpointService", + "rpcName": str(client_call_details.method), + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class EndpointServiceGrpcAsyncIOTransport(EndpointServiceTransport): """gRPC AsyncIO backend transport for EndpointService. @@ -235,10 +317,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 @@ -261,7 +346,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. @@ -288,7 +373,7 @@ def create_endpoint( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_endpoint" not in self._stubs: - self._stubs["create_endpoint"] = self.grpc_channel.unary_unary( + self._stubs["create_endpoint"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.EndpointService/CreateEndpoint", request_serializer=endpoint_service.CreateEndpointRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -314,7 +399,7 @@ def get_endpoint( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_endpoint" not in self._stubs: - self._stubs["get_endpoint"] = self.grpc_channel.unary_unary( + self._stubs["get_endpoint"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.EndpointService/GetEndpoint", request_serializer=endpoint_service.GetEndpointRequest.serialize, response_deserializer=endpoint.Endpoint.deserialize, @@ -343,7 +428,7 @@ def list_endpoints( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_endpoints" not in self._stubs: - self._stubs["list_endpoints"] = self.grpc_channel.unary_unary( + self._stubs["list_endpoints"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.EndpointService/ListEndpoints", request_serializer=endpoint_service.ListEndpointsRequest.serialize, response_deserializer=endpoint_service.ListEndpointsResponse.deserialize, @@ -371,7 +456,7 @@ def update_endpoint( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_endpoint" not in self._stubs: - self._stubs["update_endpoint"] = self.grpc_channel.unary_unary( + self._stubs["update_endpoint"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.EndpointService/UpdateEndpoint", request_serializer=endpoint_service.UpdateEndpointRequest.serialize, response_deserializer=gca_endpoint.Endpoint.deserialize, @@ -400,7 +485,9 @@ def update_endpoint_long_running( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_endpoint_long_running" not in self._stubs: - self._stubs["update_endpoint_long_running"] = self.grpc_channel.unary_unary( + self._stubs[ + "update_endpoint_long_running" + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.EndpointService/UpdateEndpointLongRunning", request_serializer=endpoint_service.UpdateEndpointLongRunningRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -428,7 +515,7 @@ def delete_endpoint( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_endpoint" not in self._stubs: - self._stubs["delete_endpoint"] = self.grpc_channel.unary_unary( + self._stubs["delete_endpoint"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.EndpointService/DeleteEndpoint", request_serializer=endpoint_service.DeleteEndpointRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -457,7 +544,7 @@ def deploy_model( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "deploy_model" not in self._stubs: - self._stubs["deploy_model"] = self.grpc_channel.unary_unary( + self._stubs["deploy_model"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.EndpointService/DeployModel", request_serializer=endpoint_service.DeployModelRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -487,7 +574,7 @@ def undeploy_model( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "undeploy_model" not in self._stubs: - self._stubs["undeploy_model"] = self.grpc_channel.unary_unary( + self._stubs["undeploy_model"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.EndpointService/UndeployModel", request_serializer=endpoint_service.UndeployModelRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -519,7 +606,7 @@ def mutate_deployed_model( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "mutate_deployed_model" not in self._stubs: - self._stubs["mutate_deployed_model"] = self.grpc_channel.unary_unary( + self._stubs["mutate_deployed_model"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.EndpointService/MutateDeployedModel", request_serializer=endpoint_service.MutateDeployedModelRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -632,7 +719,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: @@ -648,7 +735,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, @@ -665,7 +752,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -682,7 +769,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -699,7 +786,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, @@ -718,7 +805,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, @@ -737,7 +824,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -754,7 +841,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -779,7 +866,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -805,7 +892,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -834,7 +921,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1/services/endpoint_service/transports/rest.py b/google/cloud/aiplatform_v1/services/endpoint_service/transports/rest.py index cd22e00966..4ec406ce3b 100644 --- a/google/cloud/aiplatform_v1/services/endpoint_service/transports/rest.py +++ b/google/cloud/aiplatform_v1/services/endpoint_service/transports/rest.py @@ -13,9 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging +import json # type: ignore from google.auth.transport.requests import AuthorizedSession # type: ignore -import json # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.api_core import exceptions as core_exceptions from google.api_core import retry as retries @@ -49,6 +50,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, @@ -153,8 +162,10 @@ def post_update_endpoint_long_running(self, response): def pre_create_endpoint( self, request: endpoint_service.CreateEndpointRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[endpoint_service.CreateEndpointRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + endpoint_service.CreateEndpointRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for create_endpoint Override in a subclass to manipulate the request or metadata @@ -176,8 +187,10 @@ def post_create_endpoint( def pre_delete_endpoint( self, request: endpoint_service.DeleteEndpointRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[endpoint_service.DeleteEndpointRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + endpoint_service.DeleteEndpointRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for delete_endpoint Override in a subclass to manipulate the request or metadata @@ -199,8 +212,10 @@ def post_delete_endpoint( def pre_deploy_model( self, request: endpoint_service.DeployModelRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[endpoint_service.DeployModelRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + endpoint_service.DeployModelRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for deploy_model Override in a subclass to manipulate the request or metadata @@ -222,8 +237,10 @@ def post_deploy_model( def pre_get_endpoint( self, request: endpoint_service.GetEndpointRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[endpoint_service.GetEndpointRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + endpoint_service.GetEndpointRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_endpoint Override in a subclass to manipulate the request or metadata @@ -243,8 +260,10 @@ def post_get_endpoint(self, response: endpoint.Endpoint) -> endpoint.Endpoint: def pre_list_endpoints( self, request: endpoint_service.ListEndpointsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[endpoint_service.ListEndpointsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + endpoint_service.ListEndpointsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_endpoints Override in a subclass to manipulate the request or metadata @@ -266,8 +285,11 @@ def post_list_endpoints( def pre_mutate_deployed_model( self, request: endpoint_service.MutateDeployedModelRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[endpoint_service.MutateDeployedModelRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + endpoint_service.MutateDeployedModelRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for mutate_deployed_model Override in a subclass to manipulate the request or metadata @@ -289,8 +311,10 @@ def post_mutate_deployed_model( def pre_undeploy_model( self, request: endpoint_service.UndeployModelRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[endpoint_service.UndeployModelRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + endpoint_service.UndeployModelRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for undeploy_model Override in a subclass to manipulate the request or metadata @@ -312,8 +336,10 @@ def post_undeploy_model( def pre_update_endpoint( self, request: endpoint_service.UpdateEndpointRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[endpoint_service.UpdateEndpointRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + endpoint_service.UpdateEndpointRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for update_endpoint Override in a subclass to manipulate the request or metadata @@ -335,9 +361,10 @@ def post_update_endpoint( def pre_update_endpoint_long_running( self, request: endpoint_service.UpdateEndpointLongRunningRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - endpoint_service.UpdateEndpointLongRunningRequest, Sequence[Tuple[str, str]] + endpoint_service.UpdateEndpointLongRunningRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for update_endpoint_long_running @@ -360,8 +387,10 @@ def post_update_endpoint_long_running( def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -383,8 +412,10 @@ def post_get_location( def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -406,8 +437,10 @@ def post_list_locations( def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -427,8 +460,10 @@ def post_get_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -448,8 +483,11 @@ def post_set_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -471,8 +509,10 @@ def post_test_iam_permissions( def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -492,8 +532,10 @@ def post_cancel_operation(self, response: None) -> None: 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 @@ -513,8 +555,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 @@ -536,8 +580,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 @@ -559,8 +605,10 @@ def post_list_operations( def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -2581,7 +2629,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 endpoint method over HTTP. @@ -2592,8 +2640,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: @@ -2606,6 +2656,7 @@ def __call__( http_options = ( _BaseEndpointServiceRestTransport._BaseCreateEndpoint._get_http_options() ) + request, metadata = self._interceptor.pre_create_endpoint(request, metadata) transcoded_request = _BaseEndpointServiceRestTransport._BaseCreateEndpoint._get_transcoded_request( http_options, request @@ -2620,6 +2671,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.aiplatform_v1.EndpointServiceClient.CreateEndpoint", + extra={ + "serviceName": "google.cloud.aiplatform.v1.EndpointService", + "rpcName": "CreateEndpoint", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = EndpointServiceRestTransport._CreateEndpoint._get_response( self._host, @@ -2639,7 +2717,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_endpoint(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.aiplatform_v1.EndpointServiceClient.create_endpoint", + extra={ + "serviceName": "google.cloud.aiplatform.v1.EndpointService", + "rpcName": "CreateEndpoint", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _DeleteEndpoint( @@ -2677,7 +2777,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 endpoint method over HTTP. @@ -2688,8 +2788,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: @@ -2702,6 +2804,7 @@ def __call__( http_options = ( _BaseEndpointServiceRestTransport._BaseDeleteEndpoint._get_http_options() ) + request, metadata = self._interceptor.pre_delete_endpoint(request, metadata) transcoded_request = _BaseEndpointServiceRestTransport._BaseDeleteEndpoint._get_transcoded_request( http_options, request @@ -2712,6 +2815,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.aiplatform_v1.EndpointServiceClient.DeleteEndpoint", + extra={ + "serviceName": "google.cloud.aiplatform.v1.EndpointService", + "rpcName": "DeleteEndpoint", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = EndpointServiceRestTransport._DeleteEndpoint._get_response( self._host, @@ -2730,7 +2860,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_endpoint(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.aiplatform_v1.EndpointServiceClient.delete_endpoint", + extra={ + "serviceName": "google.cloud.aiplatform.v1.EndpointService", + "rpcName": "DeleteEndpoint", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _DeployModel( @@ -2769,7 +2921,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 deploy model method over HTTP. @@ -2780,8 +2932,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: @@ -2794,6 +2948,7 @@ def __call__( http_options = ( _BaseEndpointServiceRestTransport._BaseDeployModel._get_http_options() ) + request, metadata = self._interceptor.pre_deploy_model(request, metadata) transcoded_request = _BaseEndpointServiceRestTransport._BaseDeployModel._get_transcoded_request( http_options, request @@ -2808,6 +2963,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.aiplatform_v1.EndpointServiceClient.DeployModel", + extra={ + "serviceName": "google.cloud.aiplatform.v1.EndpointService", + "rpcName": "DeployModel", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = EndpointServiceRestTransport._DeployModel._get_response( self._host, @@ -2827,7 +3009,29 @@ def __call__( # Return the response resp = operations_pb2.Operation() json_format.Parse(response.content, resp, ignore_unknown_fields=True) + resp = self._interceptor.post_deploy_model(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.aiplatform_v1.EndpointServiceClient.deploy_model", + extra={ + "serviceName": "google.cloud.aiplatform.v1.EndpointService", + "rpcName": "DeployModel", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _GetEndpoint( @@ -2865,7 +3069,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]]] = (), ) -> endpoint.Endpoint: r"""Call the get endpoint method over HTTP. @@ -2876,8 +3080,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: ~.endpoint.Endpoint: @@ -2890,6 +3096,7 @@ def __call__( http_options = ( _BaseEndpointServiceRestTransport._BaseGetEndpoint._get_http_options() ) + request, metadata = self._interceptor.pre_get_endpoint(request, metadata) transcoded_request = _BaseEndpointServiceRestTransport._BaseGetEndpoint._get_transcoded_request( http_options, request @@ -2900,6 +3107,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.aiplatform_v1.EndpointServiceClient.GetEndpoint", + extra={ + "serviceName": "google.cloud.aiplatform.v1.EndpointService", + "rpcName": "GetEndpoint", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = EndpointServiceRestTransport._GetEndpoint._get_response( self._host, @@ -2920,7 +3154,29 @@ def __call__( pb_resp = endpoint.Endpoint.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_endpoint(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = endpoint.Endpoint.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.aiplatform_v1.EndpointServiceClient.get_endpoint", + extra={ + "serviceName": "google.cloud.aiplatform.v1.EndpointService", + "rpcName": "GetEndpoint", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListEndpoints( @@ -2958,7 +3214,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]]] = (), ) -> endpoint_service.ListEndpointsResponse: r"""Call the list endpoints method over HTTP. @@ -2969,8 +3225,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: ~.endpoint_service.ListEndpointsResponse: @@ -2982,6 +3240,7 @@ def __call__( http_options = ( _BaseEndpointServiceRestTransport._BaseListEndpoints._get_http_options() ) + request, metadata = self._interceptor.pre_list_endpoints(request, metadata) transcoded_request = _BaseEndpointServiceRestTransport._BaseListEndpoints._get_transcoded_request( http_options, request @@ -2992,6 +3251,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.aiplatform_v1.EndpointServiceClient.ListEndpoints", + extra={ + "serviceName": "google.cloud.aiplatform.v1.EndpointService", + "rpcName": "ListEndpoints", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = EndpointServiceRestTransport._ListEndpoints._get_response( self._host, @@ -3012,7 +3298,31 @@ def __call__( pb_resp = endpoint_service.ListEndpointsResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_endpoints(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = endpoint_service.ListEndpointsResponse.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.aiplatform_v1.EndpointServiceClient.list_endpoints", + extra={ + "serviceName": "google.cloud.aiplatform.v1.EndpointService", + "rpcName": "ListEndpoints", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _MutateDeployedModel( @@ -3052,7 +3362,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 mutate deployed model method over HTTP. @@ -3063,8 +3373,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: @@ -3077,6 +3389,7 @@ def __call__( http_options = ( _BaseEndpointServiceRestTransport._BaseMutateDeployedModel._get_http_options() ) + request, metadata = self._interceptor.pre_mutate_deployed_model( request, metadata ) @@ -3093,6 +3406,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.aiplatform_v1.EndpointServiceClient.MutateDeployedModel", + extra={ + "serviceName": "google.cloud.aiplatform.v1.EndpointService", + "rpcName": "MutateDeployedModel", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = EndpointServiceRestTransport._MutateDeployedModel._get_response( self._host, @@ -3112,7 +3452,29 @@ def __call__( # Return the response resp = operations_pb2.Operation() json_format.Parse(response.content, resp, ignore_unknown_fields=True) + resp = self._interceptor.post_mutate_deployed_model(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.aiplatform_v1.EndpointServiceClient.mutate_deployed_model", + extra={ + "serviceName": "google.cloud.aiplatform.v1.EndpointService", + "rpcName": "MutateDeployedModel", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _UndeployModel( @@ -3151,7 +3513,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 undeploy model method over HTTP. @@ -3162,8 +3524,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: @@ -3176,6 +3540,7 @@ def __call__( http_options = ( _BaseEndpointServiceRestTransport._BaseUndeployModel._get_http_options() ) + request, metadata = self._interceptor.pre_undeploy_model(request, metadata) transcoded_request = _BaseEndpointServiceRestTransport._BaseUndeployModel._get_transcoded_request( http_options, request @@ -3190,6 +3555,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.aiplatform_v1.EndpointServiceClient.UndeployModel", + extra={ + "serviceName": "google.cloud.aiplatform.v1.EndpointService", + "rpcName": "UndeployModel", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = EndpointServiceRestTransport._UndeployModel._get_response( self._host, @@ -3209,7 +3601,29 @@ def __call__( # Return the response resp = operations_pb2.Operation() json_format.Parse(response.content, resp, ignore_unknown_fields=True) + resp = self._interceptor.post_undeploy_model(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.aiplatform_v1.EndpointServiceClient.undeploy_model", + extra={ + "serviceName": "google.cloud.aiplatform.v1.EndpointService", + "rpcName": "UndeployModel", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _UpdateEndpoint( @@ -3248,7 +3662,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]]] = (), ) -> gca_endpoint.Endpoint: r"""Call the update endpoint method over HTTP. @@ -3259,8 +3673,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: ~.gca_endpoint.Endpoint: @@ -3273,6 +3689,7 @@ def __call__( http_options = ( _BaseEndpointServiceRestTransport._BaseUpdateEndpoint._get_http_options() ) + request, metadata = self._interceptor.pre_update_endpoint(request, metadata) transcoded_request = _BaseEndpointServiceRestTransport._BaseUpdateEndpoint._get_transcoded_request( http_options, request @@ -3287,6 +3704,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.aiplatform_v1.EndpointServiceClient.UpdateEndpoint", + extra={ + "serviceName": "google.cloud.aiplatform.v1.EndpointService", + "rpcName": "UpdateEndpoint", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = EndpointServiceRestTransport._UpdateEndpoint._get_response( self._host, @@ -3308,7 +3752,29 @@ def __call__( pb_resp = gca_endpoint.Endpoint.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_update_endpoint(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gca_endpoint.Endpoint.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.aiplatform_v1.EndpointServiceClient.update_endpoint", + extra={ + "serviceName": "google.cloud.aiplatform.v1.EndpointService", + "rpcName": "UpdateEndpoint", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _UpdateEndpointLongRunning( @@ -3348,7 +3814,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 endpoint long running method over HTTP. @@ -3360,8 +3826,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: @@ -3374,6 +3842,7 @@ def __call__( http_options = ( _BaseEndpointServiceRestTransport._BaseUpdateEndpointLongRunning._get_http_options() ) + request, metadata = self._interceptor.pre_update_endpoint_long_running( request, metadata ) @@ -3390,6 +3859,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.aiplatform_v1.EndpointServiceClient.UpdateEndpointLongRunning", + extra={ + "serviceName": "google.cloud.aiplatform.v1.EndpointService", + "rpcName": "UpdateEndpointLongRunning", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( EndpointServiceRestTransport._UpdateEndpointLongRunning._get_response( @@ -3411,7 +3907,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_endpoint_long_running(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.aiplatform_v1.EndpointServiceClient.update_endpoint_long_running", + extra={ + "serviceName": "google.cloud.aiplatform.v1.EndpointService", + "rpcName": "UpdateEndpointLongRunning", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp @property @@ -3531,7 +4049,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]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -3542,8 +4060,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: locations_pb2.Location: Response from GetLocation method. @@ -3552,6 +4072,7 @@ def __call__( http_options = ( _BaseEndpointServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = self._interceptor.pre_get_location(request, metadata) transcoded_request = _BaseEndpointServiceRestTransport._BaseGetLocation._get_transcoded_request( http_options, request @@ -3562,6 +4083,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.aiplatform_v1.EndpointServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.EndpointService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = EndpointServiceRestTransport._GetLocation._get_response( self._host, @@ -3581,6 +4129,27 @@ def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_location(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.aiplatform_v1.EndpointServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.EndpointService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3622,7 +4191,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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -3633,8 +4202,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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -3643,6 +4214,7 @@ def __call__( http_options = ( _BaseEndpointServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = self._interceptor.pre_list_locations(request, metadata) transcoded_request = _BaseEndpointServiceRestTransport._BaseListLocations._get_transcoded_request( http_options, request @@ -3653,6 +4225,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.aiplatform_v1.EndpointServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.EndpointService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = EndpointServiceRestTransport._ListLocations._get_response( self._host, @@ -3672,6 +4271,27 @@ def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_list_locations(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.aiplatform_v1.EndpointServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.EndpointService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3713,7 +4333,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]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -3724,8 +4344,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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -3734,6 +4356,7 @@ def __call__( http_options = ( _BaseEndpointServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_get_iam_policy(request, metadata) transcoded_request = _BaseEndpointServiceRestTransport._BaseGetIamPolicy._get_transcoded_request( http_options, request @@ -3744,6 +4367,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.aiplatform_v1.EndpointServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.EndpointService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = EndpointServiceRestTransport._GetIamPolicy._get_response( self._host, @@ -3763,6 +4413,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_iam_policy(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.aiplatform_v1.EndpointServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.EndpointService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3805,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]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -3816,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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -3826,6 +4499,7 @@ def __call__( http_options = ( _BaseEndpointServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_set_iam_policy(request, metadata) transcoded_request = _BaseEndpointServiceRestTransport._BaseSetIamPolicy._get_transcoded_request( http_options, request @@ -3840,6 +4514,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.aiplatform_v1.EndpointServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.EndpointService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = EndpointServiceRestTransport._SetIamPolicy._get_response( self._host, @@ -3860,6 +4561,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_set_iam_policy(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.aiplatform_v1.EndpointServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.EndpointService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3902,7 +4624,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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -3913,8 +4635,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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -3923,6 +4647,7 @@ def __call__( http_options = ( _BaseEndpointServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -3935,6 +4660,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.aiplatform_v1.EndpointServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.EndpointService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = EndpointServiceRestTransport._TestIamPermissions._get_response( self._host, @@ -3954,6 +4706,27 @@ def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_test_iam_permissions(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.aiplatform_v1.EndpointServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.EndpointService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3995,7 +4768,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 cancel operation method over HTTP. @@ -4006,13 +4779,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 = ( _BaseEndpointServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = self._interceptor.pre_cancel_operation( request, metadata ) @@ -4025,6 +4801,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.aiplatform_v1.EndpointServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.EndpointService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = EndpointServiceRestTransport._CancelOperation._get_response( self._host, @@ -4081,7 +4884,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. @@ -4092,13 +4895,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 = ( _BaseEndpointServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = self._interceptor.pre_delete_operation( request, metadata ) @@ -4111,6 +4917,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.aiplatform_v1.EndpointServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.EndpointService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = EndpointServiceRestTransport._DeleteOperation._get_response( self._host, @@ -4167,7 +5000,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. @@ -4178,8 +5011,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. @@ -4188,6 +5023,7 @@ def __call__( http_options = ( _BaseEndpointServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = self._interceptor.pre_get_operation(request, metadata) transcoded_request = _BaseEndpointServiceRestTransport._BaseGetOperation._get_transcoded_request( http_options, request @@ -4198,6 +5034,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.aiplatform_v1.EndpointServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.EndpointService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = EndpointServiceRestTransport._GetOperation._get_response( self._host, @@ -4217,6 +5080,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.aiplatform_v1.EndpointServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.EndpointService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4258,7 +5142,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. @@ -4269,8 +5153,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. @@ -4279,6 +5165,7 @@ def __call__( http_options = ( _BaseEndpointServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = self._interceptor.pre_list_operations(request, metadata) transcoded_request = _BaseEndpointServiceRestTransport._BaseListOperations._get_transcoded_request( http_options, request @@ -4289,6 +5176,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.aiplatform_v1.EndpointServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.EndpointService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = EndpointServiceRestTransport._ListOperations._get_response( self._host, @@ -4308,6 +5222,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.aiplatform_v1.EndpointServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.EndpointService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4349,7 +5284,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 wait operation method over HTTP. @@ -4360,8 +5295,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 WaitOperation method. @@ -4370,6 +5307,7 @@ def __call__( http_options = ( _BaseEndpointServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = self._interceptor.pre_wait_operation(request, metadata) transcoded_request = _BaseEndpointServiceRestTransport._BaseWaitOperation._get_transcoded_request( http_options, request @@ -4380,6 +5318,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.aiplatform_v1.EndpointServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.EndpointService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = EndpointServiceRestTransport._WaitOperation._get_response( self._host, @@ -4399,6 +5364,27 @@ def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = self._interceptor.post_wait_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.aiplatform_v1.EndpointServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.EndpointService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1/services/endpoint_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1/services/endpoint_service/transports/rest_asyncio.py index 7d5e3d9cda..e0af0b0040 100644 --- a/google/cloud/aiplatform_v1/services/endpoint_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1/services/endpoint_service/transports/rest_asyncio.py @@ -60,6 +60,18 @@ from .base import DEFAULT_CLIENT_INFO as BASE_DEFAULT_CLIENT_INFO + +import logging + +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__) + try: OptionalRetry = Union[retries.AsyncRetry, gapic_v1.method._MethodDefault, None] except AttributeError: # pragma: NO COVER @@ -168,8 +180,10 @@ async def post_update_endpoint_long_running(self, response): async def pre_create_endpoint( self, request: endpoint_service.CreateEndpointRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[endpoint_service.CreateEndpointRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + endpoint_service.CreateEndpointRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for create_endpoint Override in a subclass to manipulate the request or metadata @@ -191,8 +205,10 @@ async def post_create_endpoint( async def pre_delete_endpoint( self, request: endpoint_service.DeleteEndpointRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[endpoint_service.DeleteEndpointRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + endpoint_service.DeleteEndpointRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for delete_endpoint Override in a subclass to manipulate the request or metadata @@ -214,8 +230,10 @@ async def post_delete_endpoint( async def pre_deploy_model( self, request: endpoint_service.DeployModelRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[endpoint_service.DeployModelRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + endpoint_service.DeployModelRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for deploy_model Override in a subclass to manipulate the request or metadata @@ -237,8 +255,10 @@ async def post_deploy_model( async def pre_get_endpoint( self, request: endpoint_service.GetEndpointRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[endpoint_service.GetEndpointRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + endpoint_service.GetEndpointRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_endpoint Override in a subclass to manipulate the request or metadata @@ -258,8 +278,10 @@ async def post_get_endpoint(self, response: endpoint.Endpoint) -> endpoint.Endpo async def pre_list_endpoints( self, request: endpoint_service.ListEndpointsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[endpoint_service.ListEndpointsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + endpoint_service.ListEndpointsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_endpoints Override in a subclass to manipulate the request or metadata @@ -281,8 +303,11 @@ async def post_list_endpoints( async def pre_mutate_deployed_model( self, request: endpoint_service.MutateDeployedModelRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[endpoint_service.MutateDeployedModelRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + endpoint_service.MutateDeployedModelRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for mutate_deployed_model Override in a subclass to manipulate the request or metadata @@ -304,8 +329,10 @@ async def post_mutate_deployed_model( async def pre_undeploy_model( self, request: endpoint_service.UndeployModelRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[endpoint_service.UndeployModelRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + endpoint_service.UndeployModelRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for undeploy_model Override in a subclass to manipulate the request or metadata @@ -327,8 +354,10 @@ async def post_undeploy_model( async def pre_update_endpoint( self, request: endpoint_service.UpdateEndpointRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[endpoint_service.UpdateEndpointRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + endpoint_service.UpdateEndpointRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for update_endpoint Override in a subclass to manipulate the request or metadata @@ -350,9 +379,10 @@ async def post_update_endpoint( async def pre_update_endpoint_long_running( self, request: endpoint_service.UpdateEndpointLongRunningRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - endpoint_service.UpdateEndpointLongRunningRequest, Sequence[Tuple[str, str]] + endpoint_service.UpdateEndpointLongRunningRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for update_endpoint_long_running @@ -375,8 +405,10 @@ async def post_update_endpoint_long_running( async def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -398,8 +430,10 @@ async def post_get_location( async def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -421,8 +455,10 @@ async def post_list_locations( async def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -444,8 +480,10 @@ async def post_get_iam_policy( async def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -467,8 +505,11 @@ async def post_set_iam_policy( async def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -490,8 +531,10 @@ async def post_test_iam_permissions( async def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -511,8 +554,10 @@ async def post_cancel_operation(self, response: None) -> None: async 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 @@ -532,8 +577,10 @@ async def post_delete_operation(self, response: None) -> None: async 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 @@ -555,8 +602,10 @@ async def post_get_operation( async 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 @@ -578,8 +627,10 @@ async def post_list_operations( async def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -805,7 +856,7 @@ async 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 endpoint method over HTTP. @@ -816,8 +867,10 @@ async def __call__( 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: @@ -830,6 +883,7 @@ async def __call__( http_options = ( _BaseEndpointServiceRestTransport._BaseCreateEndpoint._get_http_options() ) + request, metadata = await self._interceptor.pre_create_endpoint( request, metadata ) @@ -846,6 +900,33 @@ async 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.aiplatform_v1.EndpointServiceClient.CreateEndpoint", + extra={ + "serviceName": "google.cloud.aiplatform.v1.EndpointService", + "rpcName": "CreateEndpoint", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncEndpointServiceRestTransport._CreateEndpoint._get_response( @@ -876,6 +957,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_create_endpoint(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.EndpointServiceAsyncClient.create_endpoint", + extra={ + "serviceName": "google.cloud.aiplatform.v1.EndpointService", + "rpcName": "CreateEndpoint", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _DeleteEndpoint( @@ -914,7 +1017,7 @@ async 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 endpoint method over HTTP. @@ -925,8 +1028,10 @@ async def __call__( 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: @@ -939,6 +1044,7 @@ async def __call__( http_options = ( _BaseEndpointServiceRestTransport._BaseDeleteEndpoint._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_endpoint( request, metadata ) @@ -951,6 +1057,33 @@ async 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.aiplatform_v1.EndpointServiceClient.DeleteEndpoint", + extra={ + "serviceName": "google.cloud.aiplatform.v1.EndpointService", + "rpcName": "DeleteEndpoint", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncEndpointServiceRestTransport._DeleteEndpoint._get_response( @@ -980,6 +1113,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_delete_endpoint(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.EndpointServiceAsyncClient.delete_endpoint", + extra={ + "serviceName": "google.cloud.aiplatform.v1.EndpointService", + "rpcName": "DeleteEndpoint", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _DeployModel( @@ -1018,7 +1173,7 @@ async 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 deploy model method over HTTP. @@ -1029,8 +1184,10 @@ async def __call__( 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: @@ -1043,6 +1200,7 @@ async def __call__( http_options = ( _BaseEndpointServiceRestTransport._BaseDeployModel._get_http_options() ) + request, metadata = await self._interceptor.pre_deploy_model( request, metadata ) @@ -1059,6 +1217,33 @@ async 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.aiplatform_v1.EndpointServiceClient.DeployModel", + extra={ + "serviceName": "google.cloud.aiplatform.v1.EndpointService", + "rpcName": "DeployModel", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncEndpointServiceRestTransport._DeployModel._get_response( @@ -1089,6 +1274,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_deploy_model(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.EndpointServiceAsyncClient.deploy_model", + extra={ + "serviceName": "google.cloud.aiplatform.v1.EndpointService", + "rpcName": "DeployModel", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _GetEndpoint( @@ -1126,7 +1333,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> endpoint.Endpoint: r"""Call the get endpoint method over HTTP. @@ -1137,8 +1344,10 @@ async def __call__( 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: ~.endpoint.Endpoint: @@ -1151,6 +1360,7 @@ async def __call__( http_options = ( _BaseEndpointServiceRestTransport._BaseGetEndpoint._get_http_options() ) + request, metadata = await self._interceptor.pre_get_endpoint( request, metadata ) @@ -1163,6 +1373,33 @@ async 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.aiplatform_v1.EndpointServiceClient.GetEndpoint", + extra={ + "serviceName": "google.cloud.aiplatform.v1.EndpointService", + "rpcName": "GetEndpoint", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncEndpointServiceRestTransport._GetEndpoint._get_response( @@ -1192,6 +1429,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_get_endpoint(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = endpoint.Endpoint.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.EndpointServiceAsyncClient.get_endpoint", + extra={ + "serviceName": "google.cloud.aiplatform.v1.EndpointService", + "rpcName": "GetEndpoint", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ListEndpoints( @@ -1230,7 +1489,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> endpoint_service.ListEndpointsResponse: r"""Call the list endpoints method over HTTP. @@ -1241,8 +1500,10 @@ async def __call__( 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: ~.endpoint_service.ListEndpointsResponse: @@ -1254,6 +1515,7 @@ async def __call__( http_options = ( _BaseEndpointServiceRestTransport._BaseListEndpoints._get_http_options() ) + request, metadata = await self._interceptor.pre_list_endpoints( request, metadata ) @@ -1266,6 +1528,33 @@ async 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.aiplatform_v1.EndpointServiceClient.ListEndpoints", + extra={ + "serviceName": "google.cloud.aiplatform.v1.EndpointService", + "rpcName": "ListEndpoints", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncEndpointServiceRestTransport._ListEndpoints._get_response( @@ -1295,6 +1584,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_list_endpoints(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = endpoint_service.ListEndpointsResponse.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.EndpointServiceAsyncClient.list_endpoints", + extra={ + "serviceName": "google.cloud.aiplatform.v1.EndpointService", + "rpcName": "ListEndpoints", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _MutateDeployedModel( @@ -1334,7 +1647,7 @@ async 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 mutate deployed model method over HTTP. @@ -1345,8 +1658,10 @@ async def __call__( 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: @@ -1359,6 +1674,7 @@ async def __call__( http_options = ( _BaseEndpointServiceRestTransport._BaseMutateDeployedModel._get_http_options() ) + request, metadata = await self._interceptor.pre_mutate_deployed_model( request, metadata ) @@ -1375,6 +1691,33 @@ async 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.aiplatform_v1.EndpointServiceClient.MutateDeployedModel", + extra={ + "serviceName": "google.cloud.aiplatform.v1.EndpointService", + "rpcName": "MutateDeployedModel", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncEndpointServiceRestTransport._MutateDeployedModel._get_response( self._host, @@ -1403,6 +1746,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_mutate_deployed_model(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.EndpointServiceAsyncClient.mutate_deployed_model", + extra={ + "serviceName": "google.cloud.aiplatform.v1.EndpointService", + "rpcName": "MutateDeployedModel", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _UndeployModel( @@ -1442,7 +1807,7 @@ async 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 undeploy model method over HTTP. @@ -1453,8 +1818,10 @@ async def __call__( 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: @@ -1467,6 +1834,7 @@ async def __call__( http_options = ( _BaseEndpointServiceRestTransport._BaseUndeployModel._get_http_options() ) + request, metadata = await self._interceptor.pre_undeploy_model( request, metadata ) @@ -1483,6 +1851,33 @@ async 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.aiplatform_v1.EndpointServiceClient.UndeployModel", + extra={ + "serviceName": "google.cloud.aiplatform.v1.EndpointService", + "rpcName": "UndeployModel", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncEndpointServiceRestTransport._UndeployModel._get_response( @@ -1513,6 +1908,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_undeploy_model(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.EndpointServiceAsyncClient.undeploy_model", + extra={ + "serviceName": "google.cloud.aiplatform.v1.EndpointService", + "rpcName": "UndeployModel", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _UpdateEndpoint( @@ -1552,7 +1969,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> gca_endpoint.Endpoint: r"""Call the update endpoint method over HTTP. @@ -1563,8 +1980,10 @@ async def __call__( 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: ~.gca_endpoint.Endpoint: @@ -1577,6 +1996,7 @@ async def __call__( http_options = ( _BaseEndpointServiceRestTransport._BaseUpdateEndpoint._get_http_options() ) + request, metadata = await self._interceptor.pre_update_endpoint( request, metadata ) @@ -1593,6 +2013,33 @@ async 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.aiplatform_v1.EndpointServiceClient.UpdateEndpoint", + extra={ + "serviceName": "google.cloud.aiplatform.v1.EndpointService", + "rpcName": "UpdateEndpoint", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncEndpointServiceRestTransport._UpdateEndpoint._get_response( @@ -1623,6 +2070,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_update_endpoint(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gca_endpoint.Endpoint.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.EndpointServiceAsyncClient.update_endpoint", + extra={ + "serviceName": "google.cloud.aiplatform.v1.EndpointService", + "rpcName": "UpdateEndpoint", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _UpdateEndpointLongRunning( @@ -1662,7 +2131,7 @@ async 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 endpoint long running method over HTTP. @@ -1674,8 +2143,10 @@ async def __call__( 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: @@ -1688,6 +2159,7 @@ async def __call__( http_options = ( _BaseEndpointServiceRestTransport._BaseUpdateEndpointLongRunning._get_http_options() ) + ( request, metadata, @@ -1707,6 +2179,33 @@ async 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.aiplatform_v1.EndpointServiceClient.UpdateEndpointLongRunning", + extra={ + "serviceName": "google.cloud.aiplatform.v1.EndpointService", + "rpcName": "UpdateEndpointLongRunning", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncEndpointServiceRestTransport._UpdateEndpointLongRunning._get_response( self._host, @@ -1735,6 +2234,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_update_endpoint_long_running(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.EndpointServiceAsyncClient.update_endpoint_long_running", + extra={ + "serviceName": "google.cloud.aiplatform.v1.EndpointService", + "rpcName": "UpdateEndpointLongRunning", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp @property @@ -3713,7 +4234,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -3724,8 +4245,10 @@ async def __call__( 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: locations_pb2.Location: Response from GetLocation method. @@ -3734,6 +4257,7 @@ async def __call__( http_options = ( _BaseEndpointServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_location( request, metadata ) @@ -3746,6 +4270,33 @@ async 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.aiplatform_v1.EndpointServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.EndpointService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncEndpointServiceRestTransport._GetLocation._get_response( @@ -3773,6 +4324,27 @@ async def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_location(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.aiplatform_v1.EndpointServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.EndpointService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3815,7 +4387,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -3826,8 +4398,10 @@ async def __call__( 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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -3836,6 +4410,7 @@ async def __call__( http_options = ( _BaseEndpointServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_locations( request, metadata ) @@ -3848,6 +4423,33 @@ async 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.aiplatform_v1.EndpointServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.EndpointService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncEndpointServiceRestTransport._ListLocations._get_response( @@ -3875,6 +4477,27 @@ async def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_list_locations(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.aiplatform_v1.EndpointServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.EndpointService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3917,7 +4540,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -3928,8 +4551,10 @@ async def __call__( 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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -3938,6 +4563,7 @@ async def __call__( http_options = ( _BaseEndpointServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_get_iam_policy( request, metadata ) @@ -3950,6 +4576,33 @@ async 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.aiplatform_v1.EndpointServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.EndpointService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncEndpointServiceRestTransport._GetIamPolicy._get_response( @@ -3977,6 +4630,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_iam_policy(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.aiplatform_v1.EndpointServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.EndpointService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4020,7 +4694,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -4031,8 +4705,10 @@ async def __call__( 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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -4041,6 +4717,7 @@ async def __call__( http_options = ( _BaseEndpointServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_set_iam_policy( request, metadata ) @@ -4057,6 +4734,33 @@ async 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.aiplatform_v1.EndpointServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.EndpointService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncEndpointServiceRestTransport._SetIamPolicy._get_response( @@ -4085,6 +4789,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_set_iam_policy(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.aiplatform_v1.EndpointServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.EndpointService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4127,7 +4852,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -4138,8 +4863,10 @@ async def __call__( 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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -4148,6 +4875,7 @@ async def __call__( http_options = ( _BaseEndpointServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = await self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -4160,6 +4888,33 @@ async 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.aiplatform_v1.EndpointServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.EndpointService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncEndpointServiceRestTransport._TestIamPermissions._get_response( self._host, @@ -4185,6 +4940,27 @@ async def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_test_iam_permissions(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.aiplatform_v1.EndpointServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.EndpointService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4227,7 +5003,7 @@ async 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 cancel operation method over HTTP. @@ -4238,13 +5014,16 @@ async def __call__( 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`. """ http_options = ( _BaseEndpointServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_cancel_operation( request, metadata ) @@ -4257,6 +5036,33 @@ async 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.aiplatform_v1.EndpointServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.EndpointService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncEndpointServiceRestTransport._CancelOperation._get_response( @@ -4322,7 +5128,7 @@ async 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. @@ -4333,13 +5139,16 @@ async def __call__( 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`. """ http_options = ( _BaseEndpointServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_operation( request, metadata ) @@ -4352,6 +5161,33 @@ async 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.aiplatform_v1.EndpointServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.EndpointService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncEndpointServiceRestTransport._DeleteOperation._get_response( @@ -4417,7 +5253,7 @@ async 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. @@ -4428,8 +5264,10 @@ async def __call__( 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: Response from GetOperation method. @@ -4438,6 +5276,7 @@ async def __call__( http_options = ( _BaseEndpointServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_operation( request, metadata ) @@ -4450,6 +5289,33 @@ async 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.aiplatform_v1.EndpointServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.EndpointService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncEndpointServiceRestTransport._GetOperation._get_response( @@ -4477,6 +5343,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1.EndpointServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.EndpointService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4519,7 +5406,7 @@ async 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. @@ -4530,8 +5417,10 @@ async def __call__( 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 from ListOperations method. @@ -4540,6 +5429,7 @@ async def __call__( http_options = ( _BaseEndpointServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_operations( request, metadata ) @@ -4552,6 +5442,33 @@ async 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.aiplatform_v1.EndpointServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.EndpointService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncEndpointServiceRestTransport._ListOperations._get_response( @@ -4579,6 +5496,27 @@ async def __call__( resp = operations_pb2.ListOperationsResponse() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1.EndpointServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.EndpointService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4621,7 +5559,7 @@ async 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 wait operation method over HTTP. @@ -4632,8 +5570,10 @@ async def __call__( 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: Response from WaitOperation method. @@ -4642,6 +5582,7 @@ async def __call__( http_options = ( _BaseEndpointServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_wait_operation( request, metadata ) @@ -4654,6 +5595,33 @@ async 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.aiplatform_v1.EndpointServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.EndpointService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncEndpointServiceRestTransport._WaitOperation._get_response( @@ -4681,6 +5649,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_wait_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.aiplatform_v1.EndpointServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.EndpointService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1/services/evaluation_service/async_client.py b/google/cloud/aiplatform_v1/services/evaluation_service/async_client.py index 205a951941..8a78009556 100644 --- a/google/cloud/aiplatform_v1/services/evaluation_service/async_client.py +++ b/google/cloud/aiplatform_v1/services/evaluation_service/async_client.py @@ -13,6 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging as std_logging from collections import OrderedDict import re from typing import ( @@ -52,6 +53,15 @@ from .transports.grpc_asyncio import EvaluationServiceGrpcAsyncIOTransport from .client import EvaluationServiceClient +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 EvaluationServiceAsyncClient: """Vertex AI Online Evaluation Service.""" @@ -259,6 +269,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.aiplatform_v1.EvaluationServiceAsyncClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1.EvaluationService", + "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.aiplatform.v1.EvaluationService", + "credentialsType": None, + }, + ) + async def evaluate_instances( self, request: Optional[ @@ -267,7 +299,7 @@ async def evaluate_instances( *, 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]]] = (), ) -> evaluation_service.EvaluateInstancesResponse: r"""Evaluates instances based on a given metric. @@ -304,8 +336,10 @@ async def sample_evaluate_instances(): 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.aiplatform_v1.types.EvaluateInstancesResponse: @@ -351,7 +385,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. @@ -362,8 +396,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. @@ -404,7 +440,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. @@ -415,8 +451,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. @@ -457,7 +495,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. @@ -473,8 +511,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 """ @@ -511,7 +551,7 @@ async def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -526,8 +566,10 @@ async def cancel_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 """ @@ -564,7 +606,7 @@ async def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -581,8 +623,10 @@ async def wait_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. @@ -623,7 +667,7 @@ async def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -636,8 +680,10 @@ async def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -742,7 +788,7 @@ async def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -756,8 +802,10 @@ async def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -862,7 +910,7 @@ async def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -877,8 +925,10 @@ async def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -922,7 +972,7 @@ async def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -933,8 +983,10 @@ async def get_location( 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: ~.location_pb2.Location: Location object. @@ -975,7 +1027,7 @@ async def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -986,8 +1038,10 @@ async def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1/services/evaluation_service/client.py b/google/cloud/aiplatform_v1/services/evaluation_service/client.py index 95109b1d2d..0dc5d30f5e 100644 --- a/google/cloud/aiplatform_v1/services/evaluation_service/client.py +++ b/google/cloud/aiplatform_v1/services/evaluation_service/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 ( @@ -48,6 +49,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.cloud.aiplatform_v1.types import evaluation_service from google.cloud.location import locations_pb2 # type: ignore from google.iam.v1 import iam_policy_pb2 # type: ignore @@ -576,6 +586,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( @@ -667,6 +681,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.aiplatform_v1.EvaluationServiceClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1.EvaluationService", + "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.aiplatform.v1.EvaluationService", + "credentialsType": None, + }, + ) + def evaluate_instances( self, request: Optional[ @@ -675,7 +712,7 @@ def evaluate_instances( *, 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]]] = (), ) -> evaluation_service.EvaluateInstancesResponse: r"""Evaluates instances based on a given metric. @@ -712,8 +749,10 @@ def sample_evaluate_instances(): 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.aiplatform_v1.types.EvaluateInstancesResponse: @@ -770,7 +809,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. @@ -781,8 +820,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. @@ -823,7 +864,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. @@ -834,8 +875,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. @@ -876,7 +919,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. @@ -892,8 +935,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 """ @@ -930,7 +975,7 @@ def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -945,8 +990,10 @@ def cancel_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 """ @@ -983,7 +1030,7 @@ def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -1000,8 +1047,10 @@ def wait_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. @@ -1042,7 +1091,7 @@ def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -1055,8 +1104,10 @@ def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -1161,7 +1212,7 @@ def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -1175,8 +1226,10 @@ def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -1281,7 +1334,7 @@ def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -1296,8 +1349,10 @@ def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -1339,7 +1394,7 @@ def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -1350,8 +1405,10 @@ def get_location( 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: ~.location_pb2.Location: Location object. @@ -1392,7 +1449,7 @@ def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -1403,8 +1460,10 @@ def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1/services/evaluation_service/transports/grpc.py b/google/cloud/aiplatform_v1/services/evaluation_service/transports/grpc.py index ea49cf80fd..d2d283ae18 100644 --- a/google/cloud/aiplatform_v1/services/evaluation_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1/services/evaluation_service/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 import warnings from typing import Callable, Dict, Optional, Sequence, Tuple, Union @@ -21,8 +24,11 @@ import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from google.cloud.aiplatform_v1.types import evaluation_service from google.cloud.location import locations_pb2 # type: ignore @@ -31,6 +37,81 @@ from google.longrunning import operations_pb2 # type: ignore from .base import EvaluationServiceTransport, DEFAULT_CLIENT_INFO +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.aiplatform.v1.EvaluationService", + "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.aiplatform.v1.EvaluationService", + "rpcName": client_call_details.method, + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class EvaluationServiceGrpcTransport(EvaluationServiceTransport): """gRPC backend transport for EvaluationService. @@ -184,7 +265,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 @@ -261,7 +347,7 @@ def evaluate_instances( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "evaluate_instances" not in self._stubs: - self._stubs["evaluate_instances"] = self.grpc_channel.unary_unary( + self._stubs["evaluate_instances"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.EvaluationService/EvaluateInstances", request_serializer=evaluation_service.EvaluateInstancesRequest.serialize, response_deserializer=evaluation_service.EvaluateInstancesResponse.deserialize, @@ -269,7 +355,7 @@ def evaluate_instances( return self._stubs["evaluate_instances"] def close(self): - self.grpc_channel.close() + self._logged_channel.close() @property def delete_operation( @@ -281,7 +367,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, @@ -298,7 +384,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -315,7 +401,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -332,7 +418,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, @@ -351,7 +437,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, @@ -370,7 +456,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -387,7 +473,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -412,7 +498,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -438,7 +524,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -467,7 +553,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1/services/evaluation_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1/services/evaluation_service/transports/grpc_asyncio.py index e56dcda01d..a9793b26e3 100644 --- a/google/cloud/aiplatform_v1/services/evaluation_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1/services/evaluation_service/transports/grpc_asyncio.py @@ -14,6 +14,9 @@ # limitations under the License. # import inspect +import json +import pickle +import logging as std_logging import warnings from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union @@ -23,8 +26,11 @@ from google.api_core import retry_async as retries from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from grpc.experimental import aio # type: ignore from google.cloud.aiplatform_v1.types import evaluation_service @@ -35,6 +41,82 @@ from .base import EvaluationServiceTransport, DEFAULT_CLIENT_INFO from .grpc import EvaluationServiceGrpcTransport +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.aiplatform.v1.EvaluationService", + "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.aiplatform.v1.EvaluationService", + "rpcName": str(client_call_details.method), + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class EvaluationServiceGrpcAsyncIOTransport(EvaluationServiceTransport): """gRPC AsyncIO backend transport for EvaluationService. @@ -231,10 +313,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 @@ -269,7 +354,7 @@ def evaluate_instances( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "evaluate_instances" not in self._stubs: - self._stubs["evaluate_instances"] = self.grpc_channel.unary_unary( + self._stubs["evaluate_instances"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.EvaluationService/EvaluateInstances", request_serializer=evaluation_service.EvaluateInstancesRequest.serialize, response_deserializer=evaluation_service.EvaluateInstancesResponse.deserialize, @@ -342,7 +427,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: @@ -358,7 +443,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, @@ -375,7 +460,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -392,7 +477,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -409,7 +494,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, @@ -428,7 +513,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, @@ -447,7 +532,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -464,7 +549,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -489,7 +574,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -515,7 +600,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -544,7 +629,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1/services/evaluation_service/transports/rest.py b/google/cloud/aiplatform_v1/services/evaluation_service/transports/rest.py index cae6e24a99..bb24ccdc1f 100644 --- a/google/cloud/aiplatform_v1/services/evaluation_service/transports/rest.py +++ b/google/cloud/aiplatform_v1/services/evaluation_service/transports/rest.py @@ -13,9 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging +import json # type: ignore from google.auth.transport.requests import AuthorizedSession # type: ignore -import json # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.api_core import exceptions as core_exceptions from google.api_core import retry as retries @@ -46,6 +47,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, @@ -86,8 +95,11 @@ def post_evaluate_instances(self, response): def pre_evaluate_instances( self, request: evaluation_service.EvaluateInstancesRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[evaluation_service.EvaluateInstancesRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + evaluation_service.EvaluateInstancesRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for evaluate_instances Override in a subclass to manipulate the request or metadata @@ -109,8 +121,10 @@ def post_evaluate_instances( def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -132,8 +146,10 @@ def post_get_location( def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -155,8 +171,10 @@ def post_list_locations( def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -176,8 +194,10 @@ def post_get_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -197,8 +217,11 @@ def post_set_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -220,8 +243,10 @@ def post_test_iam_permissions( def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -241,8 +266,10 @@ def post_cancel_operation(self, response: None) -> None: 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 @@ -262,8 +289,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 @@ -285,8 +314,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 @@ -308,8 +339,10 @@ def post_list_operations( def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -452,7 +485,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]]] = (), ) -> evaluation_service.EvaluateInstancesResponse: r"""Call the evaluate instances method over HTTP. @@ -463,8 +496,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: ~.evaluation_service.EvaluateInstancesResponse: @@ -476,6 +511,7 @@ def __call__( http_options = ( _BaseEvaluationServiceRestTransport._BaseEvaluateInstances._get_http_options() ) + request, metadata = self._interceptor.pre_evaluate_instances( request, metadata ) @@ -492,6 +528,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.aiplatform_v1.EvaluationServiceClient.EvaluateInstances", + extra={ + "serviceName": "google.cloud.aiplatform.v1.EvaluationService", + "rpcName": "EvaluateInstances", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = EvaluationServiceRestTransport._EvaluateInstances._get_response( self._host, @@ -513,7 +576,31 @@ def __call__( pb_resp = evaluation_service.EvaluateInstancesResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_evaluate_instances(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + evaluation_service.EvaluateInstancesResponse.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.aiplatform_v1.EvaluationServiceClient.evaluate_instances", + extra={ + "serviceName": "google.cloud.aiplatform.v1.EvaluationService", + "rpcName": "EvaluateInstances", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp @property @@ -566,7 +653,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]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -577,8 +664,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: locations_pb2.Location: Response from GetLocation method. @@ -587,6 +676,7 @@ def __call__( http_options = ( _BaseEvaluationServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = self._interceptor.pre_get_location(request, metadata) transcoded_request = _BaseEvaluationServiceRestTransport._BaseGetLocation._get_transcoded_request( http_options, request @@ -597,6 +687,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.aiplatform_v1.EvaluationServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.EvaluationService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = EvaluationServiceRestTransport._GetLocation._get_response( self._host, @@ -616,6 +733,27 @@ def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_location(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.aiplatform_v1.EvaluationServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.EvaluationService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -658,7 +796,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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -669,8 +807,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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -679,6 +819,7 @@ def __call__( http_options = ( _BaseEvaluationServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = self._interceptor.pre_list_locations(request, metadata) transcoded_request = _BaseEvaluationServiceRestTransport._BaseListLocations._get_transcoded_request( http_options, request @@ -689,6 +830,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.aiplatform_v1.EvaluationServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.EvaluationService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = EvaluationServiceRestTransport._ListLocations._get_response( self._host, @@ -708,6 +876,27 @@ def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_list_locations(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.aiplatform_v1.EvaluationServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.EvaluationService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -749,7 +938,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]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -760,8 +949,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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -770,6 +961,7 @@ def __call__( http_options = ( _BaseEvaluationServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_get_iam_policy(request, metadata) transcoded_request = _BaseEvaluationServiceRestTransport._BaseGetIamPolicy._get_transcoded_request( http_options, request @@ -780,6 +972,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.aiplatform_v1.EvaluationServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.EvaluationService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = EvaluationServiceRestTransport._GetIamPolicy._get_response( self._host, @@ -799,6 +1018,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_iam_policy(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.aiplatform_v1.EvaluationServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.EvaluationService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -841,7 +1081,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]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -852,8 +1092,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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -862,6 +1104,7 @@ def __call__( http_options = ( _BaseEvaluationServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_set_iam_policy(request, metadata) transcoded_request = _BaseEvaluationServiceRestTransport._BaseSetIamPolicy._get_transcoded_request( http_options, request @@ -876,6 +1119,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.aiplatform_v1.EvaluationServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.EvaluationService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = EvaluationServiceRestTransport._SetIamPolicy._get_response( self._host, @@ -896,6 +1166,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_set_iam_policy(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.aiplatform_v1.EvaluationServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.EvaluationService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -938,7 +1229,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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -949,8 +1240,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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -959,6 +1252,7 @@ def __call__( http_options = ( _BaseEvaluationServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -971,6 +1265,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.aiplatform_v1.EvaluationServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.EvaluationService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = EvaluationServiceRestTransport._TestIamPermissions._get_response( self._host, @@ -990,6 +1311,27 @@ def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_test_iam_permissions(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.aiplatform_v1.EvaluationServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.EvaluationService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1032,7 +1374,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 cancel operation method over HTTP. @@ -1043,13 +1385,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 = ( _BaseEvaluationServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = self._interceptor.pre_cancel_operation( request, metadata ) @@ -1062,6 +1407,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.aiplatform_v1.EvaluationServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.EvaluationService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = EvaluationServiceRestTransport._CancelOperation._get_response( self._host, @@ -1119,7 +1491,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. @@ -1130,13 +1502,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 = ( _BaseEvaluationServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = self._interceptor.pre_delete_operation( request, metadata ) @@ -1149,6 +1524,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.aiplatform_v1.EvaluationServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.EvaluationService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = EvaluationServiceRestTransport._DeleteOperation._get_response( self._host, @@ -1205,7 +1607,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. @@ -1216,8 +1618,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. @@ -1226,6 +1630,7 @@ def __call__( http_options = ( _BaseEvaluationServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = self._interceptor.pre_get_operation(request, metadata) transcoded_request = _BaseEvaluationServiceRestTransport._BaseGetOperation._get_transcoded_request( http_options, request @@ -1236,6 +1641,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.aiplatform_v1.EvaluationServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.EvaluationService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = EvaluationServiceRestTransport._GetOperation._get_response( self._host, @@ -1255,6 +1687,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.aiplatform_v1.EvaluationServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.EvaluationService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1297,7 +1750,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. @@ -1308,8 +1761,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. @@ -1318,6 +1773,7 @@ def __call__( http_options = ( _BaseEvaluationServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = self._interceptor.pre_list_operations(request, metadata) transcoded_request = _BaseEvaluationServiceRestTransport._BaseListOperations._get_transcoded_request( http_options, request @@ -1328,6 +1784,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.aiplatform_v1.EvaluationServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.EvaluationService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = EvaluationServiceRestTransport._ListOperations._get_response( self._host, @@ -1347,6 +1830,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.aiplatform_v1.EvaluationServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.EvaluationService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1389,7 +1893,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 wait operation method over HTTP. @@ -1400,8 +1904,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 WaitOperation method. @@ -1410,6 +1916,7 @@ def __call__( http_options = ( _BaseEvaluationServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = self._interceptor.pre_wait_operation(request, metadata) transcoded_request = _BaseEvaluationServiceRestTransport._BaseWaitOperation._get_transcoded_request( http_options, request @@ -1420,6 +1927,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.aiplatform_v1.EvaluationServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.EvaluationService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = EvaluationServiceRestTransport._WaitOperation._get_response( self._host, @@ -1439,6 +1973,27 @@ def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = self._interceptor.post_wait_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.aiplatform_v1.EvaluationServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.EvaluationService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1/services/evaluation_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1/services/evaluation_service/transports/rest_asyncio.py index 490e9d5e59..c85eee6302 100644 --- a/google/cloud/aiplatform_v1/services/evaluation_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1/services/evaluation_service/transports/rest_asyncio.py @@ -56,6 +56,18 @@ from .base import DEFAULT_CLIENT_INFO as BASE_DEFAULT_CLIENT_INFO + +import logging + +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__) + try: OptionalRetry = Union[retries.AsyncRetry, gapic_v1.method._MethodDefault, None] except AttributeError: # pragma: NO COVER @@ -100,8 +112,11 @@ async def post_evaluate_instances(self, response): async def pre_evaluate_instances( self, request: evaluation_service.EvaluateInstancesRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[evaluation_service.EvaluateInstancesRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + evaluation_service.EvaluateInstancesRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for evaluate_instances Override in a subclass to manipulate the request or metadata @@ -123,8 +138,10 @@ async def post_evaluate_instances( async def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -146,8 +163,10 @@ async def post_get_location( async def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -169,8 +188,10 @@ async def post_list_locations( async def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -192,8 +213,10 @@ async def post_get_iam_policy( async def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -215,8 +238,11 @@ async def post_set_iam_policy( async def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -238,8 +264,10 @@ async def post_test_iam_permissions( async def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -259,8 +287,10 @@ async def post_cancel_operation(self, response: None) -> None: async 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 @@ -280,8 +310,10 @@ async def post_delete_operation(self, response: None) -> None: async 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 @@ -303,8 +335,10 @@ async def post_get_operation( async 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 @@ -326,8 +360,10 @@ async def post_list_operations( async def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -510,7 +546,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> evaluation_service.EvaluateInstancesResponse: r"""Call the evaluate instances method over HTTP. @@ -521,8 +557,10 @@ async def __call__( 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: ~.evaluation_service.EvaluateInstancesResponse: @@ -534,6 +572,7 @@ async def __call__( http_options = ( _BaseEvaluationServiceRestTransport._BaseEvaluateInstances._get_http_options() ) + request, metadata = await self._interceptor.pre_evaluate_instances( request, metadata ) @@ -550,6 +589,33 @@ async 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.aiplatform_v1.EvaluationServiceClient.EvaluateInstances", + extra={ + "serviceName": "google.cloud.aiplatform.v1.EvaluationService", + "rpcName": "EvaluateInstances", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncEvaluationServiceRestTransport._EvaluateInstances._get_response( self._host, @@ -578,6 +644,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_evaluate_instances(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + evaluation_service.EvaluateInstancesResponse.to_json(response) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.EvaluationServiceAsyncClient.evaluate_instances", + extra={ + "serviceName": "google.cloud.aiplatform.v1.EvaluationService", + "rpcName": "EvaluateInstances", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp @property @@ -629,7 +719,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -640,8 +730,10 @@ async def __call__( 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: locations_pb2.Location: Response from GetLocation method. @@ -650,6 +742,7 @@ async def __call__( http_options = ( _BaseEvaluationServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_location( request, metadata ) @@ -662,6 +755,33 @@ async 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.aiplatform_v1.EvaluationServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.EvaluationService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncEvaluationServiceRestTransport._GetLocation._get_response( @@ -689,6 +809,27 @@ async def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_location(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.aiplatform_v1.EvaluationServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.EvaluationService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -731,7 +872,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -742,8 +883,10 @@ async def __call__( 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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -752,6 +895,7 @@ async def __call__( http_options = ( _BaseEvaluationServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_locations( request, metadata ) @@ -764,6 +908,33 @@ async 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.aiplatform_v1.EvaluationServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.EvaluationService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncEvaluationServiceRestTransport._ListLocations._get_response( @@ -791,6 +962,27 @@ async def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_list_locations(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.aiplatform_v1.EvaluationServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.EvaluationService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -833,7 +1025,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -844,8 +1036,10 @@ async def __call__( 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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -854,6 +1048,7 @@ async def __call__( http_options = ( _BaseEvaluationServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_get_iam_policy( request, metadata ) @@ -866,6 +1061,33 @@ async 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.aiplatform_v1.EvaluationServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.EvaluationService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncEvaluationServiceRestTransport._GetIamPolicy._get_response( @@ -893,6 +1115,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_iam_policy(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.aiplatform_v1.EvaluationServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.EvaluationService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -936,7 +1179,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -947,8 +1190,10 @@ async def __call__( 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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -957,6 +1202,7 @@ async def __call__( http_options = ( _BaseEvaluationServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_set_iam_policy( request, metadata ) @@ -973,6 +1219,33 @@ async 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.aiplatform_v1.EvaluationServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.EvaluationService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncEvaluationServiceRestTransport._SetIamPolicy._get_response( @@ -1001,6 +1274,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_set_iam_policy(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.aiplatform_v1.EvaluationServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.EvaluationService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1043,7 +1337,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -1054,8 +1348,10 @@ async def __call__( 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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -1064,6 +1360,7 @@ async def __call__( http_options = ( _BaseEvaluationServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = await self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -1076,6 +1373,33 @@ async 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.aiplatform_v1.EvaluationServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.EvaluationService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncEvaluationServiceRestTransport._TestIamPermissions._get_response( self._host, @@ -1101,6 +1425,27 @@ async def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_test_iam_permissions(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.aiplatform_v1.EvaluationServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.EvaluationService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1143,7 +1488,7 @@ async 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 cancel operation method over HTTP. @@ -1154,13 +1499,16 @@ async def __call__( 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`. """ http_options = ( _BaseEvaluationServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_cancel_operation( request, metadata ) @@ -1173,6 +1521,33 @@ async 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.aiplatform_v1.EvaluationServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.EvaluationService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncEvaluationServiceRestTransport._CancelOperation._get_response( self._host, @@ -1236,7 +1611,7 @@ async 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. @@ -1247,13 +1622,16 @@ async def __call__( 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`. """ http_options = ( _BaseEvaluationServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_operation( request, metadata ) @@ -1266,6 +1644,33 @@ async 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.aiplatform_v1.EvaluationServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.EvaluationService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncEvaluationServiceRestTransport._DeleteOperation._get_response( self._host, @@ -1329,7 +1734,7 @@ async 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. @@ -1340,8 +1745,10 @@ async def __call__( 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: Response from GetOperation method. @@ -1350,6 +1757,7 @@ async def __call__( http_options = ( _BaseEvaluationServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_operation( request, metadata ) @@ -1362,6 +1770,33 @@ async 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.aiplatform_v1.EvaluationServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.EvaluationService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncEvaluationServiceRestTransport._GetOperation._get_response( @@ -1389,6 +1824,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1.EvaluationServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.EvaluationService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1431,7 +1887,7 @@ async 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. @@ -1442,8 +1898,10 @@ async def __call__( 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 from ListOperations method. @@ -1452,6 +1910,7 @@ async def __call__( http_options = ( _BaseEvaluationServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_operations( request, metadata ) @@ -1464,6 +1923,33 @@ async 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.aiplatform_v1.EvaluationServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.EvaluationService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncEvaluationServiceRestTransport._ListOperations._get_response( @@ -1491,6 +1977,27 @@ async def __call__( resp = operations_pb2.ListOperationsResponse() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1.EvaluationServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.EvaluationService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1533,7 +2040,7 @@ async 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 wait operation method over HTTP. @@ -1544,8 +2051,10 @@ async def __call__( 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: Response from WaitOperation method. @@ -1554,6 +2063,7 @@ async def __call__( http_options = ( _BaseEvaluationServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_wait_operation( request, metadata ) @@ -1566,6 +2076,33 @@ async 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.aiplatform_v1.EvaluationServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.EvaluationService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncEvaluationServiceRestTransport._WaitOperation._get_response( @@ -1593,6 +2130,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_wait_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.aiplatform_v1.EvaluationServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.EvaluationService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1/services/feature_online_store_admin_service/async_client.py b/google/cloud/aiplatform_v1/services/feature_online_store_admin_service/async_client.py index 198128a73e..5a776f909f 100644 --- a/google/cloud/aiplatform_v1/services/feature_online_store_admin_service/async_client.py +++ b/google/cloud/aiplatform_v1/services/feature_online_store_admin_service/async_client.py @@ -13,6 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging as std_logging from collections import OrderedDict import re from typing import ( @@ -74,6 +75,15 @@ from .transports.grpc_asyncio import FeatureOnlineStoreAdminServiceGrpcAsyncIOTransport from .client import FeatureOnlineStoreAdminServiceClient +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 FeatureOnlineStoreAdminServiceAsyncClient: """The service that handles CRUD and List for resources for @@ -309,6 +319,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.aiplatform_v1.FeatureOnlineStoreAdminServiceAsyncClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService", + "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.aiplatform.v1.FeatureOnlineStoreAdminService", + "credentialsType": None, + }, + ) + async def create_feature_online_store( self, request: Optional[ @@ -324,7 +356,7 @@ async def create_feature_online_store( feature_online_store_id: 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"""Creates a new FeatureOnlineStore in a given project and location. @@ -402,8 +434,10 @@ async def sample_create_feature_online_store(): 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: @@ -489,7 +523,7 @@ async def get_feature_online_store( 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]]] = (), ) -> feature_online_store.FeatureOnlineStore: r"""Gets details of a single FeatureOnlineStore. @@ -533,8 +567,10 @@ async def sample_get_feature_online_store(): 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.aiplatform_v1.types.FeatureOnlineStore: @@ -606,7 +642,7 @@ async def list_feature_online_stores( 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.ListFeatureOnlineStoresAsyncPager: r"""Lists FeatureOnlineStores in a given project and location. @@ -653,8 +689,10 @@ async def sample_list_feature_online_stores(): 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.aiplatform_v1.services.feature_online_store_admin_service.pagers.ListFeatureOnlineStoresAsyncPager: @@ -740,7 +778,7 @@ async def update_feature_online_store( 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"""Updates the parameters of a single FeatureOnlineStore. @@ -816,8 +854,10 @@ async def sample_update_feature_online_store(): 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: @@ -904,7 +944,7 @@ async def delete_feature_online_store( force: Optional[bool] = 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"""Deletes a single FeatureOnlineStore. The FeatureOnlineStore must not contain any FeatureViews. @@ -964,8 +1004,10 @@ async def sample_delete_feature_online_store(): 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: @@ -1056,7 +1098,7 @@ async def create_feature_view( feature_view_id: 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"""Creates a new FeatureView in a given FeatureOnlineStore. @@ -1131,8 +1173,10 @@ async def sample_create_feature_view(): 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 get_feature_view( 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]]] = (), ) -> feature_view.FeatureView: r"""Gets details of a single FeatureView. @@ -1257,8 +1301,10 @@ async def sample_get_feature_view(): 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.aiplatform_v1.types.FeatureView: @@ -1324,7 +1370,7 @@ async def list_feature_views( 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.ListFeatureViewsAsyncPager: r"""Lists FeatureViews in a given FeatureOnlineStore. @@ -1370,8 +1416,10 @@ async def sample_list_feature_views(): 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.aiplatform_v1.services.feature_online_store_admin_service.pagers.ListFeatureViewsAsyncPager: @@ -1453,7 +1501,7 @@ async def update_feature_view( 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"""Updates the parameters of a single FeatureView. @@ -1532,8 +1580,10 @@ async def sample_update_feature_view(): 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: @@ -1614,7 +1664,7 @@ async def delete_feature_view( 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"""Deletes a single FeatureView. @@ -1663,8 +1713,10 @@ async def sample_delete_feature_view(): 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: @@ -1749,7 +1801,7 @@ async def sync_feature_view( feature_view: 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]]] = (), ) -> feature_online_store_admin_service.SyncFeatureViewResponse: r"""Triggers on-demand sync for the FeatureView. @@ -1793,8 +1845,10 @@ async def sample_sync_feature_view(): 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.aiplatform_v1.types.SyncFeatureViewResponse: @@ -1861,7 +1915,7 @@ async def get_feature_view_sync( 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]]] = (), ) -> feature_view_sync.FeatureViewSync: r"""Gets details of a single FeatureViewSync. @@ -1906,8 +1960,10 @@ async def sample_get_feature_view_sync(): 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.aiplatform_v1.types.FeatureViewSync: @@ -1976,7 +2032,7 @@ async def list_feature_view_syncs( 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.ListFeatureViewSyncsAsyncPager: r"""Lists FeatureViewSyncs in a given FeatureView. @@ -2022,8 +2078,10 @@ async def sample_list_feature_view_syncs(): 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.aiplatform_v1.services.feature_online_store_admin_service.pagers.ListFeatureViewSyncsAsyncPager: @@ -2101,7 +2159,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. @@ -2112,8 +2170,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. @@ -2154,7 +2214,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. @@ -2165,8 +2225,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. @@ -2207,7 +2269,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. @@ -2223,8 +2285,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 """ @@ -2261,7 +2325,7 @@ async def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -2276,8 +2340,10 @@ async def cancel_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 """ @@ -2314,7 +2380,7 @@ async def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -2331,8 +2397,10 @@ async def wait_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. @@ -2373,7 +2441,7 @@ async def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -2386,8 +2454,10 @@ async def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -2492,7 +2562,7 @@ async def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -2506,8 +2576,10 @@ async def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -2612,7 +2684,7 @@ async def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -2627,8 +2699,10 @@ async def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -2672,7 +2746,7 @@ async def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -2683,8 +2757,10 @@ async def get_location( 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: ~.location_pb2.Location: Location object. @@ -2725,7 +2801,7 @@ async def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -2736,8 +2812,10 @@ async def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1/services/feature_online_store_admin_service/client.py b/google/cloud/aiplatform_v1/services/feature_online_store_admin_service/client.py index 40e1b3a2bd..6b72e2823d 100644 --- a/google/cloud/aiplatform_v1/services/feature_online_store_admin_service/client.py +++ b/google/cloud/aiplatform_v1/services/feature_online_store_admin_service/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 ( @@ -48,6 +49,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 as gac_operation # type: ignore from google.api_core import operation_async # type: ignore from google.cloud.aiplatform_v1.services.feature_online_store_admin_service import ( @@ -684,6 +694,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( @@ -779,6 +793,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.aiplatform_v1.FeatureOnlineStoreAdminServiceClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService", + "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.aiplatform.v1.FeatureOnlineStoreAdminService", + "credentialsType": None, + }, + ) + def create_feature_online_store( self, request: Optional[ @@ -794,7 +831,7 @@ def create_feature_online_store( feature_online_store_id: 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]]] = (), ) -> gac_operation.Operation: r"""Creates a new FeatureOnlineStore in a given project and location. @@ -872,8 +909,10 @@ def sample_create_feature_online_store(): 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: @@ -958,7 +997,7 @@ def get_feature_online_store( 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]]] = (), ) -> feature_online_store.FeatureOnlineStore: r"""Gets details of a single FeatureOnlineStore. @@ -1002,8 +1041,10 @@ def sample_get_feature_online_store(): 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.aiplatform_v1.types.FeatureOnlineStore: @@ -1072,7 +1113,7 @@ def list_feature_online_stores( 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.ListFeatureOnlineStoresPager: r"""Lists FeatureOnlineStores in a given project and location. @@ -1119,8 +1160,10 @@ def sample_list_feature_online_stores(): 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.aiplatform_v1.services.feature_online_store_admin_service.pagers.ListFeatureOnlineStoresPager: @@ -1205,7 +1248,7 @@ def update_feature_online_store( 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]]] = (), ) -> gac_operation.Operation: r"""Updates the parameters of a single FeatureOnlineStore. @@ -1281,8 +1324,10 @@ def sample_update_feature_online_store(): 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: @@ -1368,7 +1413,7 @@ def delete_feature_online_store( force: Optional[bool] = 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]]] = (), ) -> gac_operation.Operation: r"""Deletes a single FeatureOnlineStore. The FeatureOnlineStore must not contain any FeatureViews. @@ -1428,8 +1473,10 @@ def sample_delete_feature_online_store(): 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: @@ -1519,7 +1566,7 @@ def create_feature_view( feature_view_id: 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]]] = (), ) -> gac_operation.Operation: r"""Creates a new FeatureView in a given FeatureOnlineStore. @@ -1594,8 +1641,10 @@ def sample_create_feature_view(): 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: @@ -1673,7 +1722,7 @@ def get_feature_view( 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]]] = (), ) -> feature_view.FeatureView: r"""Gets details of a single FeatureView. @@ -1717,8 +1766,10 @@ def sample_get_feature_view(): 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.aiplatform_v1.types.FeatureView: @@ -1781,7 +1832,7 @@ def list_feature_views( 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.ListFeatureViewsPager: r"""Lists FeatureViews in a given FeatureOnlineStore. @@ -1827,8 +1878,10 @@ def sample_list_feature_views(): 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.aiplatform_v1.services.feature_online_store_admin_service.pagers.ListFeatureViewsPager: @@ -1907,7 +1960,7 @@ def update_feature_view( 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]]] = (), ) -> gac_operation.Operation: r"""Updates the parameters of a single FeatureView. @@ -1986,8 +2039,10 @@ def sample_update_feature_view(): 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: @@ -2065,7 +2120,7 @@ def delete_feature_view( 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]]] = (), ) -> gac_operation.Operation: r"""Deletes a single FeatureView. @@ -2114,8 +2169,10 @@ def sample_delete_feature_view(): 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: @@ -2197,7 +2254,7 @@ def sync_feature_view( feature_view: 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]]] = (), ) -> feature_online_store_admin_service.SyncFeatureViewResponse: r"""Triggers on-demand sync for the FeatureView. @@ -2241,8 +2298,10 @@ def sample_sync_feature_view(): 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.aiplatform_v1.types.SyncFeatureViewResponse: @@ -2306,7 +2365,7 @@ def get_feature_view_sync( 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]]] = (), ) -> feature_view_sync.FeatureViewSync: r"""Gets details of a single FeatureViewSync. @@ -2351,8 +2410,10 @@ def sample_get_feature_view_sync(): 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.aiplatform_v1.types.FeatureViewSync: @@ -2418,7 +2479,7 @@ def list_feature_view_syncs( 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.ListFeatureViewSyncsPager: r"""Lists FeatureViewSyncs in a given FeatureView. @@ -2464,8 +2525,10 @@ def sample_list_feature_view_syncs(): 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.aiplatform_v1.services.feature_online_store_admin_service.pagers.ListFeatureViewSyncsPager: @@ -2553,7 +2616,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. @@ -2564,8 +2627,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. @@ -2606,7 +2671,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. @@ -2617,8 +2682,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. @@ -2659,7 +2726,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. @@ -2675,8 +2742,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 """ @@ -2713,7 +2782,7 @@ def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -2728,8 +2797,10 @@ def cancel_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 """ @@ -2766,7 +2837,7 @@ def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -2783,8 +2854,10 @@ def wait_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. @@ -2825,7 +2898,7 @@ def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -2838,8 +2911,10 @@ def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -2944,7 +3019,7 @@ def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -2958,8 +3033,10 @@ def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -3064,7 +3141,7 @@ def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -3079,8 +3156,10 @@ def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -3122,7 +3201,7 @@ def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -3133,8 +3212,10 @@ def get_location( 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: ~.location_pb2.Location: Location object. @@ -3175,7 +3256,7 @@ def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -3186,8 +3267,10 @@ def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1/services/feature_online_store_admin_service/pagers.py b/google/cloud/aiplatform_v1/services/feature_online_store_admin_service/pagers.py index 0ceeaf3ff5..c32523d9d2 100644 --- a/google/cloud/aiplatform_v1/services/feature_online_store_admin_service/pagers.py +++ b/google/cloud/aiplatform_v1/services/feature_online_store_admin_service/pagers.py @@ -71,7 +71,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. @@ -85,8 +85,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 = ( @@ -154,7 +156,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. @@ -168,8 +170,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 = ( @@ -240,7 +244,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. @@ -254,8 +258,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 = feature_online_store_admin_service.ListFeatureViewsRequest( @@ -320,7 +326,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. @@ -334,8 +340,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 = feature_online_store_admin_service.ListFeatureViewsRequest( @@ -404,7 +412,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. @@ -418,8 +426,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 = feature_online_store_admin_service.ListFeatureViewSyncsRequest( @@ -485,7 +495,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. @@ -499,8 +509,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 = feature_online_store_admin_service.ListFeatureViewSyncsRequest( diff --git a/google/cloud/aiplatform_v1/services/feature_online_store_admin_service/transports/grpc.py b/google/cloud/aiplatform_v1/services/feature_online_store_admin_service/transports/grpc.py index 9a1ec29314..57a93ad60b 100644 --- a/google/cloud/aiplatform_v1/services/feature_online_store_admin_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1/services/feature_online_store_admin_service/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 import warnings from typing import Callable, Dict, Optional, Sequence, Tuple, Union @@ -22,8 +25,11 @@ import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from google.cloud.aiplatform_v1.types import feature_online_store from google.cloud.aiplatform_v1.types import feature_online_store_admin_service @@ -35,6 +41,81 @@ from google.longrunning import operations_pb2 # type: ignore from .base import FeatureOnlineStoreAdminServiceTransport, DEFAULT_CLIENT_INFO +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.aiplatform.v1.FeatureOnlineStoreAdminService", + "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.aiplatform.v1.FeatureOnlineStoreAdminService", + "rpcName": client_call_details.method, + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class FeatureOnlineStoreAdminServiceGrpcTransport( FeatureOnlineStoreAdminServiceTransport @@ -192,7 +273,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 @@ -256,7 +342,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 @@ -284,7 +372,9 @@ def create_feature_online_store( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_feature_online_store" not in self._stubs: - self._stubs["create_feature_online_store"] = self.grpc_channel.unary_unary( + self._stubs[ + "create_feature_online_store" + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService/CreateFeatureOnlineStore", request_serializer=feature_online_store_admin_service.CreateFeatureOnlineStoreRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -313,7 +403,7 @@ def get_feature_online_store( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_feature_online_store" not in self._stubs: - self._stubs["get_feature_online_store"] = self.grpc_channel.unary_unary( + self._stubs["get_feature_online_store"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService/GetFeatureOnlineStore", request_serializer=feature_online_store_admin_service.GetFeatureOnlineStoreRequest.serialize, response_deserializer=feature_online_store.FeatureOnlineStore.deserialize, @@ -343,7 +433,9 @@ def list_feature_online_stores( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_feature_online_stores" not in self._stubs: - self._stubs["list_feature_online_stores"] = self.grpc_channel.unary_unary( + self._stubs[ + "list_feature_online_stores" + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService/ListFeatureOnlineStores", request_serializer=feature_online_store_admin_service.ListFeatureOnlineStoresRequest.serialize, response_deserializer=feature_online_store_admin_service.ListFeatureOnlineStoresResponse.deserialize, @@ -373,7 +465,9 @@ def update_feature_online_store( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_feature_online_store" not in self._stubs: - self._stubs["update_feature_online_store"] = self.grpc_channel.unary_unary( + self._stubs[ + "update_feature_online_store" + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService/UpdateFeatureOnlineStore", request_serializer=feature_online_store_admin_service.UpdateFeatureOnlineStoreRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -403,7 +497,9 @@ def delete_feature_online_store( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_feature_online_store" not in self._stubs: - self._stubs["delete_feature_online_store"] = self.grpc_channel.unary_unary( + self._stubs[ + "delete_feature_online_store" + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService/DeleteFeatureOnlineStore", request_serializer=feature_online_store_admin_service.DeleteFeatureOnlineStoreRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -433,7 +529,7 @@ def create_feature_view( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_feature_view" not in self._stubs: - self._stubs["create_feature_view"] = self.grpc_channel.unary_unary( + self._stubs["create_feature_view"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService/CreateFeatureView", request_serializer=feature_online_store_admin_service.CreateFeatureViewRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -462,7 +558,7 @@ def get_feature_view( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_feature_view" not in self._stubs: - self._stubs["get_feature_view"] = self.grpc_channel.unary_unary( + self._stubs["get_feature_view"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService/GetFeatureView", request_serializer=feature_online_store_admin_service.GetFeatureViewRequest.serialize, response_deserializer=feature_view.FeatureView.deserialize, @@ -491,7 +587,7 @@ def list_feature_views( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_feature_views" not in self._stubs: - self._stubs["list_feature_views"] = self.grpc_channel.unary_unary( + self._stubs["list_feature_views"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService/ListFeatureViews", request_serializer=feature_online_store_admin_service.ListFeatureViewsRequest.serialize, response_deserializer=feature_online_store_admin_service.ListFeatureViewsResponse.deserialize, @@ -520,7 +616,7 @@ def update_feature_view( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_feature_view" not in self._stubs: - self._stubs["update_feature_view"] = self.grpc_channel.unary_unary( + self._stubs["update_feature_view"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService/UpdateFeatureView", request_serializer=feature_online_store_admin_service.UpdateFeatureViewRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -549,7 +645,7 @@ def delete_feature_view( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_feature_view" not in self._stubs: - self._stubs["delete_feature_view"] = self.grpc_channel.unary_unary( + self._stubs["delete_feature_view"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService/DeleteFeatureView", request_serializer=feature_online_store_admin_service.DeleteFeatureViewRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -578,7 +674,7 @@ def sync_feature_view( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "sync_feature_view" not in self._stubs: - self._stubs["sync_feature_view"] = self.grpc_channel.unary_unary( + self._stubs["sync_feature_view"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService/SyncFeatureView", request_serializer=feature_online_store_admin_service.SyncFeatureViewRequest.serialize, response_deserializer=feature_online_store_admin_service.SyncFeatureViewResponse.deserialize, @@ -607,7 +703,7 @@ def get_feature_view_sync( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_feature_view_sync" not in self._stubs: - self._stubs["get_feature_view_sync"] = self.grpc_channel.unary_unary( + self._stubs["get_feature_view_sync"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService/GetFeatureViewSync", request_serializer=feature_online_store_admin_service.GetFeatureViewSyncRequest.serialize, response_deserializer=feature_view_sync.FeatureViewSync.deserialize, @@ -636,7 +732,7 @@ def list_feature_view_syncs( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_feature_view_syncs" not in self._stubs: - self._stubs["list_feature_view_syncs"] = self.grpc_channel.unary_unary( + self._stubs["list_feature_view_syncs"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService/ListFeatureViewSyncs", request_serializer=feature_online_store_admin_service.ListFeatureViewSyncsRequest.serialize, response_deserializer=feature_online_store_admin_service.ListFeatureViewSyncsResponse.deserialize, @@ -644,7 +740,7 @@ def list_feature_view_syncs( return self._stubs["list_feature_view_syncs"] def close(self): - self.grpc_channel.close() + self._logged_channel.close() @property def delete_operation( @@ -656,7 +752,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, @@ -673,7 +769,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -690,7 +786,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -707,7 +803,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, @@ -726,7 +822,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, @@ -745,7 +841,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -762,7 +858,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -787,7 +883,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -813,7 +909,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -842,7 +938,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1/services/feature_online_store_admin_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1/services/feature_online_store_admin_service/transports/grpc_asyncio.py index a2c93a2ab5..5ba580cd46 100644 --- a/google/cloud/aiplatform_v1/services/feature_online_store_admin_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1/services/feature_online_store_admin_service/transports/grpc_asyncio.py @@ -14,6 +14,9 @@ # limitations under the License. # import inspect +import json +import pickle +import logging as std_logging import warnings from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union @@ -24,8 +27,11 @@ from google.api_core import operations_v1 from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from grpc.experimental import aio # type: ignore from google.cloud.aiplatform_v1.types import feature_online_store @@ -39,6 +45,82 @@ from .base import FeatureOnlineStoreAdminServiceTransport, DEFAULT_CLIENT_INFO from .grpc import FeatureOnlineStoreAdminServiceGrpcTransport +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.aiplatform.v1.FeatureOnlineStoreAdminService", + "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.aiplatform.v1.FeatureOnlineStoreAdminService", + "rpcName": str(client_call_details.method), + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class FeatureOnlineStoreAdminServiceGrpcAsyncIOTransport( FeatureOnlineStoreAdminServiceTransport @@ -239,10 +321,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 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. @@ -294,7 +379,9 @@ def create_feature_online_store( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_feature_online_store" not in self._stubs: - self._stubs["create_feature_online_store"] = self.grpc_channel.unary_unary( + self._stubs[ + "create_feature_online_store" + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService/CreateFeatureOnlineStore", request_serializer=feature_online_store_admin_service.CreateFeatureOnlineStoreRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -323,7 +410,7 @@ def get_feature_online_store( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_feature_online_store" not in self._stubs: - self._stubs["get_feature_online_store"] = self.grpc_channel.unary_unary( + self._stubs["get_feature_online_store"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService/GetFeatureOnlineStore", request_serializer=feature_online_store_admin_service.GetFeatureOnlineStoreRequest.serialize, response_deserializer=feature_online_store.FeatureOnlineStore.deserialize, @@ -353,7 +440,9 @@ def list_feature_online_stores( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_feature_online_stores" not in self._stubs: - self._stubs["list_feature_online_stores"] = self.grpc_channel.unary_unary( + self._stubs[ + "list_feature_online_stores" + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService/ListFeatureOnlineStores", request_serializer=feature_online_store_admin_service.ListFeatureOnlineStoresRequest.serialize, response_deserializer=feature_online_store_admin_service.ListFeatureOnlineStoresResponse.deserialize, @@ -383,7 +472,9 @@ def update_feature_online_store( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_feature_online_store" not in self._stubs: - self._stubs["update_feature_online_store"] = self.grpc_channel.unary_unary( + self._stubs[ + "update_feature_online_store" + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService/UpdateFeatureOnlineStore", request_serializer=feature_online_store_admin_service.UpdateFeatureOnlineStoreRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -413,7 +504,9 @@ def delete_feature_online_store( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_feature_online_store" not in self._stubs: - self._stubs["delete_feature_online_store"] = self.grpc_channel.unary_unary( + self._stubs[ + "delete_feature_online_store" + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService/DeleteFeatureOnlineStore", request_serializer=feature_online_store_admin_service.DeleteFeatureOnlineStoreRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -443,7 +536,7 @@ def create_feature_view( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_feature_view" not in self._stubs: - self._stubs["create_feature_view"] = self.grpc_channel.unary_unary( + self._stubs["create_feature_view"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService/CreateFeatureView", request_serializer=feature_online_store_admin_service.CreateFeatureViewRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -472,7 +565,7 @@ def get_feature_view( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_feature_view" not in self._stubs: - self._stubs["get_feature_view"] = self.grpc_channel.unary_unary( + self._stubs["get_feature_view"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService/GetFeatureView", request_serializer=feature_online_store_admin_service.GetFeatureViewRequest.serialize, response_deserializer=feature_view.FeatureView.deserialize, @@ -501,7 +594,7 @@ def list_feature_views( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_feature_views" not in self._stubs: - self._stubs["list_feature_views"] = self.grpc_channel.unary_unary( + self._stubs["list_feature_views"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService/ListFeatureViews", request_serializer=feature_online_store_admin_service.ListFeatureViewsRequest.serialize, response_deserializer=feature_online_store_admin_service.ListFeatureViewsResponse.deserialize, @@ -530,7 +623,7 @@ def update_feature_view( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_feature_view" not in self._stubs: - self._stubs["update_feature_view"] = self.grpc_channel.unary_unary( + self._stubs["update_feature_view"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService/UpdateFeatureView", request_serializer=feature_online_store_admin_service.UpdateFeatureViewRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -559,7 +652,7 @@ def delete_feature_view( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_feature_view" not in self._stubs: - self._stubs["delete_feature_view"] = self.grpc_channel.unary_unary( + self._stubs["delete_feature_view"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService/DeleteFeatureView", request_serializer=feature_online_store_admin_service.DeleteFeatureViewRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -588,7 +681,7 @@ def sync_feature_view( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "sync_feature_view" not in self._stubs: - self._stubs["sync_feature_view"] = self.grpc_channel.unary_unary( + self._stubs["sync_feature_view"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService/SyncFeatureView", request_serializer=feature_online_store_admin_service.SyncFeatureViewRequest.serialize, response_deserializer=feature_online_store_admin_service.SyncFeatureViewResponse.deserialize, @@ -617,7 +710,7 @@ def get_feature_view_sync( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_feature_view_sync" not in self._stubs: - self._stubs["get_feature_view_sync"] = self.grpc_channel.unary_unary( + self._stubs["get_feature_view_sync"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService/GetFeatureViewSync", request_serializer=feature_online_store_admin_service.GetFeatureViewSyncRequest.serialize, response_deserializer=feature_view_sync.FeatureViewSync.deserialize, @@ -646,7 +739,7 @@ def list_feature_view_syncs( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_feature_view_syncs" not in self._stubs: - self._stubs["list_feature_view_syncs"] = self.grpc_channel.unary_unary( + self._stubs["list_feature_view_syncs"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService/ListFeatureViewSyncs", request_serializer=feature_online_store_admin_service.ListFeatureViewSyncsRequest.serialize, response_deserializer=feature_online_store_admin_service.ListFeatureViewSyncsResponse.deserialize, @@ -779,7 +872,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: @@ -795,7 +888,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, @@ -812,7 +905,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -829,7 +922,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -846,7 +939,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, @@ -865,7 +958,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, @@ -884,7 +977,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -901,7 +994,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -926,7 +1019,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -952,7 +1045,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -981,7 +1074,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1/services/feature_online_store_admin_service/transports/rest.py b/google/cloud/aiplatform_v1/services/feature_online_store_admin_service/transports/rest.py index a91ea3703f..a3e0413311 100644 --- a/google/cloud/aiplatform_v1/services/feature_online_store_admin_service/transports/rest.py +++ b/google/cloud/aiplatform_v1/services/feature_online_store_admin_service/transports/rest.py @@ -13,9 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging +import json # type: ignore from google.auth.transport.requests import AuthorizedSession # type: ignore -import json # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.api_core import exceptions as core_exceptions from google.api_core import retry as retries @@ -50,6 +51,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, @@ -186,10 +195,10 @@ def post_update_feature_view(self, response): def pre_create_feature_online_store( self, request: feature_online_store_admin_service.CreateFeatureOnlineStoreRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ feature_online_store_admin_service.CreateFeatureOnlineStoreRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for create_feature_online_store @@ -212,10 +221,10 @@ def post_create_feature_online_store( def pre_create_feature_view( self, request: feature_online_store_admin_service.CreateFeatureViewRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ feature_online_store_admin_service.CreateFeatureViewRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for create_feature_view @@ -238,10 +247,10 @@ def post_create_feature_view( def pre_delete_feature_online_store( self, request: feature_online_store_admin_service.DeleteFeatureOnlineStoreRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ feature_online_store_admin_service.DeleteFeatureOnlineStoreRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for delete_feature_online_store @@ -264,10 +273,10 @@ def post_delete_feature_online_store( def pre_delete_feature_view( self, request: feature_online_store_admin_service.DeleteFeatureViewRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ feature_online_store_admin_service.DeleteFeatureViewRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for delete_feature_view @@ -290,10 +299,10 @@ def post_delete_feature_view( def pre_get_feature_online_store( self, request: feature_online_store_admin_service.GetFeatureOnlineStoreRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ feature_online_store_admin_service.GetFeatureOnlineStoreRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for get_feature_online_store @@ -316,10 +325,10 @@ def post_get_feature_online_store( def pre_get_feature_view( self, request: feature_online_store_admin_service.GetFeatureViewRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ feature_online_store_admin_service.GetFeatureViewRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for get_feature_view @@ -342,10 +351,10 @@ def post_get_feature_view( def pre_get_feature_view_sync( self, request: feature_online_store_admin_service.GetFeatureViewSyncRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ feature_online_store_admin_service.GetFeatureViewSyncRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for get_feature_view_sync @@ -368,10 +377,10 @@ def post_get_feature_view_sync( def pre_list_feature_online_stores( self, request: feature_online_store_admin_service.ListFeatureOnlineStoresRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ feature_online_store_admin_service.ListFeatureOnlineStoresRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for list_feature_online_stores @@ -395,10 +404,10 @@ def post_list_feature_online_stores( def pre_list_feature_views( self, request: feature_online_store_admin_service.ListFeatureViewsRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ feature_online_store_admin_service.ListFeatureViewsRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for list_feature_views @@ -421,10 +430,10 @@ def post_list_feature_views( def pre_list_feature_view_syncs( self, request: feature_online_store_admin_service.ListFeatureViewSyncsRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ feature_online_store_admin_service.ListFeatureViewSyncsRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for list_feature_view_syncs @@ -447,10 +456,10 @@ def post_list_feature_view_syncs( def pre_sync_feature_view( self, request: feature_online_store_admin_service.SyncFeatureViewRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ feature_online_store_admin_service.SyncFeatureViewRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for sync_feature_view @@ -473,10 +482,10 @@ def post_sync_feature_view( def pre_update_feature_online_store( self, request: feature_online_store_admin_service.UpdateFeatureOnlineStoreRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ feature_online_store_admin_service.UpdateFeatureOnlineStoreRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for update_feature_online_store @@ -499,10 +508,10 @@ def post_update_feature_online_store( def pre_update_feature_view( self, request: feature_online_store_admin_service.UpdateFeatureViewRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ feature_online_store_admin_service.UpdateFeatureViewRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for update_feature_view @@ -525,8 +534,10 @@ def post_update_feature_view( def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -548,8 +559,10 @@ def post_get_location( def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -571,8 +584,10 @@ def post_list_locations( def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -592,8 +607,10 @@ def post_get_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -613,8 +630,11 @@ def post_set_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -636,8 +656,10 @@ def post_test_iam_permissions( def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -657,8 +679,10 @@ def post_cancel_operation(self, response: None) -> None: 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 @@ -678,8 +702,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 @@ -701,8 +727,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 @@ -724,8 +752,10 @@ def post_list_operations( def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -2754,7 +2784,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 feature online store method over HTTP. @@ -2766,8 +2796,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: @@ -2780,6 +2812,7 @@ def __call__( http_options = ( _BaseFeatureOnlineStoreAdminServiceRestTransport._BaseCreateFeatureOnlineStore._get_http_options() ) + request, metadata = self._interceptor.pre_create_feature_online_store( request, metadata ) @@ -2796,6 +2829,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.aiplatform_v1.FeatureOnlineStoreAdminServiceClient.CreateFeatureOnlineStore", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService", + "rpcName": "CreateFeatureOnlineStore", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeatureOnlineStoreAdminServiceRestTransport._CreateFeatureOnlineStore._get_response( self._host, @@ -2815,7 +2875,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_feature_online_store(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.aiplatform_v1.FeatureOnlineStoreAdminServiceClient.create_feature_online_store", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService", + "rpcName": "CreateFeatureOnlineStore", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _CreateFeatureView( @@ -2855,7 +2937,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 feature view method over HTTP. @@ -2866,8 +2948,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: @@ -2880,6 +2964,7 @@ def __call__( http_options = ( _BaseFeatureOnlineStoreAdminServiceRestTransport._BaseCreateFeatureView._get_http_options() ) + request, metadata = self._interceptor.pre_create_feature_view( request, metadata ) @@ -2896,6 +2981,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.aiplatform_v1.FeatureOnlineStoreAdminServiceClient.CreateFeatureView", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService", + "rpcName": "CreateFeatureView", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeatureOnlineStoreAdminServiceRestTransport._CreateFeatureView._get_response( self._host, @@ -2915,7 +3027,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_feature_view(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.aiplatform_v1.FeatureOnlineStoreAdminServiceClient.create_feature_view", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService", + "rpcName": "CreateFeatureView", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _DeleteFeatureOnlineStore( @@ -2956,7 +3090,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 feature online store method over HTTP. @@ -2968,8 +3102,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: @@ -2982,6 +3118,7 @@ def __call__( http_options = ( _BaseFeatureOnlineStoreAdminServiceRestTransport._BaseDeleteFeatureOnlineStore._get_http_options() ) + request, metadata = self._interceptor.pre_delete_feature_online_store( request, metadata ) @@ -2994,6 +3131,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.aiplatform_v1.FeatureOnlineStoreAdminServiceClient.DeleteFeatureOnlineStore", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService", + "rpcName": "DeleteFeatureOnlineStore", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeatureOnlineStoreAdminServiceRestTransport._DeleteFeatureOnlineStore._get_response( self._host, @@ -3012,7 +3176,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_feature_online_store(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.aiplatform_v1.FeatureOnlineStoreAdminServiceClient.delete_feature_online_store", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService", + "rpcName": "DeleteFeatureOnlineStore", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _DeleteFeatureView( @@ -3051,7 +3237,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 feature view method over HTTP. @@ -3062,8 +3248,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: @@ -3076,6 +3264,7 @@ def __call__( http_options = ( _BaseFeatureOnlineStoreAdminServiceRestTransport._BaseDeleteFeatureView._get_http_options() ) + request, metadata = self._interceptor.pre_delete_feature_view( request, metadata ) @@ -3088,6 +3277,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.aiplatform_v1.FeatureOnlineStoreAdminServiceClient.DeleteFeatureView", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService", + "rpcName": "DeleteFeatureView", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeatureOnlineStoreAdminServiceRestTransport._DeleteFeatureView._get_response( self._host, @@ -3106,7 +3322,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_feature_view(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.aiplatform_v1.FeatureOnlineStoreAdminServiceClient.delete_feature_view", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService", + "rpcName": "DeleteFeatureView", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _GetFeatureOnlineStore( @@ -3147,7 +3385,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]]] = (), ) -> feature_online_store.FeatureOnlineStore: r"""Call the get feature online store method over HTTP. @@ -3158,8 +3396,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: ~.feature_online_store.FeatureOnlineStore: @@ -3174,6 +3414,7 @@ def __call__( http_options = ( _BaseFeatureOnlineStoreAdminServiceRestTransport._BaseGetFeatureOnlineStore._get_http_options() ) + request, metadata = self._interceptor.pre_get_feature_online_store( request, metadata ) @@ -3186,6 +3427,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.aiplatform_v1.FeatureOnlineStoreAdminServiceClient.GetFeatureOnlineStore", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService", + "rpcName": "GetFeatureOnlineStore", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeatureOnlineStoreAdminServiceRestTransport._GetFeatureOnlineStore._get_response( self._host, @@ -3206,7 +3474,31 @@ def __call__( pb_resp = feature_online_store.FeatureOnlineStore.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_feature_online_store(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = feature_online_store.FeatureOnlineStore.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.aiplatform_v1.FeatureOnlineStoreAdminServiceClient.get_feature_online_store", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService", + "rpcName": "GetFeatureOnlineStore", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _GetFeatureView( @@ -3245,7 +3537,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]]] = (), ) -> feature_view.FeatureView: r"""Call the get feature view method over HTTP. @@ -3256,8 +3548,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: ~.feature_view.FeatureView: @@ -3270,6 +3564,7 @@ def __call__( http_options = ( _BaseFeatureOnlineStoreAdminServiceRestTransport._BaseGetFeatureView._get_http_options() ) + request, metadata = self._interceptor.pre_get_feature_view( request, metadata ) @@ -3282,6 +3577,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.aiplatform_v1.FeatureOnlineStoreAdminServiceClient.GetFeatureView", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService", + "rpcName": "GetFeatureView", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeatureOnlineStoreAdminServiceRestTransport._GetFeatureView._get_response( self._host, @@ -3302,7 +3624,29 @@ def __call__( pb_resp = feature_view.FeatureView.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_feature_view(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = feature_view.FeatureView.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.aiplatform_v1.FeatureOnlineStoreAdminServiceClient.get_feature_view", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService", + "rpcName": "GetFeatureView", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _GetFeatureViewSync( @@ -3343,7 +3687,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]]] = (), ) -> feature_view_sync.FeatureViewSync: r"""Call the get feature view sync method over HTTP. @@ -3354,8 +3698,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: ~.feature_view_sync.FeatureViewSync: @@ -3369,6 +3715,7 @@ def __call__( http_options = ( _BaseFeatureOnlineStoreAdminServiceRestTransport._BaseGetFeatureViewSync._get_http_options() ) + request, metadata = self._interceptor.pre_get_feature_view_sync( request, metadata ) @@ -3381,6 +3728,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.aiplatform_v1.FeatureOnlineStoreAdminServiceClient.GetFeatureViewSync", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService", + "rpcName": "GetFeatureViewSync", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeatureOnlineStoreAdminServiceRestTransport._GetFeatureViewSync._get_response( self._host, @@ -3401,7 +3775,31 @@ def __call__( pb_resp = feature_view_sync.FeatureViewSync.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_feature_view_sync(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = feature_view_sync.FeatureViewSync.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.aiplatform_v1.FeatureOnlineStoreAdminServiceClient.get_feature_view_sync", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService", + "rpcName": "GetFeatureViewSync", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListFeatureOnlineStores( @@ -3442,7 +3840,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]]] = (), ) -> feature_online_store_admin_service.ListFeatureOnlineStoresResponse: r"""Call the list feature online stores method over HTTP. @@ -3454,8 +3852,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: ~.feature_online_store_admin_service.ListFeatureOnlineStoresResponse: @@ -3467,6 +3867,7 @@ def __call__( http_options = ( _BaseFeatureOnlineStoreAdminServiceRestTransport._BaseListFeatureOnlineStores._get_http_options() ) + request, metadata = self._interceptor.pre_list_feature_online_stores( request, metadata ) @@ -3479,6 +3880,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.aiplatform_v1.FeatureOnlineStoreAdminServiceClient.ListFeatureOnlineStores", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService", + "rpcName": "ListFeatureOnlineStores", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeatureOnlineStoreAdminServiceRestTransport._ListFeatureOnlineStores._get_response( self._host, @@ -3503,7 +3931,31 @@ def __call__( ) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_feature_online_stores(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = feature_online_store_admin_service.ListFeatureOnlineStoresResponse.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.aiplatform_v1.FeatureOnlineStoreAdminServiceClient.list_feature_online_stores", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService", + "rpcName": "ListFeatureOnlineStores", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListFeatureViews( @@ -3542,7 +3994,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]]] = (), ) -> feature_online_store_admin_service.ListFeatureViewsResponse: r"""Call the list feature views method over HTTP. @@ -3553,8 +4005,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: ~.feature_online_store_admin_service.ListFeatureViewsResponse: @@ -3566,6 +4020,7 @@ def __call__( http_options = ( _BaseFeatureOnlineStoreAdminServiceRestTransport._BaseListFeatureViews._get_http_options() ) + request, metadata = self._interceptor.pre_list_feature_views( request, metadata ) @@ -3578,6 +4033,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.aiplatform_v1.FeatureOnlineStoreAdminServiceClient.ListFeatureViews", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService", + "rpcName": "ListFeatureViews", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeatureOnlineStoreAdminServiceRestTransport._ListFeatureViews._get_response( self._host, @@ -3600,7 +4082,31 @@ def __call__( ) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_feature_views(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = feature_online_store_admin_service.ListFeatureViewsResponse.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.aiplatform_v1.FeatureOnlineStoreAdminServiceClient.list_feature_views", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService", + "rpcName": "ListFeatureViews", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListFeatureViewSyncs( @@ -3641,7 +4147,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]]] = (), ) -> feature_online_store_admin_service.ListFeatureViewSyncsResponse: r"""Call the list feature view syncs method over HTTP. @@ -3652,8 +4158,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: ~.feature_online_store_admin_service.ListFeatureViewSyncsResponse: @@ -3665,6 +4173,7 @@ def __call__( http_options = ( _BaseFeatureOnlineStoreAdminServiceRestTransport._BaseListFeatureViewSyncs._get_http_options() ) + request, metadata = self._interceptor.pre_list_feature_view_syncs( request, metadata ) @@ -3677,6 +4186,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.aiplatform_v1.FeatureOnlineStoreAdminServiceClient.ListFeatureViewSyncs", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService", + "rpcName": "ListFeatureViewSyncs", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeatureOnlineStoreAdminServiceRestTransport._ListFeatureViewSyncs._get_response( self._host, @@ -3699,7 +4235,31 @@ def __call__( ) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_feature_view_syncs(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = feature_online_store_admin_service.ListFeatureViewSyncsResponse.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.aiplatform_v1.FeatureOnlineStoreAdminServiceClient.list_feature_view_syncs", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService", + "rpcName": "ListFeatureViewSyncs", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _SyncFeatureView( @@ -3739,7 +4299,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]]] = (), ) -> feature_online_store_admin_service.SyncFeatureViewResponse: r"""Call the sync feature view method over HTTP. @@ -3750,8 +4310,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: ~.feature_online_store_admin_service.SyncFeatureViewResponse: @@ -3763,6 +4325,7 @@ def __call__( http_options = ( _BaseFeatureOnlineStoreAdminServiceRestTransport._BaseSyncFeatureView._get_http_options() ) + request, metadata = self._interceptor.pre_sync_feature_view( request, metadata ) @@ -3779,6 +4342,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.aiplatform_v1.FeatureOnlineStoreAdminServiceClient.SyncFeatureView", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService", + "rpcName": "SyncFeatureView", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeatureOnlineStoreAdminServiceRestTransport._SyncFeatureView._get_response( self._host, @@ -3802,7 +4392,31 @@ def __call__( ) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_sync_feature_view(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = feature_online_store_admin_service.SyncFeatureViewResponse.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.aiplatform_v1.FeatureOnlineStoreAdminServiceClient.sync_feature_view", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService", + "rpcName": "SyncFeatureView", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _UpdateFeatureOnlineStore( @@ -3844,7 +4458,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 feature online store method over HTTP. @@ -3856,8 +4470,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: @@ -3870,6 +4486,7 @@ def __call__( http_options = ( _BaseFeatureOnlineStoreAdminServiceRestTransport._BaseUpdateFeatureOnlineStore._get_http_options() ) + request, metadata = self._interceptor.pre_update_feature_online_store( request, metadata ) @@ -3886,6 +4503,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.aiplatform_v1.FeatureOnlineStoreAdminServiceClient.UpdateFeatureOnlineStore", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService", + "rpcName": "UpdateFeatureOnlineStore", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeatureOnlineStoreAdminServiceRestTransport._UpdateFeatureOnlineStore._get_response( self._host, @@ -3905,7 +4549,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_feature_online_store(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.aiplatform_v1.FeatureOnlineStoreAdminServiceClient.update_feature_online_store", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService", + "rpcName": "UpdateFeatureOnlineStore", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _UpdateFeatureView( @@ -3945,7 +4611,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 feature view method over HTTP. @@ -3956,8 +4622,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: @@ -3970,6 +4638,7 @@ def __call__( http_options = ( _BaseFeatureOnlineStoreAdminServiceRestTransport._BaseUpdateFeatureView._get_http_options() ) + request, metadata = self._interceptor.pre_update_feature_view( request, metadata ) @@ -3986,6 +4655,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.aiplatform_v1.FeatureOnlineStoreAdminServiceClient.UpdateFeatureView", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService", + "rpcName": "UpdateFeatureView", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeatureOnlineStoreAdminServiceRestTransport._UpdateFeatureView._get_response( self._host, @@ -4005,7 +4701,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_feature_view(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.aiplatform_v1.FeatureOnlineStoreAdminServiceClient.update_feature_view", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService", + "rpcName": "UpdateFeatureView", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp @property @@ -4191,7 +4909,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]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -4202,8 +4920,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: locations_pb2.Location: Response from GetLocation method. @@ -4212,6 +4932,7 @@ def __call__( http_options = ( _BaseFeatureOnlineStoreAdminServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = self._interceptor.pre_get_location(request, metadata) transcoded_request = _BaseFeatureOnlineStoreAdminServiceRestTransport._BaseGetLocation._get_transcoded_request( http_options, request @@ -4222,6 +4943,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.aiplatform_v1.FeatureOnlineStoreAdminServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( FeatureOnlineStoreAdminServiceRestTransport._GetLocation._get_response( @@ -4243,6 +4991,27 @@ def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_location(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.aiplatform_v1.FeatureOnlineStoreAdminServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4285,7 +5054,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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -4296,8 +5065,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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -4306,6 +5077,7 @@ def __call__( http_options = ( _BaseFeatureOnlineStoreAdminServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = self._interceptor.pre_list_locations(request, metadata) transcoded_request = _BaseFeatureOnlineStoreAdminServiceRestTransport._BaseListLocations._get_transcoded_request( http_options, request @@ -4316,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.aiplatform_v1.FeatureOnlineStoreAdminServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeatureOnlineStoreAdminServiceRestTransport._ListLocations._get_response( self._host, @@ -4335,6 +5134,27 @@ def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_list_locations(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.aiplatform_v1.FeatureOnlineStoreAdminServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4377,7 +5197,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]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -4388,8 +5208,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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -4398,6 +5220,7 @@ def __call__( http_options = ( _BaseFeatureOnlineStoreAdminServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_get_iam_policy(request, metadata) transcoded_request = _BaseFeatureOnlineStoreAdminServiceRestTransport._BaseGetIamPolicy._get_transcoded_request( http_options, request @@ -4408,6 +5231,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.aiplatform_v1.FeatureOnlineStoreAdminServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( FeatureOnlineStoreAdminServiceRestTransport._GetIamPolicy._get_response( @@ -4429,6 +5279,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_iam_policy(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.aiplatform_v1.FeatureOnlineStoreAdminServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4472,7 +5343,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]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -4483,8 +5354,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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -4493,6 +5366,7 @@ def __call__( http_options = ( _BaseFeatureOnlineStoreAdminServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_set_iam_policy(request, metadata) transcoded_request = _BaseFeatureOnlineStoreAdminServiceRestTransport._BaseSetIamPolicy._get_transcoded_request( http_options, request @@ -4507,6 +5381,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.aiplatform_v1.FeatureOnlineStoreAdminServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( FeatureOnlineStoreAdminServiceRestTransport._SetIamPolicy._get_response( @@ -4529,6 +5430,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_set_iam_policy(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.aiplatform_v1.FeatureOnlineStoreAdminServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4573,7 +5495,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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -4584,8 +5506,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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -4594,6 +5518,7 @@ def __call__( http_options = ( _BaseFeatureOnlineStoreAdminServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -4606,6 +5531,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.aiplatform_v1.FeatureOnlineStoreAdminServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeatureOnlineStoreAdminServiceRestTransport._TestIamPermissions._get_response( self._host, @@ -4625,6 +5577,27 @@ def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_test_iam_permissions(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.aiplatform_v1.FeatureOnlineStoreAdminServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4667,7 +5640,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 cancel operation method over HTTP. @@ -4678,13 +5651,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 = ( _BaseFeatureOnlineStoreAdminServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = self._interceptor.pre_cancel_operation( request, metadata ) @@ -4697,6 +5673,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.aiplatform_v1.FeatureOnlineStoreAdminServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeatureOnlineStoreAdminServiceRestTransport._CancelOperation._get_response( self._host, @@ -4754,7 +5757,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. @@ -4765,13 +5768,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 = ( _BaseFeatureOnlineStoreAdminServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = self._interceptor.pre_delete_operation( request, metadata ) @@ -4784,6 +5790,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.aiplatform_v1.FeatureOnlineStoreAdminServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeatureOnlineStoreAdminServiceRestTransport._DeleteOperation._get_response( self._host, @@ -4841,7 +5874,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. @@ -4852,8 +5885,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. @@ -4862,6 +5897,7 @@ def __call__( http_options = ( _BaseFeatureOnlineStoreAdminServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = self._interceptor.pre_get_operation(request, metadata) transcoded_request = _BaseFeatureOnlineStoreAdminServiceRestTransport._BaseGetOperation._get_transcoded_request( http_options, request @@ -4872,6 +5908,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.aiplatform_v1.FeatureOnlineStoreAdminServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( FeatureOnlineStoreAdminServiceRestTransport._GetOperation._get_response( @@ -4893,6 +5956,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.aiplatform_v1.FeatureOnlineStoreAdminServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4935,7 +6019,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. @@ -4946,8 +6030,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. @@ -4956,6 +6042,7 @@ def __call__( http_options = ( _BaseFeatureOnlineStoreAdminServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = self._interceptor.pre_list_operations(request, metadata) transcoded_request = _BaseFeatureOnlineStoreAdminServiceRestTransport._BaseListOperations._get_transcoded_request( http_options, request @@ -4966,6 +6053,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.aiplatform_v1.FeatureOnlineStoreAdminServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeatureOnlineStoreAdminServiceRestTransport._ListOperations._get_response( self._host, @@ -4985,6 +6099,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.aiplatform_v1.FeatureOnlineStoreAdminServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5027,7 +6162,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 wait operation method over HTTP. @@ -5038,8 +6173,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 WaitOperation method. @@ -5048,6 +6185,7 @@ def __call__( http_options = ( _BaseFeatureOnlineStoreAdminServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = self._interceptor.pre_wait_operation(request, metadata) transcoded_request = _BaseFeatureOnlineStoreAdminServiceRestTransport._BaseWaitOperation._get_transcoded_request( http_options, request @@ -5058,6 +6196,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.aiplatform_v1.FeatureOnlineStoreAdminServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeatureOnlineStoreAdminServiceRestTransport._WaitOperation._get_response( self._host, @@ -5077,6 +6242,27 @@ def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = self._interceptor.post_wait_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.aiplatform_v1.FeatureOnlineStoreAdminServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1/services/feature_online_store_admin_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1/services/feature_online_store_admin_service/transports/rest_asyncio.py index e64f579650..d8b92d337b 100644 --- a/google/cloud/aiplatform_v1/services/feature_online_store_admin_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1/services/feature_online_store_admin_service/transports/rest_asyncio.py @@ -61,6 +61,18 @@ from .base import DEFAULT_CLIENT_INFO as BASE_DEFAULT_CLIENT_INFO + +import logging + +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__) + try: OptionalRetry = Union[retries.AsyncRetry, gapic_v1.method._MethodDefault, None] except AttributeError: # pragma: NO COVER @@ -201,10 +213,10 @@ async def post_update_feature_view(self, response): async def pre_create_feature_online_store( self, request: feature_online_store_admin_service.CreateFeatureOnlineStoreRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ feature_online_store_admin_service.CreateFeatureOnlineStoreRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for create_feature_online_store @@ -227,10 +239,10 @@ async def post_create_feature_online_store( async def pre_create_feature_view( self, request: feature_online_store_admin_service.CreateFeatureViewRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ feature_online_store_admin_service.CreateFeatureViewRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for create_feature_view @@ -253,10 +265,10 @@ async def post_create_feature_view( async def pre_delete_feature_online_store( self, request: feature_online_store_admin_service.DeleteFeatureOnlineStoreRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ feature_online_store_admin_service.DeleteFeatureOnlineStoreRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for delete_feature_online_store @@ -279,10 +291,10 @@ async def post_delete_feature_online_store( async def pre_delete_feature_view( self, request: feature_online_store_admin_service.DeleteFeatureViewRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ feature_online_store_admin_service.DeleteFeatureViewRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for delete_feature_view @@ -305,10 +317,10 @@ async def post_delete_feature_view( async def pre_get_feature_online_store( self, request: feature_online_store_admin_service.GetFeatureOnlineStoreRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ feature_online_store_admin_service.GetFeatureOnlineStoreRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for get_feature_online_store @@ -331,10 +343,10 @@ async def post_get_feature_online_store( async def pre_get_feature_view( self, request: feature_online_store_admin_service.GetFeatureViewRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ feature_online_store_admin_service.GetFeatureViewRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for get_feature_view @@ -357,10 +369,10 @@ async def post_get_feature_view( async def pre_get_feature_view_sync( self, request: feature_online_store_admin_service.GetFeatureViewSyncRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ feature_online_store_admin_service.GetFeatureViewSyncRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for get_feature_view_sync @@ -383,10 +395,10 @@ async def post_get_feature_view_sync( async def pre_list_feature_online_stores( self, request: feature_online_store_admin_service.ListFeatureOnlineStoresRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ feature_online_store_admin_service.ListFeatureOnlineStoresRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for list_feature_online_stores @@ -410,10 +422,10 @@ async def post_list_feature_online_stores( async def pre_list_feature_views( self, request: feature_online_store_admin_service.ListFeatureViewsRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ feature_online_store_admin_service.ListFeatureViewsRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for list_feature_views @@ -436,10 +448,10 @@ async def post_list_feature_views( async def pre_list_feature_view_syncs( self, request: feature_online_store_admin_service.ListFeatureViewSyncsRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ feature_online_store_admin_service.ListFeatureViewSyncsRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for list_feature_view_syncs @@ -462,10 +474,10 @@ async def post_list_feature_view_syncs( async def pre_sync_feature_view( self, request: feature_online_store_admin_service.SyncFeatureViewRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ feature_online_store_admin_service.SyncFeatureViewRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for sync_feature_view @@ -488,10 +500,10 @@ async def post_sync_feature_view( async def pre_update_feature_online_store( self, request: feature_online_store_admin_service.UpdateFeatureOnlineStoreRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ feature_online_store_admin_service.UpdateFeatureOnlineStoreRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for update_feature_online_store @@ -514,10 +526,10 @@ async def post_update_feature_online_store( async def pre_update_feature_view( self, request: feature_online_store_admin_service.UpdateFeatureViewRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ feature_online_store_admin_service.UpdateFeatureViewRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for update_feature_view @@ -540,8 +552,10 @@ async def post_update_feature_view( async def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -563,8 +577,10 @@ async def post_get_location( async def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -586,8 +602,10 @@ async def post_list_locations( async def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -609,8 +627,10 @@ async def post_get_iam_policy( async def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -632,8 +652,11 @@ async def post_set_iam_policy( async def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -655,8 +678,10 @@ async def post_test_iam_permissions( async def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -676,8 +701,10 @@ async def post_cancel_operation(self, response: None) -> None: async 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 @@ -697,8 +724,10 @@ async def post_delete_operation(self, response: None) -> None: async 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 @@ -720,8 +749,10 @@ async def post_get_operation( async 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 @@ -743,8 +774,10 @@ async def post_list_operations( async def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -999,7 +1032,7 @@ async 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 feature online store method over HTTP. @@ -1011,8 +1044,10 @@ async def __call__( 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: @@ -1025,6 +1060,7 @@ async def __call__( http_options = ( _BaseFeatureOnlineStoreAdminServiceRestTransport._BaseCreateFeatureOnlineStore._get_http_options() ) + request, metadata = await self._interceptor.pre_create_feature_online_store( request, metadata ) @@ -1041,6 +1077,33 @@ async 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.aiplatform_v1.FeatureOnlineStoreAdminServiceClient.CreateFeatureOnlineStore", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService", + "rpcName": "CreateFeatureOnlineStore", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeatureOnlineStoreAdminServiceRestTransport._CreateFeatureOnlineStore._get_response( self._host, @@ -1069,6 +1132,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_create_feature_online_store(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.FeatureOnlineStoreAdminServiceAsyncClient.create_feature_online_store", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService", + "rpcName": "CreateFeatureOnlineStore", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _CreateFeatureView( @@ -1110,7 +1195,7 @@ async 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 feature view method over HTTP. @@ -1121,8 +1206,10 @@ async def __call__( 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: @@ -1135,6 +1222,7 @@ async def __call__( http_options = ( _BaseFeatureOnlineStoreAdminServiceRestTransport._BaseCreateFeatureView._get_http_options() ) + request, metadata = await self._interceptor.pre_create_feature_view( request, metadata ) @@ -1151,6 +1239,33 @@ async 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.aiplatform_v1.FeatureOnlineStoreAdminServiceClient.CreateFeatureView", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService", + "rpcName": "CreateFeatureView", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeatureOnlineStoreAdminServiceRestTransport._CreateFeatureView._get_response( self._host, @@ -1179,6 +1294,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_create_feature_view(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.FeatureOnlineStoreAdminServiceAsyncClient.create_feature_view", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService", + "rpcName": "CreateFeatureView", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _DeleteFeatureOnlineStore( @@ -1219,7 +1356,7 @@ async 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 feature online store method over HTTP. @@ -1231,8 +1368,10 @@ async def __call__( 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: @@ -1245,6 +1384,7 @@ async def __call__( http_options = ( _BaseFeatureOnlineStoreAdminServiceRestTransport._BaseDeleteFeatureOnlineStore._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_feature_online_store( request, metadata ) @@ -1257,6 +1397,33 @@ async 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.aiplatform_v1.FeatureOnlineStoreAdminServiceClient.DeleteFeatureOnlineStore", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService", + "rpcName": "DeleteFeatureOnlineStore", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeatureOnlineStoreAdminServiceRestTransport._DeleteFeatureOnlineStore._get_response( self._host, @@ -1284,6 +1451,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_delete_feature_online_store(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.FeatureOnlineStoreAdminServiceAsyncClient.delete_feature_online_store", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService", + "rpcName": "DeleteFeatureOnlineStore", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _DeleteFeatureView( @@ -1324,7 +1513,7 @@ async 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 feature view method over HTTP. @@ -1335,8 +1524,10 @@ async def __call__( 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: @@ -1349,6 +1540,7 @@ async def __call__( http_options = ( _BaseFeatureOnlineStoreAdminServiceRestTransport._BaseDeleteFeatureView._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_feature_view( request, metadata ) @@ -1361,6 +1553,33 @@ async 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.aiplatform_v1.FeatureOnlineStoreAdminServiceClient.DeleteFeatureView", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService", + "rpcName": "DeleteFeatureView", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeatureOnlineStoreAdminServiceRestTransport._DeleteFeatureView._get_response( self._host, @@ -1388,6 +1607,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_delete_feature_view(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.FeatureOnlineStoreAdminServiceAsyncClient.delete_feature_view", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService", + "rpcName": "DeleteFeatureView", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _GetFeatureOnlineStore( @@ -1428,7 +1669,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> feature_online_store.FeatureOnlineStore: r"""Call the get feature online store method over HTTP. @@ -1439,8 +1680,10 @@ async def __call__( 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: ~.feature_online_store.FeatureOnlineStore: @@ -1455,6 +1698,7 @@ async def __call__( http_options = ( _BaseFeatureOnlineStoreAdminServiceRestTransport._BaseGetFeatureOnlineStore._get_http_options() ) + request, metadata = await self._interceptor.pre_get_feature_online_store( request, metadata ) @@ -1467,6 +1711,33 @@ async 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.aiplatform_v1.FeatureOnlineStoreAdminServiceClient.GetFeatureOnlineStore", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService", + "rpcName": "GetFeatureOnlineStore", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeatureOnlineStoreAdminServiceRestTransport._GetFeatureOnlineStore._get_response( self._host, @@ -1494,6 +1765,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_get_feature_online_store(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = feature_online_store.FeatureOnlineStore.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.FeatureOnlineStoreAdminServiceAsyncClient.get_feature_online_store", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService", + "rpcName": "GetFeatureOnlineStore", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _GetFeatureView( @@ -1534,7 +1829,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> feature_view.FeatureView: r"""Call the get feature view method over HTTP. @@ -1545,8 +1840,10 @@ async def __call__( 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: ~.feature_view.FeatureView: @@ -1559,6 +1856,7 @@ async def __call__( http_options = ( _BaseFeatureOnlineStoreAdminServiceRestTransport._BaseGetFeatureView._get_http_options() ) + request, metadata = await self._interceptor.pre_get_feature_view( request, metadata ) @@ -1571,6 +1869,33 @@ async 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.aiplatform_v1.FeatureOnlineStoreAdminServiceClient.GetFeatureView", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService", + "rpcName": "GetFeatureView", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeatureOnlineStoreAdminServiceRestTransport._GetFeatureView._get_response( self._host, @@ -1598,6 +1923,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_get_feature_view(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = feature_view.FeatureView.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.FeatureOnlineStoreAdminServiceAsyncClient.get_feature_view", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService", + "rpcName": "GetFeatureView", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _GetFeatureViewSync( @@ -1638,7 +1985,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> feature_view_sync.FeatureViewSync: r"""Call the get feature view sync method over HTTP. @@ -1649,8 +1996,10 @@ async def __call__( 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: ~.feature_view_sync.FeatureViewSync: @@ -1664,6 +2013,7 @@ async def __call__( http_options = ( _BaseFeatureOnlineStoreAdminServiceRestTransport._BaseGetFeatureViewSync._get_http_options() ) + request, metadata = await self._interceptor.pre_get_feature_view_sync( request, metadata ) @@ -1676,6 +2026,33 @@ async 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.aiplatform_v1.FeatureOnlineStoreAdminServiceClient.GetFeatureViewSync", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService", + "rpcName": "GetFeatureViewSync", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeatureOnlineStoreAdminServiceRestTransport._GetFeatureViewSync._get_response( self._host, @@ -1703,6 +2080,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_get_feature_view_sync(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = feature_view_sync.FeatureViewSync.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.FeatureOnlineStoreAdminServiceAsyncClient.get_feature_view_sync", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService", + "rpcName": "GetFeatureViewSync", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ListFeatureOnlineStores( @@ -1743,7 +2144,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> feature_online_store_admin_service.ListFeatureOnlineStoresResponse: r"""Call the list feature online stores method over HTTP. @@ -1755,8 +2156,10 @@ async def __call__( 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: ~.feature_online_store_admin_service.ListFeatureOnlineStoresResponse: @@ -1768,6 +2171,7 @@ async def __call__( http_options = ( _BaseFeatureOnlineStoreAdminServiceRestTransport._BaseListFeatureOnlineStores._get_http_options() ) + request, metadata = await self._interceptor.pre_list_feature_online_stores( request, metadata ) @@ -1780,6 +2184,33 @@ async 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.aiplatform_v1.FeatureOnlineStoreAdminServiceClient.ListFeatureOnlineStores", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService", + "rpcName": "ListFeatureOnlineStores", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeatureOnlineStoreAdminServiceRestTransport._ListFeatureOnlineStores._get_response( self._host, @@ -1811,6 +2242,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_list_feature_online_stores(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = feature_online_store_admin_service.ListFeatureOnlineStoresResponse.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.FeatureOnlineStoreAdminServiceAsyncClient.list_feature_online_stores", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService", + "rpcName": "ListFeatureOnlineStores", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ListFeatureViews( @@ -1851,7 +2306,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> feature_online_store_admin_service.ListFeatureViewsResponse: r"""Call the list feature views method over HTTP. @@ -1862,8 +2317,10 @@ async def __call__( 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: ~.feature_online_store_admin_service.ListFeatureViewsResponse: @@ -1875,6 +2332,7 @@ async def __call__( http_options = ( _BaseFeatureOnlineStoreAdminServiceRestTransport._BaseListFeatureViews._get_http_options() ) + request, metadata = await self._interceptor.pre_list_feature_views( request, metadata ) @@ -1887,6 +2345,33 @@ async 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.aiplatform_v1.FeatureOnlineStoreAdminServiceClient.ListFeatureViews", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService", + "rpcName": "ListFeatureViews", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeatureOnlineStoreAdminServiceRestTransport._ListFeatureViews._get_response( self._host, @@ -1916,6 +2401,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_list_feature_views(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = feature_online_store_admin_service.ListFeatureViewsResponse.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.FeatureOnlineStoreAdminServiceAsyncClient.list_feature_views", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService", + "rpcName": "ListFeatureViews", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ListFeatureViewSyncs( @@ -1956,7 +2465,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> feature_online_store_admin_service.ListFeatureViewSyncsResponse: r"""Call the list feature view syncs method over HTTP. @@ -1967,8 +2476,10 @@ async def __call__( 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: ~.feature_online_store_admin_service.ListFeatureViewSyncsResponse: @@ -1980,6 +2491,7 @@ async def __call__( http_options = ( _BaseFeatureOnlineStoreAdminServiceRestTransport._BaseListFeatureViewSyncs._get_http_options() ) + request, metadata = await self._interceptor.pre_list_feature_view_syncs( request, metadata ) @@ -1992,6 +2504,33 @@ async 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.aiplatform_v1.FeatureOnlineStoreAdminServiceClient.ListFeatureViewSyncs", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService", + "rpcName": "ListFeatureViewSyncs", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeatureOnlineStoreAdminServiceRestTransport._ListFeatureViewSyncs._get_response( self._host, @@ -2021,6 +2560,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_list_feature_view_syncs(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = feature_online_store_admin_service.ListFeatureViewSyncsResponse.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.FeatureOnlineStoreAdminServiceAsyncClient.list_feature_view_syncs", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService", + "rpcName": "ListFeatureViewSyncs", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _SyncFeatureView( @@ -2062,7 +2625,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> feature_online_store_admin_service.SyncFeatureViewResponse: r"""Call the sync feature view method over HTTP. @@ -2073,8 +2636,10 @@ async def __call__( 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: ~.feature_online_store_admin_service.SyncFeatureViewResponse: @@ -2086,6 +2651,7 @@ async def __call__( http_options = ( _BaseFeatureOnlineStoreAdminServiceRestTransport._BaseSyncFeatureView._get_http_options() ) + request, metadata = await self._interceptor.pre_sync_feature_view( request, metadata ) @@ -2102,6 +2668,33 @@ async 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.aiplatform_v1.FeatureOnlineStoreAdminServiceClient.SyncFeatureView", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService", + "rpcName": "SyncFeatureView", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeatureOnlineStoreAdminServiceRestTransport._SyncFeatureView._get_response( self._host, @@ -2132,6 +2725,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_sync_feature_view(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = feature_online_store_admin_service.SyncFeatureViewResponse.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.FeatureOnlineStoreAdminServiceAsyncClient.sync_feature_view", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService", + "rpcName": "SyncFeatureView", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _UpdateFeatureOnlineStore( @@ -2173,7 +2790,7 @@ async 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 feature online store method over HTTP. @@ -2185,8 +2802,10 @@ async def __call__( 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: @@ -2199,6 +2818,7 @@ async def __call__( http_options = ( _BaseFeatureOnlineStoreAdminServiceRestTransport._BaseUpdateFeatureOnlineStore._get_http_options() ) + request, metadata = await self._interceptor.pre_update_feature_online_store( request, metadata ) @@ -2215,6 +2835,33 @@ async 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.aiplatform_v1.FeatureOnlineStoreAdminServiceClient.UpdateFeatureOnlineStore", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService", + "rpcName": "UpdateFeatureOnlineStore", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeatureOnlineStoreAdminServiceRestTransport._UpdateFeatureOnlineStore._get_response( self._host, @@ -2243,6 +2890,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_update_feature_online_store(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.FeatureOnlineStoreAdminServiceAsyncClient.update_feature_online_store", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService", + "rpcName": "UpdateFeatureOnlineStore", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _UpdateFeatureView( @@ -2284,7 +2953,7 @@ async 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 feature view method over HTTP. @@ -2295,8 +2964,10 @@ async def __call__( 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: @@ -2309,6 +2980,7 @@ async def __call__( http_options = ( _BaseFeatureOnlineStoreAdminServiceRestTransport._BaseUpdateFeatureView._get_http_options() ) + request, metadata = await self._interceptor.pre_update_feature_view( request, metadata ) @@ -2325,6 +2997,33 @@ async 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.aiplatform_v1.FeatureOnlineStoreAdminServiceClient.UpdateFeatureView", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService", + "rpcName": "UpdateFeatureView", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeatureOnlineStoreAdminServiceRestTransport._UpdateFeatureView._get_response( self._host, @@ -2353,6 +3052,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_update_feature_view(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.FeatureOnlineStoreAdminServiceAsyncClient.update_feature_view", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService", + "rpcName": "UpdateFeatureView", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp @property @@ -4389,7 +5110,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -4400,8 +5121,10 @@ async def __call__( 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: locations_pb2.Location: Response from GetLocation method. @@ -4410,6 +5133,7 @@ async def __call__( http_options = ( _BaseFeatureOnlineStoreAdminServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_location( request, metadata ) @@ -4422,6 +5146,33 @@ async 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.aiplatform_v1.FeatureOnlineStoreAdminServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeatureOnlineStoreAdminServiceRestTransport._GetLocation._get_response( self._host, @@ -4447,6 +5198,27 @@ async def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_location(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.aiplatform_v1.FeatureOnlineStoreAdminServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4491,7 +5263,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -4502,8 +5274,10 @@ async def __call__( 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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -4512,6 +5286,7 @@ async def __call__( http_options = ( _BaseFeatureOnlineStoreAdminServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_locations( request, metadata ) @@ -4524,6 +5299,33 @@ async 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.aiplatform_v1.FeatureOnlineStoreAdminServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeatureOnlineStoreAdminServiceRestTransport._ListLocations._get_response( self._host, @@ -4549,6 +5351,27 @@ async def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_list_locations(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.aiplatform_v1.FeatureOnlineStoreAdminServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4591,7 +5414,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -4602,8 +5425,10 @@ async def __call__( 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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -4612,6 +5437,7 @@ async def __call__( http_options = ( _BaseFeatureOnlineStoreAdminServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_get_iam_policy( request, metadata ) @@ -4624,6 +5450,33 @@ async 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.aiplatform_v1.FeatureOnlineStoreAdminServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeatureOnlineStoreAdminServiceRestTransport._GetIamPolicy._get_response( self._host, @@ -4649,6 +5502,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_iam_policy(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.aiplatform_v1.FeatureOnlineStoreAdminServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4692,7 +5566,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -4703,8 +5577,10 @@ async def __call__( 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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -4713,6 +5589,7 @@ async def __call__( http_options = ( _BaseFeatureOnlineStoreAdminServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_set_iam_policy( request, metadata ) @@ -4729,6 +5606,33 @@ async 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.aiplatform_v1.FeatureOnlineStoreAdminServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeatureOnlineStoreAdminServiceRestTransport._SetIamPolicy._get_response( self._host, @@ -4755,6 +5659,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_set_iam_policy(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.aiplatform_v1.FeatureOnlineStoreAdminServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4799,7 +5724,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -4810,8 +5735,10 @@ async def __call__( 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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -4820,6 +5747,7 @@ async def __call__( http_options = ( _BaseFeatureOnlineStoreAdminServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = await self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -4832,6 +5760,33 @@ async 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.aiplatform_v1.FeatureOnlineStoreAdminServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeatureOnlineStoreAdminServiceRestTransport._TestIamPermissions._get_response( self._host, @@ -4857,6 +5812,27 @@ async def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_test_iam_permissions(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.aiplatform_v1.FeatureOnlineStoreAdminServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4901,7 +5877,7 @@ async 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 cancel operation method over HTTP. @@ -4912,13 +5888,16 @@ async def __call__( 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`. """ http_options = ( _BaseFeatureOnlineStoreAdminServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_cancel_operation( request, metadata ) @@ -4931,6 +5910,33 @@ async 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.aiplatform_v1.FeatureOnlineStoreAdminServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeatureOnlineStoreAdminServiceRestTransport._CancelOperation._get_response( self._host, @@ -4996,7 +6002,7 @@ async 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. @@ -5007,13 +6013,16 @@ async def __call__( 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`. """ http_options = ( _BaseFeatureOnlineStoreAdminServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_operation( request, metadata ) @@ -5026,6 +6035,33 @@ async 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.aiplatform_v1.FeatureOnlineStoreAdminServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeatureOnlineStoreAdminServiceRestTransport._DeleteOperation._get_response( self._host, @@ -5089,7 +6125,7 @@ async 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. @@ -5100,8 +6136,10 @@ async def __call__( 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: Response from GetOperation method. @@ -5110,6 +6148,7 @@ async def __call__( http_options = ( _BaseFeatureOnlineStoreAdminServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_operation( request, metadata ) @@ -5122,6 +6161,33 @@ async 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.aiplatform_v1.FeatureOnlineStoreAdminServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeatureOnlineStoreAdminServiceRestTransport._GetOperation._get_response( self._host, @@ -5147,6 +6213,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1.FeatureOnlineStoreAdminServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5191,7 +6278,7 @@ async 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. @@ -5202,8 +6289,10 @@ async def __call__( 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 from ListOperations method. @@ -5212,6 +6301,7 @@ async def __call__( http_options = ( _BaseFeatureOnlineStoreAdminServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_operations( request, metadata ) @@ -5224,6 +6314,33 @@ async 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.aiplatform_v1.FeatureOnlineStoreAdminServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeatureOnlineStoreAdminServiceRestTransport._ListOperations._get_response( self._host, @@ -5249,6 +6366,27 @@ async def __call__( resp = operations_pb2.ListOperationsResponse() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1.FeatureOnlineStoreAdminServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5293,7 +6431,7 @@ async 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 wait operation method over HTTP. @@ -5304,8 +6442,10 @@ async def __call__( 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: Response from WaitOperation method. @@ -5314,6 +6454,7 @@ async def __call__( http_options = ( _BaseFeatureOnlineStoreAdminServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_wait_operation( request, metadata ) @@ -5326,6 +6467,33 @@ async 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.aiplatform_v1.FeatureOnlineStoreAdminServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeatureOnlineStoreAdminServiceRestTransport._WaitOperation._get_response( self._host, @@ -5351,6 +6519,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_wait_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.aiplatform_v1.FeatureOnlineStoreAdminServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreAdminService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1/services/feature_online_store_service/async_client.py b/google/cloud/aiplatform_v1/services/feature_online_store_service/async_client.py index 20cb6cd87b..47ae8ca418 100644 --- a/google/cloud/aiplatform_v1/services/feature_online_store_service/async_client.py +++ b/google/cloud/aiplatform_v1/services/feature_online_store_service/async_client.py @@ -13,6 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging as std_logging from collections import OrderedDict import re from typing import ( @@ -53,6 +54,15 @@ from .transports.grpc_asyncio import FeatureOnlineStoreServiceGrpcAsyncIOTransport from .client import FeatureOnlineStoreServiceClient +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 FeatureOnlineStoreServiceAsyncClient: """A service for fetching feature values from the online store.""" @@ -272,6 +282,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.aiplatform_v1.FeatureOnlineStoreServiceAsyncClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreService", + "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.aiplatform.v1.FeatureOnlineStoreService", + "credentialsType": None, + }, + ) + async def fetch_feature_values( self, request: Optional[ @@ -282,7 +314,7 @@ async def fetch_feature_values( data_key: Optional[feature_online_store_service.FeatureViewDataKey] = 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]]] = (), ) -> feature_online_store_service.FetchFeatureValuesResponse: r"""Fetch feature values under a FeatureView. @@ -335,8 +367,10 @@ async def sample_fetch_feature_values(): 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.aiplatform_v1.types.FetchFeatureValuesResponse: @@ -404,7 +438,7 @@ async def search_nearest_entities( *, 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]]] = (), ) -> feature_online_store_service.SearchNearestEntitiesResponse: r"""Search the nearest entities under a FeatureView. Search only works for indexable feature view; if a @@ -448,8 +482,10 @@ async def sample_search_nearest_entities(): 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.aiplatform_v1.types.SearchNearestEntitiesResponse: @@ -499,7 +535,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. @@ -510,8 +546,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. @@ -552,7 +590,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. @@ -563,8 +601,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. @@ -605,7 +645,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. @@ -621,8 +661,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 """ @@ -659,7 +701,7 @@ async def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -674,8 +716,10 @@ async def cancel_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 """ @@ -712,7 +756,7 @@ async def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -729,8 +773,10 @@ async def wait_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. @@ -771,7 +817,7 @@ async def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -784,8 +830,10 @@ async def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -890,7 +938,7 @@ async def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -904,8 +952,10 @@ async def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -1010,7 +1060,7 @@ async def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -1025,8 +1075,10 @@ async def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -1070,7 +1122,7 @@ async def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -1081,8 +1133,10 @@ async def get_location( 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: ~.location_pb2.Location: Location object. @@ -1123,7 +1177,7 @@ async def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -1134,8 +1188,10 @@ async def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1/services/feature_online_store_service/client.py b/google/cloud/aiplatform_v1/services/feature_online_store_service/client.py index f42d716803..1484975278 100644 --- a/google/cloud/aiplatform_v1/services/feature_online_store_service/client.py +++ b/google/cloud/aiplatform_v1/services/feature_online_store_service/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 ( @@ -48,6 +49,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.cloud.aiplatform_v1.types import feature_online_store_service from google.cloud.location import locations_pb2 # type: ignore from google.iam.v1 import iam_policy_pb2 # type: ignore @@ -607,6 +617,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( @@ -698,6 +712,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.aiplatform_v1.FeatureOnlineStoreServiceClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreService", + "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.aiplatform.v1.FeatureOnlineStoreService", + "credentialsType": None, + }, + ) + def fetch_feature_values( self, request: Optional[ @@ -708,7 +745,7 @@ def fetch_feature_values( data_key: Optional[feature_online_store_service.FeatureViewDataKey] = 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]]] = (), ) -> feature_online_store_service.FetchFeatureValuesResponse: r"""Fetch feature values under a FeatureView. @@ -761,8 +798,10 @@ def sample_fetch_feature_values(): 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.aiplatform_v1.types.FetchFeatureValuesResponse: @@ -827,7 +866,7 @@ def search_nearest_entities( *, 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]]] = (), ) -> feature_online_store_service.SearchNearestEntitiesResponse: r"""Search the nearest entities under a FeatureView. Search only works for indexable feature view; if a @@ -871,8 +910,10 @@ def sample_search_nearest_entities(): 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.aiplatform_v1.types.SearchNearestEntitiesResponse: @@ -933,7 +974,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. @@ -944,8 +985,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. @@ -986,7 +1029,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. @@ -997,8 +1040,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. @@ -1039,7 +1084,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. @@ -1055,8 +1100,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 """ @@ -1093,7 +1140,7 @@ def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -1108,8 +1155,10 @@ def cancel_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 """ @@ -1146,7 +1195,7 @@ def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -1163,8 +1212,10 @@ def wait_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. @@ -1205,7 +1256,7 @@ def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -1218,8 +1269,10 @@ def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -1324,7 +1377,7 @@ def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -1338,8 +1391,10 @@ def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -1444,7 +1499,7 @@ def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -1459,8 +1514,10 @@ def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -1502,7 +1559,7 @@ def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -1513,8 +1570,10 @@ def get_location( 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: ~.location_pb2.Location: Location object. @@ -1555,7 +1614,7 @@ def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -1566,8 +1625,10 @@ def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1/services/feature_online_store_service/transports/grpc.py b/google/cloud/aiplatform_v1/services/feature_online_store_service/transports/grpc.py index ed5dae5c96..56cb59a642 100644 --- a/google/cloud/aiplatform_v1/services/feature_online_store_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1/services/feature_online_store_service/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 import warnings from typing import Callable, Dict, Optional, Sequence, Tuple, Union @@ -21,8 +24,11 @@ import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from google.cloud.aiplatform_v1.types import feature_online_store_service from google.cloud.location import locations_pb2 # type: ignore @@ -31,6 +37,81 @@ from google.longrunning import operations_pb2 # type: ignore from .base import FeatureOnlineStoreServiceTransport, DEFAULT_CLIENT_INFO +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.aiplatform.v1.FeatureOnlineStoreService", + "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.aiplatform.v1.FeatureOnlineStoreService", + "rpcName": client_call_details.method, + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class FeatureOnlineStoreServiceGrpcTransport(FeatureOnlineStoreServiceTransport): """gRPC backend transport for FeatureOnlineStoreService. @@ -184,7 +265,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 @@ -261,7 +347,7 @@ def fetch_feature_values( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "fetch_feature_values" not in self._stubs: - self._stubs["fetch_feature_values"] = self.grpc_channel.unary_unary( + self._stubs["fetch_feature_values"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.FeatureOnlineStoreService/FetchFeatureValues", request_serializer=feature_online_store_service.FetchFeatureValuesRequest.serialize, response_deserializer=feature_online_store_service.FetchFeatureValuesResponse.deserialize, @@ -293,7 +379,7 @@ def search_nearest_entities( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "search_nearest_entities" not in self._stubs: - self._stubs["search_nearest_entities"] = self.grpc_channel.unary_unary( + self._stubs["search_nearest_entities"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.FeatureOnlineStoreService/SearchNearestEntities", request_serializer=feature_online_store_service.SearchNearestEntitiesRequest.serialize, response_deserializer=feature_online_store_service.SearchNearestEntitiesResponse.deserialize, @@ -301,7 +387,7 @@ def search_nearest_entities( return self._stubs["search_nearest_entities"] def close(self): - self.grpc_channel.close() + self._logged_channel.close() @property def delete_operation( @@ -313,7 +399,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, @@ -330,7 +416,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -347,7 +433,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -364,7 +450,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, @@ -383,7 +469,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, @@ -402,7 +488,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -419,7 +505,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -444,7 +530,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -470,7 +556,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -499,7 +585,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1/services/feature_online_store_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1/services/feature_online_store_service/transports/grpc_asyncio.py index 3e53fcb30a..5cf0b283b5 100644 --- a/google/cloud/aiplatform_v1/services/feature_online_store_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1/services/feature_online_store_service/transports/grpc_asyncio.py @@ -14,6 +14,9 @@ # limitations under the License. # import inspect +import json +import pickle +import logging as std_logging import warnings from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union @@ -23,8 +26,11 @@ from google.api_core import retry_async as retries from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from grpc.experimental import aio # type: ignore from google.cloud.aiplatform_v1.types import feature_online_store_service @@ -35,6 +41,82 @@ from .base import FeatureOnlineStoreServiceTransport, DEFAULT_CLIENT_INFO from .grpc import FeatureOnlineStoreServiceGrpcTransport +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.aiplatform.v1.FeatureOnlineStoreService", + "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.aiplatform.v1.FeatureOnlineStoreService", + "rpcName": str(client_call_details.method), + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class FeatureOnlineStoreServiceGrpcAsyncIOTransport(FeatureOnlineStoreServiceTransport): """gRPC AsyncIO backend transport for FeatureOnlineStoreService. @@ -231,10 +313,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 @@ -269,7 +354,7 @@ def fetch_feature_values( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "fetch_feature_values" not in self._stubs: - self._stubs["fetch_feature_values"] = self.grpc_channel.unary_unary( + self._stubs["fetch_feature_values"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.FeatureOnlineStoreService/FetchFeatureValues", request_serializer=feature_online_store_service.FetchFeatureValuesRequest.serialize, response_deserializer=feature_online_store_service.FetchFeatureValuesResponse.deserialize, @@ -301,7 +386,7 @@ def search_nearest_entities( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "search_nearest_entities" not in self._stubs: - self._stubs["search_nearest_entities"] = self.grpc_channel.unary_unary( + self._stubs["search_nearest_entities"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.FeatureOnlineStoreService/SearchNearestEntities", request_serializer=feature_online_store_service.SearchNearestEntitiesRequest.serialize, response_deserializer=feature_online_store_service.SearchNearestEntitiesResponse.deserialize, @@ -379,7 +464,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: @@ -395,7 +480,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, @@ -412,7 +497,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -429,7 +514,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -446,7 +531,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, @@ -465,7 +550,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, @@ -484,7 +569,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -501,7 +586,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -526,7 +611,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -552,7 +637,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -581,7 +666,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1/services/feature_online_store_service/transports/rest.py b/google/cloud/aiplatform_v1/services/feature_online_store_service/transports/rest.py index c72228afd4..5fea64417c 100644 --- a/google/cloud/aiplatform_v1/services/feature_online_store_service/transports/rest.py +++ b/google/cloud/aiplatform_v1/services/feature_online_store_service/transports/rest.py @@ -13,9 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging +import json # type: ignore from google.auth.transport.requests import AuthorizedSession # type: ignore -import json # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.api_core import exceptions as core_exceptions from google.api_core import retry as retries @@ -46,6 +47,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, @@ -94,10 +103,10 @@ def post_search_nearest_entities(self, response): def pre_fetch_feature_values( self, request: feature_online_store_service.FetchFeatureValuesRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ feature_online_store_service.FetchFeatureValuesRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for fetch_feature_values @@ -120,10 +129,10 @@ def post_fetch_feature_values( def pre_search_nearest_entities( self, request: feature_online_store_service.SearchNearestEntitiesRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ feature_online_store_service.SearchNearestEntitiesRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for search_nearest_entities @@ -146,8 +155,10 @@ def post_search_nearest_entities( def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -169,8 +180,10 @@ def post_get_location( def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -192,8 +205,10 @@ def post_list_locations( def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -213,8 +228,10 @@ def post_get_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -234,8 +251,11 @@ def post_set_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -257,8 +277,10 @@ def post_test_iam_permissions( def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -278,8 +300,10 @@ def post_cancel_operation(self, response: None) -> None: 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 @@ -299,8 +323,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 @@ -322,8 +348,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 @@ -345,8 +373,10 @@ def post_list_operations( def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -491,7 +521,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]]] = (), ) -> feature_online_store_service.FetchFeatureValuesResponse: r"""Call the fetch feature values method over HTTP. @@ -504,8 +534,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: ~.feature_online_store_service.FetchFeatureValuesResponse: @@ -517,6 +549,7 @@ def __call__( http_options = ( _BaseFeatureOnlineStoreServiceRestTransport._BaseFetchFeatureValues._get_http_options() ) + request, metadata = self._interceptor.pre_fetch_feature_values( request, metadata ) @@ -533,6 +566,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.aiplatform_v1.FeatureOnlineStoreServiceClient.FetchFeatureValues", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreService", + "rpcName": "FetchFeatureValues", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeatureOnlineStoreServiceRestTransport._FetchFeatureValues._get_response( self._host, @@ -554,7 +614,33 @@ def __call__( pb_resp = feature_online_store_service.FetchFeatureValuesResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_fetch_feature_values(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + feature_online_store_service.FetchFeatureValuesResponse.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.aiplatform_v1.FeatureOnlineStoreServiceClient.fetch_feature_values", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreService", + "rpcName": "FetchFeatureValues", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _SearchNearestEntities( @@ -594,7 +680,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]]] = (), ) -> feature_online_store_service.SearchNearestEntitiesResponse: r"""Call the search nearest entities method over HTTP. @@ -605,8 +691,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: ~.feature_online_store_service.SearchNearestEntitiesResponse: @@ -618,6 +706,7 @@ def __call__( http_options = ( _BaseFeatureOnlineStoreServiceRestTransport._BaseSearchNearestEntities._get_http_options() ) + request, metadata = self._interceptor.pre_search_nearest_entities( request, metadata ) @@ -634,6 +723,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.aiplatform_v1.FeatureOnlineStoreServiceClient.SearchNearestEntities", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreService", + "rpcName": "SearchNearestEntities", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeatureOnlineStoreServiceRestTransport._SearchNearestEntities._get_response( self._host, @@ -657,7 +773,31 @@ def __call__( ) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_search_nearest_entities(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = feature_online_store_service.SearchNearestEntitiesResponse.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.aiplatform_v1.FeatureOnlineStoreServiceClient.search_nearest_entities", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreService", + "rpcName": "SearchNearestEntities", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp @property @@ -722,7 +862,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]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -733,8 +873,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: locations_pb2.Location: Response from GetLocation method. @@ -743,6 +885,7 @@ def __call__( http_options = ( _BaseFeatureOnlineStoreServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = self._interceptor.pre_get_location(request, metadata) transcoded_request = _BaseFeatureOnlineStoreServiceRestTransport._BaseGetLocation._get_transcoded_request( http_options, request @@ -753,6 +896,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.aiplatform_v1.FeatureOnlineStoreServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( FeatureOnlineStoreServiceRestTransport._GetLocation._get_response( @@ -774,6 +944,27 @@ def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_location(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.aiplatform_v1.FeatureOnlineStoreServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -816,7 +1007,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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -827,8 +1018,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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -837,6 +1030,7 @@ def __call__( http_options = ( _BaseFeatureOnlineStoreServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = self._interceptor.pre_list_locations(request, metadata) transcoded_request = _BaseFeatureOnlineStoreServiceRestTransport._BaseListLocations._get_transcoded_request( http_options, request @@ -847,6 +1041,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.aiplatform_v1.FeatureOnlineStoreServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( FeatureOnlineStoreServiceRestTransport._ListLocations._get_response( @@ -868,6 +1089,27 @@ def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_list_locations(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.aiplatform_v1.FeatureOnlineStoreServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -910,7 +1152,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]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -921,8 +1163,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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -931,6 +1175,7 @@ def __call__( http_options = ( _BaseFeatureOnlineStoreServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_get_iam_policy(request, metadata) transcoded_request = _BaseFeatureOnlineStoreServiceRestTransport._BaseGetIamPolicy._get_transcoded_request( http_options, request @@ -941,6 +1186,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.aiplatform_v1.FeatureOnlineStoreServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( FeatureOnlineStoreServiceRestTransport._GetIamPolicy._get_response( @@ -962,6 +1234,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_iam_policy(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.aiplatform_v1.FeatureOnlineStoreServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1005,7 +1298,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]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -1016,8 +1309,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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -1026,6 +1321,7 @@ def __call__( http_options = ( _BaseFeatureOnlineStoreServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_set_iam_policy(request, metadata) transcoded_request = _BaseFeatureOnlineStoreServiceRestTransport._BaseSetIamPolicy._get_transcoded_request( http_options, request @@ -1040,6 +1336,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.aiplatform_v1.FeatureOnlineStoreServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( FeatureOnlineStoreServiceRestTransport._SetIamPolicy._get_response( @@ -1062,6 +1385,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_set_iam_policy(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.aiplatform_v1.FeatureOnlineStoreServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1104,7 +1448,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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -1115,8 +1459,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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -1125,6 +1471,7 @@ def __call__( http_options = ( _BaseFeatureOnlineStoreServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -1137,6 +1484,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.aiplatform_v1.FeatureOnlineStoreServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeatureOnlineStoreServiceRestTransport._TestIamPermissions._get_response( self._host, @@ -1156,6 +1530,27 @@ def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_test_iam_permissions(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.aiplatform_v1.FeatureOnlineStoreServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1198,7 +1593,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 cancel operation method over HTTP. @@ -1209,13 +1604,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 = ( _BaseFeatureOnlineStoreServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = self._interceptor.pre_cancel_operation( request, metadata ) @@ -1228,6 +1626,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.aiplatform_v1.FeatureOnlineStoreServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( FeatureOnlineStoreServiceRestTransport._CancelOperation._get_response( @@ -1287,7 +1712,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. @@ -1298,13 +1723,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 = ( _BaseFeatureOnlineStoreServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = self._interceptor.pre_delete_operation( request, metadata ) @@ -1317,6 +1745,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.aiplatform_v1.FeatureOnlineStoreServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( FeatureOnlineStoreServiceRestTransport._DeleteOperation._get_response( @@ -1376,7 +1831,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. @@ -1387,8 +1842,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. @@ -1397,6 +1854,7 @@ def __call__( http_options = ( _BaseFeatureOnlineStoreServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = self._interceptor.pre_get_operation(request, metadata) transcoded_request = _BaseFeatureOnlineStoreServiceRestTransport._BaseGetOperation._get_transcoded_request( http_options, request @@ -1407,6 +1865,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.aiplatform_v1.FeatureOnlineStoreServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( FeatureOnlineStoreServiceRestTransport._GetOperation._get_response( @@ -1428,6 +1913,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.aiplatform_v1.FeatureOnlineStoreServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1470,7 +1976,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. @@ -1481,8 +1987,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. @@ -1491,6 +1999,7 @@ def __call__( http_options = ( _BaseFeatureOnlineStoreServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = self._interceptor.pre_list_operations(request, metadata) transcoded_request = _BaseFeatureOnlineStoreServiceRestTransport._BaseListOperations._get_transcoded_request( http_options, request @@ -1501,6 +2010,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.aiplatform_v1.FeatureOnlineStoreServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( FeatureOnlineStoreServiceRestTransport._ListOperations._get_response( @@ -1522,6 +2058,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.aiplatform_v1.FeatureOnlineStoreServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1564,7 +2121,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 wait operation method over HTTP. @@ -1575,8 +2132,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 WaitOperation method. @@ -1585,6 +2144,7 @@ def __call__( http_options = ( _BaseFeatureOnlineStoreServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = self._interceptor.pre_wait_operation(request, metadata) transcoded_request = _BaseFeatureOnlineStoreServiceRestTransport._BaseWaitOperation._get_transcoded_request( http_options, request @@ -1595,6 +2155,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.aiplatform_v1.FeatureOnlineStoreServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( FeatureOnlineStoreServiceRestTransport._WaitOperation._get_response( @@ -1616,6 +2203,27 @@ def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = self._interceptor.post_wait_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.aiplatform_v1.FeatureOnlineStoreServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1/services/feature_online_store_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1/services/feature_online_store_service/transports/rest_asyncio.py index 2d9d079e60..e13eceebc4 100644 --- a/google/cloud/aiplatform_v1/services/feature_online_store_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1/services/feature_online_store_service/transports/rest_asyncio.py @@ -56,6 +56,18 @@ from .base import DEFAULT_CLIENT_INFO as BASE_DEFAULT_CLIENT_INFO + +import logging + +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__) + try: OptionalRetry = Union[retries.AsyncRetry, gapic_v1.method._MethodDefault, None] except AttributeError: # pragma: NO COVER @@ -108,10 +120,10 @@ async def post_search_nearest_entities(self, response): async def pre_fetch_feature_values( self, request: feature_online_store_service.FetchFeatureValuesRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ feature_online_store_service.FetchFeatureValuesRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for fetch_feature_values @@ -134,10 +146,10 @@ async def post_fetch_feature_values( async def pre_search_nearest_entities( self, request: feature_online_store_service.SearchNearestEntitiesRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ feature_online_store_service.SearchNearestEntitiesRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for search_nearest_entities @@ -160,8 +172,10 @@ async def post_search_nearest_entities( async def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -183,8 +197,10 @@ async def post_get_location( async def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -206,8 +222,10 @@ async def post_list_locations( async def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -229,8 +247,10 @@ async def post_get_iam_policy( async def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -252,8 +272,11 @@ async def post_set_iam_policy( async def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -275,8 +298,10 @@ async def post_test_iam_permissions( async def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -296,8 +321,10 @@ async def post_cancel_operation(self, response: None) -> None: async 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 @@ -317,8 +344,10 @@ async def post_delete_operation(self, response: None) -> None: async 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 @@ -340,8 +369,10 @@ async def post_get_operation( async 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 @@ -363,8 +394,10 @@ async def post_list_operations( async def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -558,7 +591,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> feature_online_store_service.FetchFeatureValuesResponse: r"""Call the fetch feature values method over HTTP. @@ -571,8 +604,10 @@ async def __call__( 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: ~.feature_online_store_service.FetchFeatureValuesResponse: @@ -584,6 +619,7 @@ async def __call__( http_options = ( _BaseFeatureOnlineStoreServiceRestTransport._BaseFetchFeatureValues._get_http_options() ) + request, metadata = await self._interceptor.pre_fetch_feature_values( request, metadata ) @@ -600,6 +636,33 @@ async 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.aiplatform_v1.FeatureOnlineStoreServiceClient.FetchFeatureValues", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreService", + "rpcName": "FetchFeatureValues", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeatureOnlineStoreServiceRestTransport._FetchFeatureValues._get_response( self._host, @@ -628,6 +691,32 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_fetch_feature_values(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + feature_online_store_service.FetchFeatureValuesResponse.to_json( + response + ) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.FeatureOnlineStoreServiceAsyncClient.fetch_feature_values", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreService", + "rpcName": "FetchFeatureValues", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _SearchNearestEntities( @@ -669,7 +758,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> feature_online_store_service.SearchNearestEntitiesResponse: r"""Call the search nearest entities method over HTTP. @@ -680,8 +769,10 @@ async def __call__( 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: ~.feature_online_store_service.SearchNearestEntitiesResponse: @@ -693,6 +784,7 @@ async def __call__( http_options = ( _BaseFeatureOnlineStoreServiceRestTransport._BaseSearchNearestEntities._get_http_options() ) + request, metadata = await self._interceptor.pre_search_nearest_entities( request, metadata ) @@ -709,6 +801,33 @@ async 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.aiplatform_v1.FeatureOnlineStoreServiceClient.SearchNearestEntities", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreService", + "rpcName": "SearchNearestEntities", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeatureOnlineStoreServiceRestTransport._SearchNearestEntities._get_response( self._host, @@ -739,6 +858,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_search_nearest_entities(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = feature_online_store_service.SearchNearestEntitiesResponse.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.FeatureOnlineStoreServiceAsyncClient.search_nearest_entities", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreService", + "rpcName": "SearchNearestEntities", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp @property @@ -799,7 +942,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -810,8 +953,10 @@ async def __call__( 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: locations_pb2.Location: Response from GetLocation method. @@ -820,6 +965,7 @@ async def __call__( http_options = ( _BaseFeatureOnlineStoreServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_location( request, metadata ) @@ -832,6 +978,33 @@ async 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.aiplatform_v1.FeatureOnlineStoreServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeatureOnlineStoreServiceRestTransport._GetLocation._get_response( self._host, @@ -857,6 +1030,27 @@ async def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_location(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.aiplatform_v1.FeatureOnlineStoreServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -899,7 +1093,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -910,8 +1104,10 @@ async def __call__( 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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -920,6 +1116,7 @@ async def __call__( http_options = ( _BaseFeatureOnlineStoreServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_locations( request, metadata ) @@ -932,6 +1129,33 @@ async 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.aiplatform_v1.FeatureOnlineStoreServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeatureOnlineStoreServiceRestTransport._ListLocations._get_response( self._host, @@ -957,6 +1181,27 @@ async def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_list_locations(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.aiplatform_v1.FeatureOnlineStoreServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -999,7 +1244,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -1010,8 +1255,10 @@ async def __call__( 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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -1020,6 +1267,7 @@ async def __call__( http_options = ( _BaseFeatureOnlineStoreServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_get_iam_policy( request, metadata ) @@ -1032,6 +1280,33 @@ async 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.aiplatform_v1.FeatureOnlineStoreServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeatureOnlineStoreServiceRestTransport._GetIamPolicy._get_response( self._host, @@ -1057,6 +1332,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_iam_policy(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.aiplatform_v1.FeatureOnlineStoreServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1100,7 +1396,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -1111,8 +1407,10 @@ async def __call__( 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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -1121,6 +1419,7 @@ async def __call__( http_options = ( _BaseFeatureOnlineStoreServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_set_iam_policy( request, metadata ) @@ -1137,6 +1436,33 @@ async 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.aiplatform_v1.FeatureOnlineStoreServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeatureOnlineStoreServiceRestTransport._SetIamPolicy._get_response( self._host, @@ -1163,6 +1489,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_set_iam_policy(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.aiplatform_v1.FeatureOnlineStoreServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1207,7 +1554,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -1218,8 +1565,10 @@ async def __call__( 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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -1228,6 +1577,7 @@ async def __call__( http_options = ( _BaseFeatureOnlineStoreServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = await self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -1240,6 +1590,33 @@ async 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.aiplatform_v1.FeatureOnlineStoreServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeatureOnlineStoreServiceRestTransport._TestIamPermissions._get_response( self._host, @@ -1265,6 +1642,27 @@ async def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_test_iam_permissions(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.aiplatform_v1.FeatureOnlineStoreServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1307,7 +1705,7 @@ async 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 cancel operation method over HTTP. @@ -1318,13 +1716,16 @@ async def __call__( 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`. """ http_options = ( _BaseFeatureOnlineStoreServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_cancel_operation( request, metadata ) @@ -1337,6 +1738,33 @@ async 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.aiplatform_v1.FeatureOnlineStoreServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeatureOnlineStoreServiceRestTransport._CancelOperation._get_response( self._host, @@ -1400,7 +1828,7 @@ async 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. @@ -1411,13 +1839,16 @@ async def __call__( 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`. """ http_options = ( _BaseFeatureOnlineStoreServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_operation( request, metadata ) @@ -1430,6 +1861,33 @@ async 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.aiplatform_v1.FeatureOnlineStoreServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeatureOnlineStoreServiceRestTransport._DeleteOperation._get_response( self._host, @@ -1493,7 +1951,7 @@ async 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. @@ -1504,8 +1962,10 @@ async def __call__( 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: Response from GetOperation method. @@ -1514,6 +1974,7 @@ async def __call__( http_options = ( _BaseFeatureOnlineStoreServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_operation( request, metadata ) @@ -1526,6 +1987,33 @@ async 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.aiplatform_v1.FeatureOnlineStoreServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeatureOnlineStoreServiceRestTransport._GetOperation._get_response( self._host, @@ -1551,6 +2039,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1.FeatureOnlineStoreServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1593,7 +2102,7 @@ async 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. @@ -1604,8 +2113,10 @@ async def __call__( 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 from ListOperations method. @@ -1614,6 +2125,7 @@ async def __call__( http_options = ( _BaseFeatureOnlineStoreServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_operations( request, metadata ) @@ -1626,6 +2138,33 @@ async 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.aiplatform_v1.FeatureOnlineStoreServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeatureOnlineStoreServiceRestTransport._ListOperations._get_response( self._host, @@ -1651,6 +2190,27 @@ async def __call__( resp = operations_pb2.ListOperationsResponse() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1.FeatureOnlineStoreServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1693,7 +2253,7 @@ async 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 wait operation method over HTTP. @@ -1704,8 +2264,10 @@ async def __call__( 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: Response from WaitOperation method. @@ -1714,6 +2276,7 @@ async def __call__( http_options = ( _BaseFeatureOnlineStoreServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_wait_operation( request, metadata ) @@ -1726,6 +2289,33 @@ async 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.aiplatform_v1.FeatureOnlineStoreServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeatureOnlineStoreServiceRestTransport._WaitOperation._get_response( self._host, @@ -1751,6 +2341,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_wait_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.aiplatform_v1.FeatureOnlineStoreServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureOnlineStoreService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1/services/feature_registry_service/async_client.py b/google/cloud/aiplatform_v1/services/feature_registry_service/async_client.py index 3b38c8326b..4e75484161 100644 --- a/google/cloud/aiplatform_v1/services/feature_registry_service/async_client.py +++ b/google/cloud/aiplatform_v1/services/feature_registry_service/async_client.py @@ -13,6 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging as std_logging from collections import OrderedDict import re from typing import ( @@ -64,6 +65,15 @@ from .transports.grpc_asyncio import FeatureRegistryServiceGrpcAsyncIOTransport from .client import FeatureRegistryServiceClient +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 FeatureRegistryServiceAsyncClient: """The service that handles CRUD and List for resources for @@ -281,6 +291,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.aiplatform_v1.FeatureRegistryServiceAsyncClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureRegistryService", + "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.aiplatform.v1.FeatureRegistryService", + "credentialsType": None, + }, + ) + async def create_feature_group( self, request: Optional[ @@ -292,7 +324,7 @@ async def create_feature_group( feature_group_id: 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"""Creates a new FeatureGroup in a given project and location. @@ -367,8 +399,10 @@ async def sample_create_feature_group(): 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: @@ -446,7 +480,7 @@ async def get_feature_group( 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]]] = (), ) -> feature_group.FeatureGroup: r"""Gets details of a single FeatureGroup. @@ -490,8 +524,10 @@ async def sample_get_feature_group(): 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.aiplatform_v1.types.FeatureGroup: @@ -552,7 +588,7 @@ async def list_feature_groups( 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.ListFeatureGroupsAsyncPager: r"""Lists FeatureGroups in a given project and location. @@ -598,8 +634,10 @@ async def sample_list_feature_groups(): 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.aiplatform_v1.services.feature_registry_service.pagers.ListFeatureGroupsAsyncPager: @@ -677,7 +715,7 @@ async def update_feature_group( 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"""Updates the parameters of a single FeatureGroup. @@ -749,8 +787,10 @@ async def sample_update_feature_group(): 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: @@ -829,7 +869,7 @@ async def delete_feature_group( force: Optional[bool] = 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"""Deletes a single FeatureGroup. @@ -887,8 +927,10 @@ async def sample_delete_feature_group(): 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: @@ -973,7 +1015,7 @@ async def create_feature( feature_id: 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"""Creates a new Feature in a given FeatureGroup. @@ -1048,8 +1090,10 @@ async def sample_create_feature(): 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: @@ -1130,7 +1174,7 @@ async def batch_create_features( ] = 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"""Creates a batch of Features in a given FeatureGroup. @@ -1199,8 +1243,10 @@ async def sample_batch_create_features(): 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: @@ -1273,7 +1319,7 @@ async def get_feature( 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]]] = (), ) -> feature.Feature: r"""Gets details of a single Feature. @@ -1322,8 +1368,10 @@ async def sample_get_feature(): 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.aiplatform_v1.types.Feature: @@ -1385,7 +1433,7 @@ async def list_features( 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.ListFeaturesAsyncPager: r"""Lists Features in a given FeatureGroup. @@ -1435,8 +1483,10 @@ async def sample_list_features(): 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.aiplatform_v1.services.feature_registry_service.pagers.ListFeaturesAsyncPager: @@ -1516,7 +1566,7 @@ async def update_feature( 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"""Updates the parameters of a single Feature. @@ -1589,8 +1639,10 @@ async def sample_update_feature(): 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: @@ -1668,7 +1720,7 @@ async def delete_feature( 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"""Deletes a single Feature. @@ -1720,8 +1772,10 @@ async def sample_delete_feature(): 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: @@ -1799,7 +1853,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. @@ -1810,8 +1864,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. @@ -1852,7 +1908,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. @@ -1863,8 +1919,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. @@ -1905,7 +1963,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. @@ -1921,8 +1979,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 """ @@ -1959,7 +2019,7 @@ async def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -1974,8 +2034,10 @@ async def cancel_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 """ @@ -2012,7 +2074,7 @@ async def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -2029,8 +2091,10 @@ async def wait_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. @@ -2071,7 +2135,7 @@ async def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -2084,8 +2148,10 @@ async def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -2190,7 +2256,7 @@ async def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -2204,8 +2270,10 @@ async def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -2310,7 +2378,7 @@ async def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -2325,8 +2393,10 @@ async def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -2370,7 +2440,7 @@ async def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -2381,8 +2451,10 @@ async def get_location( 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: ~.location_pb2.Location: Location object. @@ -2423,7 +2495,7 @@ async def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -2434,8 +2506,10 @@ async def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1/services/feature_registry_service/client.py b/google/cloud/aiplatform_v1/services/feature_registry_service/client.py index eb01ec8083..7ded4d3d77 100644 --- a/google/cloud/aiplatform_v1/services/feature_registry_service/client.py +++ b/google/cloud/aiplatform_v1/services/feature_registry_service/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 ( @@ -48,6 +49,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 as gac_operation # type: ignore from google.api_core import operation_async # type: ignore from google.cloud.aiplatform_v1.services.feature_registry_service import pagers @@ -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( @@ -731,6 +745,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.aiplatform_v1.FeatureRegistryServiceClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureRegistryService", + "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.aiplatform.v1.FeatureRegistryService", + "credentialsType": None, + }, + ) + def create_feature_group( self, request: Optional[ @@ -742,7 +779,7 @@ def create_feature_group( feature_group_id: 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]]] = (), ) -> gac_operation.Operation: r"""Creates a new FeatureGroup in a given project and location. @@ -817,8 +854,10 @@ def sample_create_feature_group(): 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: @@ -893,7 +932,7 @@ def get_feature_group( 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]]] = (), ) -> feature_group.FeatureGroup: r"""Gets details of a single FeatureGroup. @@ -937,8 +976,10 @@ def sample_get_feature_group(): 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.aiplatform_v1.types.FeatureGroup: @@ -996,7 +1037,7 @@ def list_feature_groups( 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.ListFeatureGroupsPager: r"""Lists FeatureGroups in a given project and location. @@ -1042,8 +1083,10 @@ def sample_list_feature_groups(): 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.aiplatform_v1.services.feature_registry_service.pagers.ListFeatureGroupsPager: @@ -1118,7 +1161,7 @@ def update_feature_group( 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]]] = (), ) -> gac_operation.Operation: r"""Updates the parameters of a single FeatureGroup. @@ -1190,8 +1233,10 @@ def sample_update_feature_group(): 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: @@ -1267,7 +1312,7 @@ def delete_feature_group( force: Optional[bool] = 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]]] = (), ) -> gac_operation.Operation: r"""Deletes a single FeatureGroup. @@ -1325,8 +1370,10 @@ def sample_delete_feature_group(): 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: @@ -1408,7 +1455,7 @@ def create_feature( feature_id: 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]]] = (), ) -> gac_operation.Operation: r"""Creates a new Feature in a given FeatureGroup. @@ -1483,8 +1530,10 @@ def sample_create_feature(): 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: @@ -1562,7 +1611,7 @@ def batch_create_features( ] = 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]]] = (), ) -> gac_operation.Operation: r"""Creates a batch of Features in a given FeatureGroup. @@ -1631,8 +1680,10 @@ def sample_batch_create_features(): 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: @@ -1702,7 +1753,7 @@ def get_feature( 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]]] = (), ) -> feature.Feature: r"""Gets details of a single Feature. @@ -1751,8 +1802,10 @@ def sample_get_feature(): 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.aiplatform_v1.types.Feature: @@ -1811,7 +1864,7 @@ def list_features( 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.ListFeaturesPager: r"""Lists Features in a given FeatureGroup. @@ -1861,8 +1914,10 @@ def sample_list_features(): 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.aiplatform_v1.services.feature_registry_service.pagers.ListFeaturesPager: @@ -1939,7 +1994,7 @@ def update_feature( 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]]] = (), ) -> gac_operation.Operation: r"""Updates the parameters of a single Feature. @@ -2012,8 +2067,10 @@ def sample_update_feature(): 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: @@ -2088,7 +2145,7 @@ def delete_feature( 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]]] = (), ) -> gac_operation.Operation: r"""Deletes a single Feature. @@ -2140,8 +2197,10 @@ def sample_delete_feature(): 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: @@ -2229,7 +2288,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. @@ -2240,8 +2299,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. @@ -2282,7 +2343,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. @@ -2293,8 +2354,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. @@ -2335,7 +2398,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. @@ -2351,8 +2414,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 """ @@ -2389,7 +2454,7 @@ def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -2404,8 +2469,10 @@ def cancel_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 """ @@ -2442,7 +2509,7 @@ def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -2459,8 +2526,10 @@ def wait_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. @@ -2501,7 +2570,7 @@ def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -2514,8 +2583,10 @@ def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -2620,7 +2691,7 @@ def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -2634,8 +2705,10 @@ def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -2740,7 +2813,7 @@ def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -2755,8 +2828,10 @@ def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -2798,7 +2873,7 @@ def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -2809,8 +2884,10 @@ def get_location( 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: ~.location_pb2.Location: Location object. @@ -2851,7 +2928,7 @@ def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -2862,8 +2939,10 @@ def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1/services/feature_registry_service/pagers.py b/google/cloud/aiplatform_v1/services/feature_registry_service/pagers.py index 1b301fa296..6e041eda7f 100644 --- a/google/cloud/aiplatform_v1/services/feature_registry_service/pagers.py +++ b/google/cloud/aiplatform_v1/services/feature_registry_service/pagers.py @@ -69,7 +69,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. @@ -83,8 +83,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 = feature_registry_service.ListFeatureGroupsRequest(request) @@ -145,7 +147,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. @@ -159,8 +161,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 = feature_registry_service.ListFeatureGroupsRequest(request) @@ -225,7 +229,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. @@ -239,8 +243,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 = featurestore_service.ListFeaturesRequest(request) @@ -299,7 +305,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. @@ -313,8 +319,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 = featurestore_service.ListFeaturesRequest(request) diff --git a/google/cloud/aiplatform_v1/services/feature_registry_service/transports/grpc.py b/google/cloud/aiplatform_v1/services/feature_registry_service/transports/grpc.py index 913d0f8461..a65b81ae85 100644 --- a/google/cloud/aiplatform_v1/services/feature_registry_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1/services/feature_registry_service/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 import warnings from typing import Callable, Dict, Optional, Sequence, Tuple, Union @@ -22,8 +25,11 @@ import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from google.cloud.aiplatform_v1.types import feature from google.cloud.aiplatform_v1.types import feature_group @@ -35,6 +41,81 @@ from google.longrunning import operations_pb2 # type: ignore from .base import FeatureRegistryServiceTransport, DEFAULT_CLIENT_INFO +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.aiplatform.v1.FeatureRegistryService", + "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.aiplatform.v1.FeatureRegistryService", + "rpcName": client_call_details.method, + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class FeatureRegistryServiceGrpcTransport(FeatureRegistryServiceTransport): """gRPC backend transport for FeatureRegistryService. @@ -190,7 +271,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 @@ -254,7 +340,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 @@ -281,7 +369,7 @@ def create_feature_group( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_feature_group" not in self._stubs: - self._stubs["create_feature_group"] = self.grpc_channel.unary_unary( + self._stubs["create_feature_group"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.FeatureRegistryService/CreateFeatureGroup", request_serializer=feature_registry_service.CreateFeatureGroupRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -309,7 +397,7 @@ def get_feature_group( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_feature_group" not in self._stubs: - self._stubs["get_feature_group"] = self.grpc_channel.unary_unary( + self._stubs["get_feature_group"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.FeatureRegistryService/GetFeatureGroup", request_serializer=feature_registry_service.GetFeatureGroupRequest.serialize, response_deserializer=feature_group.FeatureGroup.deserialize, @@ -338,7 +426,7 @@ def list_feature_groups( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_feature_groups" not in self._stubs: - self._stubs["list_feature_groups"] = self.grpc_channel.unary_unary( + self._stubs["list_feature_groups"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.FeatureRegistryService/ListFeatureGroups", request_serializer=feature_registry_service.ListFeatureGroupsRequest.serialize, response_deserializer=feature_registry_service.ListFeatureGroupsResponse.deserialize, @@ -366,7 +454,7 @@ def update_feature_group( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_feature_group" not in self._stubs: - self._stubs["update_feature_group"] = self.grpc_channel.unary_unary( + self._stubs["update_feature_group"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.FeatureRegistryService/UpdateFeatureGroup", request_serializer=feature_registry_service.UpdateFeatureGroupRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -394,7 +482,7 @@ def delete_feature_group( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_feature_group" not in self._stubs: - self._stubs["delete_feature_group"] = self.grpc_channel.unary_unary( + self._stubs["delete_feature_group"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.FeatureRegistryService/DeleteFeatureGroup", request_serializer=feature_registry_service.DeleteFeatureGroupRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -422,7 +510,7 @@ def create_feature( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_feature" not in self._stubs: - self._stubs["create_feature"] = self.grpc_channel.unary_unary( + self._stubs["create_feature"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.FeatureRegistryService/CreateFeature", request_serializer=featurestore_service.CreateFeatureRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -450,7 +538,7 @@ def batch_create_features( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "batch_create_features" not in self._stubs: - self._stubs["batch_create_features"] = self.grpc_channel.unary_unary( + self._stubs["batch_create_features"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.FeatureRegistryService/BatchCreateFeatures", request_serializer=featurestore_service.BatchCreateFeaturesRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -476,7 +564,7 @@ def get_feature( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_feature" not in self._stubs: - self._stubs["get_feature"] = self.grpc_channel.unary_unary( + self._stubs["get_feature"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.FeatureRegistryService/GetFeature", request_serializer=featurestore_service.GetFeatureRequest.serialize, response_deserializer=feature.Feature.deserialize, @@ -505,7 +593,7 @@ def list_features( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_features" not in self._stubs: - self._stubs["list_features"] = self.grpc_channel.unary_unary( + self._stubs["list_features"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.FeatureRegistryService/ListFeatures", request_serializer=featurestore_service.ListFeaturesRequest.serialize, response_deserializer=featurestore_service.ListFeaturesResponse.deserialize, @@ -533,7 +621,7 @@ def update_feature( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_feature" not in self._stubs: - self._stubs["update_feature"] = self.grpc_channel.unary_unary( + self._stubs["update_feature"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.FeatureRegistryService/UpdateFeature", request_serializer=featurestore_service.UpdateFeatureRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -561,7 +649,7 @@ def delete_feature( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_feature" not in self._stubs: - self._stubs["delete_feature"] = self.grpc_channel.unary_unary( + self._stubs["delete_feature"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.FeatureRegistryService/DeleteFeature", request_serializer=featurestore_service.DeleteFeatureRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -569,7 +657,7 @@ def delete_feature( return self._stubs["delete_feature"] def close(self): - self.grpc_channel.close() + self._logged_channel.close() @property def delete_operation( @@ -581,7 +669,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, @@ -598,7 +686,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -615,7 +703,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -632,7 +720,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, @@ -651,7 +739,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, @@ -670,7 +758,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -687,7 +775,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -712,7 +800,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -738,7 +826,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -767,7 +855,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1/services/feature_registry_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1/services/feature_registry_service/transports/grpc_asyncio.py index 525f3b82bc..193e6751af 100644 --- a/google/cloud/aiplatform_v1/services/feature_registry_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1/services/feature_registry_service/transports/grpc_asyncio.py @@ -14,6 +14,9 @@ # limitations under the License. # import inspect +import json +import pickle +import logging as std_logging import warnings from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union @@ -24,8 +27,11 @@ from google.api_core import operations_v1 from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from grpc.experimental import aio # type: ignore from google.cloud.aiplatform_v1.types import feature @@ -39,6 +45,82 @@ from .base import FeatureRegistryServiceTransport, DEFAULT_CLIENT_INFO from .grpc import FeatureRegistryServiceGrpcTransport +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.aiplatform.v1.FeatureRegistryService", + "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.aiplatform.v1.FeatureRegistryService", + "rpcName": str(client_call_details.method), + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class FeatureRegistryServiceGrpcAsyncIOTransport(FeatureRegistryServiceTransport): """gRPC AsyncIO backend transport for FeatureRegistryService. @@ -237,10 +319,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 @@ -263,7 +348,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. @@ -292,7 +377,7 @@ def create_feature_group( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_feature_group" not in self._stubs: - self._stubs["create_feature_group"] = self.grpc_channel.unary_unary( + self._stubs["create_feature_group"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.FeatureRegistryService/CreateFeatureGroup", request_serializer=feature_registry_service.CreateFeatureGroupRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -321,7 +406,7 @@ def get_feature_group( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_feature_group" not in self._stubs: - self._stubs["get_feature_group"] = self.grpc_channel.unary_unary( + self._stubs["get_feature_group"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.FeatureRegistryService/GetFeatureGroup", request_serializer=feature_registry_service.GetFeatureGroupRequest.serialize, response_deserializer=feature_group.FeatureGroup.deserialize, @@ -350,7 +435,7 @@ def list_feature_groups( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_feature_groups" not in self._stubs: - self._stubs["list_feature_groups"] = self.grpc_channel.unary_unary( + self._stubs["list_feature_groups"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.FeatureRegistryService/ListFeatureGroups", request_serializer=feature_registry_service.ListFeatureGroupsRequest.serialize, response_deserializer=feature_registry_service.ListFeatureGroupsResponse.deserialize, @@ -379,7 +464,7 @@ def update_feature_group( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_feature_group" not in self._stubs: - self._stubs["update_feature_group"] = self.grpc_channel.unary_unary( + self._stubs["update_feature_group"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.FeatureRegistryService/UpdateFeatureGroup", request_serializer=feature_registry_service.UpdateFeatureGroupRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -408,7 +493,7 @@ def delete_feature_group( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_feature_group" not in self._stubs: - self._stubs["delete_feature_group"] = self.grpc_channel.unary_unary( + self._stubs["delete_feature_group"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.FeatureRegistryService/DeleteFeatureGroup", request_serializer=feature_registry_service.DeleteFeatureGroupRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -436,7 +521,7 @@ def create_feature( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_feature" not in self._stubs: - self._stubs["create_feature"] = self.grpc_channel.unary_unary( + self._stubs["create_feature"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.FeatureRegistryService/CreateFeature", request_serializer=featurestore_service.CreateFeatureRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -465,7 +550,7 @@ def batch_create_features( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "batch_create_features" not in self._stubs: - self._stubs["batch_create_features"] = self.grpc_channel.unary_unary( + self._stubs["batch_create_features"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.FeatureRegistryService/BatchCreateFeatures", request_serializer=featurestore_service.BatchCreateFeaturesRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -491,7 +576,7 @@ def get_feature( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_feature" not in self._stubs: - self._stubs["get_feature"] = self.grpc_channel.unary_unary( + self._stubs["get_feature"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.FeatureRegistryService/GetFeature", request_serializer=featurestore_service.GetFeatureRequest.serialize, response_deserializer=feature.Feature.deserialize, @@ -520,7 +605,7 @@ def list_features( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_features" not in self._stubs: - self._stubs["list_features"] = self.grpc_channel.unary_unary( + self._stubs["list_features"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.FeatureRegistryService/ListFeatures", request_serializer=featurestore_service.ListFeaturesRequest.serialize, response_deserializer=featurestore_service.ListFeaturesResponse.deserialize, @@ -548,7 +633,7 @@ def update_feature( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_feature" not in self._stubs: - self._stubs["update_feature"] = self.grpc_channel.unary_unary( + self._stubs["update_feature"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.FeatureRegistryService/UpdateFeature", request_serializer=featurestore_service.UpdateFeatureRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -576,7 +661,7 @@ def delete_feature( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_feature" not in self._stubs: - self._stubs["delete_feature"] = self.grpc_channel.unary_unary( + self._stubs["delete_feature"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.FeatureRegistryService/DeleteFeature", request_serializer=featurestore_service.DeleteFeatureRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -699,7 +784,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: @@ -715,7 +800,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, @@ -732,7 +817,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -749,7 +834,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -766,7 +851,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, @@ -785,7 +870,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, @@ -804,7 +889,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -821,7 +906,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -846,7 +931,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -872,7 +957,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -901,7 +986,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1/services/feature_registry_service/transports/rest.py b/google/cloud/aiplatform_v1/services/feature_registry_service/transports/rest.py index ad3eca6cd1..f4676c6e43 100644 --- a/google/cloud/aiplatform_v1/services/feature_registry_service/transports/rest.py +++ b/google/cloud/aiplatform_v1/services/feature_registry_service/transports/rest.py @@ -13,9 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging +import json # type: ignore from google.auth.transport.requests import AuthorizedSession # type: ignore -import json # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.api_core import exceptions as core_exceptions from google.api_core import retry as retries @@ -50,6 +51,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, @@ -170,9 +179,10 @@ def post_update_feature_group(self, response): def pre_batch_create_features( self, request: featurestore_service.BatchCreateFeaturesRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - featurestore_service.BatchCreateFeaturesRequest, Sequence[Tuple[str, str]] + featurestore_service.BatchCreateFeaturesRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for batch_create_features @@ -195,8 +205,11 @@ def post_batch_create_features( def pre_create_feature( self, request: featurestore_service.CreateFeatureRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[featurestore_service.CreateFeatureRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + featurestore_service.CreateFeatureRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for create_feature Override in a subclass to manipulate the request or metadata @@ -218,9 +231,10 @@ def post_create_feature( def pre_create_feature_group( self, request: feature_registry_service.CreateFeatureGroupRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - feature_registry_service.CreateFeatureGroupRequest, Sequence[Tuple[str, str]] + feature_registry_service.CreateFeatureGroupRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for create_feature_group @@ -243,8 +257,11 @@ def post_create_feature_group( def pre_delete_feature( self, request: featurestore_service.DeleteFeatureRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[featurestore_service.DeleteFeatureRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + featurestore_service.DeleteFeatureRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for delete_feature Override in a subclass to manipulate the request or metadata @@ -266,9 +283,10 @@ def post_delete_feature( def pre_delete_feature_group( self, request: feature_registry_service.DeleteFeatureGroupRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - feature_registry_service.DeleteFeatureGroupRequest, Sequence[Tuple[str, str]] + feature_registry_service.DeleteFeatureGroupRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for delete_feature_group @@ -291,8 +309,10 @@ def post_delete_feature_group( def pre_get_feature( self, request: featurestore_service.GetFeatureRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[featurestore_service.GetFeatureRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + featurestore_service.GetFeatureRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_feature Override in a subclass to manipulate the request or metadata @@ -312,9 +332,10 @@ def post_get_feature(self, response: feature.Feature) -> feature.Feature: def pre_get_feature_group( self, request: feature_registry_service.GetFeatureGroupRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - feature_registry_service.GetFeatureGroupRequest, Sequence[Tuple[str, str]] + feature_registry_service.GetFeatureGroupRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for get_feature_group @@ -337,9 +358,10 @@ def post_get_feature_group( def pre_list_feature_groups( self, request: feature_registry_service.ListFeatureGroupsRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - feature_registry_service.ListFeatureGroupsRequest, Sequence[Tuple[str, str]] + feature_registry_service.ListFeatureGroupsRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for list_feature_groups @@ -362,8 +384,11 @@ def post_list_feature_groups( def pre_list_features( self, request: featurestore_service.ListFeaturesRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[featurestore_service.ListFeaturesRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + featurestore_service.ListFeaturesRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for list_features Override in a subclass to manipulate the request or metadata @@ -385,8 +410,11 @@ def post_list_features( def pre_update_feature( self, request: featurestore_service.UpdateFeatureRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[featurestore_service.UpdateFeatureRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + featurestore_service.UpdateFeatureRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for update_feature Override in a subclass to manipulate the request or metadata @@ -408,9 +436,10 @@ def post_update_feature( def pre_update_feature_group( self, request: feature_registry_service.UpdateFeatureGroupRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - feature_registry_service.UpdateFeatureGroupRequest, Sequence[Tuple[str, str]] + feature_registry_service.UpdateFeatureGroupRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for update_feature_group @@ -433,8 +462,10 @@ def post_update_feature_group( def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -456,8 +487,10 @@ def post_get_location( def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -479,8 +512,10 @@ def post_list_locations( def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -500,8 +535,10 @@ def post_get_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -521,8 +558,11 @@ def post_set_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -544,8 +584,10 @@ def post_test_iam_permissions( def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -565,8 +607,10 @@ def post_cancel_operation(self, response: None) -> None: 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 @@ -586,8 +630,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 @@ -609,8 +655,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 @@ -632,8 +680,10 @@ def post_list_operations( def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -2656,7 +2706,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 batch create features method over HTTP. @@ -2669,8 +2719,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: @@ -2683,6 +2735,7 @@ def __call__( http_options = ( _BaseFeatureRegistryServiceRestTransport._BaseBatchCreateFeatures._get_http_options() ) + request, metadata = self._interceptor.pre_batch_create_features( request, metadata ) @@ -2699,6 +2752,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.aiplatform_v1.FeatureRegistryServiceClient.BatchCreateFeatures", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureRegistryService", + "rpcName": "BatchCreateFeatures", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( FeatureRegistryServiceRestTransport._BatchCreateFeatures._get_response( @@ -2720,7 +2800,29 @@ def __call__( # Return the response resp = operations_pb2.Operation() json_format.Parse(response.content, resp, ignore_unknown_fields=True) + resp = self._interceptor.post_batch_create_features(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.aiplatform_v1.FeatureRegistryServiceClient.batch_create_features", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureRegistryService", + "rpcName": "BatchCreateFeatures", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _CreateFeature( @@ -2760,7 +2862,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 feature method over HTTP. @@ -2773,8 +2875,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: @@ -2787,6 +2891,7 @@ def __call__( http_options = ( _BaseFeatureRegistryServiceRestTransport._BaseCreateFeature._get_http_options() ) + request, metadata = self._interceptor.pre_create_feature(request, metadata) transcoded_request = _BaseFeatureRegistryServiceRestTransport._BaseCreateFeature._get_transcoded_request( http_options, request @@ -2801,6 +2906,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.aiplatform_v1.FeatureRegistryServiceClient.CreateFeature", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureRegistryService", + "rpcName": "CreateFeature", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeatureRegistryServiceRestTransport._CreateFeature._get_response( self._host, @@ -2820,7 +2952,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_feature(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.aiplatform_v1.FeatureRegistryServiceClient.create_feature", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureRegistryService", + "rpcName": "CreateFeature", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _CreateFeatureGroup( @@ -2860,7 +3014,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 feature group method over HTTP. @@ -2871,8 +3025,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: @@ -2885,6 +3041,7 @@ def __call__( http_options = ( _BaseFeatureRegistryServiceRestTransport._BaseCreateFeatureGroup._get_http_options() ) + request, metadata = self._interceptor.pre_create_feature_group( request, metadata ) @@ -2901,6 +3058,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.aiplatform_v1.FeatureRegistryServiceClient.CreateFeatureGroup", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureRegistryService", + "rpcName": "CreateFeatureGroup", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( FeatureRegistryServiceRestTransport._CreateFeatureGroup._get_response( @@ -2922,7 +3106,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_feature_group(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.aiplatform_v1.FeatureRegistryServiceClient.create_feature_group", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureRegistryService", + "rpcName": "CreateFeatureGroup", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _DeleteFeature( @@ -2961,7 +3167,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 feature method over HTTP. @@ -2974,8 +3180,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: @@ -2988,6 +3196,7 @@ def __call__( http_options = ( _BaseFeatureRegistryServiceRestTransport._BaseDeleteFeature._get_http_options() ) + request, metadata = self._interceptor.pre_delete_feature(request, metadata) transcoded_request = _BaseFeatureRegistryServiceRestTransport._BaseDeleteFeature._get_transcoded_request( http_options, request @@ -2998,6 +3207,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.aiplatform_v1.FeatureRegistryServiceClient.DeleteFeature", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureRegistryService", + "rpcName": "DeleteFeature", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeatureRegistryServiceRestTransport._DeleteFeature._get_response( self._host, @@ -3016,7 +3252,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_feature(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.aiplatform_v1.FeatureRegistryServiceClient.delete_feature", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureRegistryService", + "rpcName": "DeleteFeature", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _DeleteFeatureGroup( @@ -3055,7 +3313,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 feature group method over HTTP. @@ -3066,8 +3324,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: @@ -3080,6 +3340,7 @@ def __call__( http_options = ( _BaseFeatureRegistryServiceRestTransport._BaseDeleteFeatureGroup._get_http_options() ) + request, metadata = self._interceptor.pre_delete_feature_group( request, metadata ) @@ -3092,6 +3353,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.aiplatform_v1.FeatureRegistryServiceClient.DeleteFeatureGroup", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureRegistryService", + "rpcName": "DeleteFeatureGroup", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( FeatureRegistryServiceRestTransport._DeleteFeatureGroup._get_response( @@ -3112,7 +3400,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_feature_group(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.aiplatform_v1.FeatureRegistryServiceClient.delete_feature_group", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureRegistryService", + "rpcName": "DeleteFeatureGroup", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _GetFeature( @@ -3151,7 +3461,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]]] = (), ) -> feature.Feature: r"""Call the get feature method over HTTP. @@ -3164,8 +3474,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: ~.feature.Feature: @@ -3178,6 +3490,7 @@ def __call__( http_options = ( _BaseFeatureRegistryServiceRestTransport._BaseGetFeature._get_http_options() ) + request, metadata = self._interceptor.pre_get_feature(request, metadata) transcoded_request = _BaseFeatureRegistryServiceRestTransport._BaseGetFeature._get_transcoded_request( http_options, request @@ -3188,6 +3501,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.aiplatform_v1.FeatureRegistryServiceClient.GetFeature", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureRegistryService", + "rpcName": "GetFeature", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeatureRegistryServiceRestTransport._GetFeature._get_response( self._host, @@ -3208,7 +3548,29 @@ def __call__( pb_resp = feature.Feature.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_feature(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = feature.Feature.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.aiplatform_v1.FeatureRegistryServiceClient.get_feature", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureRegistryService", + "rpcName": "GetFeature", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _GetFeatureGroup( @@ -3247,7 +3609,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]]] = (), ) -> feature_group.FeatureGroup: r"""Call the get feature group method over HTTP. @@ -3258,8 +3620,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: ~.feature_group.FeatureGroup: @@ -3269,6 +3633,7 @@ def __call__( http_options = ( _BaseFeatureRegistryServiceRestTransport._BaseGetFeatureGroup._get_http_options() ) + request, metadata = self._interceptor.pre_get_feature_group( request, metadata ) @@ -3281,6 +3646,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.aiplatform_v1.FeatureRegistryServiceClient.GetFeatureGroup", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureRegistryService", + "rpcName": "GetFeatureGroup", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( FeatureRegistryServiceRestTransport._GetFeatureGroup._get_response( @@ -3303,7 +3695,29 @@ def __call__( pb_resp = feature_group.FeatureGroup.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_feature_group(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = feature_group.FeatureGroup.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.aiplatform_v1.FeatureRegistryServiceClient.get_feature_group", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureRegistryService", + "rpcName": "GetFeatureGroup", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListFeatureGroups( @@ -3342,7 +3756,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]]] = (), ) -> feature_registry_service.ListFeatureGroupsResponse: r"""Call the list feature groups method over HTTP. @@ -3353,8 +3767,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: ~.feature_registry_service.ListFeatureGroupsResponse: @@ -3366,6 +3782,7 @@ def __call__( http_options = ( _BaseFeatureRegistryServiceRestTransport._BaseListFeatureGroups._get_http_options() ) + request, metadata = self._interceptor.pre_list_feature_groups( request, metadata ) @@ -3378,6 +3795,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.aiplatform_v1.FeatureRegistryServiceClient.ListFeatureGroups", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureRegistryService", + "rpcName": "ListFeatureGroups", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( FeatureRegistryServiceRestTransport._ListFeatureGroups._get_response( @@ -3400,7 +3844,33 @@ def __call__( pb_resp = feature_registry_service.ListFeatureGroupsResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_feature_groups(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + feature_registry_service.ListFeatureGroupsResponse.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.aiplatform_v1.FeatureRegistryServiceClient.list_feature_groups", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureRegistryService", + "rpcName": "ListFeatureGroups", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListFeatures( @@ -3439,7 +3909,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]]] = (), ) -> featurestore_service.ListFeaturesResponse: r"""Call the list features method over HTTP. @@ -3452,8 +3922,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: ~.featurestore_service.ListFeaturesResponse: @@ -3467,6 +3939,7 @@ def __call__( http_options = ( _BaseFeatureRegistryServiceRestTransport._BaseListFeatures._get_http_options() ) + request, metadata = self._interceptor.pre_list_features(request, metadata) transcoded_request = _BaseFeatureRegistryServiceRestTransport._BaseListFeatures._get_transcoded_request( http_options, request @@ -3477,6 +3950,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.aiplatform_v1.FeatureRegistryServiceClient.ListFeatures", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureRegistryService", + "rpcName": "ListFeatures", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeatureRegistryServiceRestTransport._ListFeatures._get_response( self._host, @@ -3497,7 +3997,31 @@ def __call__( pb_resp = featurestore_service.ListFeaturesResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_features(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + featurestore_service.ListFeaturesResponse.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.aiplatform_v1.FeatureRegistryServiceClient.list_features", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureRegistryService", + "rpcName": "ListFeatures", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _UpdateFeature( @@ -3537,7 +4061,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 feature method over HTTP. @@ -3550,8 +4074,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: @@ -3564,6 +4090,7 @@ def __call__( http_options = ( _BaseFeatureRegistryServiceRestTransport._BaseUpdateFeature._get_http_options() ) + request, metadata = self._interceptor.pre_update_feature(request, metadata) transcoded_request = _BaseFeatureRegistryServiceRestTransport._BaseUpdateFeature._get_transcoded_request( http_options, request @@ -3578,6 +4105,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.aiplatform_v1.FeatureRegistryServiceClient.UpdateFeature", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureRegistryService", + "rpcName": "UpdateFeature", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeatureRegistryServiceRestTransport._UpdateFeature._get_response( self._host, @@ -3597,7 +4151,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_feature(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.aiplatform_v1.FeatureRegistryServiceClient.update_feature", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureRegistryService", + "rpcName": "UpdateFeature", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _UpdateFeatureGroup( @@ -3637,7 +4213,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 feature group method over HTTP. @@ -3648,8 +4224,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: @@ -3662,6 +4240,7 @@ def __call__( http_options = ( _BaseFeatureRegistryServiceRestTransport._BaseUpdateFeatureGroup._get_http_options() ) + request, metadata = self._interceptor.pre_update_feature_group( request, metadata ) @@ -3678,6 +4257,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.aiplatform_v1.FeatureRegistryServiceClient.UpdateFeatureGroup", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureRegistryService", + "rpcName": "UpdateFeatureGroup", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( FeatureRegistryServiceRestTransport._UpdateFeatureGroup._get_response( @@ -3699,7 +4305,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_feature_group(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.aiplatform_v1.FeatureRegistryServiceClient.update_feature_group", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureRegistryService", + "rpcName": "UpdateFeatureGroup", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp @property @@ -3852,7 +4480,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]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -3863,8 +4491,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: locations_pb2.Location: Response from GetLocation method. @@ -3873,6 +4503,7 @@ def __call__( http_options = ( _BaseFeatureRegistryServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = self._interceptor.pre_get_location(request, metadata) transcoded_request = _BaseFeatureRegistryServiceRestTransport._BaseGetLocation._get_transcoded_request( http_options, request @@ -3883,6 +4514,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.aiplatform_v1.FeatureRegistryServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureRegistryService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeatureRegistryServiceRestTransport._GetLocation._get_response( self._host, @@ -3902,6 +4560,27 @@ def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_location(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.aiplatform_v1.FeatureRegistryServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureRegistryService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3944,7 +4623,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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -3955,8 +4634,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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -3965,6 +4646,7 @@ def __call__( http_options = ( _BaseFeatureRegistryServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = self._interceptor.pre_list_locations(request, metadata) transcoded_request = _BaseFeatureRegistryServiceRestTransport._BaseListLocations._get_transcoded_request( http_options, request @@ -3975,6 +4657,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.aiplatform_v1.FeatureRegistryServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureRegistryService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeatureRegistryServiceRestTransport._ListLocations._get_response( self._host, @@ -3994,6 +4703,27 @@ def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_list_locations(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.aiplatform_v1.FeatureRegistryServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureRegistryService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4036,7 +4766,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]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -4047,8 +4777,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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -4057,6 +4789,7 @@ def __call__( http_options = ( _BaseFeatureRegistryServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_get_iam_policy(request, metadata) transcoded_request = _BaseFeatureRegistryServiceRestTransport._BaseGetIamPolicy._get_transcoded_request( http_options, request @@ -4067,6 +4800,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.aiplatform_v1.FeatureRegistryServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureRegistryService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeatureRegistryServiceRestTransport._GetIamPolicy._get_response( self._host, @@ -4086,6 +4846,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_iam_policy(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.aiplatform_v1.FeatureRegistryServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureRegistryService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4129,7 +4910,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]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -4140,8 +4921,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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -4150,6 +4933,7 @@ def __call__( http_options = ( _BaseFeatureRegistryServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_set_iam_policy(request, metadata) transcoded_request = _BaseFeatureRegistryServiceRestTransport._BaseSetIamPolicy._get_transcoded_request( http_options, request @@ -4164,6 +4948,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.aiplatform_v1.FeatureRegistryServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureRegistryService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeatureRegistryServiceRestTransport._SetIamPolicy._get_response( self._host, @@ -4184,6 +4995,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_set_iam_policy(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.aiplatform_v1.FeatureRegistryServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureRegistryService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4226,7 +5058,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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -4237,8 +5069,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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -4247,6 +5081,7 @@ def __call__( http_options = ( _BaseFeatureRegistryServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -4259,6 +5094,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.aiplatform_v1.FeatureRegistryServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureRegistryService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( FeatureRegistryServiceRestTransport._TestIamPermissions._get_response( @@ -4280,6 +5142,27 @@ def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_test_iam_permissions(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.aiplatform_v1.FeatureRegistryServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureRegistryService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4322,7 +5205,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 cancel operation method over HTTP. @@ -4333,13 +5216,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 = ( _BaseFeatureRegistryServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = self._interceptor.pre_cancel_operation( request, metadata ) @@ -4352,6 +5238,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.aiplatform_v1.FeatureRegistryServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureRegistryService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( FeatureRegistryServiceRestTransport._CancelOperation._get_response( @@ -4411,7 +5324,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. @@ -4422,13 +5335,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 = ( _BaseFeatureRegistryServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = self._interceptor.pre_delete_operation( request, metadata ) @@ -4441,6 +5357,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.aiplatform_v1.FeatureRegistryServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureRegistryService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( FeatureRegistryServiceRestTransport._DeleteOperation._get_response( @@ -4500,7 +5443,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. @@ -4511,8 +5454,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. @@ -4521,6 +5466,7 @@ def __call__( http_options = ( _BaseFeatureRegistryServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = self._interceptor.pre_get_operation(request, metadata) transcoded_request = _BaseFeatureRegistryServiceRestTransport._BaseGetOperation._get_transcoded_request( http_options, request @@ -4531,6 +5477,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.aiplatform_v1.FeatureRegistryServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureRegistryService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeatureRegistryServiceRestTransport._GetOperation._get_response( self._host, @@ -4550,6 +5523,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.aiplatform_v1.FeatureRegistryServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureRegistryService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4592,7 +5586,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. @@ -4603,8 +5597,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. @@ -4613,6 +5609,7 @@ def __call__( http_options = ( _BaseFeatureRegistryServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = self._interceptor.pre_list_operations(request, metadata) transcoded_request = _BaseFeatureRegistryServiceRestTransport._BaseListOperations._get_transcoded_request( http_options, request @@ -4623,6 +5620,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.aiplatform_v1.FeatureRegistryServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureRegistryService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( FeatureRegistryServiceRestTransport._ListOperations._get_response( @@ -4644,6 +5668,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.aiplatform_v1.FeatureRegistryServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureRegistryService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4686,7 +5731,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 wait operation method over HTTP. @@ -4697,8 +5742,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 WaitOperation method. @@ -4707,6 +5754,7 @@ def __call__( http_options = ( _BaseFeatureRegistryServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = self._interceptor.pre_wait_operation(request, metadata) transcoded_request = _BaseFeatureRegistryServiceRestTransport._BaseWaitOperation._get_transcoded_request( http_options, request @@ -4717,6 +5765,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.aiplatform_v1.FeatureRegistryServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureRegistryService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeatureRegistryServiceRestTransport._WaitOperation._get_response( self._host, @@ -4736,6 +5811,27 @@ def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = self._interceptor.post_wait_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.aiplatform_v1.FeatureRegistryServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureRegistryService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1/services/feature_registry_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1/services/feature_registry_service/transports/rest_asyncio.py index e907e34c6c..d55fd66166 100644 --- a/google/cloud/aiplatform_v1/services/feature_registry_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1/services/feature_registry_service/transports/rest_asyncio.py @@ -61,6 +61,18 @@ from .base import DEFAULT_CLIENT_INFO as BASE_DEFAULT_CLIENT_INFO + +import logging + +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__) + try: OptionalRetry = Union[retries.AsyncRetry, gapic_v1.method._MethodDefault, None] except AttributeError: # pragma: NO COVER @@ -185,9 +197,10 @@ async def post_update_feature_group(self, response): async def pre_batch_create_features( self, request: featurestore_service.BatchCreateFeaturesRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - featurestore_service.BatchCreateFeaturesRequest, Sequence[Tuple[str, str]] + featurestore_service.BatchCreateFeaturesRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for batch_create_features @@ -210,8 +223,11 @@ async def post_batch_create_features( async def pre_create_feature( self, request: featurestore_service.CreateFeatureRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[featurestore_service.CreateFeatureRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + featurestore_service.CreateFeatureRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for create_feature Override in a subclass to manipulate the request or metadata @@ -233,9 +249,10 @@ async def post_create_feature( async def pre_create_feature_group( self, request: feature_registry_service.CreateFeatureGroupRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - feature_registry_service.CreateFeatureGroupRequest, Sequence[Tuple[str, str]] + feature_registry_service.CreateFeatureGroupRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for create_feature_group @@ -258,8 +275,11 @@ async def post_create_feature_group( async def pre_delete_feature( self, request: featurestore_service.DeleteFeatureRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[featurestore_service.DeleteFeatureRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + featurestore_service.DeleteFeatureRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for delete_feature Override in a subclass to manipulate the request or metadata @@ -281,9 +301,10 @@ async def post_delete_feature( async def pre_delete_feature_group( self, request: feature_registry_service.DeleteFeatureGroupRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - feature_registry_service.DeleteFeatureGroupRequest, Sequence[Tuple[str, str]] + feature_registry_service.DeleteFeatureGroupRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for delete_feature_group @@ -306,8 +327,10 @@ async def post_delete_feature_group( async def pre_get_feature( self, request: featurestore_service.GetFeatureRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[featurestore_service.GetFeatureRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + featurestore_service.GetFeatureRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_feature Override in a subclass to manipulate the request or metadata @@ -327,9 +350,10 @@ async def post_get_feature(self, response: feature.Feature) -> feature.Feature: async def pre_get_feature_group( self, request: feature_registry_service.GetFeatureGroupRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - feature_registry_service.GetFeatureGroupRequest, Sequence[Tuple[str, str]] + feature_registry_service.GetFeatureGroupRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for get_feature_group @@ -352,9 +376,10 @@ async def post_get_feature_group( async def pre_list_feature_groups( self, request: feature_registry_service.ListFeatureGroupsRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - feature_registry_service.ListFeatureGroupsRequest, Sequence[Tuple[str, str]] + feature_registry_service.ListFeatureGroupsRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for list_feature_groups @@ -377,8 +402,11 @@ async def post_list_feature_groups( async def pre_list_features( self, request: featurestore_service.ListFeaturesRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[featurestore_service.ListFeaturesRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + featurestore_service.ListFeaturesRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for list_features Override in a subclass to manipulate the request or metadata @@ -400,8 +428,11 @@ async def post_list_features( async def pre_update_feature( self, request: featurestore_service.UpdateFeatureRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[featurestore_service.UpdateFeatureRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + featurestore_service.UpdateFeatureRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for update_feature Override in a subclass to manipulate the request or metadata @@ -423,9 +454,10 @@ async def post_update_feature( async def pre_update_feature_group( self, request: feature_registry_service.UpdateFeatureGroupRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - feature_registry_service.UpdateFeatureGroupRequest, Sequence[Tuple[str, str]] + feature_registry_service.UpdateFeatureGroupRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for update_feature_group @@ -448,8 +480,10 @@ async def post_update_feature_group( async def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -471,8 +505,10 @@ async def post_get_location( async def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -494,8 +530,10 @@ async def post_list_locations( async def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -517,8 +555,10 @@ async def post_get_iam_policy( async def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -540,8 +580,11 @@ async def post_set_iam_policy( async def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -563,8 +606,10 @@ async def post_test_iam_permissions( async def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -584,8 +629,10 @@ async def post_cancel_operation(self, response: None) -> None: async 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 @@ -605,8 +652,10 @@ async def post_delete_operation(self, response: None) -> None: async 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 @@ -628,8 +677,10 @@ async def post_get_operation( async 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 @@ -651,8 +702,10 @@ async def post_list_operations( async def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -891,7 +944,7 @@ async 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 batch create features method over HTTP. @@ -904,8 +957,10 @@ async def __call__( 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: @@ -918,6 +973,7 @@ async def __call__( http_options = ( _BaseFeatureRegistryServiceRestTransport._BaseBatchCreateFeatures._get_http_options() ) + request, metadata = await self._interceptor.pre_batch_create_features( request, metadata ) @@ -934,6 +990,33 @@ async 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.aiplatform_v1.FeatureRegistryServiceClient.BatchCreateFeatures", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureRegistryService", + "rpcName": "BatchCreateFeatures", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeatureRegistryServiceRestTransport._BatchCreateFeatures._get_response( self._host, @@ -962,6 +1045,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_batch_create_features(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.FeatureRegistryServiceAsyncClient.batch_create_features", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureRegistryService", + "rpcName": "BatchCreateFeatures", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _CreateFeature( @@ -1001,7 +1106,7 @@ async 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 feature method over HTTP. @@ -1014,8 +1119,10 @@ async def __call__( 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: @@ -1028,6 +1135,7 @@ async def __call__( http_options = ( _BaseFeatureRegistryServiceRestTransport._BaseCreateFeature._get_http_options() ) + request, metadata = await self._interceptor.pre_create_feature( request, metadata ) @@ -1044,6 +1152,33 @@ async 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.aiplatform_v1.FeatureRegistryServiceClient.CreateFeature", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureRegistryService", + "rpcName": "CreateFeature", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeatureRegistryServiceRestTransport._CreateFeature._get_response( self._host, @@ -1072,6 +1207,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_create_feature(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.FeatureRegistryServiceAsyncClient.create_feature", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureRegistryService", + "rpcName": "CreateFeature", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _CreateFeatureGroup( @@ -1111,7 +1268,7 @@ async 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 feature group method over HTTP. @@ -1122,8 +1279,10 @@ async def __call__( 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: @@ -1136,6 +1295,7 @@ async def __call__( http_options = ( _BaseFeatureRegistryServiceRestTransport._BaseCreateFeatureGroup._get_http_options() ) + request, metadata = await self._interceptor.pre_create_feature_group( request, metadata ) @@ -1152,6 +1312,33 @@ async 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.aiplatform_v1.FeatureRegistryServiceClient.CreateFeatureGroup", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureRegistryService", + "rpcName": "CreateFeatureGroup", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeatureRegistryServiceRestTransport._CreateFeatureGroup._get_response( self._host, @@ -1180,6 +1367,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_create_feature_group(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.FeatureRegistryServiceAsyncClient.create_feature_group", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureRegistryService", + "rpcName": "CreateFeatureGroup", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _DeleteFeature( @@ -1218,7 +1427,7 @@ async 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 feature method over HTTP. @@ -1231,8 +1440,10 @@ async def __call__( 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: @@ -1245,6 +1456,7 @@ async def __call__( http_options = ( _BaseFeatureRegistryServiceRestTransport._BaseDeleteFeature._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_feature( request, metadata ) @@ -1257,6 +1469,33 @@ async 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.aiplatform_v1.FeatureRegistryServiceClient.DeleteFeature", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureRegistryService", + "rpcName": "DeleteFeature", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeatureRegistryServiceRestTransport._DeleteFeature._get_response( self._host, @@ -1284,6 +1523,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_delete_feature(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.FeatureRegistryServiceAsyncClient.delete_feature", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureRegistryService", + "rpcName": "DeleteFeature", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _DeleteFeatureGroup( @@ -1322,7 +1583,7 @@ async 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 feature group method over HTTP. @@ -1333,8 +1594,10 @@ async def __call__( 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: @@ -1347,6 +1610,7 @@ async def __call__( http_options = ( _BaseFeatureRegistryServiceRestTransport._BaseDeleteFeatureGroup._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_feature_group( request, metadata ) @@ -1359,6 +1623,33 @@ async 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.aiplatform_v1.FeatureRegistryServiceClient.DeleteFeatureGroup", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureRegistryService", + "rpcName": "DeleteFeatureGroup", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeatureRegistryServiceRestTransport._DeleteFeatureGroup._get_response( self._host, @@ -1386,6 +1677,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_delete_feature_group(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.FeatureRegistryServiceAsyncClient.delete_feature_group", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureRegistryService", + "rpcName": "DeleteFeatureGroup", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _GetFeature( @@ -1424,7 +1737,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> feature.Feature: r"""Call the get feature method over HTTP. @@ -1437,8 +1750,10 @@ async def __call__( 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: ~.feature.Feature: @@ -1451,6 +1766,7 @@ async def __call__( http_options = ( _BaseFeatureRegistryServiceRestTransport._BaseGetFeature._get_http_options() ) + request, metadata = await self._interceptor.pre_get_feature( request, metadata ) @@ -1463,6 +1779,33 @@ async 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.aiplatform_v1.FeatureRegistryServiceClient.GetFeature", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureRegistryService", + "rpcName": "GetFeature", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeatureRegistryServiceRestTransport._GetFeature._get_response( self._host, @@ -1490,6 +1833,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_get_feature(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = feature.Feature.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.FeatureRegistryServiceAsyncClient.get_feature", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureRegistryService", + "rpcName": "GetFeature", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _GetFeatureGroup( @@ -1528,7 +1893,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> feature_group.FeatureGroup: r"""Call the get feature group method over HTTP. @@ -1539,8 +1904,10 @@ async def __call__( 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: ~.feature_group.FeatureGroup: @@ -1550,6 +1917,7 @@ async def __call__( http_options = ( _BaseFeatureRegistryServiceRestTransport._BaseGetFeatureGroup._get_http_options() ) + request, metadata = await self._interceptor.pre_get_feature_group( request, metadata ) @@ -1562,6 +1930,33 @@ async 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.aiplatform_v1.FeatureRegistryServiceClient.GetFeatureGroup", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureRegistryService", + "rpcName": "GetFeatureGroup", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeatureRegistryServiceRestTransport._GetFeatureGroup._get_response( self._host, @@ -1589,6 +1984,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_get_feature_group(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = feature_group.FeatureGroup.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.FeatureRegistryServiceAsyncClient.get_feature_group", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureRegistryService", + "rpcName": "GetFeatureGroup", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ListFeatureGroups( @@ -1627,7 +2044,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> feature_registry_service.ListFeatureGroupsResponse: r"""Call the list feature groups method over HTTP. @@ -1638,8 +2055,10 @@ async def __call__( 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: ~.feature_registry_service.ListFeatureGroupsResponse: @@ -1651,6 +2070,7 @@ async def __call__( http_options = ( _BaseFeatureRegistryServiceRestTransport._BaseListFeatureGroups._get_http_options() ) + request, metadata = await self._interceptor.pre_list_feature_groups( request, metadata ) @@ -1663,6 +2083,33 @@ async 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.aiplatform_v1.FeatureRegistryServiceClient.ListFeatureGroups", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureRegistryService", + "rpcName": "ListFeatureGroups", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeatureRegistryServiceRestTransport._ListFeatureGroups._get_response( self._host, @@ -1690,6 +2137,32 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_list_feature_groups(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + feature_registry_service.ListFeatureGroupsResponse.to_json( + response + ) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.FeatureRegistryServiceAsyncClient.list_feature_groups", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureRegistryService", + "rpcName": "ListFeatureGroups", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ListFeatures( @@ -1728,7 +2201,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> featurestore_service.ListFeaturesResponse: r"""Call the list features method over HTTP. @@ -1741,8 +2214,10 @@ async def __call__( 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: ~.featurestore_service.ListFeaturesResponse: @@ -1756,6 +2231,7 @@ async def __call__( http_options = ( _BaseFeatureRegistryServiceRestTransport._BaseListFeatures._get_http_options() ) + request, metadata = await self._interceptor.pre_list_features( request, metadata ) @@ -1768,6 +2244,33 @@ async 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.aiplatform_v1.FeatureRegistryServiceClient.ListFeatures", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureRegistryService", + "rpcName": "ListFeatures", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeatureRegistryServiceRestTransport._ListFeatures._get_response( self._host, @@ -1795,6 +2298,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_list_features(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + featurestore_service.ListFeaturesResponse.to_json(response) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.FeatureRegistryServiceAsyncClient.list_features", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureRegistryService", + "rpcName": "ListFeatures", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _UpdateFeature( @@ -1834,7 +2361,7 @@ async 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 feature method over HTTP. @@ -1847,8 +2374,10 @@ async def __call__( 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: @@ -1861,6 +2390,7 @@ async def __call__( http_options = ( _BaseFeatureRegistryServiceRestTransport._BaseUpdateFeature._get_http_options() ) + request, metadata = await self._interceptor.pre_update_feature( request, metadata ) @@ -1877,6 +2407,33 @@ async 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.aiplatform_v1.FeatureRegistryServiceClient.UpdateFeature", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureRegistryService", + "rpcName": "UpdateFeature", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeatureRegistryServiceRestTransport._UpdateFeature._get_response( self._host, @@ -1905,6 +2462,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_update_feature(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.FeatureRegistryServiceAsyncClient.update_feature", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureRegistryService", + "rpcName": "UpdateFeature", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _UpdateFeatureGroup( @@ -1944,7 +2523,7 @@ async 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 feature group method over HTTP. @@ -1955,8 +2534,10 @@ async def __call__( 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: @@ -1969,6 +2550,7 @@ async def __call__( http_options = ( _BaseFeatureRegistryServiceRestTransport._BaseUpdateFeatureGroup._get_http_options() ) + request, metadata = await self._interceptor.pre_update_feature_group( request, metadata ) @@ -1985,6 +2567,33 @@ async 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.aiplatform_v1.FeatureRegistryServiceClient.UpdateFeatureGroup", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureRegistryService", + "rpcName": "UpdateFeatureGroup", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeatureRegistryServiceRestTransport._UpdateFeatureGroup._get_response( self._host, @@ -2013,6 +2622,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_update_feature_group(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.FeatureRegistryServiceAsyncClient.update_feature_group", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureRegistryService", + "rpcName": "UpdateFeatureGroup", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp @property @@ -4020,7 +4651,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -4031,8 +4662,10 @@ async def __call__( 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: locations_pb2.Location: Response from GetLocation method. @@ -4041,6 +4674,7 @@ async def __call__( http_options = ( _BaseFeatureRegistryServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_location( request, metadata ) @@ -4053,6 +4687,33 @@ async 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.aiplatform_v1.FeatureRegistryServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureRegistryService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeatureRegistryServiceRestTransport._GetLocation._get_response( self._host, @@ -4078,6 +4739,27 @@ async def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_location(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.aiplatform_v1.FeatureRegistryServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureRegistryService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4120,7 +4802,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -4131,8 +4813,10 @@ async def __call__( 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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -4141,6 +4825,7 @@ async def __call__( http_options = ( _BaseFeatureRegistryServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_locations( request, metadata ) @@ -4153,6 +4838,33 @@ async 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.aiplatform_v1.FeatureRegistryServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureRegistryService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeatureRegistryServiceRestTransport._ListLocations._get_response( self._host, @@ -4178,6 +4890,27 @@ async def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_list_locations(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.aiplatform_v1.FeatureRegistryServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureRegistryService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4220,7 +4953,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -4231,8 +4964,10 @@ async def __call__( 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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -4241,6 +4976,7 @@ async def __call__( http_options = ( _BaseFeatureRegistryServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_get_iam_policy( request, metadata ) @@ -4253,6 +4989,33 @@ async 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.aiplatform_v1.FeatureRegistryServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureRegistryService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeatureRegistryServiceRestTransport._GetIamPolicy._get_response( self._host, @@ -4278,6 +5041,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_iam_policy(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.aiplatform_v1.FeatureRegistryServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureRegistryService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4321,7 +5105,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -4332,8 +5116,10 @@ async def __call__( 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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -4342,6 +5128,7 @@ async def __call__( http_options = ( _BaseFeatureRegistryServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_set_iam_policy( request, metadata ) @@ -4358,6 +5145,33 @@ async 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.aiplatform_v1.FeatureRegistryServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureRegistryService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeatureRegistryServiceRestTransport._SetIamPolicy._get_response( self._host, @@ -4384,6 +5198,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_set_iam_policy(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.aiplatform_v1.FeatureRegistryServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureRegistryService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4426,7 +5261,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -4437,8 +5272,10 @@ async def __call__( 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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -4447,6 +5284,7 @@ async def __call__( http_options = ( _BaseFeatureRegistryServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = await self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -4459,6 +5297,33 @@ async 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.aiplatform_v1.FeatureRegistryServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureRegistryService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeatureRegistryServiceRestTransport._TestIamPermissions._get_response( self._host, @@ -4484,6 +5349,27 @@ async def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_test_iam_permissions(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.aiplatform_v1.FeatureRegistryServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureRegistryService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4526,7 +5412,7 @@ async 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 cancel operation method over HTTP. @@ -4537,13 +5423,16 @@ async def __call__( 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`. """ http_options = ( _BaseFeatureRegistryServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_cancel_operation( request, metadata ) @@ -4556,6 +5445,33 @@ async 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.aiplatform_v1.FeatureRegistryServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureRegistryService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeatureRegistryServiceRestTransport._CancelOperation._get_response( self._host, @@ -4619,7 +5535,7 @@ async 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. @@ -4630,13 +5546,16 @@ async def __call__( 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`. """ http_options = ( _BaseFeatureRegistryServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_operation( request, metadata ) @@ -4649,6 +5568,33 @@ async 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.aiplatform_v1.FeatureRegistryServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureRegistryService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeatureRegistryServiceRestTransport._DeleteOperation._get_response( self._host, @@ -4712,7 +5658,7 @@ async 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. @@ -4723,8 +5669,10 @@ async def __call__( 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: Response from GetOperation method. @@ -4733,6 +5681,7 @@ async def __call__( http_options = ( _BaseFeatureRegistryServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_operation( request, metadata ) @@ -4745,6 +5694,33 @@ async 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.aiplatform_v1.FeatureRegistryServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureRegistryService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeatureRegistryServiceRestTransport._GetOperation._get_response( self._host, @@ -4770,6 +5746,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1.FeatureRegistryServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureRegistryService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4812,7 +5809,7 @@ async 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. @@ -4823,8 +5820,10 @@ async def __call__( 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 from ListOperations method. @@ -4833,6 +5832,7 @@ async def __call__( http_options = ( _BaseFeatureRegistryServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_operations( request, metadata ) @@ -4845,6 +5845,33 @@ async 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.aiplatform_v1.FeatureRegistryServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureRegistryService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeatureRegistryServiceRestTransport._ListOperations._get_response( self._host, @@ -4870,6 +5897,27 @@ async def __call__( resp = operations_pb2.ListOperationsResponse() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1.FeatureRegistryServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureRegistryService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4912,7 +5960,7 @@ async 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 wait operation method over HTTP. @@ -4923,8 +5971,10 @@ async def __call__( 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: Response from WaitOperation method. @@ -4933,6 +5983,7 @@ async def __call__( http_options = ( _BaseFeatureRegistryServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_wait_operation( request, metadata ) @@ -4945,6 +5996,33 @@ async 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.aiplatform_v1.FeatureRegistryServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureRegistryService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeatureRegistryServiceRestTransport._WaitOperation._get_response( self._host, @@ -4970,6 +6048,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_wait_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.aiplatform_v1.FeatureRegistryServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeatureRegistryService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1/services/featurestore_online_serving_service/async_client.py b/google/cloud/aiplatform_v1/services/featurestore_online_serving_service/async_client.py index f3f034f452..ca33dbb455 100644 --- a/google/cloud/aiplatform_v1/services/featurestore_online_serving_service/async_client.py +++ b/google/cloud/aiplatform_v1/services/featurestore_online_serving_service/async_client.py @@ -13,6 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging as std_logging from collections import OrderedDict import re from typing import ( @@ -59,6 +60,15 @@ ) from .client import FeaturestoreOnlineServingServiceClient +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 FeaturestoreOnlineServingServiceAsyncClient: """A service for serving online feature values.""" @@ -280,6 +290,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.aiplatform_v1.FeaturestoreOnlineServingServiceAsyncClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreOnlineServingService", + "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.aiplatform.v1.FeaturestoreOnlineServingService", + "credentialsType": None, + }, + ) + async def read_feature_values( self, request: Optional[ @@ -289,7 +321,7 @@ async def read_feature_values( entity_type: 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]]] = (), ) -> featurestore_online_service.ReadFeatureValuesResponse: r"""Reads Feature values of a specific entity of an EntityType. For reading feature values of multiple @@ -345,8 +377,10 @@ async def sample_read_feature_values(): 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.aiplatform_v1.types.ReadFeatureValuesResponse: @@ -413,7 +447,7 @@ def streaming_read_feature_values( entity_type: 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]]] = (), ) -> Awaitable[ AsyncIterable[featurestore_online_service.ReadFeatureValuesResponse] ]: @@ -471,8 +505,10 @@ async def sample_streaming_read_feature_values(): 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: AsyncIterable[google.cloud.aiplatform_v1.types.ReadFeatureValuesResponse]: @@ -544,7 +580,7 @@ async def write_feature_values( ] = 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]]] = (), ) -> featurestore_online_service.WriteFeatureValuesResponse: r"""Writes Feature values of one or more entities of an EntityType. @@ -607,8 +643,10 @@ async def sample_write_feature_values(): 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.aiplatform_v1.types.WriteFeatureValuesResponse: @@ -674,7 +712,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. @@ -685,8 +723,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. @@ -727,7 +767,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. @@ -738,8 +778,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. @@ -780,7 +822,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. @@ -796,8 +838,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 """ @@ -834,7 +878,7 @@ async def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -849,8 +893,10 @@ async def cancel_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 """ @@ -887,7 +933,7 @@ async def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -904,8 +950,10 @@ async def wait_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. @@ -946,7 +994,7 @@ async def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -959,8 +1007,10 @@ async def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -1065,7 +1115,7 @@ async def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -1079,8 +1129,10 @@ async def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -1185,7 +1237,7 @@ async def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -1200,8 +1252,10 @@ async def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -1245,7 +1299,7 @@ async def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -1256,8 +1310,10 @@ async def get_location( 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: ~.location_pb2.Location: Location object. @@ -1298,7 +1354,7 @@ async def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -1309,8 +1365,10 @@ async def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1/services/featurestore_online_serving_service/client.py b/google/cloud/aiplatform_v1/services/featurestore_online_serving_service/client.py index e13506927f..4ad99e8df7 100644 --- a/google/cloud/aiplatform_v1/services/featurestore_online_serving_service/client.py +++ b/google/cloud/aiplatform_v1/services/featurestore_online_serving_service/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 ( @@ -49,6 +50,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.cloud.aiplatform_v1.types import featurestore_online_service from google.cloud.location import locations_pb2 # type: ignore from google.iam.v1 import iam_policy_pb2 # type: ignore @@ -618,6 +628,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( @@ -713,6 +727,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.aiplatform_v1.FeaturestoreOnlineServingServiceClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreOnlineServingService", + "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.aiplatform.v1.FeaturestoreOnlineServingService", + "credentialsType": None, + }, + ) + def read_feature_values( self, request: Optional[ @@ -722,7 +759,7 @@ def read_feature_values( entity_type: 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]]] = (), ) -> featurestore_online_service.ReadFeatureValuesResponse: r"""Reads Feature values of a specific entity of an EntityType. For reading feature values of multiple @@ -778,8 +815,10 @@ def sample_read_feature_values(): 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.aiplatform_v1.types.ReadFeatureValuesResponse: @@ -843,7 +882,7 @@ def streaming_read_feature_values( entity_type: 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]]] = (), ) -> Iterable[featurestore_online_service.ReadFeatureValuesResponse]: r"""Reads Feature values for multiple entities. Depending on their size, data for different entities may be broken @@ -899,8 +938,10 @@ def sample_streaming_read_feature_values(): 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: Iterable[google.cloud.aiplatform_v1.types.ReadFeatureValuesResponse]: @@ -971,7 +1012,7 @@ def write_feature_values( ] = 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]]] = (), ) -> featurestore_online_service.WriteFeatureValuesResponse: r"""Writes Feature values of one or more entities of an EntityType. @@ -1034,8 +1075,10 @@ def sample_write_feature_values(): 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.aiplatform_v1.types.WriteFeatureValuesResponse: @@ -1111,7 +1154,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. @@ -1122,8 +1165,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. @@ -1164,7 +1209,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. @@ -1175,8 +1220,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. @@ -1217,7 +1264,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. @@ -1233,8 +1280,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 """ @@ -1271,7 +1320,7 @@ def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -1286,8 +1335,10 @@ def cancel_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 """ @@ -1324,7 +1375,7 @@ def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -1341,8 +1392,10 @@ def wait_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. @@ -1383,7 +1436,7 @@ def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -1396,8 +1449,10 @@ def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -1502,7 +1557,7 @@ def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -1516,8 +1571,10 @@ def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -1622,7 +1679,7 @@ def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -1637,8 +1694,10 @@ def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -1680,7 +1739,7 @@ def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -1691,8 +1750,10 @@ def get_location( 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: ~.location_pb2.Location: Location object. @@ -1733,7 +1794,7 @@ def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -1744,8 +1805,10 @@ def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1/services/featurestore_online_serving_service/transports/grpc.py b/google/cloud/aiplatform_v1/services/featurestore_online_serving_service/transports/grpc.py index a474c42d17..44390159be 100644 --- a/google/cloud/aiplatform_v1/services/featurestore_online_serving_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1/services/featurestore_online_serving_service/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 import warnings from typing import Callable, Dict, Optional, Sequence, Tuple, Union @@ -21,8 +24,11 @@ import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from google.cloud.aiplatform_v1.types import featurestore_online_service from google.cloud.location import locations_pb2 # type: ignore @@ -31,6 +37,81 @@ from google.longrunning import operations_pb2 # type: ignore from .base import FeaturestoreOnlineServingServiceTransport, DEFAULT_CLIENT_INFO +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.aiplatform.v1.FeaturestoreOnlineServingService", + "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.aiplatform.v1.FeaturestoreOnlineServingService", + "rpcName": client_call_details.method, + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class FeaturestoreOnlineServingServiceGrpcTransport( FeaturestoreOnlineServingServiceTransport @@ -186,7 +267,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 @@ -266,7 +352,7 @@ def read_feature_values( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "read_feature_values" not in self._stubs: - self._stubs["read_feature_values"] = self.grpc_channel.unary_unary( + self._stubs["read_feature_values"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.FeaturestoreOnlineServingService/ReadFeatureValues", request_serializer=featurestore_online_service.ReadFeatureValuesRequest.serialize, response_deserializer=featurestore_online_service.ReadFeatureValuesResponse.deserialize, @@ -299,7 +385,7 @@ def streaming_read_feature_values( if "streaming_read_feature_values" not in self._stubs: self._stubs[ "streaming_read_feature_values" - ] = self.grpc_channel.unary_stream( + ] = self._logged_channel.unary_stream( "/google.cloud.aiplatform.v1.FeaturestoreOnlineServingService/StreamingReadFeatureValues", request_serializer=featurestore_online_service.StreamingReadFeatureValuesRequest.serialize, response_deserializer=featurestore_online_service.ReadFeatureValuesResponse.deserialize, @@ -332,7 +418,7 @@ def write_feature_values( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "write_feature_values" not in self._stubs: - self._stubs["write_feature_values"] = self.grpc_channel.unary_unary( + self._stubs["write_feature_values"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.FeaturestoreOnlineServingService/WriteFeatureValues", request_serializer=featurestore_online_service.WriteFeatureValuesRequest.serialize, response_deserializer=featurestore_online_service.WriteFeatureValuesResponse.deserialize, @@ -340,7 +426,7 @@ def write_feature_values( return self._stubs["write_feature_values"] def close(self): - self.grpc_channel.close() + self._logged_channel.close() @property def delete_operation( @@ -352,7 +438,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, @@ -369,7 +455,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -386,7 +472,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -403,7 +489,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, @@ -422,7 +508,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, @@ -441,7 +527,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -458,7 +544,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -483,7 +569,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -509,7 +595,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -538,7 +624,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1/services/featurestore_online_serving_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1/services/featurestore_online_serving_service/transports/grpc_asyncio.py index 45e210c194..9756b18ae0 100644 --- a/google/cloud/aiplatform_v1/services/featurestore_online_serving_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1/services/featurestore_online_serving_service/transports/grpc_asyncio.py @@ -14,6 +14,9 @@ # limitations under the License. # import inspect +import json +import pickle +import logging as std_logging import warnings from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union @@ -23,8 +26,11 @@ from google.api_core import retry_async as retries from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from grpc.experimental import aio # type: ignore from google.cloud.aiplatform_v1.types import featurestore_online_service @@ -35,6 +41,82 @@ from .base import FeaturestoreOnlineServingServiceTransport, DEFAULT_CLIENT_INFO from .grpc import FeaturestoreOnlineServingServiceGrpcTransport +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.aiplatform.v1.FeaturestoreOnlineServingService", + "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.aiplatform.v1.FeaturestoreOnlineServingService", + "rpcName": str(client_call_details.method), + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class FeaturestoreOnlineServingServiceGrpcAsyncIOTransport( FeaturestoreOnlineServingServiceTransport @@ -233,10 +315,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 @@ -274,7 +359,7 @@ def read_feature_values( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "read_feature_values" not in self._stubs: - self._stubs["read_feature_values"] = self.grpc_channel.unary_unary( + self._stubs["read_feature_values"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.FeaturestoreOnlineServingService/ReadFeatureValues", request_serializer=featurestore_online_service.ReadFeatureValuesRequest.serialize, response_deserializer=featurestore_online_service.ReadFeatureValuesResponse.deserialize, @@ -307,7 +392,7 @@ def streaming_read_feature_values( if "streaming_read_feature_values" not in self._stubs: self._stubs[ "streaming_read_feature_values" - ] = self.grpc_channel.unary_stream( + ] = self._logged_channel.unary_stream( "/google.cloud.aiplatform.v1.FeaturestoreOnlineServingService/StreamingReadFeatureValues", request_serializer=featurestore_online_service.StreamingReadFeatureValuesRequest.serialize, response_deserializer=featurestore_online_service.ReadFeatureValuesResponse.deserialize, @@ -340,7 +425,7 @@ def write_feature_values( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "write_feature_values" not in self._stubs: - self._stubs["write_feature_values"] = self.grpc_channel.unary_unary( + self._stubs["write_feature_values"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.FeaturestoreOnlineServingService/WriteFeatureValues", request_serializer=featurestore_online_service.WriteFeatureValuesRequest.serialize, response_deserializer=featurestore_online_service.WriteFeatureValuesResponse.deserialize, @@ -423,7 +508,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: @@ -439,7 +524,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, @@ -456,7 +541,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -473,7 +558,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -490,7 +575,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, @@ -509,7 +594,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, @@ -528,7 +613,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -545,7 +630,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -570,7 +655,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -596,7 +681,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -625,7 +710,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1/services/featurestore_online_serving_service/transports/rest.py b/google/cloud/aiplatform_v1/services/featurestore_online_serving_service/transports/rest.py index 2edf06625f..250186b13a 100644 --- a/google/cloud/aiplatform_v1/services/featurestore_online_serving_service/transports/rest.py +++ b/google/cloud/aiplatform_v1/services/featurestore_online_serving_service/transports/rest.py @@ -13,9 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging +import json # type: ignore from google.auth.transport.requests import AuthorizedSession # type: ignore -import json # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.api_core import exceptions as core_exceptions from google.api_core import retry as retries @@ -46,6 +47,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, @@ -102,9 +111,10 @@ def post_write_feature_values(self, response): def pre_read_feature_values( self, request: featurestore_online_service.ReadFeatureValuesRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - featurestore_online_service.ReadFeatureValuesRequest, Sequence[Tuple[str, str]] + featurestore_online_service.ReadFeatureValuesRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for read_feature_values @@ -127,10 +137,10 @@ def post_read_feature_values( def pre_streaming_read_feature_values( self, request: featurestore_online_service.StreamingReadFeatureValuesRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ featurestore_online_service.StreamingReadFeatureValuesRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for streaming_read_feature_values @@ -153,9 +163,10 @@ def post_streaming_read_feature_values( def pre_write_feature_values( self, request: featurestore_online_service.WriteFeatureValuesRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - featurestore_online_service.WriteFeatureValuesRequest, Sequence[Tuple[str, str]] + featurestore_online_service.WriteFeatureValuesRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for write_feature_values @@ -178,8 +189,10 @@ def post_write_feature_values( def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -201,8 +214,10 @@ def post_get_location( def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -224,8 +239,10 @@ def post_list_locations( def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -245,8 +262,10 @@ def post_get_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -266,8 +285,11 @@ def post_set_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -289,8 +311,10 @@ def post_test_iam_permissions( def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -310,8 +334,10 @@ def post_cancel_operation(self, response: None) -> None: 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 @@ -331,8 +357,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 @@ -354,8 +382,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 @@ -377,8 +407,10 @@ def post_list_operations( def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -527,7 +559,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]]] = (), ) -> featurestore_online_service.ReadFeatureValuesResponse: r"""Call the read feature values method over HTTP. @@ -538,8 +570,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: ~.featurestore_online_service.ReadFeatureValuesResponse: @@ -551,6 +585,7 @@ def __call__( http_options = ( _BaseFeaturestoreOnlineServingServiceRestTransport._BaseReadFeatureValues._get_http_options() ) + request, metadata = self._interceptor.pre_read_feature_values( request, metadata ) @@ -567,6 +602,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.aiplatform_v1.FeaturestoreOnlineServingServiceClient.ReadFeatureValues", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreOnlineServingService", + "rpcName": "ReadFeatureValues", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeaturestoreOnlineServingServiceRestTransport._ReadFeatureValues._get_response( self._host, @@ -588,7 +650,33 @@ def __call__( pb_resp = featurestore_online_service.ReadFeatureValuesResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_read_feature_values(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + featurestore_online_service.ReadFeatureValuesResponse.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.aiplatform_v1.FeaturestoreOnlineServingServiceClient.read_feature_values", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreOnlineServingService", + "rpcName": "ReadFeatureValues", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _StreamingReadFeatureValues( @@ -631,7 +719,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]]] = (), ) -> rest_streaming.ResponseIterator: r"""Call the streaming read feature values method over HTTP. @@ -643,8 +731,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: ~.featurestore_online_service.ReadFeatureValuesResponse: @@ -656,6 +746,7 @@ def __call__( http_options = ( _BaseFeaturestoreOnlineServingServiceRestTransport._BaseStreamingReadFeatureValues._get_http_options() ) + request, metadata = self._interceptor.pre_streaming_read_feature_values( request, metadata ) @@ -672,6 +763,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.aiplatform_v1.FeaturestoreOnlineServingServiceClient.StreamingReadFeatureValues", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreOnlineServingService", + "rpcName": "StreamingReadFeatureValues", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeaturestoreOnlineServingServiceRestTransport._StreamingReadFeatureValues._get_response( self._host, @@ -692,6 +810,7 @@ def __call__( resp = rest_streaming.ResponseIterator( response, featurestore_online_service.ReadFeatureValuesResponse ) + resp = self._interceptor.post_streaming_read_feature_values(resp) return resp @@ -734,7 +853,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]]] = (), ) -> featurestore_online_service.WriteFeatureValuesResponse: r"""Call the write feature values method over HTTP. @@ -745,8 +864,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: ~.featurestore_online_service.WriteFeatureValuesResponse: @@ -758,6 +879,7 @@ def __call__( http_options = ( _BaseFeaturestoreOnlineServingServiceRestTransport._BaseWriteFeatureValues._get_http_options() ) + request, metadata = self._interceptor.pre_write_feature_values( request, metadata ) @@ -774,6 +896,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.aiplatform_v1.FeaturestoreOnlineServingServiceClient.WriteFeatureValues", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreOnlineServingService", + "rpcName": "WriteFeatureValues", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeaturestoreOnlineServingServiceRestTransport._WriteFeatureValues._get_response( self._host, @@ -795,7 +944,33 @@ def __call__( pb_resp = featurestore_online_service.WriteFeatureValuesResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_write_feature_values(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + featurestore_online_service.WriteFeatureValuesResponse.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.aiplatform_v1.FeaturestoreOnlineServingServiceClient.write_feature_values", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreOnlineServingService", + "rpcName": "WriteFeatureValues", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp @property @@ -871,7 +1046,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]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -882,8 +1057,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: locations_pb2.Location: Response from GetLocation method. @@ -892,6 +1069,7 @@ def __call__( http_options = ( _BaseFeaturestoreOnlineServingServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = self._interceptor.pre_get_location(request, metadata) transcoded_request = _BaseFeaturestoreOnlineServingServiceRestTransport._BaseGetLocation._get_transcoded_request( http_options, request @@ -902,6 +1080,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.aiplatform_v1.FeaturestoreOnlineServingServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreOnlineServingService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeaturestoreOnlineServingServiceRestTransport._GetLocation._get_response( self._host, @@ -921,6 +1126,27 @@ def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_location(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.aiplatform_v1.FeaturestoreOnlineServingServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreOnlineServingService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -963,7 +1189,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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -974,8 +1200,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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -984,6 +1212,7 @@ def __call__( http_options = ( _BaseFeaturestoreOnlineServingServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = self._interceptor.pre_list_locations(request, metadata) transcoded_request = _BaseFeaturestoreOnlineServingServiceRestTransport._BaseListLocations._get_transcoded_request( http_options, request @@ -994,6 +1223,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.aiplatform_v1.FeaturestoreOnlineServingServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreOnlineServingService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeaturestoreOnlineServingServiceRestTransport._ListLocations._get_response( self._host, @@ -1013,6 +1269,27 @@ def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_list_locations(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.aiplatform_v1.FeaturestoreOnlineServingServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreOnlineServingService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1055,7 +1332,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]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -1066,8 +1343,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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -1076,6 +1355,7 @@ def __call__( http_options = ( _BaseFeaturestoreOnlineServingServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_get_iam_policy(request, metadata) transcoded_request = _BaseFeaturestoreOnlineServingServiceRestTransport._BaseGetIamPolicy._get_transcoded_request( http_options, request @@ -1086,6 +1366,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.aiplatform_v1.FeaturestoreOnlineServingServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreOnlineServingService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeaturestoreOnlineServingServiceRestTransport._GetIamPolicy._get_response( self._host, @@ -1105,6 +1412,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_iam_policy(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.aiplatform_v1.FeaturestoreOnlineServingServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreOnlineServingService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1148,7 +1476,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]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -1159,8 +1487,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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -1169,6 +1499,7 @@ def __call__( http_options = ( _BaseFeaturestoreOnlineServingServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_set_iam_policy(request, metadata) transcoded_request = _BaseFeaturestoreOnlineServingServiceRestTransport._BaseSetIamPolicy._get_transcoded_request( http_options, request @@ -1183,6 +1514,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.aiplatform_v1.FeaturestoreOnlineServingServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreOnlineServingService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeaturestoreOnlineServingServiceRestTransport._SetIamPolicy._get_response( self._host, @@ -1203,6 +1561,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_set_iam_policy(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.aiplatform_v1.FeaturestoreOnlineServingServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreOnlineServingService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1247,7 +1626,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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -1258,8 +1637,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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -1268,6 +1649,7 @@ def __call__( http_options = ( _BaseFeaturestoreOnlineServingServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -1280,6 +1662,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.aiplatform_v1.FeaturestoreOnlineServingServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreOnlineServingService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeaturestoreOnlineServingServiceRestTransport._TestIamPermissions._get_response( self._host, @@ -1299,6 +1708,27 @@ def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_test_iam_permissions(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.aiplatform_v1.FeaturestoreOnlineServingServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreOnlineServingService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1341,7 +1771,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 cancel operation method over HTTP. @@ -1352,13 +1782,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 = ( _BaseFeaturestoreOnlineServingServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = self._interceptor.pre_cancel_operation( request, metadata ) @@ -1371,6 +1804,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.aiplatform_v1.FeaturestoreOnlineServingServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreOnlineServingService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeaturestoreOnlineServingServiceRestTransport._CancelOperation._get_response( self._host, @@ -1428,7 +1888,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. @@ -1439,13 +1899,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 = ( _BaseFeaturestoreOnlineServingServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = self._interceptor.pre_delete_operation( request, metadata ) @@ -1458,6 +1921,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.aiplatform_v1.FeaturestoreOnlineServingServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreOnlineServingService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeaturestoreOnlineServingServiceRestTransport._DeleteOperation._get_response( self._host, @@ -1515,7 +2005,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. @@ -1526,8 +2016,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. @@ -1536,6 +2028,7 @@ def __call__( http_options = ( _BaseFeaturestoreOnlineServingServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = self._interceptor.pre_get_operation(request, metadata) transcoded_request = _BaseFeaturestoreOnlineServingServiceRestTransport._BaseGetOperation._get_transcoded_request( http_options, request @@ -1546,6 +2039,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.aiplatform_v1.FeaturestoreOnlineServingServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreOnlineServingService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeaturestoreOnlineServingServiceRestTransport._GetOperation._get_response( self._host, @@ -1565,6 +2085,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.aiplatform_v1.FeaturestoreOnlineServingServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreOnlineServingService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1607,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]]] = (), ) -> operations_pb2.ListOperationsResponse: r"""Call the list operations method over HTTP. @@ -1618,8 +2159,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. @@ -1628,6 +2171,7 @@ def __call__( http_options = ( _BaseFeaturestoreOnlineServingServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = self._interceptor.pre_list_operations(request, metadata) transcoded_request = _BaseFeaturestoreOnlineServingServiceRestTransport._BaseListOperations._get_transcoded_request( http_options, request @@ -1638,6 +2182,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.aiplatform_v1.FeaturestoreOnlineServingServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreOnlineServingService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeaturestoreOnlineServingServiceRestTransport._ListOperations._get_response( self._host, @@ -1657,6 +2228,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.aiplatform_v1.FeaturestoreOnlineServingServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreOnlineServingService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1699,7 +2291,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 wait operation method over HTTP. @@ -1710,8 +2302,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 WaitOperation method. @@ -1720,6 +2314,7 @@ def __call__( http_options = ( _BaseFeaturestoreOnlineServingServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = self._interceptor.pre_wait_operation(request, metadata) transcoded_request = _BaseFeaturestoreOnlineServingServiceRestTransport._BaseWaitOperation._get_transcoded_request( http_options, request @@ -1730,6 +2325,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.aiplatform_v1.FeaturestoreOnlineServingServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreOnlineServingService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeaturestoreOnlineServingServiceRestTransport._WaitOperation._get_response( self._host, @@ -1749,6 +2371,27 @@ def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = self._interceptor.post_wait_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.aiplatform_v1.FeaturestoreOnlineServingServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreOnlineServingService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1/services/featurestore_online_serving_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1/services/featurestore_online_serving_service/transports/rest_asyncio.py index b99d1e8257..0d580bd02a 100644 --- a/google/cloud/aiplatform_v1/services/featurestore_online_serving_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1/services/featurestore_online_serving_service/transports/rest_asyncio.py @@ -56,6 +56,18 @@ from .base import DEFAULT_CLIENT_INFO as BASE_DEFAULT_CLIENT_INFO + +import logging + +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__) + try: OptionalRetry = Union[retries.AsyncRetry, gapic_v1.method._MethodDefault, None] except AttributeError: # pragma: NO COVER @@ -116,9 +128,10 @@ async def post_write_feature_values(self, response): async def pre_read_feature_values( self, request: featurestore_online_service.ReadFeatureValuesRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - featurestore_online_service.ReadFeatureValuesRequest, Sequence[Tuple[str, str]] + featurestore_online_service.ReadFeatureValuesRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for read_feature_values @@ -141,10 +154,10 @@ async def post_read_feature_values( async def pre_streaming_read_feature_values( self, request: featurestore_online_service.StreamingReadFeatureValuesRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ featurestore_online_service.StreamingReadFeatureValuesRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for streaming_read_feature_values @@ -167,9 +180,10 @@ async def post_streaming_read_feature_values( async def pre_write_feature_values( self, request: featurestore_online_service.WriteFeatureValuesRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - featurestore_online_service.WriteFeatureValuesRequest, Sequence[Tuple[str, str]] + featurestore_online_service.WriteFeatureValuesRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for write_feature_values @@ -192,8 +206,10 @@ async def post_write_feature_values( async def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -215,8 +231,10 @@ async def post_get_location( async def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -238,8 +256,10 @@ async def post_list_locations( async def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -261,8 +281,10 @@ async def post_get_iam_policy( async def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -284,8 +306,11 @@ async def post_set_iam_policy( async def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -307,8 +332,10 @@ async def post_test_iam_permissions( async def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -328,8 +355,10 @@ async def post_cancel_operation(self, response: None) -> None: async 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 @@ -349,8 +378,10 @@ async def post_delete_operation(self, response: None) -> None: async 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 @@ -372,8 +403,10 @@ async def post_get_operation( async 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 @@ -395,8 +428,10 @@ async def post_list_operations( async def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -597,7 +632,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> featurestore_online_service.ReadFeatureValuesResponse: r"""Call the read feature values method over HTTP. @@ -608,8 +643,10 @@ async def __call__( 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: ~.featurestore_online_service.ReadFeatureValuesResponse: @@ -621,6 +658,7 @@ async def __call__( http_options = ( _BaseFeaturestoreOnlineServingServiceRestTransport._BaseReadFeatureValues._get_http_options() ) + request, metadata = await self._interceptor.pre_read_feature_values( request, metadata ) @@ -637,6 +675,33 @@ async 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.aiplatform_v1.FeaturestoreOnlineServingServiceClient.ReadFeatureValues", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreOnlineServingService", + "rpcName": "ReadFeatureValues", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeaturestoreOnlineServingServiceRestTransport._ReadFeatureValues._get_response( self._host, @@ -665,6 +730,32 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_read_feature_values(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + featurestore_online_service.ReadFeatureValuesResponse.to_json( + response + ) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.FeaturestoreOnlineServingServiceAsyncClient.read_feature_values", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreOnlineServingService", + "rpcName": "ReadFeatureValues", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _StreamingReadFeatureValues( @@ -706,7 +797,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> rest_streaming_async.AsyncResponseIterator: r"""Call the streaming read feature values method over HTTP. @@ -718,8 +809,10 @@ async def __call__( 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: ~.featurestore_online_service.ReadFeatureValuesResponse: @@ -731,6 +824,7 @@ async def __call__( http_options = ( _BaseFeaturestoreOnlineServingServiceRestTransport._BaseStreamingReadFeatureValues._get_http_options() ) + ( request, metadata, @@ -750,6 +844,33 @@ async 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.aiplatform_v1.FeaturestoreOnlineServingServiceClient.StreamingReadFeatureValues", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreOnlineServingService", + "rpcName": "StreamingReadFeatureValues", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeaturestoreOnlineServingServiceRestTransport._StreamingReadFeatureValues._get_response( self._host, @@ -818,7 +939,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> featurestore_online_service.WriteFeatureValuesResponse: r"""Call the write feature values method over HTTP. @@ -829,8 +950,10 @@ async def __call__( 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: ~.featurestore_online_service.WriteFeatureValuesResponse: @@ -842,6 +965,7 @@ async def __call__( http_options = ( _BaseFeaturestoreOnlineServingServiceRestTransport._BaseWriteFeatureValues._get_http_options() ) + request, metadata = await self._interceptor.pre_write_feature_values( request, metadata ) @@ -858,6 +982,33 @@ async 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.aiplatform_v1.FeaturestoreOnlineServingServiceClient.WriteFeatureValues", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreOnlineServingService", + "rpcName": "WriteFeatureValues", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeaturestoreOnlineServingServiceRestTransport._WriteFeatureValues._get_response( self._host, @@ -886,6 +1037,32 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_write_feature_values(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + featurestore_online_service.WriteFeatureValuesResponse.to_json( + response + ) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.FeaturestoreOnlineServingServiceAsyncClient.write_feature_values", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreOnlineServingService", + "rpcName": "WriteFeatureValues", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp @property @@ -957,7 +1134,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -968,8 +1145,10 @@ async def __call__( 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: locations_pb2.Location: Response from GetLocation method. @@ -978,6 +1157,7 @@ async def __call__( http_options = ( _BaseFeaturestoreOnlineServingServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_location( request, metadata ) @@ -990,6 +1170,33 @@ async 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.aiplatform_v1.FeaturestoreOnlineServingServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreOnlineServingService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeaturestoreOnlineServingServiceRestTransport._GetLocation._get_response( self._host, @@ -1015,6 +1222,27 @@ async def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_location(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.aiplatform_v1.FeaturestoreOnlineServingServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreOnlineServingService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1059,7 +1287,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -1070,8 +1298,10 @@ async def __call__( 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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -1080,6 +1310,7 @@ async def __call__( http_options = ( _BaseFeaturestoreOnlineServingServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_locations( request, metadata ) @@ -1092,6 +1323,33 @@ async 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.aiplatform_v1.FeaturestoreOnlineServingServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreOnlineServingService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeaturestoreOnlineServingServiceRestTransport._ListLocations._get_response( self._host, @@ -1117,6 +1375,27 @@ async def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_list_locations(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.aiplatform_v1.FeaturestoreOnlineServingServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreOnlineServingService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1161,7 +1440,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -1172,8 +1451,10 @@ async def __call__( 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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -1182,6 +1463,7 @@ async def __call__( http_options = ( _BaseFeaturestoreOnlineServingServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_get_iam_policy( request, metadata ) @@ -1194,6 +1476,33 @@ async 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.aiplatform_v1.FeaturestoreOnlineServingServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreOnlineServingService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeaturestoreOnlineServingServiceRestTransport._GetIamPolicy._get_response( self._host, @@ -1219,6 +1528,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_iam_policy(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.aiplatform_v1.FeaturestoreOnlineServingServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreOnlineServingService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1264,7 +1594,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -1275,8 +1605,10 @@ async def __call__( 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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -1285,6 +1617,7 @@ async def __call__( http_options = ( _BaseFeaturestoreOnlineServingServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_set_iam_policy( request, metadata ) @@ -1301,6 +1634,33 @@ async 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.aiplatform_v1.FeaturestoreOnlineServingServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreOnlineServingService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeaturestoreOnlineServingServiceRestTransport._SetIamPolicy._get_response( self._host, @@ -1327,6 +1687,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_set_iam_policy(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.aiplatform_v1.FeaturestoreOnlineServingServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreOnlineServingService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1371,7 +1752,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -1382,8 +1763,10 @@ async def __call__( 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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -1392,6 +1775,7 @@ async def __call__( http_options = ( _BaseFeaturestoreOnlineServingServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = await self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -1404,6 +1788,33 @@ async 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.aiplatform_v1.FeaturestoreOnlineServingServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreOnlineServingService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeaturestoreOnlineServingServiceRestTransport._TestIamPermissions._get_response( self._host, @@ -1429,6 +1840,27 @@ async def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_test_iam_permissions(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.aiplatform_v1.FeaturestoreOnlineServingServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreOnlineServingService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1473,7 +1905,7 @@ async 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 cancel operation method over HTTP. @@ -1484,13 +1916,16 @@ async def __call__( 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`. """ http_options = ( _BaseFeaturestoreOnlineServingServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_cancel_operation( request, metadata ) @@ -1503,6 +1938,33 @@ async 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.aiplatform_v1.FeaturestoreOnlineServingServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreOnlineServingService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeaturestoreOnlineServingServiceRestTransport._CancelOperation._get_response( self._host, @@ -1568,7 +2030,7 @@ async 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. @@ -1579,13 +2041,16 @@ async def __call__( 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`. """ http_options = ( _BaseFeaturestoreOnlineServingServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_operation( request, metadata ) @@ -1598,6 +2063,33 @@ async 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.aiplatform_v1.FeaturestoreOnlineServingServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreOnlineServingService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeaturestoreOnlineServingServiceRestTransport._DeleteOperation._get_response( self._host, @@ -1663,7 +2155,7 @@ async 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. @@ -1674,8 +2166,10 @@ async def __call__( 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: Response from GetOperation method. @@ -1684,6 +2178,7 @@ async def __call__( http_options = ( _BaseFeaturestoreOnlineServingServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_operation( request, metadata ) @@ -1696,6 +2191,33 @@ async 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.aiplatform_v1.FeaturestoreOnlineServingServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreOnlineServingService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeaturestoreOnlineServingServiceRestTransport._GetOperation._get_response( self._host, @@ -1721,6 +2243,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1.FeaturestoreOnlineServingServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreOnlineServingService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1765,7 +2308,7 @@ async 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. @@ -1776,8 +2319,10 @@ async def __call__( 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 from ListOperations method. @@ -1786,6 +2331,7 @@ async def __call__( http_options = ( _BaseFeaturestoreOnlineServingServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_operations( request, metadata ) @@ -1798,6 +2344,33 @@ async 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.aiplatform_v1.FeaturestoreOnlineServingServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreOnlineServingService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeaturestoreOnlineServingServiceRestTransport._ListOperations._get_response( self._host, @@ -1823,6 +2396,27 @@ async def __call__( resp = operations_pb2.ListOperationsResponse() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1.FeaturestoreOnlineServingServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreOnlineServingService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1867,7 +2461,7 @@ async 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 wait operation method over HTTP. @@ -1878,8 +2472,10 @@ async def __call__( 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: Response from WaitOperation method. @@ -1888,6 +2484,7 @@ async def __call__( http_options = ( _BaseFeaturestoreOnlineServingServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_wait_operation( request, metadata ) @@ -1900,6 +2497,33 @@ async 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.aiplatform_v1.FeaturestoreOnlineServingServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreOnlineServingService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeaturestoreOnlineServingServiceRestTransport._WaitOperation._get_response( self._host, @@ -1925,6 +2549,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_wait_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.aiplatform_v1.FeaturestoreOnlineServingServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreOnlineServingService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1/services/featurestore_service/async_client.py b/google/cloud/aiplatform_v1/services/featurestore_service/async_client.py index 64f328aa7c..1a66a83db8 100644 --- a/google/cloud/aiplatform_v1/services/featurestore_service/async_client.py +++ b/google/cloud/aiplatform_v1/services/featurestore_service/async_client.py @@ -13,6 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging as std_logging from collections import OrderedDict import re from typing import ( @@ -67,6 +68,15 @@ from .transports.grpc_asyncio import FeaturestoreServiceGrpcAsyncIOTransport from .client import FeaturestoreServiceClient +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 FeaturestoreServiceAsyncClient: """The service that handles CRUD and List for resources for @@ -286,6 +296,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.aiplatform_v1.FeaturestoreServiceAsyncClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "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.aiplatform.v1.FeaturestoreService", + "credentialsType": None, + }, + ) + async def create_featurestore( self, request: Optional[ @@ -297,7 +329,7 @@ async def create_featurestore( featurestore_id: 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"""Creates a new Featurestore in a given project and location. @@ -368,8 +400,10 @@ async def sample_create_featurestore(): 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: @@ -448,7 +482,7 @@ async def get_featurestore( 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]]] = (), ) -> featurestore.Featurestore: r"""Gets details of a single Featurestore. @@ -492,8 +526,10 @@ async def sample_get_featurestore(): 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.aiplatform_v1.types.Featurestore: @@ -559,7 +595,7 @@ async def list_featurestores( 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.ListFeaturestoresAsyncPager: r"""Lists Featurestores in a given project and location. @@ -605,8 +641,10 @@ async def sample_list_featurestores(): 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.aiplatform_v1.services.featurestore_service.pagers.ListFeaturestoresAsyncPager: @@ -684,7 +722,7 @@ async def update_featurestore( 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"""Updates the parameters of a single Featurestore. @@ -752,8 +790,10 @@ async def sample_update_featurestore(): 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: @@ -833,7 +873,7 @@ async def delete_featurestore( force: Optional[bool] = 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"""Deletes a single Featurestore. The Featurestore must not contain any EntityTypes or ``force`` must be set to true for the request @@ -894,8 +934,10 @@ async def sample_delete_featurestore(): 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: @@ -980,7 +1022,7 @@ async def create_entity_type( entity_type_id: 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"""Creates a new EntityType in a given Featurestore. @@ -1049,8 +1091,10 @@ async def sample_create_entity_type(): 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: @@ -1129,7 +1173,7 @@ async def get_entity_type( 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]]] = (), ) -> entity_type.EntityType: r"""Gets details of a single EntityType. @@ -1173,8 +1217,10 @@ async def sample_get_entity_type(): 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.aiplatform_v1.types.EntityType: @@ -1241,7 +1287,7 @@ async def list_entity_types( 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.ListEntityTypesAsyncPager: r"""Lists EntityTypes in a given Featurestore. @@ -1287,8 +1333,10 @@ async def sample_list_entity_types(): 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.aiplatform_v1.services.featurestore_service.pagers.ListEntityTypesAsyncPager: @@ -1366,7 +1414,7 @@ async def update_entity_type( 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]]] = (), ) -> gca_entity_type.EntityType: r"""Updates the parameters of a single EntityType. @@ -1436,8 +1484,10 @@ async def sample_update_entity_type(): 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.aiplatform_v1.types.EntityType: @@ -1509,7 +1559,7 @@ async def delete_entity_type( force: Optional[bool] = 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"""Deletes a single EntityType. The EntityType must not have any Features or ``force`` must be set to true for the request to @@ -1569,8 +1619,10 @@ async def sample_delete_entity_type(): 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: @@ -1655,7 +1707,7 @@ async def create_feature( feature_id: 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"""Creates a new Feature in a given EntityType. @@ -1730,8 +1782,10 @@ async def sample_create_feature(): 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: @@ -1812,7 +1866,7 @@ async def batch_create_features( ] = 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"""Creates a batch of Features in a given EntityType. @@ -1881,8 +1935,10 @@ async def sample_batch_create_features(): 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: @@ -1955,7 +2011,7 @@ async def get_feature( 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]]] = (), ) -> feature.Feature: r"""Gets details of a single Feature. @@ -2004,8 +2060,10 @@ async def sample_get_feature(): 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.aiplatform_v1.types.Feature: @@ -2067,7 +2125,7 @@ async def list_features( 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.ListFeaturesAsyncPager: r"""Lists Features in a given EntityType. @@ -2117,8 +2175,10 @@ async def sample_list_features(): 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.aiplatform_v1.services.featurestore_service.pagers.ListFeaturesAsyncPager: @@ -2198,7 +2258,7 @@ async def update_feature( 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]]] = (), ) -> gca_feature.Feature: r"""Updates the parameters of a single Feature. @@ -2267,8 +2327,10 @@ async def sample_update_feature(): 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.aiplatform_v1.types.Feature: @@ -2336,7 +2398,7 @@ async def delete_feature( 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"""Deletes a single Feature. @@ -2388,8 +2450,10 @@ async def sample_delete_feature(): 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: @@ -2470,7 +2534,7 @@ async def import_feature_values( entity_type: 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"""Imports Feature values into the Featurestore from a source storage. @@ -2553,8 +2617,10 @@ async def sample_import_feature_values(): 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: @@ -2629,7 +2695,7 @@ async def batch_read_feature_values( featurestore: 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"""Batch reads Feature values from a Featurestore. @@ -2697,8 +2763,10 @@ async def sample_batch_read_feature_values(): 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: @@ -2773,7 +2841,7 @@ async def export_feature_values( entity_type: 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"""Exports Feature values from all the entities of a target EntityType. @@ -2831,8 +2899,10 @@ async def sample_export_feature_values(): 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: @@ -2907,7 +2977,7 @@ async def delete_feature_values( entity_type: 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 Feature values from Featurestore. @@ -2973,8 +3043,10 @@ async def sample_delete_feature_values(): 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: @@ -3050,7 +3122,7 @@ async def search_features( query: 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.SearchFeaturesAsyncPager: r"""Searches Features matching a query in a given project. @@ -3172,8 +3244,10 @@ async def sample_search_features(): 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.aiplatform_v1.services.featurestore_service.pagers.SearchFeaturesAsyncPager: @@ -3249,7 +3323,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. @@ -3260,8 +3334,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. @@ -3302,7 +3378,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. @@ -3313,8 +3389,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. @@ -3355,7 +3433,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. @@ -3371,8 +3449,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 """ @@ -3409,7 +3489,7 @@ async def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -3424,8 +3504,10 @@ async def cancel_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 """ @@ -3462,7 +3544,7 @@ async def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -3479,8 +3561,10 @@ async def wait_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. @@ -3521,7 +3605,7 @@ async def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -3534,8 +3618,10 @@ async def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -3640,7 +3726,7 @@ async def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -3654,8 +3740,10 @@ async def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -3760,7 +3848,7 @@ async def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -3775,8 +3863,10 @@ async def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -3820,7 +3910,7 @@ async def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -3831,8 +3921,10 @@ async def get_location( 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: ~.location_pb2.Location: Location object. @@ -3873,7 +3965,7 @@ async def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -3884,8 +3976,10 @@ async def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1/services/featurestore_service/client.py b/google/cloud/aiplatform_v1/services/featurestore_service/client.py index c71b73bc07..ef45471379 100644 --- a/google/cloud/aiplatform_v1/services/featurestore_service/client.py +++ b/google/cloud/aiplatform_v1/services/featurestore_service/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 ( @@ -48,6 +49,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 as gac_operation # type: ignore from google.api_core import operation_async # type: ignore from google.cloud.aiplatform_v1.services.featurestore_service import pagers @@ -665,6 +675,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( @@ -756,6 +770,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.aiplatform_v1.FeaturestoreServiceClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "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.aiplatform.v1.FeaturestoreService", + "credentialsType": None, + }, + ) + def create_featurestore( self, request: Optional[ @@ -767,7 +804,7 @@ def create_featurestore( featurestore_id: 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]]] = (), ) -> gac_operation.Operation: r"""Creates a new Featurestore in a given project and location. @@ -838,8 +875,10 @@ def sample_create_featurestore(): 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: @@ -915,7 +954,7 @@ def get_featurestore( 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]]] = (), ) -> featurestore.Featurestore: r"""Gets details of a single Featurestore. @@ -959,8 +998,10 @@ def sample_get_featurestore(): 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.aiplatform_v1.types.Featurestore: @@ -1023,7 +1064,7 @@ def list_featurestores( 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.ListFeaturestoresPager: r"""Lists Featurestores in a given project and location. @@ -1069,8 +1110,10 @@ def sample_list_featurestores(): 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.aiplatform_v1.services.featurestore_service.pagers.ListFeaturestoresPager: @@ -1145,7 +1188,7 @@ def update_featurestore( 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]]] = (), ) -> gac_operation.Operation: r"""Updates the parameters of a single Featurestore. @@ -1213,8 +1256,10 @@ def sample_update_featurestore(): 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: @@ -1291,7 +1336,7 @@ def delete_featurestore( force: Optional[bool] = 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]]] = (), ) -> gac_operation.Operation: r"""Deletes a single Featurestore. The Featurestore must not contain any EntityTypes or ``force`` must be set to true for the request @@ -1352,8 +1397,10 @@ def sample_delete_featurestore(): 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: @@ -1435,7 +1482,7 @@ def create_entity_type( entity_type_id: 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]]] = (), ) -> gac_operation.Operation: r"""Creates a new EntityType in a given Featurestore. @@ -1504,8 +1551,10 @@ def sample_create_entity_type(): 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: @@ -1581,7 +1630,7 @@ def get_entity_type( 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]]] = (), ) -> entity_type.EntityType: r"""Gets details of a single EntityType. @@ -1625,8 +1674,10 @@ def sample_get_entity_type(): 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.aiplatform_v1.types.EntityType: @@ -1690,7 +1741,7 @@ def list_entity_types( 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.ListEntityTypesPager: r"""Lists EntityTypes in a given Featurestore. @@ -1736,8 +1787,10 @@ def sample_list_entity_types(): 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.aiplatform_v1.services.featurestore_service.pagers.ListEntityTypesPager: @@ -1812,7 +1865,7 @@ def update_entity_type( 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]]] = (), ) -> gca_entity_type.EntityType: r"""Updates the parameters of a single EntityType. @@ -1882,8 +1935,10 @@ def sample_update_entity_type(): 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.aiplatform_v1.types.EntityType: @@ -1952,7 +2007,7 @@ def delete_entity_type( force: Optional[bool] = 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]]] = (), ) -> gac_operation.Operation: r"""Deletes a single EntityType. The EntityType must not have any Features or ``force`` must be set to true for the request to @@ -2012,8 +2067,10 @@ def sample_delete_entity_type(): 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: @@ -2095,7 +2152,7 @@ def create_feature( feature_id: 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]]] = (), ) -> gac_operation.Operation: r"""Creates a new Feature in a given EntityType. @@ -2170,8 +2227,10 @@ def sample_create_feature(): 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: @@ -2249,7 +2308,7 @@ def batch_create_features( ] = 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]]] = (), ) -> gac_operation.Operation: r"""Creates a batch of Features in a given EntityType. @@ -2318,8 +2377,10 @@ def sample_batch_create_features(): 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: @@ -2389,7 +2450,7 @@ def get_feature( 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]]] = (), ) -> feature.Feature: r"""Gets details of a single Feature. @@ -2438,8 +2499,10 @@ def sample_get_feature(): 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.aiplatform_v1.types.Feature: @@ -2498,7 +2561,7 @@ def list_features( 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.ListFeaturesPager: r"""Lists Features in a given EntityType. @@ -2548,8 +2611,10 @@ def sample_list_features(): 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.aiplatform_v1.services.featurestore_service.pagers.ListFeaturesPager: @@ -2626,7 +2691,7 @@ def update_feature( 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]]] = (), ) -> gca_feature.Feature: r"""Updates the parameters of a single Feature. @@ -2695,8 +2760,10 @@ def sample_update_feature(): 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.aiplatform_v1.types.Feature: @@ -2761,7 +2828,7 @@ def delete_feature( 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]]] = (), ) -> gac_operation.Operation: r"""Deletes a single Feature. @@ -2813,8 +2880,10 @@ def sample_delete_feature(): 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: @@ -2892,7 +2961,7 @@ def import_feature_values( entity_type: 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]]] = (), ) -> gac_operation.Operation: r"""Imports Feature values into the Featurestore from a source storage. @@ -2975,8 +3044,10 @@ def sample_import_feature_values(): 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: @@ -3048,7 +3119,7 @@ def batch_read_feature_values( featurestore: 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]]] = (), ) -> gac_operation.Operation: r"""Batch reads Feature values from a Featurestore. @@ -3116,8 +3187,10 @@ def sample_batch_read_feature_values(): 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: @@ -3191,7 +3264,7 @@ def export_feature_values( entity_type: 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]]] = (), ) -> gac_operation.Operation: r"""Exports Feature values from all the entities of a target EntityType. @@ -3249,8 +3322,10 @@ def sample_export_feature_values(): 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: @@ -3322,7 +3397,7 @@ def delete_feature_values( entity_type: 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]]] = (), ) -> gac_operation.Operation: r"""Delete Feature values from Featurestore. @@ -3388,8 +3463,10 @@ def sample_delete_feature_values(): 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: @@ -3462,7 +3539,7 @@ def search_features( query: 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.SearchFeaturesPager: r"""Searches Features matching a query in a given project. @@ -3584,8 +3661,10 @@ def sample_search_features(): 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.aiplatform_v1.services.featurestore_service.pagers.SearchFeaturesPager: @@ -3671,7 +3750,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. @@ -3682,8 +3761,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. @@ -3724,7 +3805,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. @@ -3735,8 +3816,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. @@ -3777,7 +3860,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. @@ -3793,8 +3876,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 """ @@ -3831,7 +3916,7 @@ def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -3846,8 +3931,10 @@ def cancel_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 """ @@ -3884,7 +3971,7 @@ def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -3901,8 +3988,10 @@ def wait_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. @@ -3943,7 +4032,7 @@ def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -3956,8 +4045,10 @@ def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -4062,7 +4153,7 @@ def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -4076,8 +4167,10 @@ def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -4182,7 +4275,7 @@ def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -4197,8 +4290,10 @@ def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -4240,7 +4335,7 @@ def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -4251,8 +4346,10 @@ def get_location( 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: ~.location_pb2.Location: Location object. @@ -4293,7 +4390,7 @@ def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -4304,8 +4401,10 @@ def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1/services/featurestore_service/pagers.py b/google/cloud/aiplatform_v1/services/featurestore_service/pagers.py index 8759fb8d55..bd1afb27a2 100644 --- a/google/cloud/aiplatform_v1/services/featurestore_service/pagers.py +++ b/google/cloud/aiplatform_v1/services/featurestore_service/pagers.py @@ -69,7 +69,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. @@ -83,8 +83,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 = featurestore_service.ListFeaturestoresRequest(request) @@ -145,7 +147,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. @@ -159,8 +161,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 = featurestore_service.ListFeaturestoresRequest(request) @@ -225,7 +229,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. @@ -239,8 +243,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 = featurestore_service.ListEntityTypesRequest(request) @@ -299,7 +305,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. @@ -313,8 +319,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 = featurestore_service.ListEntityTypesRequest(request) @@ -379,7 +387,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. @@ -393,8 +401,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 = featurestore_service.ListFeaturesRequest(request) @@ -453,7 +463,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. @@ -467,8 +477,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 = featurestore_service.ListFeaturesRequest(request) @@ -531,7 +543,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. @@ -545,8 +557,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 = featurestore_service.SearchFeaturesRequest(request) @@ -605,7 +619,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. @@ -619,8 +633,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 = featurestore_service.SearchFeaturesRequest(request) diff --git a/google/cloud/aiplatform_v1/services/featurestore_service/transports/grpc.py b/google/cloud/aiplatform_v1/services/featurestore_service/transports/grpc.py index 95ae1d179b..1122b0636d 100644 --- a/google/cloud/aiplatform_v1/services/featurestore_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1/services/featurestore_service/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 import warnings from typing import Callable, Dict, Optional, Sequence, Tuple, Union @@ -22,8 +25,11 @@ import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from google.cloud.aiplatform_v1.types import entity_type from google.cloud.aiplatform_v1.types import entity_type as gca_entity_type @@ -37,6 +43,81 @@ from google.longrunning import operations_pb2 # type: ignore from .base import FeaturestoreServiceTransport, DEFAULT_CLIENT_INFO +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.aiplatform.v1.FeaturestoreService", + "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.aiplatform.v1.FeaturestoreService", + "rpcName": client_call_details.method, + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class FeaturestoreServiceGrpcTransport(FeaturestoreServiceTransport): """gRPC backend transport for FeaturestoreService. @@ -192,7 +273,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 @@ -256,7 +342,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 @@ -283,7 +371,7 @@ def create_featurestore( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_featurestore" not in self._stubs: - self._stubs["create_featurestore"] = self.grpc_channel.unary_unary( + self._stubs["create_featurestore"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.FeaturestoreService/CreateFeaturestore", request_serializer=featurestore_service.CreateFeaturestoreRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -311,7 +399,7 @@ def get_featurestore( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_featurestore" not in self._stubs: - self._stubs["get_featurestore"] = self.grpc_channel.unary_unary( + self._stubs["get_featurestore"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.FeaturestoreService/GetFeaturestore", request_serializer=featurestore_service.GetFeaturestoreRequest.serialize, response_deserializer=featurestore.Featurestore.deserialize, @@ -340,7 +428,7 @@ def list_featurestores( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_featurestores" not in self._stubs: - self._stubs["list_featurestores"] = self.grpc_channel.unary_unary( + self._stubs["list_featurestores"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.FeaturestoreService/ListFeaturestores", request_serializer=featurestore_service.ListFeaturestoresRequest.serialize, response_deserializer=featurestore_service.ListFeaturestoresResponse.deserialize, @@ -368,7 +456,7 @@ def update_featurestore( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_featurestore" not in self._stubs: - self._stubs["update_featurestore"] = self.grpc_channel.unary_unary( + self._stubs["update_featurestore"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.FeaturestoreService/UpdateFeaturestore", request_serializer=featurestore_service.UpdateFeaturestoreRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -398,7 +486,7 @@ def delete_featurestore( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_featurestore" not in self._stubs: - self._stubs["delete_featurestore"] = self.grpc_channel.unary_unary( + self._stubs["delete_featurestore"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.FeaturestoreService/DeleteFeaturestore", request_serializer=featurestore_service.DeleteFeaturestoreRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -426,7 +514,7 @@ def create_entity_type( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_entity_type" not in self._stubs: - self._stubs["create_entity_type"] = self.grpc_channel.unary_unary( + self._stubs["create_entity_type"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.FeaturestoreService/CreateEntityType", request_serializer=featurestore_service.CreateEntityTypeRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -452,7 +540,7 @@ def get_entity_type( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_entity_type" not in self._stubs: - self._stubs["get_entity_type"] = self.grpc_channel.unary_unary( + self._stubs["get_entity_type"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.FeaturestoreService/GetEntityType", request_serializer=featurestore_service.GetEntityTypeRequest.serialize, response_deserializer=entity_type.EntityType.deserialize, @@ -481,7 +569,7 @@ def list_entity_types( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_entity_types" not in self._stubs: - self._stubs["list_entity_types"] = self.grpc_channel.unary_unary( + self._stubs["list_entity_types"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.FeaturestoreService/ListEntityTypes", request_serializer=featurestore_service.ListEntityTypesRequest.serialize, response_deserializer=featurestore_service.ListEntityTypesResponse.deserialize, @@ -509,7 +597,7 @@ def update_entity_type( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_entity_type" not in self._stubs: - self._stubs["update_entity_type"] = self.grpc_channel.unary_unary( + self._stubs["update_entity_type"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.FeaturestoreService/UpdateEntityType", request_serializer=featurestore_service.UpdateEntityTypeRequest.serialize, response_deserializer=gca_entity_type.EntityType.deserialize, @@ -539,7 +627,7 @@ def delete_entity_type( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_entity_type" not in self._stubs: - self._stubs["delete_entity_type"] = self.grpc_channel.unary_unary( + self._stubs["delete_entity_type"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.FeaturestoreService/DeleteEntityType", request_serializer=featurestore_service.DeleteEntityTypeRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -567,7 +655,7 @@ def create_feature( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_feature" not in self._stubs: - self._stubs["create_feature"] = self.grpc_channel.unary_unary( + self._stubs["create_feature"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.FeaturestoreService/CreateFeature", request_serializer=featurestore_service.CreateFeatureRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -595,7 +683,7 @@ def batch_create_features( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "batch_create_features" not in self._stubs: - self._stubs["batch_create_features"] = self.grpc_channel.unary_unary( + self._stubs["batch_create_features"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.FeaturestoreService/BatchCreateFeatures", request_serializer=featurestore_service.BatchCreateFeaturesRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -621,7 +709,7 @@ def get_feature( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_feature" not in self._stubs: - self._stubs["get_feature"] = self.grpc_channel.unary_unary( + self._stubs["get_feature"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.FeaturestoreService/GetFeature", request_serializer=featurestore_service.GetFeatureRequest.serialize, response_deserializer=feature.Feature.deserialize, @@ -650,7 +738,7 @@ def list_features( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_features" not in self._stubs: - self._stubs["list_features"] = self.grpc_channel.unary_unary( + self._stubs["list_features"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.FeaturestoreService/ListFeatures", request_serializer=featurestore_service.ListFeaturesRequest.serialize, response_deserializer=featurestore_service.ListFeaturesResponse.deserialize, @@ -676,7 +764,7 @@ def update_feature( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_feature" not in self._stubs: - self._stubs["update_feature"] = self.grpc_channel.unary_unary( + self._stubs["update_feature"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.FeaturestoreService/UpdateFeature", request_serializer=featurestore_service.UpdateFeatureRequest.serialize, response_deserializer=gca_feature.Feature.deserialize, @@ -704,7 +792,7 @@ def delete_feature( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_feature" not in self._stubs: - self._stubs["delete_feature"] = self.grpc_channel.unary_unary( + self._stubs["delete_feature"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.FeaturestoreService/DeleteFeature", request_serializer=featurestore_service.DeleteFeatureRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -756,7 +844,7 @@ def import_feature_values( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "import_feature_values" not in self._stubs: - self._stubs["import_feature_values"] = self.grpc_channel.unary_unary( + self._stubs["import_feature_values"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.FeaturestoreService/ImportFeatureValues", request_serializer=featurestore_service.ImportFeatureValuesRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -790,7 +878,7 @@ def batch_read_feature_values( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "batch_read_feature_values" not in self._stubs: - self._stubs["batch_read_feature_values"] = self.grpc_channel.unary_unary( + self._stubs["batch_read_feature_values"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.FeaturestoreService/BatchReadFeatureValues", request_serializer=featurestore_service.BatchReadFeatureValuesRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -819,7 +907,7 @@ def export_feature_values( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "export_feature_values" not in self._stubs: - self._stubs["export_feature_values"] = self.grpc_channel.unary_unary( + self._stubs["export_feature_values"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.FeaturestoreService/ExportFeatureValues", request_serializer=featurestore_service.ExportFeatureValuesRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -859,7 +947,7 @@ def delete_feature_values( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_feature_values" not in self._stubs: - self._stubs["delete_feature_values"] = self.grpc_channel.unary_unary( + self._stubs["delete_feature_values"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.FeaturestoreService/DeleteFeatureValues", request_serializer=featurestore_service.DeleteFeatureValuesRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -889,7 +977,7 @@ def search_features( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "search_features" not in self._stubs: - self._stubs["search_features"] = self.grpc_channel.unary_unary( + self._stubs["search_features"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.FeaturestoreService/SearchFeatures", request_serializer=featurestore_service.SearchFeaturesRequest.serialize, response_deserializer=featurestore_service.SearchFeaturesResponse.deserialize, @@ -897,7 +985,7 @@ def search_features( return self._stubs["search_features"] def close(self): - self.grpc_channel.close() + self._logged_channel.close() @property def delete_operation( @@ -909,7 +997,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, @@ -926,7 +1014,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -943,7 +1031,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -960,7 +1048,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, @@ -979,7 +1067,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, @@ -998,7 +1086,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -1015,7 +1103,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -1040,7 +1128,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -1066,7 +1154,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -1095,7 +1183,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1/services/featurestore_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1/services/featurestore_service/transports/grpc_asyncio.py index 2c9550a322..36c7c714c6 100644 --- a/google/cloud/aiplatform_v1/services/featurestore_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1/services/featurestore_service/transports/grpc_asyncio.py @@ -14,6 +14,9 @@ # limitations under the License. # import inspect +import json +import pickle +import logging as std_logging import warnings from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union @@ -24,8 +27,11 @@ from google.api_core import operations_v1 from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from grpc.experimental import aio # type: ignore from google.cloud.aiplatform_v1.types import entity_type @@ -41,6 +47,82 @@ from .base import FeaturestoreServiceTransport, DEFAULT_CLIENT_INFO from .grpc import FeaturestoreServiceGrpcTransport +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.aiplatform.v1.FeaturestoreService", + "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.aiplatform.v1.FeaturestoreService", + "rpcName": str(client_call_details.method), + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class FeaturestoreServiceGrpcAsyncIOTransport(FeaturestoreServiceTransport): """gRPC AsyncIO backend transport for FeaturestoreService. @@ -239,10 +321,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 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. @@ -294,7 +379,7 @@ def create_featurestore( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_featurestore" not in self._stubs: - self._stubs["create_featurestore"] = self.grpc_channel.unary_unary( + self._stubs["create_featurestore"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.FeaturestoreService/CreateFeaturestore", request_serializer=featurestore_service.CreateFeaturestoreRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -323,7 +408,7 @@ def get_featurestore( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_featurestore" not in self._stubs: - self._stubs["get_featurestore"] = self.grpc_channel.unary_unary( + self._stubs["get_featurestore"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.FeaturestoreService/GetFeaturestore", request_serializer=featurestore_service.GetFeaturestoreRequest.serialize, response_deserializer=featurestore.Featurestore.deserialize, @@ -352,7 +437,7 @@ def list_featurestores( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_featurestores" not in self._stubs: - self._stubs["list_featurestores"] = self.grpc_channel.unary_unary( + self._stubs["list_featurestores"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.FeaturestoreService/ListFeaturestores", request_serializer=featurestore_service.ListFeaturestoresRequest.serialize, response_deserializer=featurestore_service.ListFeaturestoresResponse.deserialize, @@ -381,7 +466,7 @@ def update_featurestore( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_featurestore" not in self._stubs: - self._stubs["update_featurestore"] = self.grpc_channel.unary_unary( + self._stubs["update_featurestore"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.FeaturestoreService/UpdateFeaturestore", request_serializer=featurestore_service.UpdateFeaturestoreRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -412,7 +497,7 @@ def delete_featurestore( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_featurestore" not in self._stubs: - self._stubs["delete_featurestore"] = self.grpc_channel.unary_unary( + self._stubs["delete_featurestore"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.FeaturestoreService/DeleteFeaturestore", request_serializer=featurestore_service.DeleteFeaturestoreRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -441,7 +526,7 @@ def create_entity_type( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_entity_type" not in self._stubs: - self._stubs["create_entity_type"] = self.grpc_channel.unary_unary( + self._stubs["create_entity_type"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.FeaturestoreService/CreateEntityType", request_serializer=featurestore_service.CreateEntityTypeRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -469,7 +554,7 @@ def get_entity_type( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_entity_type" not in self._stubs: - self._stubs["get_entity_type"] = self.grpc_channel.unary_unary( + self._stubs["get_entity_type"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.FeaturestoreService/GetEntityType", request_serializer=featurestore_service.GetEntityTypeRequest.serialize, response_deserializer=entity_type.EntityType.deserialize, @@ -498,7 +583,7 @@ def list_entity_types( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_entity_types" not in self._stubs: - self._stubs["list_entity_types"] = self.grpc_channel.unary_unary( + self._stubs["list_entity_types"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.FeaturestoreService/ListEntityTypes", request_serializer=featurestore_service.ListEntityTypesRequest.serialize, response_deserializer=featurestore_service.ListEntityTypesResponse.deserialize, @@ -527,7 +612,7 @@ def update_entity_type( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_entity_type" not in self._stubs: - self._stubs["update_entity_type"] = self.grpc_channel.unary_unary( + self._stubs["update_entity_type"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.FeaturestoreService/UpdateEntityType", request_serializer=featurestore_service.UpdateEntityTypeRequest.serialize, response_deserializer=gca_entity_type.EntityType.deserialize, @@ -558,7 +643,7 @@ def delete_entity_type( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_entity_type" not in self._stubs: - self._stubs["delete_entity_type"] = self.grpc_channel.unary_unary( + self._stubs["delete_entity_type"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.FeaturestoreService/DeleteEntityType", request_serializer=featurestore_service.DeleteEntityTypeRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -586,7 +671,7 @@ def create_feature( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_feature" not in self._stubs: - self._stubs["create_feature"] = self.grpc_channel.unary_unary( + self._stubs["create_feature"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.FeaturestoreService/CreateFeature", request_serializer=featurestore_service.CreateFeatureRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -615,7 +700,7 @@ def batch_create_features( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "batch_create_features" not in self._stubs: - self._stubs["batch_create_features"] = self.grpc_channel.unary_unary( + self._stubs["batch_create_features"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.FeaturestoreService/BatchCreateFeatures", request_serializer=featurestore_service.BatchCreateFeaturesRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -641,7 +726,7 @@ def get_feature( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_feature" not in self._stubs: - self._stubs["get_feature"] = self.grpc_channel.unary_unary( + self._stubs["get_feature"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.FeaturestoreService/GetFeature", request_serializer=featurestore_service.GetFeatureRequest.serialize, response_deserializer=feature.Feature.deserialize, @@ -670,7 +755,7 @@ def list_features( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_features" not in self._stubs: - self._stubs["list_features"] = self.grpc_channel.unary_unary( + self._stubs["list_features"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.FeaturestoreService/ListFeatures", request_serializer=featurestore_service.ListFeaturesRequest.serialize, response_deserializer=featurestore_service.ListFeaturesResponse.deserialize, @@ -698,7 +783,7 @@ def update_feature( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_feature" not in self._stubs: - self._stubs["update_feature"] = self.grpc_channel.unary_unary( + self._stubs["update_feature"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.FeaturestoreService/UpdateFeature", request_serializer=featurestore_service.UpdateFeatureRequest.serialize, response_deserializer=gca_feature.Feature.deserialize, @@ -726,7 +811,7 @@ def delete_feature( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_feature" not in self._stubs: - self._stubs["delete_feature"] = self.grpc_channel.unary_unary( + self._stubs["delete_feature"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.FeaturestoreService/DeleteFeature", request_serializer=featurestore_service.DeleteFeatureRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -779,7 +864,7 @@ def import_feature_values( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "import_feature_values" not in self._stubs: - self._stubs["import_feature_values"] = self.grpc_channel.unary_unary( + self._stubs["import_feature_values"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.FeaturestoreService/ImportFeatureValues", request_serializer=featurestore_service.ImportFeatureValuesRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -814,7 +899,7 @@ def batch_read_feature_values( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "batch_read_feature_values" not in self._stubs: - self._stubs["batch_read_feature_values"] = self.grpc_channel.unary_unary( + self._stubs["batch_read_feature_values"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.FeaturestoreService/BatchReadFeatureValues", request_serializer=featurestore_service.BatchReadFeatureValuesRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -844,7 +929,7 @@ def export_feature_values( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "export_feature_values" not in self._stubs: - self._stubs["export_feature_values"] = self.grpc_channel.unary_unary( + self._stubs["export_feature_values"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.FeaturestoreService/ExportFeatureValues", request_serializer=featurestore_service.ExportFeatureValuesRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -885,7 +970,7 @@ def delete_feature_values( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_feature_values" not in self._stubs: - self._stubs["delete_feature_values"] = self.grpc_channel.unary_unary( + self._stubs["delete_feature_values"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.FeaturestoreService/DeleteFeatureValues", request_serializer=featurestore_service.DeleteFeatureValuesRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -915,7 +1000,7 @@ def search_features( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "search_features" not in self._stubs: - self._stubs["search_features"] = self.grpc_channel.unary_unary( + self._stubs["search_features"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.FeaturestoreService/SearchFeatures", request_serializer=featurestore_service.SearchFeaturesRequest.serialize, response_deserializer=featurestore_service.SearchFeaturesResponse.deserialize, @@ -1088,7 +1173,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: @@ -1104,7 +1189,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, @@ -1121,7 +1206,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -1138,7 +1223,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -1155,7 +1240,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, @@ -1174,7 +1259,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, @@ -1193,7 +1278,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -1210,7 +1295,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -1235,7 +1320,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -1261,7 +1346,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -1290,7 +1375,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1/services/featurestore_service/transports/rest.py b/google/cloud/aiplatform_v1/services/featurestore_service/transports/rest.py index a66dbf2e5c..ffadee70cf 100644 --- a/google/cloud/aiplatform_v1/services/featurestore_service/transports/rest.py +++ b/google/cloud/aiplatform_v1/services/featurestore_service/transports/rest.py @@ -13,9 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging +import json # type: ignore from google.auth.transport.requests import AuthorizedSession # type: ignore -import json # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.api_core import exceptions as core_exceptions from google.api_core import retry as retries @@ -52,6 +53,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, @@ -252,9 +261,10 @@ def post_update_featurestore(self, response): def pre_batch_create_features( self, request: featurestore_service.BatchCreateFeaturesRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - featurestore_service.BatchCreateFeaturesRequest, Sequence[Tuple[str, str]] + featurestore_service.BatchCreateFeaturesRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for batch_create_features @@ -277,9 +287,10 @@ def post_batch_create_features( def pre_batch_read_feature_values( self, request: featurestore_service.BatchReadFeatureValuesRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - featurestore_service.BatchReadFeatureValuesRequest, Sequence[Tuple[str, str]] + featurestore_service.BatchReadFeatureValuesRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for batch_read_feature_values @@ -302,8 +313,11 @@ def post_batch_read_feature_values( def pre_create_entity_type( self, request: featurestore_service.CreateEntityTypeRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[featurestore_service.CreateEntityTypeRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + featurestore_service.CreateEntityTypeRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for create_entity_type Override in a subclass to manipulate the request or metadata @@ -325,8 +339,11 @@ def post_create_entity_type( def pre_create_feature( self, request: featurestore_service.CreateFeatureRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[featurestore_service.CreateFeatureRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + featurestore_service.CreateFeatureRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for create_feature Override in a subclass to manipulate the request or metadata @@ -348,9 +365,10 @@ def post_create_feature( def pre_create_featurestore( self, request: featurestore_service.CreateFeaturestoreRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - featurestore_service.CreateFeaturestoreRequest, Sequence[Tuple[str, str]] + featurestore_service.CreateFeaturestoreRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for create_featurestore @@ -373,8 +391,11 @@ def post_create_featurestore( def pre_delete_entity_type( self, request: featurestore_service.DeleteEntityTypeRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[featurestore_service.DeleteEntityTypeRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + featurestore_service.DeleteEntityTypeRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for delete_entity_type Override in a subclass to manipulate the request or metadata @@ -396,8 +417,11 @@ def post_delete_entity_type( def pre_delete_feature( self, request: featurestore_service.DeleteFeatureRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[featurestore_service.DeleteFeatureRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + featurestore_service.DeleteFeatureRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for delete_feature Override in a subclass to manipulate the request or metadata @@ -419,9 +443,10 @@ def post_delete_feature( def pre_delete_featurestore( self, request: featurestore_service.DeleteFeaturestoreRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - featurestore_service.DeleteFeaturestoreRequest, Sequence[Tuple[str, str]] + featurestore_service.DeleteFeaturestoreRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for delete_featurestore @@ -444,9 +469,10 @@ def post_delete_featurestore( def pre_delete_feature_values( self, request: featurestore_service.DeleteFeatureValuesRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - featurestore_service.DeleteFeatureValuesRequest, Sequence[Tuple[str, str]] + featurestore_service.DeleteFeatureValuesRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for delete_feature_values @@ -469,9 +495,10 @@ def post_delete_feature_values( def pre_export_feature_values( self, request: featurestore_service.ExportFeatureValuesRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - featurestore_service.ExportFeatureValuesRequest, Sequence[Tuple[str, str]] + featurestore_service.ExportFeatureValuesRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for export_feature_values @@ -494,8 +521,11 @@ def post_export_feature_values( def pre_get_entity_type( self, request: featurestore_service.GetEntityTypeRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[featurestore_service.GetEntityTypeRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + featurestore_service.GetEntityTypeRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for get_entity_type Override in a subclass to manipulate the request or metadata @@ -517,8 +547,10 @@ def post_get_entity_type( def pre_get_feature( self, request: featurestore_service.GetFeatureRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[featurestore_service.GetFeatureRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + featurestore_service.GetFeatureRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_feature Override in a subclass to manipulate the request or metadata @@ -538,8 +570,11 @@ def post_get_feature(self, response: feature.Feature) -> feature.Feature: def pre_get_featurestore( self, request: featurestore_service.GetFeaturestoreRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[featurestore_service.GetFeaturestoreRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + featurestore_service.GetFeaturestoreRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for get_featurestore Override in a subclass to manipulate the request or metadata @@ -561,9 +596,10 @@ def post_get_featurestore( def pre_import_feature_values( self, request: featurestore_service.ImportFeatureValuesRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - featurestore_service.ImportFeatureValuesRequest, Sequence[Tuple[str, str]] + featurestore_service.ImportFeatureValuesRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for import_feature_values @@ -586,8 +622,11 @@ def post_import_feature_values( def pre_list_entity_types( self, request: featurestore_service.ListEntityTypesRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[featurestore_service.ListEntityTypesRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + featurestore_service.ListEntityTypesRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for list_entity_types Override in a subclass to manipulate the request or metadata @@ -609,8 +648,11 @@ def post_list_entity_types( def pre_list_features( self, request: featurestore_service.ListFeaturesRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[featurestore_service.ListFeaturesRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + featurestore_service.ListFeaturesRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for list_features Override in a subclass to manipulate the request or metadata @@ -632,9 +674,10 @@ def post_list_features( def pre_list_featurestores( self, request: featurestore_service.ListFeaturestoresRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - featurestore_service.ListFeaturestoresRequest, Sequence[Tuple[str, str]] + featurestore_service.ListFeaturestoresRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for list_featurestores @@ -657,8 +700,11 @@ def post_list_featurestores( def pre_search_features( self, request: featurestore_service.SearchFeaturesRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[featurestore_service.SearchFeaturesRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + featurestore_service.SearchFeaturesRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for search_features Override in a subclass to manipulate the request or metadata @@ -680,8 +726,11 @@ def post_search_features( def pre_update_entity_type( self, request: featurestore_service.UpdateEntityTypeRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[featurestore_service.UpdateEntityTypeRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + featurestore_service.UpdateEntityTypeRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for update_entity_type Override in a subclass to manipulate the request or metadata @@ -703,8 +752,11 @@ def post_update_entity_type( def pre_update_feature( self, request: featurestore_service.UpdateFeatureRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[featurestore_service.UpdateFeatureRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + featurestore_service.UpdateFeatureRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for update_feature Override in a subclass to manipulate the request or metadata @@ -724,9 +776,10 @@ def post_update_feature(self, response: gca_feature.Feature) -> gca_feature.Feat def pre_update_featurestore( self, request: featurestore_service.UpdateFeaturestoreRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - featurestore_service.UpdateFeaturestoreRequest, Sequence[Tuple[str, str]] + featurestore_service.UpdateFeaturestoreRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for update_featurestore @@ -749,8 +802,10 @@ def post_update_featurestore( def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -772,8 +827,10 @@ def post_get_location( def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -795,8 +852,10 @@ def post_list_locations( def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -816,8 +875,10 @@ def post_get_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -837,8 +898,11 @@ def post_set_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -860,8 +924,10 @@ def post_test_iam_permissions( def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -881,8 +947,10 @@ def post_cancel_operation(self, response: None) -> None: 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 @@ -902,8 +970,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 @@ -925,8 +995,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 @@ -948,8 +1020,10 @@ def post_list_operations( def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -2972,7 +3046,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 batch create features method over HTTP. @@ -2985,8 +3059,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: @@ -2999,6 +3075,7 @@ def __call__( http_options = ( _BaseFeaturestoreServiceRestTransport._BaseBatchCreateFeatures._get_http_options() ) + request, metadata = self._interceptor.pre_batch_create_features( request, metadata ) @@ -3015,6 +3092,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.aiplatform_v1.FeaturestoreServiceClient.BatchCreateFeatures", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "rpcName": "BatchCreateFeatures", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( FeaturestoreServiceRestTransport._BatchCreateFeatures._get_response( @@ -3036,7 +3140,29 @@ def __call__( # Return the response resp = operations_pb2.Operation() json_format.Parse(response.content, resp, ignore_unknown_fields=True) + resp = self._interceptor.post_batch_create_features(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.aiplatform_v1.FeaturestoreServiceClient.batch_create_features", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "rpcName": "BatchCreateFeatures", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _BatchReadFeatureValues( @@ -3076,7 +3202,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 batch read feature values method over HTTP. @@ -3087,8 +3213,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: @@ -3101,6 +3229,7 @@ def __call__( http_options = ( _BaseFeaturestoreServiceRestTransport._BaseBatchReadFeatureValues._get_http_options() ) + request, metadata = self._interceptor.pre_batch_read_feature_values( request, metadata ) @@ -3117,6 +3246,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.aiplatform_v1.FeaturestoreServiceClient.BatchReadFeatureValues", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "rpcName": "BatchReadFeatureValues", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( FeaturestoreServiceRestTransport._BatchReadFeatureValues._get_response( @@ -3138,7 +3294,29 @@ def __call__( # Return the response resp = operations_pb2.Operation() json_format.Parse(response.content, resp, ignore_unknown_fields=True) + resp = self._interceptor.post_batch_read_feature_values(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.aiplatform_v1.FeaturestoreServiceClient.batch_read_feature_values", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "rpcName": "BatchReadFeatureValues", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _CreateEntityType( @@ -3178,7 +3356,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 entity type method over HTTP. @@ -3189,8 +3367,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: @@ -3203,6 +3383,7 @@ def __call__( http_options = ( _BaseFeaturestoreServiceRestTransport._BaseCreateEntityType._get_http_options() ) + request, metadata = self._interceptor.pre_create_entity_type( request, metadata ) @@ -3219,6 +3400,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.aiplatform_v1.FeaturestoreServiceClient.CreateEntityType", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "rpcName": "CreateEntityType", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeaturestoreServiceRestTransport._CreateEntityType._get_response( self._host, @@ -3238,7 +3446,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_entity_type(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.aiplatform_v1.FeaturestoreServiceClient.create_entity_type", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "rpcName": "CreateEntityType", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _CreateFeature( @@ -3278,7 +3508,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 feature method over HTTP. @@ -3291,8 +3521,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: @@ -3305,6 +3537,7 @@ def __call__( http_options = ( _BaseFeaturestoreServiceRestTransport._BaseCreateFeature._get_http_options() ) + request, metadata = self._interceptor.pre_create_feature(request, metadata) transcoded_request = _BaseFeaturestoreServiceRestTransport._BaseCreateFeature._get_transcoded_request( http_options, request @@ -3319,6 +3552,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.aiplatform_v1.FeaturestoreServiceClient.CreateFeature", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "rpcName": "CreateFeature", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeaturestoreServiceRestTransport._CreateFeature._get_response( self._host, @@ -3338,7 +3598,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_feature(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.aiplatform_v1.FeaturestoreServiceClient.create_feature", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "rpcName": "CreateFeature", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _CreateFeaturestore( @@ -3378,7 +3660,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 featurestore method over HTTP. @@ -3389,8 +3671,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: @@ -3403,6 +3687,7 @@ def __call__( http_options = ( _BaseFeaturestoreServiceRestTransport._BaseCreateFeaturestore._get_http_options() ) + request, metadata = self._interceptor.pre_create_featurestore( request, metadata ) @@ -3419,6 +3704,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.aiplatform_v1.FeaturestoreServiceClient.CreateFeaturestore", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "rpcName": "CreateFeaturestore", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( FeaturestoreServiceRestTransport._CreateFeaturestore._get_response( @@ -3440,7 +3752,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_featurestore(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.aiplatform_v1.FeaturestoreServiceClient.create_featurestore", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "rpcName": "CreateFeaturestore", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _DeleteEntityType( @@ -3479,7 +3813,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 entity type method over HTTP. @@ -3490,8 +3824,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: @@ -3504,6 +3840,7 @@ def __call__( http_options = ( _BaseFeaturestoreServiceRestTransport._BaseDeleteEntityType._get_http_options() ) + request, metadata = self._interceptor.pre_delete_entity_type( request, metadata ) @@ -3516,6 +3853,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.aiplatform_v1.FeaturestoreServiceClient.DeleteEntityType", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "rpcName": "DeleteEntityType", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeaturestoreServiceRestTransport._DeleteEntityType._get_response( self._host, @@ -3534,7 +3898,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_entity_type(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.aiplatform_v1.FeaturestoreServiceClient.delete_entity_type", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "rpcName": "DeleteEntityType", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _DeleteFeature( @@ -3573,7 +3959,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 feature method over HTTP. @@ -3586,8 +3972,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: @@ -3600,6 +3988,7 @@ def __call__( http_options = ( _BaseFeaturestoreServiceRestTransport._BaseDeleteFeature._get_http_options() ) + request, metadata = self._interceptor.pre_delete_feature(request, metadata) transcoded_request = _BaseFeaturestoreServiceRestTransport._BaseDeleteFeature._get_transcoded_request( http_options, request @@ -3610,6 +3999,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.aiplatform_v1.FeaturestoreServiceClient.DeleteFeature", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "rpcName": "DeleteFeature", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeaturestoreServiceRestTransport._DeleteFeature._get_response( self._host, @@ -3628,7 +4044,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_feature(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.aiplatform_v1.FeaturestoreServiceClient.delete_feature", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "rpcName": "DeleteFeature", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _DeleteFeaturestore( @@ -3667,7 +4105,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 featurestore method over HTTP. @@ -3678,8 +4116,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: @@ -3692,6 +4132,7 @@ def __call__( http_options = ( _BaseFeaturestoreServiceRestTransport._BaseDeleteFeaturestore._get_http_options() ) + request, metadata = self._interceptor.pre_delete_featurestore( request, metadata ) @@ -3704,6 +4145,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.aiplatform_v1.FeaturestoreServiceClient.DeleteFeaturestore", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "rpcName": "DeleteFeaturestore", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( FeaturestoreServiceRestTransport._DeleteFeaturestore._get_response( @@ -3724,7 +4192,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_featurestore(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.aiplatform_v1.FeaturestoreServiceClient.delete_featurestore", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "rpcName": "DeleteFeaturestore", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _DeleteFeatureValues( @@ -3764,7 +4254,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 feature values method over HTTP. @@ -3775,8 +4265,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: @@ -3789,6 +4281,7 @@ def __call__( http_options = ( _BaseFeaturestoreServiceRestTransport._BaseDeleteFeatureValues._get_http_options() ) + request, metadata = self._interceptor.pre_delete_feature_values( request, metadata ) @@ -3805,6 +4298,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.aiplatform_v1.FeaturestoreServiceClient.DeleteFeatureValues", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "rpcName": "DeleteFeatureValues", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( FeaturestoreServiceRestTransport._DeleteFeatureValues._get_response( @@ -3826,7 +4346,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_feature_values(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.aiplatform_v1.FeaturestoreServiceClient.delete_feature_values", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "rpcName": "DeleteFeatureValues", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ExportFeatureValues( @@ -3866,7 +4408,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 export feature values method over HTTP. @@ -3877,8 +4419,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: @@ -3891,6 +4435,7 @@ def __call__( http_options = ( _BaseFeaturestoreServiceRestTransport._BaseExportFeatureValues._get_http_options() ) + request, metadata = self._interceptor.pre_export_feature_values( request, metadata ) @@ -3907,6 +4452,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.aiplatform_v1.FeaturestoreServiceClient.ExportFeatureValues", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "rpcName": "ExportFeatureValues", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( FeaturestoreServiceRestTransport._ExportFeatureValues._get_response( @@ -3928,7 +4500,29 @@ def __call__( # Return the response resp = operations_pb2.Operation() json_format.Parse(response.content, resp, ignore_unknown_fields=True) + resp = self._interceptor.post_export_feature_values(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.aiplatform_v1.FeaturestoreServiceClient.export_feature_values", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "rpcName": "ExportFeatureValues", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _GetEntityType( @@ -3967,7 +4561,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]]] = (), ) -> entity_type.EntityType: r"""Call the get entity type method over HTTP. @@ -3978,8 +4572,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: ~.entity_type.EntityType: @@ -3995,6 +4591,7 @@ def __call__( http_options = ( _BaseFeaturestoreServiceRestTransport._BaseGetEntityType._get_http_options() ) + request, metadata = self._interceptor.pre_get_entity_type(request, metadata) transcoded_request = _BaseFeaturestoreServiceRestTransport._BaseGetEntityType._get_transcoded_request( http_options, request @@ -4005,6 +4602,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.aiplatform_v1.FeaturestoreServiceClient.GetEntityType", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "rpcName": "GetEntityType", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeaturestoreServiceRestTransport._GetEntityType._get_response( self._host, @@ -4025,7 +4649,29 @@ def __call__( pb_resp = entity_type.EntityType.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_entity_type(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = entity_type.EntityType.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.aiplatform_v1.FeaturestoreServiceClient.get_entity_type", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "rpcName": "GetEntityType", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _GetFeature( @@ -4064,7 +4710,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]]] = (), ) -> feature.Feature: r"""Call the get feature method over HTTP. @@ -4077,8 +4723,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: ~.feature.Feature: @@ -4091,6 +4739,7 @@ def __call__( http_options = ( _BaseFeaturestoreServiceRestTransport._BaseGetFeature._get_http_options() ) + request, metadata = self._interceptor.pre_get_feature(request, metadata) transcoded_request = _BaseFeaturestoreServiceRestTransport._BaseGetFeature._get_transcoded_request( http_options, request @@ -4101,6 +4750,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.aiplatform_v1.FeaturestoreServiceClient.GetFeature", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "rpcName": "GetFeature", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeaturestoreServiceRestTransport._GetFeature._get_response( self._host, @@ -4121,7 +4797,29 @@ def __call__( pb_resp = feature.Feature.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_feature(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = feature.Feature.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.aiplatform_v1.FeaturestoreServiceClient.get_feature", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "rpcName": "GetFeature", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _GetFeaturestore( @@ -4160,7 +4858,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]]] = (), ) -> featurestore.Featurestore: r"""Call the get featurestore method over HTTP. @@ -4171,8 +4869,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: ~.featurestore.Featurestore: @@ -4187,6 +4887,7 @@ def __call__( http_options = ( _BaseFeaturestoreServiceRestTransport._BaseGetFeaturestore._get_http_options() ) + request, metadata = self._interceptor.pre_get_featurestore( request, metadata ) @@ -4199,6 +4900,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.aiplatform_v1.FeaturestoreServiceClient.GetFeaturestore", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "rpcName": "GetFeaturestore", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeaturestoreServiceRestTransport._GetFeaturestore._get_response( self._host, @@ -4219,7 +4947,29 @@ def __call__( pb_resp = featurestore.Featurestore.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_featurestore(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = featurestore.Featurestore.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.aiplatform_v1.FeaturestoreServiceClient.get_featurestore", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "rpcName": "GetFeaturestore", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ImportFeatureValues( @@ -4259,7 +5009,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 import feature values method over HTTP. @@ -4270,8 +5020,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: @@ -4284,6 +5036,7 @@ def __call__( http_options = ( _BaseFeaturestoreServiceRestTransport._BaseImportFeatureValues._get_http_options() ) + request, metadata = self._interceptor.pre_import_feature_values( request, metadata ) @@ -4300,6 +5053,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.aiplatform_v1.FeaturestoreServiceClient.ImportFeatureValues", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "rpcName": "ImportFeatureValues", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( FeaturestoreServiceRestTransport._ImportFeatureValues._get_response( @@ -4321,7 +5101,29 @@ def __call__( # Return the response resp = operations_pb2.Operation() json_format.Parse(response.content, resp, ignore_unknown_fields=True) + resp = self._interceptor.post_import_feature_values(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.aiplatform_v1.FeaturestoreServiceClient.import_feature_values", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "rpcName": "ImportFeatureValues", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListEntityTypes( @@ -4360,7 +5162,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]]] = (), ) -> featurestore_service.ListEntityTypesResponse: r"""Call the list entity types method over HTTP. @@ -4371,8 +5173,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: ~.featurestore_service.ListEntityTypesResponse: @@ -4384,6 +5188,7 @@ def __call__( http_options = ( _BaseFeaturestoreServiceRestTransport._BaseListEntityTypes._get_http_options() ) + request, metadata = self._interceptor.pre_list_entity_types( request, metadata ) @@ -4396,6 +5201,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.aiplatform_v1.FeaturestoreServiceClient.ListEntityTypes", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "rpcName": "ListEntityTypes", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeaturestoreServiceRestTransport._ListEntityTypes._get_response( self._host, @@ -4416,7 +5248,31 @@ def __call__( pb_resp = featurestore_service.ListEntityTypesResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_entity_types(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + featurestore_service.ListEntityTypesResponse.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.aiplatform_v1.FeaturestoreServiceClient.list_entity_types", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "rpcName": "ListEntityTypes", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListFeatures( @@ -4455,7 +5311,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]]] = (), ) -> featurestore_service.ListFeaturesResponse: r"""Call the list features method over HTTP. @@ -4468,8 +5324,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: ~.featurestore_service.ListFeaturesResponse: @@ -4483,6 +5341,7 @@ def __call__( http_options = ( _BaseFeaturestoreServiceRestTransport._BaseListFeatures._get_http_options() ) + request, metadata = self._interceptor.pre_list_features(request, metadata) transcoded_request = _BaseFeaturestoreServiceRestTransport._BaseListFeatures._get_transcoded_request( http_options, request @@ -4493,6 +5352,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.aiplatform_v1.FeaturestoreServiceClient.ListFeatures", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "rpcName": "ListFeatures", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeaturestoreServiceRestTransport._ListFeatures._get_response( self._host, @@ -4513,7 +5399,31 @@ def __call__( pb_resp = featurestore_service.ListFeaturesResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_features(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + featurestore_service.ListFeaturesResponse.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.aiplatform_v1.FeaturestoreServiceClient.list_features", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "rpcName": "ListFeatures", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListFeaturestores( @@ -4552,7 +5462,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]]] = (), ) -> featurestore_service.ListFeaturestoresResponse: r"""Call the list featurestores method over HTTP. @@ -4563,8 +5473,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: ~.featurestore_service.ListFeaturestoresResponse: @@ -4576,6 +5488,7 @@ def __call__( http_options = ( _BaseFeaturestoreServiceRestTransport._BaseListFeaturestores._get_http_options() ) + request, metadata = self._interceptor.pre_list_featurestores( request, metadata ) @@ -4588,6 +5501,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.aiplatform_v1.FeaturestoreServiceClient.ListFeaturestores", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "rpcName": "ListFeaturestores", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( FeaturestoreServiceRestTransport._ListFeaturestores._get_response( @@ -4610,7 +5550,31 @@ def __call__( pb_resp = featurestore_service.ListFeaturestoresResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_featurestores(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + featurestore_service.ListFeaturestoresResponse.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.aiplatform_v1.FeaturestoreServiceClient.list_featurestores", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "rpcName": "ListFeaturestores", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _SearchFeatures( @@ -4649,7 +5613,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]]] = (), ) -> featurestore_service.SearchFeaturesResponse: r"""Call the search features method over HTTP. @@ -4660,8 +5624,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: ~.featurestore_service.SearchFeaturesResponse: @@ -4673,6 +5639,7 @@ def __call__( http_options = ( _BaseFeaturestoreServiceRestTransport._BaseSearchFeatures._get_http_options() ) + request, metadata = self._interceptor.pre_search_features(request, metadata) transcoded_request = _BaseFeaturestoreServiceRestTransport._BaseSearchFeatures._get_transcoded_request( http_options, request @@ -4683,6 +5650,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.aiplatform_v1.FeaturestoreServiceClient.SearchFeatures", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "rpcName": "SearchFeatures", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeaturestoreServiceRestTransport._SearchFeatures._get_response( self._host, @@ -4703,7 +5697,31 @@ def __call__( pb_resp = featurestore_service.SearchFeaturesResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_search_features(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + featurestore_service.SearchFeaturesResponse.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.aiplatform_v1.FeaturestoreServiceClient.search_features", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "rpcName": "SearchFeatures", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _UpdateEntityType( @@ -4743,7 +5761,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]]] = (), ) -> gca_entity_type.EntityType: r"""Call the update entity type method over HTTP. @@ -4754,8 +5772,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: ~.gca_entity_type.EntityType: @@ -4771,6 +5791,7 @@ def __call__( http_options = ( _BaseFeaturestoreServiceRestTransport._BaseUpdateEntityType._get_http_options() ) + request, metadata = self._interceptor.pre_update_entity_type( request, metadata ) @@ -4787,6 +5808,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.aiplatform_v1.FeaturestoreServiceClient.UpdateEntityType", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "rpcName": "UpdateEntityType", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeaturestoreServiceRestTransport._UpdateEntityType._get_response( self._host, @@ -4808,7 +5856,29 @@ def __call__( pb_resp = gca_entity_type.EntityType.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_update_entity_type(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gca_entity_type.EntityType.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.aiplatform_v1.FeaturestoreServiceClient.update_entity_type", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "rpcName": "UpdateEntityType", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _UpdateFeature( @@ -4848,7 +5918,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]]] = (), ) -> gca_feature.Feature: r"""Call the update feature method over HTTP. @@ -4861,8 +5931,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: ~.gca_feature.Feature: @@ -4875,6 +5947,7 @@ def __call__( http_options = ( _BaseFeaturestoreServiceRestTransport._BaseUpdateFeature._get_http_options() ) + request, metadata = self._interceptor.pre_update_feature(request, metadata) transcoded_request = _BaseFeaturestoreServiceRestTransport._BaseUpdateFeature._get_transcoded_request( http_options, request @@ -4889,6 +5962,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.aiplatform_v1.FeaturestoreServiceClient.UpdateFeature", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "rpcName": "UpdateFeature", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeaturestoreServiceRestTransport._UpdateFeature._get_response( self._host, @@ -4910,7 +6010,29 @@ def __call__( pb_resp = gca_feature.Feature.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_update_feature(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gca_feature.Feature.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.aiplatform_v1.FeaturestoreServiceClient.update_feature", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "rpcName": "UpdateFeature", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _UpdateFeaturestore( @@ -4950,7 +6072,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 featurestore method over HTTP. @@ -4961,8 +6083,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: @@ -4975,6 +6099,7 @@ def __call__( http_options = ( _BaseFeaturestoreServiceRestTransport._BaseUpdateFeaturestore._get_http_options() ) + request, metadata = self._interceptor.pre_update_featurestore( request, metadata ) @@ -4991,6 +6116,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.aiplatform_v1.FeaturestoreServiceClient.UpdateFeaturestore", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "rpcName": "UpdateFeaturestore", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( FeaturestoreServiceRestTransport._UpdateFeaturestore._get_response( @@ -5012,7 +6164,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_featurestore(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.aiplatform_v1.FeaturestoreServiceClient.update_featurestore", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "rpcName": "UpdateFeaturestore", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp @property @@ -5263,7 +6437,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]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -5274,8 +6448,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: locations_pb2.Location: Response from GetLocation method. @@ -5284,6 +6460,7 @@ def __call__( http_options = ( _BaseFeaturestoreServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = self._interceptor.pre_get_location(request, metadata) transcoded_request = _BaseFeaturestoreServiceRestTransport._BaseGetLocation._get_transcoded_request( http_options, request @@ -5294,6 +6471,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.aiplatform_v1.FeaturestoreServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeaturestoreServiceRestTransport._GetLocation._get_response( self._host, @@ -5313,6 +6517,27 @@ def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_location(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.aiplatform_v1.FeaturestoreServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5355,7 +6580,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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -5366,8 +6591,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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -5376,6 +6603,7 @@ def __call__( http_options = ( _BaseFeaturestoreServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = self._interceptor.pre_list_locations(request, metadata) transcoded_request = _BaseFeaturestoreServiceRestTransport._BaseListLocations._get_transcoded_request( http_options, request @@ -5386,6 +6614,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.aiplatform_v1.FeaturestoreServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeaturestoreServiceRestTransport._ListLocations._get_response( self._host, @@ -5405,6 +6660,27 @@ def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_list_locations(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.aiplatform_v1.FeaturestoreServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5447,7 +6723,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]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -5458,8 +6734,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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -5468,6 +6746,7 @@ def __call__( http_options = ( _BaseFeaturestoreServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_get_iam_policy(request, metadata) transcoded_request = _BaseFeaturestoreServiceRestTransport._BaseGetIamPolicy._get_transcoded_request( http_options, request @@ -5478,6 +6757,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.aiplatform_v1.FeaturestoreServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeaturestoreServiceRestTransport._GetIamPolicy._get_response( self._host, @@ -5497,6 +6803,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_iam_policy(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.aiplatform_v1.FeaturestoreServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5540,7 +6867,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]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -5551,8 +6878,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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -5561,6 +6890,7 @@ def __call__( http_options = ( _BaseFeaturestoreServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_set_iam_policy(request, metadata) transcoded_request = _BaseFeaturestoreServiceRestTransport._BaseSetIamPolicy._get_transcoded_request( http_options, request @@ -5575,6 +6905,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.aiplatform_v1.FeaturestoreServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeaturestoreServiceRestTransport._SetIamPolicy._get_response( self._host, @@ -5595,6 +6952,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_set_iam_policy(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.aiplatform_v1.FeaturestoreServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5637,7 +7015,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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -5648,8 +7026,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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -5658,6 +7038,7 @@ def __call__( http_options = ( _BaseFeaturestoreServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -5670,6 +7051,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.aiplatform_v1.FeaturestoreServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( FeaturestoreServiceRestTransport._TestIamPermissions._get_response( @@ -5691,6 +7099,27 @@ def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_test_iam_permissions(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.aiplatform_v1.FeaturestoreServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5733,7 +7162,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 cancel operation method over HTTP. @@ -5744,13 +7173,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 = ( _BaseFeaturestoreServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = self._interceptor.pre_cancel_operation( request, metadata ) @@ -5763,6 +7195,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.aiplatform_v1.FeaturestoreServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeaturestoreServiceRestTransport._CancelOperation._get_response( self._host, @@ -5820,7 +7279,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. @@ -5831,13 +7290,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 = ( _BaseFeaturestoreServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = self._interceptor.pre_delete_operation( request, metadata ) @@ -5850,6 +7312,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.aiplatform_v1.FeaturestoreServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeaturestoreServiceRestTransport._DeleteOperation._get_response( self._host, @@ -5907,7 +7396,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. @@ -5918,8 +7407,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. @@ -5928,6 +7419,7 @@ def __call__( http_options = ( _BaseFeaturestoreServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = self._interceptor.pre_get_operation(request, metadata) transcoded_request = _BaseFeaturestoreServiceRestTransport._BaseGetOperation._get_transcoded_request( http_options, request @@ -5938,6 +7430,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.aiplatform_v1.FeaturestoreServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeaturestoreServiceRestTransport._GetOperation._get_response( self._host, @@ -5957,6 +7476,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.aiplatform_v1.FeaturestoreServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5999,7 +7539,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. @@ -6010,8 +7550,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. @@ -6020,6 +7562,7 @@ def __call__( http_options = ( _BaseFeaturestoreServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = self._interceptor.pre_list_operations(request, metadata) transcoded_request = _BaseFeaturestoreServiceRestTransport._BaseListOperations._get_transcoded_request( http_options, request @@ -6030,6 +7573,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.aiplatform_v1.FeaturestoreServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeaturestoreServiceRestTransport._ListOperations._get_response( self._host, @@ -6049,6 +7619,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.aiplatform_v1.FeaturestoreServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -6091,7 +7682,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 wait operation method over HTTP. @@ -6102,8 +7693,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 WaitOperation method. @@ -6112,6 +7705,7 @@ def __call__( http_options = ( _BaseFeaturestoreServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = self._interceptor.pre_wait_operation(request, metadata) transcoded_request = _BaseFeaturestoreServiceRestTransport._BaseWaitOperation._get_transcoded_request( http_options, request @@ -6122,6 +7716,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.aiplatform_v1.FeaturestoreServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeaturestoreServiceRestTransport._WaitOperation._get_response( self._host, @@ -6141,6 +7762,27 @@ def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = self._interceptor.post_wait_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.aiplatform_v1.FeaturestoreServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1/services/featurestore_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1/services/featurestore_service/transports/rest_asyncio.py index aa95d0b6db..e7bdc1b6cc 100644 --- a/google/cloud/aiplatform_v1/services/featurestore_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1/services/featurestore_service/transports/rest_asyncio.py @@ -63,6 +63,18 @@ from .base import DEFAULT_CLIENT_INFO as BASE_DEFAULT_CLIENT_INFO + +import logging + +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__) + try: OptionalRetry = Union[retries.AsyncRetry, gapic_v1.method._MethodDefault, None] except AttributeError: # pragma: NO COVER @@ -267,9 +279,10 @@ async def post_update_featurestore(self, response): async def pre_batch_create_features( self, request: featurestore_service.BatchCreateFeaturesRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - featurestore_service.BatchCreateFeaturesRequest, Sequence[Tuple[str, str]] + featurestore_service.BatchCreateFeaturesRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for batch_create_features @@ -292,9 +305,10 @@ async def post_batch_create_features( async def pre_batch_read_feature_values( self, request: featurestore_service.BatchReadFeatureValuesRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - featurestore_service.BatchReadFeatureValuesRequest, Sequence[Tuple[str, str]] + featurestore_service.BatchReadFeatureValuesRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for batch_read_feature_values @@ -317,8 +331,11 @@ async def post_batch_read_feature_values( async def pre_create_entity_type( self, request: featurestore_service.CreateEntityTypeRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[featurestore_service.CreateEntityTypeRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + featurestore_service.CreateEntityTypeRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for create_entity_type Override in a subclass to manipulate the request or metadata @@ -340,8 +357,11 @@ async def post_create_entity_type( async def pre_create_feature( self, request: featurestore_service.CreateFeatureRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[featurestore_service.CreateFeatureRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + featurestore_service.CreateFeatureRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for create_feature Override in a subclass to manipulate the request or metadata @@ -363,9 +383,10 @@ async def post_create_feature( async def pre_create_featurestore( self, request: featurestore_service.CreateFeaturestoreRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - featurestore_service.CreateFeaturestoreRequest, Sequence[Tuple[str, str]] + featurestore_service.CreateFeaturestoreRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for create_featurestore @@ -388,8 +409,11 @@ async def post_create_featurestore( async def pre_delete_entity_type( self, request: featurestore_service.DeleteEntityTypeRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[featurestore_service.DeleteEntityTypeRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + featurestore_service.DeleteEntityTypeRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for delete_entity_type Override in a subclass to manipulate the request or metadata @@ -411,8 +435,11 @@ async def post_delete_entity_type( async def pre_delete_feature( self, request: featurestore_service.DeleteFeatureRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[featurestore_service.DeleteFeatureRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + featurestore_service.DeleteFeatureRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for delete_feature Override in a subclass to manipulate the request or metadata @@ -434,9 +461,10 @@ async def post_delete_feature( async def pre_delete_featurestore( self, request: featurestore_service.DeleteFeaturestoreRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - featurestore_service.DeleteFeaturestoreRequest, Sequence[Tuple[str, str]] + featurestore_service.DeleteFeaturestoreRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for delete_featurestore @@ -459,9 +487,10 @@ async def post_delete_featurestore( async def pre_delete_feature_values( self, request: featurestore_service.DeleteFeatureValuesRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - featurestore_service.DeleteFeatureValuesRequest, Sequence[Tuple[str, str]] + featurestore_service.DeleteFeatureValuesRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for delete_feature_values @@ -484,9 +513,10 @@ async def post_delete_feature_values( async def pre_export_feature_values( self, request: featurestore_service.ExportFeatureValuesRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - featurestore_service.ExportFeatureValuesRequest, Sequence[Tuple[str, str]] + featurestore_service.ExportFeatureValuesRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for export_feature_values @@ -509,8 +539,11 @@ async def post_export_feature_values( async def pre_get_entity_type( self, request: featurestore_service.GetEntityTypeRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[featurestore_service.GetEntityTypeRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + featurestore_service.GetEntityTypeRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for get_entity_type Override in a subclass to manipulate the request or metadata @@ -532,8 +565,10 @@ async def post_get_entity_type( async def pre_get_feature( self, request: featurestore_service.GetFeatureRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[featurestore_service.GetFeatureRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + featurestore_service.GetFeatureRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_feature Override in a subclass to manipulate the request or metadata @@ -553,8 +588,11 @@ async def post_get_feature(self, response: feature.Feature) -> feature.Feature: async def pre_get_featurestore( self, request: featurestore_service.GetFeaturestoreRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[featurestore_service.GetFeaturestoreRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + featurestore_service.GetFeaturestoreRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for get_featurestore Override in a subclass to manipulate the request or metadata @@ -576,9 +614,10 @@ async def post_get_featurestore( async def pre_import_feature_values( self, request: featurestore_service.ImportFeatureValuesRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - featurestore_service.ImportFeatureValuesRequest, Sequence[Tuple[str, str]] + featurestore_service.ImportFeatureValuesRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for import_feature_values @@ -601,8 +640,11 @@ async def post_import_feature_values( async def pre_list_entity_types( self, request: featurestore_service.ListEntityTypesRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[featurestore_service.ListEntityTypesRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + featurestore_service.ListEntityTypesRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for list_entity_types Override in a subclass to manipulate the request or metadata @@ -624,8 +666,11 @@ async def post_list_entity_types( async def pre_list_features( self, request: featurestore_service.ListFeaturesRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[featurestore_service.ListFeaturesRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + featurestore_service.ListFeaturesRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for list_features Override in a subclass to manipulate the request or metadata @@ -647,9 +692,10 @@ async def post_list_features( async def pre_list_featurestores( self, request: featurestore_service.ListFeaturestoresRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - featurestore_service.ListFeaturestoresRequest, Sequence[Tuple[str, str]] + featurestore_service.ListFeaturestoresRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for list_featurestores @@ -672,8 +718,11 @@ async def post_list_featurestores( async def pre_search_features( self, request: featurestore_service.SearchFeaturesRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[featurestore_service.SearchFeaturesRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + featurestore_service.SearchFeaturesRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for search_features Override in a subclass to manipulate the request or metadata @@ -695,8 +744,11 @@ async def post_search_features( async def pre_update_entity_type( self, request: featurestore_service.UpdateEntityTypeRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[featurestore_service.UpdateEntityTypeRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + featurestore_service.UpdateEntityTypeRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for update_entity_type Override in a subclass to manipulate the request or metadata @@ -718,8 +770,11 @@ async def post_update_entity_type( async def pre_update_feature( self, request: featurestore_service.UpdateFeatureRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[featurestore_service.UpdateFeatureRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + featurestore_service.UpdateFeatureRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for update_feature Override in a subclass to manipulate the request or metadata @@ -741,9 +796,10 @@ async def post_update_feature( async def pre_update_featurestore( self, request: featurestore_service.UpdateFeaturestoreRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - featurestore_service.UpdateFeaturestoreRequest, Sequence[Tuple[str, str]] + featurestore_service.UpdateFeaturestoreRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for update_featurestore @@ -766,8 +822,10 @@ async def post_update_featurestore( async def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -789,8 +847,10 @@ async def post_get_location( async def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -812,8 +872,10 @@ async def post_list_locations( async def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -835,8 +897,10 @@ async def post_get_iam_policy( async def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -858,8 +922,11 @@ async def post_set_iam_policy( async def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -881,8 +948,10 @@ async def post_test_iam_permissions( async def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -902,8 +971,10 @@ async def post_cancel_operation(self, response: None) -> None: async 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 @@ -923,8 +994,10 @@ async def post_delete_operation(self, response: None) -> None: async 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 @@ -946,8 +1019,10 @@ async def post_get_operation( async 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 @@ -969,8 +1044,10 @@ async def post_list_operations( async def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -1257,7 +1334,7 @@ async 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 batch create features method over HTTP. @@ -1270,8 +1347,10 @@ async def __call__( 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: @@ -1284,6 +1363,7 @@ async def __call__( http_options = ( _BaseFeaturestoreServiceRestTransport._BaseBatchCreateFeatures._get_http_options() ) + request, metadata = await self._interceptor.pre_batch_create_features( request, metadata ) @@ -1300,6 +1380,33 @@ async 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.aiplatform_v1.FeaturestoreServiceClient.BatchCreateFeatures", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "rpcName": "BatchCreateFeatures", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeaturestoreServiceRestTransport._BatchCreateFeatures._get_response( self._host, @@ -1328,6 +1435,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_batch_create_features(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.FeaturestoreServiceAsyncClient.batch_create_features", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "rpcName": "BatchCreateFeatures", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _BatchReadFeatureValues( @@ -1367,7 +1496,7 @@ async 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 batch read feature values method over HTTP. @@ -1378,8 +1507,10 @@ async def __call__( 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: @@ -1392,6 +1523,7 @@ async def __call__( http_options = ( _BaseFeaturestoreServiceRestTransport._BaseBatchReadFeatureValues._get_http_options() ) + request, metadata = await self._interceptor.pre_batch_read_feature_values( request, metadata ) @@ -1408,6 +1540,33 @@ async 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.aiplatform_v1.FeaturestoreServiceClient.BatchReadFeatureValues", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "rpcName": "BatchReadFeatureValues", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeaturestoreServiceRestTransport._BatchReadFeatureValues._get_response( self._host, @@ -1436,6 +1595,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_batch_read_feature_values(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.FeaturestoreServiceAsyncClient.batch_read_feature_values", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "rpcName": "BatchReadFeatureValues", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _CreateEntityType( @@ -1475,7 +1656,7 @@ async 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 entity type method over HTTP. @@ -1486,8 +1667,10 @@ async def __call__( 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: @@ -1500,6 +1683,7 @@ async def __call__( http_options = ( _BaseFeaturestoreServiceRestTransport._BaseCreateEntityType._get_http_options() ) + request, metadata = await self._interceptor.pre_create_entity_type( request, metadata ) @@ -1516,6 +1700,33 @@ async 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.aiplatform_v1.FeaturestoreServiceClient.CreateEntityType", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "rpcName": "CreateEntityType", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeaturestoreServiceRestTransport._CreateEntityType._get_response( self._host, @@ -1544,6 +1755,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_create_entity_type(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.FeaturestoreServiceAsyncClient.create_entity_type", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "rpcName": "CreateEntityType", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _CreateFeature( @@ -1583,7 +1816,7 @@ async 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 feature method over HTTP. @@ -1596,8 +1829,10 @@ async def __call__( 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: @@ -1610,6 +1845,7 @@ async def __call__( http_options = ( _BaseFeaturestoreServiceRestTransport._BaseCreateFeature._get_http_options() ) + request, metadata = await self._interceptor.pre_create_feature( request, metadata ) @@ -1626,6 +1862,33 @@ async 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.aiplatform_v1.FeaturestoreServiceClient.CreateFeature", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "rpcName": "CreateFeature", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeaturestoreServiceRestTransport._CreateFeature._get_response( self._host, @@ -1654,6 +1917,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_create_feature(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.FeaturestoreServiceAsyncClient.create_feature", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "rpcName": "CreateFeature", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _CreateFeaturestore( @@ -1693,7 +1978,7 @@ async 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 featurestore method over HTTP. @@ -1704,8 +1989,10 @@ async def __call__( 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: @@ -1718,6 +2005,7 @@ async def __call__( http_options = ( _BaseFeaturestoreServiceRestTransport._BaseCreateFeaturestore._get_http_options() ) + request, metadata = await self._interceptor.pre_create_featurestore( request, metadata ) @@ -1734,6 +2022,33 @@ async 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.aiplatform_v1.FeaturestoreServiceClient.CreateFeaturestore", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "rpcName": "CreateFeaturestore", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeaturestoreServiceRestTransport._CreateFeaturestore._get_response( self._host, @@ -1762,6 +2077,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_create_featurestore(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.FeaturestoreServiceAsyncClient.create_featurestore", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "rpcName": "CreateFeaturestore", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _DeleteEntityType( @@ -1800,7 +2137,7 @@ async 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 entity type method over HTTP. @@ -1811,8 +2148,10 @@ async def __call__( 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: @@ -1825,6 +2164,7 @@ async def __call__( http_options = ( _BaseFeaturestoreServiceRestTransport._BaseDeleteEntityType._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_entity_type( request, metadata ) @@ -1837,6 +2177,33 @@ async 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.aiplatform_v1.FeaturestoreServiceClient.DeleteEntityType", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "rpcName": "DeleteEntityType", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeaturestoreServiceRestTransport._DeleteEntityType._get_response( self._host, @@ -1864,6 +2231,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_delete_entity_type(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.FeaturestoreServiceAsyncClient.delete_entity_type", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "rpcName": "DeleteEntityType", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _DeleteFeature( @@ -1902,7 +2291,7 @@ async 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 feature method over HTTP. @@ -1915,8 +2304,10 @@ async def __call__( 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: @@ -1929,6 +2320,7 @@ async def __call__( http_options = ( _BaseFeaturestoreServiceRestTransport._BaseDeleteFeature._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_feature( request, metadata ) @@ -1941,6 +2333,33 @@ async 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.aiplatform_v1.FeaturestoreServiceClient.DeleteFeature", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "rpcName": "DeleteFeature", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeaturestoreServiceRestTransport._DeleteFeature._get_response( self._host, @@ -1968,6 +2387,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_delete_feature(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.FeaturestoreServiceAsyncClient.delete_feature", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "rpcName": "DeleteFeature", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _DeleteFeaturestore( @@ -2006,7 +2447,7 @@ async 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 featurestore method over HTTP. @@ -2017,8 +2458,10 @@ async def __call__( 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: @@ -2031,6 +2474,7 @@ async def __call__( http_options = ( _BaseFeaturestoreServiceRestTransport._BaseDeleteFeaturestore._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_featurestore( request, metadata ) @@ -2043,6 +2487,33 @@ async 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.aiplatform_v1.FeaturestoreServiceClient.DeleteFeaturestore", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "rpcName": "DeleteFeaturestore", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeaturestoreServiceRestTransport._DeleteFeaturestore._get_response( self._host, @@ -2070,6 +2541,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_delete_featurestore(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.FeaturestoreServiceAsyncClient.delete_featurestore", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "rpcName": "DeleteFeaturestore", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _DeleteFeatureValues( @@ -2109,7 +2602,7 @@ async 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 feature values method over HTTP. @@ -2120,8 +2613,10 @@ async def __call__( 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: @@ -2134,6 +2629,7 @@ async def __call__( http_options = ( _BaseFeaturestoreServiceRestTransport._BaseDeleteFeatureValues._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_feature_values( request, metadata ) @@ -2150,6 +2646,33 @@ async 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.aiplatform_v1.FeaturestoreServiceClient.DeleteFeatureValues", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "rpcName": "DeleteFeatureValues", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeaturestoreServiceRestTransport._DeleteFeatureValues._get_response( self._host, @@ -2178,6 +2701,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_delete_feature_values(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.FeaturestoreServiceAsyncClient.delete_feature_values", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "rpcName": "DeleteFeatureValues", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ExportFeatureValues( @@ -2217,7 +2762,7 @@ async 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 export feature values method over HTTP. @@ -2228,8 +2773,10 @@ async def __call__( 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: @@ -2242,6 +2789,7 @@ async def __call__( http_options = ( _BaseFeaturestoreServiceRestTransport._BaseExportFeatureValues._get_http_options() ) + request, metadata = await self._interceptor.pre_export_feature_values( request, metadata ) @@ -2258,6 +2806,33 @@ async 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.aiplatform_v1.FeaturestoreServiceClient.ExportFeatureValues", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "rpcName": "ExportFeatureValues", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeaturestoreServiceRestTransport._ExportFeatureValues._get_response( self._host, @@ -2286,6 +2861,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_export_feature_values(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.FeaturestoreServiceAsyncClient.export_feature_values", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "rpcName": "ExportFeatureValues", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _GetEntityType( @@ -2324,7 +2921,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> entity_type.EntityType: r"""Call the get entity type method over HTTP. @@ -2335,8 +2932,10 @@ async def __call__( 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: ~.entity_type.EntityType: @@ -2352,6 +2951,7 @@ async def __call__( http_options = ( _BaseFeaturestoreServiceRestTransport._BaseGetEntityType._get_http_options() ) + request, metadata = await self._interceptor.pre_get_entity_type( request, metadata ) @@ -2364,6 +2964,33 @@ async 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.aiplatform_v1.FeaturestoreServiceClient.GetEntityType", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "rpcName": "GetEntityType", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeaturestoreServiceRestTransport._GetEntityType._get_response( self._host, @@ -2391,6 +3018,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_get_entity_type(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = entity_type.EntityType.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.FeaturestoreServiceAsyncClient.get_entity_type", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "rpcName": "GetEntityType", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _GetFeature( @@ -2429,7 +3078,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> feature.Feature: r"""Call the get feature method over HTTP. @@ -2442,8 +3091,10 @@ async def __call__( 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: ~.feature.Feature: @@ -2456,6 +3107,7 @@ async def __call__( http_options = ( _BaseFeaturestoreServiceRestTransport._BaseGetFeature._get_http_options() ) + request, metadata = await self._interceptor.pre_get_feature( request, metadata ) @@ -2468,6 +3120,33 @@ async 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.aiplatform_v1.FeaturestoreServiceClient.GetFeature", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "rpcName": "GetFeature", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncFeaturestoreServiceRestTransport._GetFeature._get_response( @@ -2497,6 +3176,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_get_feature(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = feature.Feature.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.FeaturestoreServiceAsyncClient.get_feature", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "rpcName": "GetFeature", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _GetFeaturestore( @@ -2535,7 +3236,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> featurestore.Featurestore: r"""Call the get featurestore method over HTTP. @@ -2546,8 +3247,10 @@ async def __call__( 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: ~.featurestore.Featurestore: @@ -2562,6 +3265,7 @@ async def __call__( http_options = ( _BaseFeaturestoreServiceRestTransport._BaseGetFeaturestore._get_http_options() ) + request, metadata = await self._interceptor.pre_get_featurestore( request, metadata ) @@ -2574,6 +3278,33 @@ async 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.aiplatform_v1.FeaturestoreServiceClient.GetFeaturestore", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "rpcName": "GetFeaturestore", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeaturestoreServiceRestTransport._GetFeaturestore._get_response( self._host, @@ -2601,6 +3332,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_get_featurestore(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = featurestore.Featurestore.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.FeaturestoreServiceAsyncClient.get_featurestore", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "rpcName": "GetFeaturestore", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ImportFeatureValues( @@ -2640,7 +3393,7 @@ async 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 import feature values method over HTTP. @@ -2651,8 +3404,10 @@ async def __call__( 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: @@ -2665,6 +3420,7 @@ async def __call__( http_options = ( _BaseFeaturestoreServiceRestTransport._BaseImportFeatureValues._get_http_options() ) + request, metadata = await self._interceptor.pre_import_feature_values( request, metadata ) @@ -2681,6 +3437,33 @@ async 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.aiplatform_v1.FeaturestoreServiceClient.ImportFeatureValues", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "rpcName": "ImportFeatureValues", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeaturestoreServiceRestTransport._ImportFeatureValues._get_response( self._host, @@ -2709,6 +3492,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_import_feature_values(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.FeaturestoreServiceAsyncClient.import_feature_values", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "rpcName": "ImportFeatureValues", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ListEntityTypes( @@ -2747,7 +3552,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> featurestore_service.ListEntityTypesResponse: r"""Call the list entity types method over HTTP. @@ -2758,8 +3563,10 @@ async def __call__( 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: ~.featurestore_service.ListEntityTypesResponse: @@ -2771,6 +3578,7 @@ async def __call__( http_options = ( _BaseFeaturestoreServiceRestTransport._BaseListEntityTypes._get_http_options() ) + request, metadata = await self._interceptor.pre_list_entity_types( request, metadata ) @@ -2783,6 +3591,33 @@ async 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.aiplatform_v1.FeaturestoreServiceClient.ListEntityTypes", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "rpcName": "ListEntityTypes", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeaturestoreServiceRestTransport._ListEntityTypes._get_response( self._host, @@ -2810,6 +3645,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_list_entity_types(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + featurestore_service.ListEntityTypesResponse.to_json(response) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.FeaturestoreServiceAsyncClient.list_entity_types", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "rpcName": "ListEntityTypes", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ListFeatures( @@ -2848,7 +3707,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> featurestore_service.ListFeaturesResponse: r"""Call the list features method over HTTP. @@ -2861,8 +3720,10 @@ async def __call__( 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: ~.featurestore_service.ListFeaturesResponse: @@ -2876,6 +3737,7 @@ async def __call__( http_options = ( _BaseFeaturestoreServiceRestTransport._BaseListFeatures._get_http_options() ) + request, metadata = await self._interceptor.pre_list_features( request, metadata ) @@ -2888,6 +3750,33 @@ async 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.aiplatform_v1.FeaturestoreServiceClient.ListFeatures", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "rpcName": "ListFeatures", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncFeaturestoreServiceRestTransport._ListFeatures._get_response( @@ -2917,6 +3806,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_list_features(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + featurestore_service.ListFeaturesResponse.to_json(response) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.FeaturestoreServiceAsyncClient.list_features", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "rpcName": "ListFeatures", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ListFeaturestores( @@ -2955,7 +3868,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> featurestore_service.ListFeaturestoresResponse: r"""Call the list featurestores method over HTTP. @@ -2966,8 +3879,10 @@ async def __call__( 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: ~.featurestore_service.ListFeaturestoresResponse: @@ -2979,6 +3894,7 @@ async def __call__( http_options = ( _BaseFeaturestoreServiceRestTransport._BaseListFeaturestores._get_http_options() ) + request, metadata = await self._interceptor.pre_list_featurestores( request, metadata ) @@ -2991,6 +3907,33 @@ async 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.aiplatform_v1.FeaturestoreServiceClient.ListFeaturestores", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "rpcName": "ListFeaturestores", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeaturestoreServiceRestTransport._ListFeaturestores._get_response( self._host, @@ -3018,6 +3961,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_list_featurestores(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + featurestore_service.ListFeaturestoresResponse.to_json(response) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.FeaturestoreServiceAsyncClient.list_featurestores", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "rpcName": "ListFeaturestores", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _SearchFeatures( @@ -3056,7 +4023,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> featurestore_service.SearchFeaturesResponse: r"""Call the search features method over HTTP. @@ -3067,8 +4034,10 @@ async def __call__( 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: ~.featurestore_service.SearchFeaturesResponse: @@ -3080,6 +4049,7 @@ async def __call__( http_options = ( _BaseFeaturestoreServiceRestTransport._BaseSearchFeatures._get_http_options() ) + request, metadata = await self._interceptor.pre_search_features( request, metadata ) @@ -3092,6 +4062,33 @@ async 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.aiplatform_v1.FeaturestoreServiceClient.SearchFeatures", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "rpcName": "SearchFeatures", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeaturestoreServiceRestTransport._SearchFeatures._get_response( self._host, @@ -3119,6 +4116,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_search_features(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + featurestore_service.SearchFeaturesResponse.to_json(response) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.FeaturestoreServiceAsyncClient.search_features", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "rpcName": "SearchFeatures", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _UpdateEntityType( @@ -3158,7 +4179,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> gca_entity_type.EntityType: r"""Call the update entity type method over HTTP. @@ -3169,8 +4190,10 @@ async def __call__( 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: ~.gca_entity_type.EntityType: @@ -3186,6 +4209,7 @@ async def __call__( http_options = ( _BaseFeaturestoreServiceRestTransport._BaseUpdateEntityType._get_http_options() ) + request, metadata = await self._interceptor.pre_update_entity_type( request, metadata ) @@ -3202,6 +4226,33 @@ async 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.aiplatform_v1.FeaturestoreServiceClient.UpdateEntityType", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "rpcName": "UpdateEntityType", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeaturestoreServiceRestTransport._UpdateEntityType._get_response( self._host, @@ -3230,6 +4281,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_update_entity_type(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gca_entity_type.EntityType.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.FeaturestoreServiceAsyncClient.update_entity_type", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "rpcName": "UpdateEntityType", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _UpdateFeature( @@ -3269,7 +4342,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> gca_feature.Feature: r"""Call the update feature method over HTTP. @@ -3282,8 +4355,10 @@ async def __call__( 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: ~.gca_feature.Feature: @@ -3296,6 +4371,7 @@ async def __call__( http_options = ( _BaseFeaturestoreServiceRestTransport._BaseUpdateFeature._get_http_options() ) + request, metadata = await self._interceptor.pre_update_feature( request, metadata ) @@ -3312,6 +4388,33 @@ async 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.aiplatform_v1.FeaturestoreServiceClient.UpdateFeature", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "rpcName": "UpdateFeature", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeaturestoreServiceRestTransport._UpdateFeature._get_response( self._host, @@ -3340,6 +4443,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_update_feature(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gca_feature.Feature.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.FeaturestoreServiceAsyncClient.update_feature", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "rpcName": "UpdateFeature", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _UpdateFeaturestore( @@ -3379,7 +4504,7 @@ async 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 featurestore method over HTTP. @@ -3390,8 +4515,10 @@ async def __call__( 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: @@ -3404,6 +4531,7 @@ async def __call__( http_options = ( _BaseFeaturestoreServiceRestTransport._BaseUpdateFeaturestore._get_http_options() ) + request, metadata = await self._interceptor.pre_update_featurestore( request, metadata ) @@ -3420,6 +4548,33 @@ async 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.aiplatform_v1.FeaturestoreServiceClient.UpdateFeaturestore", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "rpcName": "UpdateFeaturestore", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeaturestoreServiceRestTransport._UpdateFeaturestore._get_response( self._host, @@ -3448,6 +4603,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_update_featurestore(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.FeaturestoreServiceAsyncClient.update_featurestore", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "rpcName": "UpdateFeaturestore", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp @property @@ -5533,7 +6710,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -5544,8 +6721,10 @@ async def __call__( 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: locations_pb2.Location: Response from GetLocation method. @@ -5554,6 +6733,7 @@ async def __call__( http_options = ( _BaseFeaturestoreServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_location( request, metadata ) @@ -5566,6 +6746,33 @@ async 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.aiplatform_v1.FeaturestoreServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncFeaturestoreServiceRestTransport._GetLocation._get_response( @@ -5593,6 +6800,27 @@ async def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_location(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.aiplatform_v1.FeaturestoreServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5635,7 +6863,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -5646,8 +6874,10 @@ async def __call__( 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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -5656,6 +6886,7 @@ async def __call__( http_options = ( _BaseFeaturestoreServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_locations( request, metadata ) @@ -5668,6 +6899,33 @@ async 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.aiplatform_v1.FeaturestoreServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeaturestoreServiceRestTransport._ListLocations._get_response( self._host, @@ -5693,6 +6951,27 @@ async def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_list_locations(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.aiplatform_v1.FeaturestoreServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5735,7 +7014,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -5746,8 +7025,10 @@ async def __call__( 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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -5756,6 +7037,7 @@ async def __call__( http_options = ( _BaseFeaturestoreServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_get_iam_policy( request, metadata ) @@ -5768,6 +7050,33 @@ async 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.aiplatform_v1.FeaturestoreServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncFeaturestoreServiceRestTransport._GetIamPolicy._get_response( @@ -5795,6 +7104,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_iam_policy(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.aiplatform_v1.FeaturestoreServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5838,7 +7168,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -5849,8 +7179,10 @@ async def __call__( 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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -5859,6 +7191,7 @@ async def __call__( http_options = ( _BaseFeaturestoreServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_set_iam_policy( request, metadata ) @@ -5875,6 +7208,33 @@ async 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.aiplatform_v1.FeaturestoreServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncFeaturestoreServiceRestTransport._SetIamPolicy._get_response( @@ -5903,6 +7263,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_set_iam_policy(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.aiplatform_v1.FeaturestoreServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5945,7 +7326,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -5956,8 +7337,10 @@ async def __call__( 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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -5966,6 +7349,7 @@ async def __call__( http_options = ( _BaseFeaturestoreServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = await self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -5978,6 +7362,33 @@ async 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.aiplatform_v1.FeaturestoreServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeaturestoreServiceRestTransport._TestIamPermissions._get_response( self._host, @@ -6003,6 +7414,27 @@ async def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_test_iam_permissions(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.aiplatform_v1.FeaturestoreServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -6045,7 +7477,7 @@ async 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 cancel operation method over HTTP. @@ -6056,13 +7488,16 @@ async def __call__( 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`. """ http_options = ( _BaseFeaturestoreServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_cancel_operation( request, metadata ) @@ -6075,6 +7510,33 @@ async 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.aiplatform_v1.FeaturestoreServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeaturestoreServiceRestTransport._CancelOperation._get_response( self._host, @@ -6138,7 +7600,7 @@ async 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. @@ -6149,13 +7611,16 @@ async def __call__( 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`. """ http_options = ( _BaseFeaturestoreServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_operation( request, metadata ) @@ -6168,6 +7633,33 @@ async 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.aiplatform_v1.FeaturestoreServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeaturestoreServiceRestTransport._DeleteOperation._get_response( self._host, @@ -6231,7 +7723,7 @@ async 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. @@ -6242,8 +7734,10 @@ async def __call__( 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: Response from GetOperation method. @@ -6252,6 +7746,7 @@ async def __call__( http_options = ( _BaseFeaturestoreServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_operation( request, metadata ) @@ -6264,6 +7759,33 @@ async 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.aiplatform_v1.FeaturestoreServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncFeaturestoreServiceRestTransport._GetOperation._get_response( @@ -6291,6 +7813,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1.FeaturestoreServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -6333,7 +7876,7 @@ async 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. @@ -6344,8 +7887,10 @@ async def __call__( 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 from ListOperations method. @@ -6354,6 +7899,7 @@ async def __call__( http_options = ( _BaseFeaturestoreServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_operations( request, metadata ) @@ -6366,6 +7912,33 @@ async 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.aiplatform_v1.FeaturestoreServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeaturestoreServiceRestTransport._ListOperations._get_response( self._host, @@ -6391,6 +7964,27 @@ async def __call__( resp = operations_pb2.ListOperationsResponse() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1.FeaturestoreServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -6433,7 +8027,7 @@ async 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 wait operation method over HTTP. @@ -6444,8 +8038,10 @@ async def __call__( 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: Response from WaitOperation method. @@ -6454,6 +8050,7 @@ async def __call__( http_options = ( _BaseFeaturestoreServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_wait_operation( request, metadata ) @@ -6466,6 +8063,33 @@ async 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.aiplatform_v1.FeaturestoreServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeaturestoreServiceRestTransport._WaitOperation._get_response( self._host, @@ -6491,6 +8115,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_wait_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.aiplatform_v1.FeaturestoreServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.FeaturestoreService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1/services/gen_ai_tuning_service/async_client.py b/google/cloud/aiplatform_v1/services/gen_ai_tuning_service/async_client.py index d52109c05c..2aeb8bee8e 100644 --- a/google/cloud/aiplatform_v1/services/gen_ai_tuning_service/async_client.py +++ b/google/cloud/aiplatform_v1/services/gen_ai_tuning_service/async_client.py @@ -13,6 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging as std_logging from collections import OrderedDict import re from typing import ( @@ -61,6 +62,15 @@ from .transports.grpc_asyncio import GenAiTuningServiceGrpcAsyncIOTransport from .client import GenAiTuningServiceClient +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 GenAiTuningServiceAsyncClient: """A service for creating and managing GenAI Tuning Jobs.""" @@ -280,6 +290,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.aiplatform_v1.GenAiTuningServiceAsyncClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1.GenAiTuningService", + "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.aiplatform.v1.GenAiTuningService", + "credentialsType": None, + }, + ) + async def create_tuning_job( self, request: Optional[ @@ -290,7 +322,7 @@ async def create_tuning_job( tuning_job: Optional[gca_tuning_job.TuningJob] = 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]]] = (), ) -> gca_tuning_job.TuningJob: r"""Creates a TuningJob. A created TuningJob right away will be attempted to be run. @@ -346,8 +378,10 @@ async def sample_create_tuning_job(): 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.aiplatform_v1.types.TuningJob: @@ -410,7 +444,7 @@ async def get_tuning_job( 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]]] = (), ) -> tuning_job.TuningJob: r"""Gets a TuningJob. @@ -454,8 +488,10 @@ async def sample_get_tuning_job(): 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.aiplatform_v1.types.TuningJob: @@ -518,7 +554,7 @@ async def list_tuning_jobs( 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.ListTuningJobsAsyncPager: r"""Lists TuningJobs in a Location. @@ -564,8 +600,10 @@ async def sample_list_tuning_jobs(): 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.aiplatform_v1.services.gen_ai_tuning_service.pagers.ListTuningJobsAsyncPager: @@ -642,7 +680,7 @@ async def cancel_tuning_job( 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"""Cancels a TuningJob. Starts asynchronous cancellation on the TuningJob. The server makes a best effort to cancel the job, but @@ -695,8 +733,10 @@ async def sample_cancel_tuning_job(): 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 @@ -751,7 +791,7 @@ async def rebase_tuned_model( tuned_model_ref: Optional[tuning_job.TunedModelRef] = 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"""Rebase a TunedModel. @@ -811,8 +851,10 @@ async def sample_rebase_tuned_model(): 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: @@ -886,7 +928,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. @@ -897,8 +939,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. @@ -939,7 +983,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. @@ -950,8 +994,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. @@ -992,7 +1038,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. @@ -1008,8 +1054,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 """ @@ -1046,7 +1094,7 @@ async def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -1061,8 +1109,10 @@ async def cancel_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 """ @@ -1099,7 +1149,7 @@ async def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -1116,8 +1166,10 @@ async def wait_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. @@ -1158,7 +1210,7 @@ async def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -1171,8 +1223,10 @@ async def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -1277,7 +1331,7 @@ async def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -1291,8 +1345,10 @@ async def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -1397,7 +1453,7 @@ async def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -1412,8 +1468,10 @@ async def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -1457,7 +1515,7 @@ async def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -1468,8 +1526,10 @@ async def get_location( 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: ~.location_pb2.Location: Location object. @@ -1510,7 +1570,7 @@ async def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -1521,8 +1581,10 @@ async def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1/services/gen_ai_tuning_service/client.py b/google/cloud/aiplatform_v1/services/gen_ai_tuning_service/client.py index f667eb4feb..358b1687ea 100644 --- a/google/cloud/aiplatform_v1/services/gen_ai_tuning_service/client.py +++ b/google/cloud/aiplatform_v1/services/gen_ai_tuning_service/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 ( @@ -48,6 +49,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.cloud.aiplatform_v1.services.gen_ai_tuning_service import pagers @@ -697,6 +707,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( @@ -788,6 +802,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.aiplatform_v1.GenAiTuningServiceClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1.GenAiTuningService", + "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.aiplatform.v1.GenAiTuningService", + "credentialsType": None, + }, + ) + def create_tuning_job( self, request: Optional[ @@ -798,7 +835,7 @@ def create_tuning_job( tuning_job: Optional[gca_tuning_job.TuningJob] = 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]]] = (), ) -> gca_tuning_job.TuningJob: r"""Creates a TuningJob. A created TuningJob right away will be attempted to be run. @@ -854,8 +891,10 @@ def sample_create_tuning_job(): 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.aiplatform_v1.types.TuningJob: @@ -915,7 +954,7 @@ def get_tuning_job( 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]]] = (), ) -> tuning_job.TuningJob: r"""Gets a TuningJob. @@ -959,8 +998,10 @@ def sample_get_tuning_job(): 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.aiplatform_v1.types.TuningJob: @@ -1020,7 +1061,7 @@ def list_tuning_jobs( 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.ListTuningJobsPager: r"""Lists TuningJobs in a Location. @@ -1066,8 +1107,10 @@ def sample_list_tuning_jobs(): 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.aiplatform_v1.services.gen_ai_tuning_service.pagers.ListTuningJobsPager: @@ -1141,7 +1184,7 @@ def cancel_tuning_job( 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"""Cancels a TuningJob. Starts asynchronous cancellation on the TuningJob. The server makes a best effort to cancel the job, but @@ -1194,8 +1237,10 @@ def sample_cancel_tuning_job(): 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 @@ -1247,7 +1292,7 @@ def rebase_tuned_model( tuned_model_ref: Optional[tuning_job.TunedModelRef] = 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"""Rebase a TunedModel. @@ -1307,8 +1352,10 @@ def sample_rebase_tuned_model(): 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: @@ -1392,7 +1439,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. @@ -1403,8 +1450,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. @@ -1445,7 +1494,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. @@ -1456,8 +1505,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. @@ -1498,7 +1549,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. @@ -1514,8 +1565,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 """ @@ -1552,7 +1605,7 @@ def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -1567,8 +1620,10 @@ def cancel_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 """ @@ -1605,7 +1660,7 @@ def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -1622,8 +1677,10 @@ def wait_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. @@ -1664,7 +1721,7 @@ def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -1677,8 +1734,10 @@ def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -1783,7 +1842,7 @@ def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -1797,8 +1856,10 @@ def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -1903,7 +1964,7 @@ def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -1918,8 +1979,10 @@ def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -1961,7 +2024,7 @@ def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -1972,8 +2035,10 @@ def get_location( 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: ~.location_pb2.Location: Location object. @@ -2014,7 +2079,7 @@ def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -2025,8 +2090,10 @@ def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1/services/gen_ai_tuning_service/pagers.py b/google/cloud/aiplatform_v1/services/gen_ai_tuning_service/pagers.py index 4597735bb5..68e0c51bda 100644 --- a/google/cloud/aiplatform_v1/services/gen_ai_tuning_service/pagers.py +++ b/google/cloud/aiplatform_v1/services/gen_ai_tuning_service/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 = genai_tuning_service.ListTuningJobsRequest(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 = genai_tuning_service.ListTuningJobsRequest(request) diff --git a/google/cloud/aiplatform_v1/services/gen_ai_tuning_service/transports/grpc.py b/google/cloud/aiplatform_v1/services/gen_ai_tuning_service/transports/grpc.py index 1bf88ed606..799ecd7474 100644 --- a/google/cloud/aiplatform_v1/services/gen_ai_tuning_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1/services/gen_ai_tuning_service/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 import warnings from typing import Callable, Dict, Optional, Sequence, Tuple, Union @@ -22,8 +25,11 @@ import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from google.cloud.aiplatform_v1.types import genai_tuning_service from google.cloud.aiplatform_v1.types import tuning_job @@ -35,6 +41,81 @@ from google.protobuf import empty_pb2 # type: ignore from .base import GenAiTuningServiceTransport, DEFAULT_CLIENT_INFO +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.aiplatform.v1.GenAiTuningService", + "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.aiplatform.v1.GenAiTuningService", + "rpcName": client_call_details.method, + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class GenAiTuningServiceGrpcTransport(GenAiTuningServiceTransport): """gRPC backend transport for GenAiTuningService. @@ -189,7 +270,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 @@ -253,7 +339,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 @@ -280,7 +368,7 @@ def create_tuning_job( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_tuning_job" not in self._stubs: - self._stubs["create_tuning_job"] = self.grpc_channel.unary_unary( + self._stubs["create_tuning_job"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.GenAiTuningService/CreateTuningJob", request_serializer=genai_tuning_service.CreateTuningJobRequest.serialize, response_deserializer=gca_tuning_job.TuningJob.deserialize, @@ -306,7 +394,7 @@ def get_tuning_job( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_tuning_job" not in self._stubs: - self._stubs["get_tuning_job"] = self.grpc_channel.unary_unary( + self._stubs["get_tuning_job"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.GenAiTuningService/GetTuningJob", request_serializer=genai_tuning_service.GetTuningJobRequest.serialize, response_deserializer=tuning_job.TuningJob.deserialize, @@ -335,7 +423,7 @@ def list_tuning_jobs( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_tuning_jobs" not in self._stubs: - self._stubs["list_tuning_jobs"] = self.grpc_channel.unary_unary( + self._stubs["list_tuning_jobs"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.GenAiTuningService/ListTuningJobs", request_serializer=genai_tuning_service.ListTuningJobsRequest.serialize, response_deserializer=genai_tuning_service.ListTuningJobsResponse.deserialize, @@ -373,7 +461,7 @@ def cancel_tuning_job( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_tuning_job" not in self._stubs: - self._stubs["cancel_tuning_job"] = self.grpc_channel.unary_unary( + self._stubs["cancel_tuning_job"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.GenAiTuningService/CancelTuningJob", request_serializer=genai_tuning_service.CancelTuningJobRequest.serialize, response_deserializer=empty_pb2.Empty.FromString, @@ -401,7 +489,7 @@ def rebase_tuned_model( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "rebase_tuned_model" not in self._stubs: - self._stubs["rebase_tuned_model"] = self.grpc_channel.unary_unary( + self._stubs["rebase_tuned_model"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.GenAiTuningService/RebaseTunedModel", request_serializer=genai_tuning_service.RebaseTunedModelRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -409,7 +497,7 @@ def rebase_tuned_model( return self._stubs["rebase_tuned_model"] def close(self): - self.grpc_channel.close() + self._logged_channel.close() @property def delete_operation( @@ -421,7 +509,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, @@ -438,7 +526,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -455,7 +543,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -472,7 +560,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, @@ -491,7 +579,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, @@ -510,7 +598,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -527,7 +615,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -552,7 +640,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -578,7 +666,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -607,7 +695,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1/services/gen_ai_tuning_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1/services/gen_ai_tuning_service/transports/grpc_asyncio.py index 7455c6705a..a194c5d5a6 100644 --- a/google/cloud/aiplatform_v1/services/gen_ai_tuning_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1/services/gen_ai_tuning_service/transports/grpc_asyncio.py @@ -14,6 +14,9 @@ # limitations under the License. # import inspect +import json +import pickle +import logging as std_logging import warnings from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union @@ -24,8 +27,11 @@ from google.api_core import operations_v1 from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from grpc.experimental import aio # type: ignore from google.cloud.aiplatform_v1.types import genai_tuning_service @@ -39,6 +45,82 @@ from .base import GenAiTuningServiceTransport, DEFAULT_CLIENT_INFO from .grpc import GenAiTuningServiceGrpcTransport +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.aiplatform.v1.GenAiTuningService", + "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.aiplatform.v1.GenAiTuningService", + "rpcName": str(client_call_details.method), + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class GenAiTuningServiceGrpcAsyncIOTransport(GenAiTuningServiceTransport): """gRPC AsyncIO backend transport for GenAiTuningService. @@ -236,10 +318,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 @@ -262,7 +347,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. @@ -291,7 +376,7 @@ def create_tuning_job( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_tuning_job" not in self._stubs: - self._stubs["create_tuning_job"] = self.grpc_channel.unary_unary( + self._stubs["create_tuning_job"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.GenAiTuningService/CreateTuningJob", request_serializer=genai_tuning_service.CreateTuningJobRequest.serialize, response_deserializer=gca_tuning_job.TuningJob.deserialize, @@ -319,7 +404,7 @@ def get_tuning_job( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_tuning_job" not in self._stubs: - self._stubs["get_tuning_job"] = self.grpc_channel.unary_unary( + self._stubs["get_tuning_job"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.GenAiTuningService/GetTuningJob", request_serializer=genai_tuning_service.GetTuningJobRequest.serialize, response_deserializer=tuning_job.TuningJob.deserialize, @@ -348,7 +433,7 @@ def list_tuning_jobs( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_tuning_jobs" not in self._stubs: - self._stubs["list_tuning_jobs"] = self.grpc_channel.unary_unary( + self._stubs["list_tuning_jobs"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.GenAiTuningService/ListTuningJobs", request_serializer=genai_tuning_service.ListTuningJobsRequest.serialize, response_deserializer=genai_tuning_service.ListTuningJobsResponse.deserialize, @@ -388,7 +473,7 @@ def cancel_tuning_job( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_tuning_job" not in self._stubs: - self._stubs["cancel_tuning_job"] = self.grpc_channel.unary_unary( + self._stubs["cancel_tuning_job"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.GenAiTuningService/CancelTuningJob", request_serializer=genai_tuning_service.CancelTuningJobRequest.serialize, response_deserializer=empty_pb2.Empty.FromString, @@ -417,7 +502,7 @@ def rebase_tuned_model( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "rebase_tuned_model" not in self._stubs: - self._stubs["rebase_tuned_model"] = self.grpc_channel.unary_unary( + self._stubs["rebase_tuned_model"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.GenAiTuningService/RebaseTunedModel", request_serializer=genai_tuning_service.RebaseTunedModelRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -510,7 +595,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: @@ -526,7 +611,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, @@ -543,7 +628,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -560,7 +645,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -577,7 +662,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, @@ -596,7 +681,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, @@ -615,7 +700,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -632,7 +717,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -657,7 +742,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -683,7 +768,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -712,7 +797,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1/services/gen_ai_tuning_service/transports/rest.py b/google/cloud/aiplatform_v1/services/gen_ai_tuning_service/transports/rest.py index 55b933376d..e815cd02ac 100644 --- a/google/cloud/aiplatform_v1/services/gen_ai_tuning_service/transports/rest.py +++ b/google/cloud/aiplatform_v1/services/gen_ai_tuning_service/transports/rest.py @@ -13,9 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging +import json # type: ignore from google.auth.transport.requests import AuthorizedSession # type: ignore -import json # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.api_core import exceptions as core_exceptions from google.api_core import retry as retries @@ -50,6 +51,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, @@ -118,8 +127,11 @@ def post_rebase_tuned_model(self, response): def pre_cancel_tuning_job( self, request: genai_tuning_service.CancelTuningJobRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[genai_tuning_service.CancelTuningJobRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + genai_tuning_service.CancelTuningJobRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for cancel_tuning_job Override in a subclass to manipulate the request or metadata @@ -130,8 +142,11 @@ def pre_cancel_tuning_job( def pre_create_tuning_job( self, request: genai_tuning_service.CreateTuningJobRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[genai_tuning_service.CreateTuningJobRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + genai_tuning_service.CreateTuningJobRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for create_tuning_job Override in a subclass to manipulate the request or metadata @@ -153,8 +168,11 @@ def post_create_tuning_job( def pre_get_tuning_job( self, request: genai_tuning_service.GetTuningJobRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[genai_tuning_service.GetTuningJobRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + genai_tuning_service.GetTuningJobRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for get_tuning_job Override in a subclass to manipulate the request or metadata @@ -176,8 +194,11 @@ def post_get_tuning_job( def pre_list_tuning_jobs( self, request: genai_tuning_service.ListTuningJobsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[genai_tuning_service.ListTuningJobsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + genai_tuning_service.ListTuningJobsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for list_tuning_jobs Override in a subclass to manipulate the request or metadata @@ -199,8 +220,11 @@ def post_list_tuning_jobs( def pre_rebase_tuned_model( self, request: genai_tuning_service.RebaseTunedModelRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[genai_tuning_service.RebaseTunedModelRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + genai_tuning_service.RebaseTunedModelRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for rebase_tuned_model Override in a subclass to manipulate the request or metadata @@ -222,8 +246,10 @@ def post_rebase_tuned_model( def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -245,8 +271,10 @@ def post_get_location( def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -268,8 +296,10 @@ def post_list_locations( def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -289,8 +319,10 @@ def post_get_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -310,8 +342,11 @@ def post_set_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -333,8 +368,10 @@ def post_test_iam_permissions( def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -354,8 +391,10 @@ def post_cancel_operation(self, response: None) -> None: 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 @@ -375,8 +414,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 @@ -398,8 +439,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 @@ -421,8 +464,10 @@ def post_list_operations( def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -2444,7 +2489,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 cancel tuning job method over HTTP. @@ -2455,13 +2500,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 = ( _BaseGenAiTuningServiceRestTransport._BaseCancelTuningJob._get_http_options() ) + request, metadata = self._interceptor.pre_cancel_tuning_job( request, metadata ) @@ -2478,6 +2526,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.aiplatform_v1.GenAiTuningServiceClient.CancelTuningJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1.GenAiTuningService", + "rpcName": "CancelTuningJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = GenAiTuningServiceRestTransport._CancelTuningJob._get_response( self._host, @@ -2531,7 +2606,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]]] = (), ) -> gca_tuning_job.TuningJob: r"""Call the create tuning job method over HTTP. @@ -2542,8 +2617,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: ~.gca_tuning_job.TuningJob: @@ -2555,6 +2632,7 @@ def __call__( http_options = ( _BaseGenAiTuningServiceRestTransport._BaseCreateTuningJob._get_http_options() ) + request, metadata = self._interceptor.pre_create_tuning_job( request, metadata ) @@ -2571,6 +2649,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.aiplatform_v1.GenAiTuningServiceClient.CreateTuningJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1.GenAiTuningService", + "rpcName": "CreateTuningJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = GenAiTuningServiceRestTransport._CreateTuningJob._get_response( self._host, @@ -2592,7 +2697,29 @@ def __call__( pb_resp = gca_tuning_job.TuningJob.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_create_tuning_job(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gca_tuning_job.TuningJob.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.aiplatform_v1.GenAiTuningServiceClient.create_tuning_job", + extra={ + "serviceName": "google.cloud.aiplatform.v1.GenAiTuningService", + "rpcName": "CreateTuningJob", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _GetTuningJob( @@ -2631,7 +2758,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]]] = (), ) -> tuning_job.TuningJob: r"""Call the get tuning job method over HTTP. @@ -2642,8 +2769,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: ~.tuning_job.TuningJob: @@ -2655,6 +2784,7 @@ def __call__( http_options = ( _BaseGenAiTuningServiceRestTransport._BaseGetTuningJob._get_http_options() ) + request, metadata = self._interceptor.pre_get_tuning_job(request, metadata) transcoded_request = _BaseGenAiTuningServiceRestTransport._BaseGetTuningJob._get_transcoded_request( http_options, request @@ -2665,6 +2795,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.aiplatform_v1.GenAiTuningServiceClient.GetTuningJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1.GenAiTuningService", + "rpcName": "GetTuningJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = GenAiTuningServiceRestTransport._GetTuningJob._get_response( self._host, @@ -2685,7 +2842,29 @@ def __call__( pb_resp = tuning_job.TuningJob.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_tuning_job(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = tuning_job.TuningJob.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.aiplatform_v1.GenAiTuningServiceClient.get_tuning_job", + extra={ + "serviceName": "google.cloud.aiplatform.v1.GenAiTuningService", + "rpcName": "GetTuningJob", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListTuningJobs( @@ -2724,7 +2903,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]]] = (), ) -> genai_tuning_service.ListTuningJobsResponse: r"""Call the list tuning jobs method over HTTP. @@ -2735,8 +2914,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: ~.genai_tuning_service.ListTuningJobsResponse: @@ -2748,6 +2929,7 @@ def __call__( http_options = ( _BaseGenAiTuningServiceRestTransport._BaseListTuningJobs._get_http_options() ) + request, metadata = self._interceptor.pre_list_tuning_jobs( request, metadata ) @@ -2760,6 +2942,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.aiplatform_v1.GenAiTuningServiceClient.ListTuningJobs", + extra={ + "serviceName": "google.cloud.aiplatform.v1.GenAiTuningService", + "rpcName": "ListTuningJobs", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = GenAiTuningServiceRestTransport._ListTuningJobs._get_response( self._host, @@ -2780,7 +2989,31 @@ def __call__( pb_resp = genai_tuning_service.ListTuningJobsResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_tuning_jobs(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + genai_tuning_service.ListTuningJobsResponse.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.aiplatform_v1.GenAiTuningServiceClient.list_tuning_jobs", + extra={ + "serviceName": "google.cloud.aiplatform.v1.GenAiTuningService", + "rpcName": "ListTuningJobs", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _RebaseTunedModel( @@ -2820,7 +3053,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 rebase tuned model method over HTTP. @@ -2831,8 +3064,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: @@ -2845,6 +3080,7 @@ def __call__( http_options = ( _BaseGenAiTuningServiceRestTransport._BaseRebaseTunedModel._get_http_options() ) + request, metadata = self._interceptor.pre_rebase_tuned_model( request, metadata ) @@ -2861,6 +3097,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.aiplatform_v1.GenAiTuningServiceClient.RebaseTunedModel", + extra={ + "serviceName": "google.cloud.aiplatform.v1.GenAiTuningService", + "rpcName": "RebaseTunedModel", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = GenAiTuningServiceRestTransport._RebaseTunedModel._get_response( self._host, @@ -2880,7 +3143,29 @@ def __call__( # Return the response resp = operations_pb2.Operation() json_format.Parse(response.content, resp, ignore_unknown_fields=True) + resp = self._interceptor.post_rebase_tuned_model(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.aiplatform_v1.GenAiTuningServiceClient.rebase_tuned_model", + extra={ + "serviceName": "google.cloud.aiplatform.v1.GenAiTuningService", + "rpcName": "RebaseTunedModel", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp @property @@ -2970,7 +3255,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]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -2981,8 +3266,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: locations_pb2.Location: Response from GetLocation method. @@ -2991,6 +3278,7 @@ def __call__( http_options = ( _BaseGenAiTuningServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = self._interceptor.pre_get_location(request, metadata) transcoded_request = _BaseGenAiTuningServiceRestTransport._BaseGetLocation._get_transcoded_request( http_options, request @@ -3001,6 +3289,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.aiplatform_v1.GenAiTuningServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.GenAiTuningService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = GenAiTuningServiceRestTransport._GetLocation._get_response( self._host, @@ -3020,6 +3335,27 @@ def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_location(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.aiplatform_v1.GenAiTuningServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.GenAiTuningService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3062,7 +3398,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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -3073,8 +3409,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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -3083,6 +3421,7 @@ def __call__( http_options = ( _BaseGenAiTuningServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = self._interceptor.pre_list_locations(request, metadata) transcoded_request = _BaseGenAiTuningServiceRestTransport._BaseListLocations._get_transcoded_request( http_options, request @@ -3093,6 +3432,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.aiplatform_v1.GenAiTuningServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.GenAiTuningService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = GenAiTuningServiceRestTransport._ListLocations._get_response( self._host, @@ -3112,6 +3478,27 @@ def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_list_locations(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.aiplatform_v1.GenAiTuningServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.GenAiTuningService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3154,7 +3541,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]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -3165,8 +3552,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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -3175,6 +3564,7 @@ def __call__( http_options = ( _BaseGenAiTuningServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_get_iam_policy(request, metadata) transcoded_request = _BaseGenAiTuningServiceRestTransport._BaseGetIamPolicy._get_transcoded_request( http_options, request @@ -3185,6 +3575,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.aiplatform_v1.GenAiTuningServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.GenAiTuningService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = GenAiTuningServiceRestTransport._GetIamPolicy._get_response( self._host, @@ -3204,6 +3621,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_iam_policy(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.aiplatform_v1.GenAiTuningServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.GenAiTuningService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3247,7 +3685,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]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -3258,8 +3696,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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -3268,6 +3708,7 @@ def __call__( http_options = ( _BaseGenAiTuningServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_set_iam_policy(request, metadata) transcoded_request = _BaseGenAiTuningServiceRestTransport._BaseSetIamPolicy._get_transcoded_request( http_options, request @@ -3282,6 +3723,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.aiplatform_v1.GenAiTuningServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.GenAiTuningService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = GenAiTuningServiceRestTransport._SetIamPolicy._get_response( self._host, @@ -3302,6 +3770,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_set_iam_policy(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.aiplatform_v1.GenAiTuningServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.GenAiTuningService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3344,7 +3833,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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -3355,8 +3844,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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -3365,6 +3856,7 @@ def __call__( http_options = ( _BaseGenAiTuningServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -3377,6 +3869,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.aiplatform_v1.GenAiTuningServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.GenAiTuningService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( GenAiTuningServiceRestTransport._TestIamPermissions._get_response( @@ -3398,6 +3917,27 @@ def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_test_iam_permissions(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.aiplatform_v1.GenAiTuningServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.GenAiTuningService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3440,7 +3980,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 cancel operation method over HTTP. @@ -3451,13 +3991,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 = ( _BaseGenAiTuningServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = self._interceptor.pre_cancel_operation( request, metadata ) @@ -3470,6 +4013,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.aiplatform_v1.GenAiTuningServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.GenAiTuningService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = GenAiTuningServiceRestTransport._CancelOperation._get_response( self._host, @@ -3527,7 +4097,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. @@ -3538,13 +4108,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 = ( _BaseGenAiTuningServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = self._interceptor.pre_delete_operation( request, metadata ) @@ -3557,6 +4130,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.aiplatform_v1.GenAiTuningServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.GenAiTuningService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = GenAiTuningServiceRestTransport._DeleteOperation._get_response( self._host, @@ -3614,7 +4214,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. @@ -3625,8 +4225,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. @@ -3635,6 +4237,7 @@ def __call__( http_options = ( _BaseGenAiTuningServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = self._interceptor.pre_get_operation(request, metadata) transcoded_request = _BaseGenAiTuningServiceRestTransport._BaseGetOperation._get_transcoded_request( http_options, request @@ -3645,6 +4248,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.aiplatform_v1.GenAiTuningServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.GenAiTuningService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = GenAiTuningServiceRestTransport._GetOperation._get_response( self._host, @@ -3664,6 +4294,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.aiplatform_v1.GenAiTuningServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.GenAiTuningService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3706,7 +4357,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. @@ -3717,8 +4368,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. @@ -3727,6 +4380,7 @@ def __call__( http_options = ( _BaseGenAiTuningServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = self._interceptor.pre_list_operations(request, metadata) transcoded_request = _BaseGenAiTuningServiceRestTransport._BaseListOperations._get_transcoded_request( http_options, request @@ -3737,6 +4391,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.aiplatform_v1.GenAiTuningServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.GenAiTuningService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = GenAiTuningServiceRestTransport._ListOperations._get_response( self._host, @@ -3756,6 +4437,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.aiplatform_v1.GenAiTuningServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.GenAiTuningService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3798,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]]] = (), ) -> operations_pb2.Operation: r"""Call the wait operation method over HTTP. @@ -3809,8 +4511,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 WaitOperation method. @@ -3819,6 +4523,7 @@ def __call__( http_options = ( _BaseGenAiTuningServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = self._interceptor.pre_wait_operation(request, metadata) transcoded_request = _BaseGenAiTuningServiceRestTransport._BaseWaitOperation._get_transcoded_request( http_options, request @@ -3829,6 +4534,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.aiplatform_v1.GenAiTuningServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.GenAiTuningService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = GenAiTuningServiceRestTransport._WaitOperation._get_response( self._host, @@ -3848,6 +4580,27 @@ def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = self._interceptor.post_wait_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.aiplatform_v1.GenAiTuningServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.GenAiTuningService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1/services/gen_ai_tuning_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1/services/gen_ai_tuning_service/transports/rest_asyncio.py index ed4801a44b..32d7faf2e7 100644 --- a/google/cloud/aiplatform_v1/services/gen_ai_tuning_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1/services/gen_ai_tuning_service/transports/rest_asyncio.py @@ -61,6 +61,18 @@ from .base import DEFAULT_CLIENT_INFO as BASE_DEFAULT_CLIENT_INFO + +import logging + +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__) + try: OptionalRetry = Union[retries.AsyncRetry, gapic_v1.method._MethodDefault, None] except AttributeError: # pragma: NO COVER @@ -133,8 +145,11 @@ async def post_rebase_tuned_model(self, response): async def pre_cancel_tuning_job( self, request: genai_tuning_service.CancelTuningJobRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[genai_tuning_service.CancelTuningJobRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + genai_tuning_service.CancelTuningJobRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for cancel_tuning_job Override in a subclass to manipulate the request or metadata @@ -145,8 +160,11 @@ async def pre_cancel_tuning_job( async def pre_create_tuning_job( self, request: genai_tuning_service.CreateTuningJobRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[genai_tuning_service.CreateTuningJobRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + genai_tuning_service.CreateTuningJobRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for create_tuning_job Override in a subclass to manipulate the request or metadata @@ -168,8 +186,11 @@ async def post_create_tuning_job( async def pre_get_tuning_job( self, request: genai_tuning_service.GetTuningJobRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[genai_tuning_service.GetTuningJobRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + genai_tuning_service.GetTuningJobRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for get_tuning_job Override in a subclass to manipulate the request or metadata @@ -191,8 +212,11 @@ async def post_get_tuning_job( async def pre_list_tuning_jobs( self, request: genai_tuning_service.ListTuningJobsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[genai_tuning_service.ListTuningJobsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + genai_tuning_service.ListTuningJobsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for list_tuning_jobs Override in a subclass to manipulate the request or metadata @@ -214,8 +238,11 @@ async def post_list_tuning_jobs( async def pre_rebase_tuned_model( self, request: genai_tuning_service.RebaseTunedModelRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[genai_tuning_service.RebaseTunedModelRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + genai_tuning_service.RebaseTunedModelRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for rebase_tuned_model Override in a subclass to manipulate the request or metadata @@ -237,8 +264,10 @@ async def post_rebase_tuned_model( async def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -260,8 +289,10 @@ async def post_get_location( async def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -283,8 +314,10 @@ async def post_list_locations( async def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -306,8 +339,10 @@ async def post_get_iam_policy( async def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -329,8 +364,11 @@ async def post_set_iam_policy( async def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -352,8 +390,10 @@ async def post_test_iam_permissions( async def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -373,8 +413,10 @@ async def post_cancel_operation(self, response: None) -> None: async 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 @@ -394,8 +436,10 @@ async def post_delete_operation(self, response: None) -> None: async 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 @@ -417,8 +461,10 @@ async def post_get_operation( async 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 @@ -440,8 +486,10 @@ async def post_list_operations( async def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -647,7 +695,7 @@ async 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 cancel tuning job method over HTTP. @@ -658,13 +706,16 @@ async def __call__( 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`. """ http_options = ( _BaseGenAiTuningServiceRestTransport._BaseCancelTuningJob._get_http_options() ) + request, metadata = await self._interceptor.pre_cancel_tuning_job( request, metadata ) @@ -681,6 +732,33 @@ async 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.aiplatform_v1.GenAiTuningServiceClient.CancelTuningJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1.GenAiTuningService", + "rpcName": "CancelTuningJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncGenAiTuningServiceRestTransport._CancelTuningJob._get_response( self._host, @@ -740,7 +818,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> gca_tuning_job.TuningJob: r"""Call the create tuning job method over HTTP. @@ -751,8 +829,10 @@ async def __call__( 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: ~.gca_tuning_job.TuningJob: @@ -764,6 +844,7 @@ async def __call__( http_options = ( _BaseGenAiTuningServiceRestTransport._BaseCreateTuningJob._get_http_options() ) + request, metadata = await self._interceptor.pre_create_tuning_job( request, metadata ) @@ -780,6 +861,33 @@ async 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.aiplatform_v1.GenAiTuningServiceClient.CreateTuningJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1.GenAiTuningService", + "rpcName": "CreateTuningJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncGenAiTuningServiceRestTransport._CreateTuningJob._get_response( self._host, @@ -808,6 +916,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_create_tuning_job(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gca_tuning_job.TuningJob.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.GenAiTuningServiceAsyncClient.create_tuning_job", + extra={ + "serviceName": "google.cloud.aiplatform.v1.GenAiTuningService", + "rpcName": "CreateTuningJob", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _GetTuningJob( @@ -846,7 +976,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> tuning_job.TuningJob: r"""Call the get tuning job method over HTTP. @@ -857,8 +987,10 @@ async def __call__( 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: ~.tuning_job.TuningJob: @@ -870,6 +1002,7 @@ async def __call__( http_options = ( _BaseGenAiTuningServiceRestTransport._BaseGetTuningJob._get_http_options() ) + request, metadata = await self._interceptor.pre_get_tuning_job( request, metadata ) @@ -882,6 +1015,33 @@ async 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.aiplatform_v1.GenAiTuningServiceClient.GetTuningJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1.GenAiTuningService", + "rpcName": "GetTuningJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncGenAiTuningServiceRestTransport._GetTuningJob._get_response( @@ -911,6 +1071,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_get_tuning_job(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = tuning_job.TuningJob.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.GenAiTuningServiceAsyncClient.get_tuning_job", + extra={ + "serviceName": "google.cloud.aiplatform.v1.GenAiTuningService", + "rpcName": "GetTuningJob", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ListTuningJobs( @@ -949,7 +1131,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> genai_tuning_service.ListTuningJobsResponse: r"""Call the list tuning jobs method over HTTP. @@ -960,8 +1142,10 @@ async def __call__( 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: ~.genai_tuning_service.ListTuningJobsResponse: @@ -973,6 +1157,7 @@ async def __call__( http_options = ( _BaseGenAiTuningServiceRestTransport._BaseListTuningJobs._get_http_options() ) + request, metadata = await self._interceptor.pre_list_tuning_jobs( request, metadata ) @@ -985,6 +1170,33 @@ async 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.aiplatform_v1.GenAiTuningServiceClient.ListTuningJobs", + extra={ + "serviceName": "google.cloud.aiplatform.v1.GenAiTuningService", + "rpcName": "ListTuningJobs", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncGenAiTuningServiceRestTransport._ListTuningJobs._get_response( self._host, @@ -1012,6 +1224,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_list_tuning_jobs(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + genai_tuning_service.ListTuningJobsResponse.to_json(response) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.GenAiTuningServiceAsyncClient.list_tuning_jobs", + extra={ + "serviceName": "google.cloud.aiplatform.v1.GenAiTuningService", + "rpcName": "ListTuningJobs", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _RebaseTunedModel( @@ -1051,7 +1287,7 @@ async 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 rebase tuned model method over HTTP. @@ -1062,8 +1298,10 @@ async def __call__( 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: @@ -1076,6 +1314,7 @@ async def __call__( http_options = ( _BaseGenAiTuningServiceRestTransport._BaseRebaseTunedModel._get_http_options() ) + request, metadata = await self._interceptor.pre_rebase_tuned_model( request, metadata ) @@ -1092,6 +1331,33 @@ async 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.aiplatform_v1.GenAiTuningServiceClient.RebaseTunedModel", + extra={ + "serviceName": "google.cloud.aiplatform.v1.GenAiTuningService", + "rpcName": "RebaseTunedModel", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncGenAiTuningServiceRestTransport._RebaseTunedModel._get_response( self._host, @@ -1120,6 +1386,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_rebase_tuned_model(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.GenAiTuningServiceAsyncClient.rebase_tuned_model", + extra={ + "serviceName": "google.cloud.aiplatform.v1.GenAiTuningService", + "rpcName": "RebaseTunedModel", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp @property @@ -3076,7 +3364,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -3087,8 +3375,10 @@ async def __call__( 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: locations_pb2.Location: Response from GetLocation method. @@ -3097,6 +3387,7 @@ async def __call__( http_options = ( _BaseGenAiTuningServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_location( request, metadata ) @@ -3109,6 +3400,33 @@ async 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.aiplatform_v1.GenAiTuningServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.GenAiTuningService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncGenAiTuningServiceRestTransport._GetLocation._get_response( @@ -3136,6 +3454,27 @@ async def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_location(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.aiplatform_v1.GenAiTuningServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.GenAiTuningService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3178,7 +3517,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -3189,8 +3528,10 @@ async def __call__( 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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -3199,6 +3540,7 @@ async def __call__( http_options = ( _BaseGenAiTuningServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_locations( request, metadata ) @@ -3211,6 +3553,33 @@ async 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.aiplatform_v1.GenAiTuningServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.GenAiTuningService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncGenAiTuningServiceRestTransport._ListLocations._get_response( @@ -3238,6 +3607,27 @@ async def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_list_locations(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.aiplatform_v1.GenAiTuningServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.GenAiTuningService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3280,7 +3670,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -3291,8 +3681,10 @@ async def __call__( 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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -3301,6 +3693,7 @@ async def __call__( http_options = ( _BaseGenAiTuningServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_get_iam_policy( request, metadata ) @@ -3313,6 +3706,33 @@ async 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.aiplatform_v1.GenAiTuningServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.GenAiTuningService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncGenAiTuningServiceRestTransport._GetIamPolicy._get_response( @@ -3340,6 +3760,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_iam_policy(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.aiplatform_v1.GenAiTuningServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.GenAiTuningService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3383,7 +3824,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -3394,8 +3835,10 @@ async def __call__( 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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -3404,6 +3847,7 @@ async def __call__( http_options = ( _BaseGenAiTuningServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_set_iam_policy( request, metadata ) @@ -3420,6 +3864,33 @@ async 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.aiplatform_v1.GenAiTuningServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.GenAiTuningService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncGenAiTuningServiceRestTransport._SetIamPolicy._get_response( @@ -3448,6 +3919,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_set_iam_policy(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.aiplatform_v1.GenAiTuningServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.GenAiTuningService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3490,7 +3982,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -3501,8 +3993,10 @@ async def __call__( 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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -3511,6 +4005,7 @@ async def __call__( http_options = ( _BaseGenAiTuningServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = await self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -3523,6 +4018,33 @@ async 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.aiplatform_v1.GenAiTuningServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.GenAiTuningService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncGenAiTuningServiceRestTransport._TestIamPermissions._get_response( self._host, @@ -3548,6 +4070,27 @@ async def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_test_iam_permissions(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.aiplatform_v1.GenAiTuningServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.GenAiTuningService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3590,7 +4133,7 @@ async 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 cancel operation method over HTTP. @@ -3601,13 +4144,16 @@ async def __call__( 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`. """ http_options = ( _BaseGenAiTuningServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_cancel_operation( request, metadata ) @@ -3620,6 +4166,33 @@ async 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.aiplatform_v1.GenAiTuningServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.GenAiTuningService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncGenAiTuningServiceRestTransport._CancelOperation._get_response( self._host, @@ -3683,7 +4256,7 @@ async 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. @@ -3694,13 +4267,16 @@ async def __call__( 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`. """ http_options = ( _BaseGenAiTuningServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_operation( request, metadata ) @@ -3713,6 +4289,33 @@ async 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.aiplatform_v1.GenAiTuningServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.GenAiTuningService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncGenAiTuningServiceRestTransport._DeleteOperation._get_response( self._host, @@ -3776,7 +4379,7 @@ async 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. @@ -3787,8 +4390,10 @@ async def __call__( 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: Response from GetOperation method. @@ -3797,6 +4402,7 @@ async def __call__( http_options = ( _BaseGenAiTuningServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_operation( request, metadata ) @@ -3809,6 +4415,33 @@ async 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.aiplatform_v1.GenAiTuningServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.GenAiTuningService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncGenAiTuningServiceRestTransport._GetOperation._get_response( @@ -3836,6 +4469,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1.GenAiTuningServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.GenAiTuningService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3878,7 +4532,7 @@ async 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. @@ -3889,8 +4543,10 @@ async def __call__( 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 from ListOperations method. @@ -3899,6 +4555,7 @@ async def __call__( http_options = ( _BaseGenAiTuningServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_operations( request, metadata ) @@ -3911,6 +4568,33 @@ async 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.aiplatform_v1.GenAiTuningServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.GenAiTuningService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncGenAiTuningServiceRestTransport._ListOperations._get_response( self._host, @@ -3936,6 +4620,27 @@ async def __call__( resp = operations_pb2.ListOperationsResponse() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1.GenAiTuningServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.GenAiTuningService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3978,7 +4683,7 @@ async 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 wait operation method over HTTP. @@ -3989,8 +4694,10 @@ async def __call__( 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: Response from WaitOperation method. @@ -3999,6 +4706,7 @@ async def __call__( http_options = ( _BaseGenAiTuningServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_wait_operation( request, metadata ) @@ -4011,6 +4719,33 @@ async 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.aiplatform_v1.GenAiTuningServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.GenAiTuningService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncGenAiTuningServiceRestTransport._WaitOperation._get_response( @@ -4038,6 +4773,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_wait_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.aiplatform_v1.GenAiTuningServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.GenAiTuningService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1/services/index_endpoint_service/async_client.py b/google/cloud/aiplatform_v1/services/index_endpoint_service/async_client.py index ee0a3a3a3e..c9e5fbef72 100644 --- a/google/cloud/aiplatform_v1/services/index_endpoint_service/async_client.py +++ b/google/cloud/aiplatform_v1/services/index_endpoint_service/async_client.py @@ -13,6 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging as std_logging from collections import OrderedDict import re from typing import ( @@ -63,6 +64,15 @@ from .transports.grpc_asyncio import IndexEndpointServiceGrpcAsyncIOTransport from .client import IndexEndpointServiceClient +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 IndexEndpointServiceAsyncClient: """A service for managing Vertex AI's IndexEndpoints.""" @@ -280,6 +290,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.aiplatform_v1.IndexEndpointServiceAsyncClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexEndpointService", + "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.aiplatform.v1.IndexEndpointService", + "credentialsType": None, + }, + ) + async def create_index_endpoint( self, request: Optional[ @@ -290,7 +322,7 @@ async def create_index_endpoint( index_endpoint: Optional[gca_index_endpoint.IndexEndpoint] = 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"""Creates an IndexEndpoint. @@ -350,8 +382,10 @@ async def sample_create_index_endpoint(): 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: @@ -426,7 +460,7 @@ async def get_index_endpoint( 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]]] = (), ) -> index_endpoint.IndexEndpoint: r"""Gets an IndexEndpoint. @@ -471,8 +505,10 @@ async def sample_get_index_endpoint(): 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.aiplatform_v1.types.IndexEndpoint: @@ -536,7 +572,7 @@ async def list_index_endpoints( 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.ListIndexEndpointsAsyncPager: r"""Lists IndexEndpoints in a Location. @@ -582,8 +618,10 @@ async def sample_list_index_endpoints(): 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.aiplatform_v1.services.index_endpoint_service.pagers.ListIndexEndpointsAsyncPager: @@ -661,7 +699,7 @@ async def update_index_endpoint( 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]]] = (), ) -> gca_index_endpoint.IndexEndpoint: r"""Updates an IndexEndpoint. @@ -715,8 +753,10 @@ async def sample_update_index_endpoint(): 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.aiplatform_v1.types.IndexEndpoint: @@ -784,7 +824,7 @@ async def delete_index_endpoint( 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"""Deletes an IndexEndpoint. @@ -833,8 +873,10 @@ async def sample_delete_index_endpoint(): 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: @@ -916,7 +958,7 @@ async def deploy_index( deployed_index: Optional[gca_index_endpoint.DeployedIndex] = 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"""Deploys an Index into this IndexEndpoint, creating a DeployedIndex within it. @@ -979,8 +1021,10 @@ async def sample_deploy_index(): 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: @@ -1058,7 +1102,7 @@ async def undeploy_index( deployed_index_id: 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"""Undeploys an Index from an IndexEndpoint, removing a DeployedIndex from it, and freeing all resources it's @@ -1117,8 +1161,10 @@ async def sample_undeploy_index(): 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: @@ -1196,7 +1242,7 @@ async def mutate_deployed_index( deployed_index: Optional[gca_index_endpoint.DeployedIndex] = 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 existing DeployedIndex under an IndexEndpoint. @@ -1261,8 +1307,10 @@ async def sample_mutate_deployed_index(): 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: @@ -1336,7 +1384,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. @@ -1347,8 +1395,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. @@ -1389,7 +1439,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. @@ -1400,8 +1450,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. @@ -1442,7 +1494,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. @@ -1458,8 +1510,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 """ @@ -1496,7 +1550,7 @@ async def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -1511,8 +1565,10 @@ async def cancel_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 """ @@ -1549,7 +1605,7 @@ async def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -1566,8 +1622,10 @@ async def wait_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. @@ -1608,7 +1666,7 @@ async def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -1621,8 +1679,10 @@ async def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -1727,7 +1787,7 @@ async def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -1741,8 +1801,10 @@ async def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -1847,7 +1909,7 @@ async def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -1862,8 +1924,10 @@ async def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -1907,7 +1971,7 @@ async def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -1918,8 +1982,10 @@ async def get_location( 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: ~.location_pb2.Location: Location object. @@ -1960,7 +2026,7 @@ async def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -1971,8 +2037,10 @@ async def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1/services/index_endpoint_service/client.py b/google/cloud/aiplatform_v1/services/index_endpoint_service/client.py index b68bac3dcd..c392d30ce9 100644 --- a/google/cloud/aiplatform_v1/services/index_endpoint_service/client.py +++ b/google/cloud/aiplatform_v1/services/index_endpoint_service/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 ( @@ -48,6 +49,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 as gac_operation # type: ignore from google.api_core import operation_async # type: ignore from google.cloud.aiplatform_v1.services.index_endpoint_service import pagers @@ -653,6 +663,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( @@ -744,6 +758,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.aiplatform_v1.IndexEndpointServiceClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexEndpointService", + "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.aiplatform.v1.IndexEndpointService", + "credentialsType": None, + }, + ) + def create_index_endpoint( self, request: Optional[ @@ -754,7 +791,7 @@ def create_index_endpoint( index_endpoint: Optional[gca_index_endpoint.IndexEndpoint] = 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]]] = (), ) -> gac_operation.Operation: r"""Creates an IndexEndpoint. @@ -814,8 +851,10 @@ def sample_create_index_endpoint(): 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: @@ -887,7 +926,7 @@ def get_index_endpoint( 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]]] = (), ) -> index_endpoint.IndexEndpoint: r"""Gets an IndexEndpoint. @@ -932,8 +971,10 @@ def sample_get_index_endpoint(): 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.aiplatform_v1.types.IndexEndpoint: @@ -994,7 +1035,7 @@ def list_index_endpoints( 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.ListIndexEndpointsPager: r"""Lists IndexEndpoints in a Location. @@ -1040,8 +1081,10 @@ def sample_list_index_endpoints(): 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.aiplatform_v1.services.index_endpoint_service.pagers.ListIndexEndpointsPager: @@ -1116,7 +1159,7 @@ def update_index_endpoint( 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]]] = (), ) -> gca_index_endpoint.IndexEndpoint: r"""Updates an IndexEndpoint. @@ -1170,8 +1213,10 @@ def sample_update_index_endpoint(): 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.aiplatform_v1.types.IndexEndpoint: @@ -1236,7 +1281,7 @@ def delete_index_endpoint( 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]]] = (), ) -> gac_operation.Operation: r"""Deletes an IndexEndpoint. @@ -1285,8 +1330,10 @@ def sample_delete_index_endpoint(): 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: @@ -1365,7 +1412,7 @@ def deploy_index( deployed_index: Optional[gca_index_endpoint.DeployedIndex] = 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]]] = (), ) -> gac_operation.Operation: r"""Deploys an Index into this IndexEndpoint, creating a DeployedIndex within it. @@ -1428,8 +1475,10 @@ def sample_deploy_index(): 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: @@ -1504,7 +1553,7 @@ def undeploy_index( deployed_index_id: 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]]] = (), ) -> gac_operation.Operation: r"""Undeploys an Index from an IndexEndpoint, removing a DeployedIndex from it, and freeing all resources it's @@ -1563,8 +1612,10 @@ def sample_undeploy_index(): 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: @@ -1639,7 +1690,7 @@ def mutate_deployed_index( deployed_index: Optional[gca_index_endpoint.DeployedIndex] = 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]]] = (), ) -> gac_operation.Operation: r"""Update an existing DeployedIndex under an IndexEndpoint. @@ -1704,8 +1755,10 @@ def sample_mutate_deployed_index(): 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: @@ -1789,7 +1842,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. @@ -1800,8 +1853,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. @@ -1842,7 +1897,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. @@ -1853,8 +1908,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. @@ -1895,7 +1952,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. @@ -1911,8 +1968,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 """ @@ -1949,7 +2008,7 @@ def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -1964,8 +2023,10 @@ def cancel_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 """ @@ -2002,7 +2063,7 @@ def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -2019,8 +2080,10 @@ def wait_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. @@ -2061,7 +2124,7 @@ def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -2074,8 +2137,10 @@ def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -2180,7 +2245,7 @@ def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -2194,8 +2259,10 @@ def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -2300,7 +2367,7 @@ def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -2315,8 +2382,10 @@ def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -2358,7 +2427,7 @@ def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -2369,8 +2438,10 @@ def get_location( 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: ~.location_pb2.Location: Location object. @@ -2411,7 +2482,7 @@ def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -2422,8 +2493,10 @@ def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1/services/index_endpoint_service/pagers.py b/google/cloud/aiplatform_v1/services/index_endpoint_service/pagers.py index 2532ea671a..34371d5b22 100644 --- a/google/cloud/aiplatform_v1/services/index_endpoint_service/pagers.py +++ b/google/cloud/aiplatform_v1/services/index_endpoint_service/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 = index_endpoint_service.ListIndexEndpointsRequest(request) @@ -143,7 +145,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. @@ -157,8 +159,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 = index_endpoint_service.ListIndexEndpointsRequest(request) diff --git a/google/cloud/aiplatform_v1/services/index_endpoint_service/transports/grpc.py b/google/cloud/aiplatform_v1/services/index_endpoint_service/transports/grpc.py index db1dd6cd3e..57d8db4850 100644 --- a/google/cloud/aiplatform_v1/services/index_endpoint_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1/services/index_endpoint_service/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 import warnings from typing import Callable, Dict, Optional, Sequence, Tuple, Union @@ -22,8 +25,11 @@ import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from google.cloud.aiplatform_v1.types import index_endpoint from google.cloud.aiplatform_v1.types import index_endpoint as gca_index_endpoint @@ -34,6 +40,81 @@ from google.longrunning import operations_pb2 # type: ignore from .base import IndexEndpointServiceTransport, DEFAULT_CLIENT_INFO +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.aiplatform.v1.IndexEndpointService", + "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.aiplatform.v1.IndexEndpointService", + "rpcName": client_call_details.method, + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class IndexEndpointServiceGrpcTransport(IndexEndpointServiceTransport): """gRPC backend transport for IndexEndpointService. @@ -188,7 +269,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 @@ -252,7 +338,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 @@ -278,7 +366,7 @@ def create_index_endpoint( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_index_endpoint" not in self._stubs: - self._stubs["create_index_endpoint"] = self.grpc_channel.unary_unary( + self._stubs["create_index_endpoint"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.IndexEndpointService/CreateIndexEndpoint", request_serializer=index_endpoint_service.CreateIndexEndpointRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -306,7 +394,7 @@ def get_index_endpoint( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_index_endpoint" not in self._stubs: - self._stubs["get_index_endpoint"] = self.grpc_channel.unary_unary( + self._stubs["get_index_endpoint"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.IndexEndpointService/GetIndexEndpoint", request_serializer=index_endpoint_service.GetIndexEndpointRequest.serialize, response_deserializer=index_endpoint.IndexEndpoint.deserialize, @@ -335,7 +423,7 @@ def list_index_endpoints( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_index_endpoints" not in self._stubs: - self._stubs["list_index_endpoints"] = self.grpc_channel.unary_unary( + self._stubs["list_index_endpoints"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.IndexEndpointService/ListIndexEndpoints", request_serializer=index_endpoint_service.ListIndexEndpointsRequest.serialize, response_deserializer=index_endpoint_service.ListIndexEndpointsResponse.deserialize, @@ -364,7 +452,7 @@ def update_index_endpoint( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_index_endpoint" not in self._stubs: - self._stubs["update_index_endpoint"] = self.grpc_channel.unary_unary( + self._stubs["update_index_endpoint"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.IndexEndpointService/UpdateIndexEndpoint", request_serializer=index_endpoint_service.UpdateIndexEndpointRequest.serialize, response_deserializer=gca_index_endpoint.IndexEndpoint.deserialize, @@ -392,7 +480,7 @@ def delete_index_endpoint( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_index_endpoint" not in self._stubs: - self._stubs["delete_index_endpoint"] = self.grpc_channel.unary_unary( + self._stubs["delete_index_endpoint"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.IndexEndpointService/DeleteIndexEndpoint", request_serializer=index_endpoint_service.DeleteIndexEndpointRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -422,7 +510,7 @@ def deploy_index( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "deploy_index" not in self._stubs: - self._stubs["deploy_index"] = self.grpc_channel.unary_unary( + self._stubs["deploy_index"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.IndexEndpointService/DeployIndex", request_serializer=index_endpoint_service.DeployIndexRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -452,7 +540,7 @@ def undeploy_index( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "undeploy_index" not in self._stubs: - self._stubs["undeploy_index"] = self.grpc_channel.unary_unary( + self._stubs["undeploy_index"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.IndexEndpointService/UndeployIndex", request_serializer=index_endpoint_service.UndeployIndexRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -481,7 +569,7 @@ def mutate_deployed_index( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "mutate_deployed_index" not in self._stubs: - self._stubs["mutate_deployed_index"] = self.grpc_channel.unary_unary( + self._stubs["mutate_deployed_index"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.IndexEndpointService/MutateDeployedIndex", request_serializer=index_endpoint_service.MutateDeployedIndexRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -489,7 +577,7 @@ def mutate_deployed_index( return self._stubs["mutate_deployed_index"] def close(self): - self.grpc_channel.close() + self._logged_channel.close() @property def delete_operation( @@ -501,7 +589,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, @@ -518,7 +606,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -535,7 +623,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -552,7 +640,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, @@ -571,7 +659,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, @@ -590,7 +678,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -607,7 +695,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -632,7 +720,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -658,7 +746,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -687,7 +775,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1/services/index_endpoint_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1/services/index_endpoint_service/transports/grpc_asyncio.py index f456c08f85..2ed580ff3e 100644 --- a/google/cloud/aiplatform_v1/services/index_endpoint_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1/services/index_endpoint_service/transports/grpc_asyncio.py @@ -14,6 +14,9 @@ # limitations under the License. # import inspect +import json +import pickle +import logging as std_logging import warnings from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union @@ -24,8 +27,11 @@ from google.api_core import operations_v1 from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from grpc.experimental import aio # type: ignore from google.cloud.aiplatform_v1.types import index_endpoint @@ -38,6 +44,82 @@ from .base import IndexEndpointServiceTransport, DEFAULT_CLIENT_INFO from .grpc import IndexEndpointServiceGrpcTransport +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.aiplatform.v1.IndexEndpointService", + "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.aiplatform.v1.IndexEndpointService", + "rpcName": str(client_call_details.method), + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class IndexEndpointServiceGrpcAsyncIOTransport(IndexEndpointServiceTransport): """gRPC AsyncIO backend transport for IndexEndpointService. @@ -235,10 +317,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 @@ -261,7 +346,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. @@ -289,7 +374,7 @@ def create_index_endpoint( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_index_endpoint" not in self._stubs: - self._stubs["create_index_endpoint"] = self.grpc_channel.unary_unary( + self._stubs["create_index_endpoint"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.IndexEndpointService/CreateIndexEndpoint", request_serializer=index_endpoint_service.CreateIndexEndpointRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -318,7 +403,7 @@ def get_index_endpoint( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_index_endpoint" not in self._stubs: - self._stubs["get_index_endpoint"] = self.grpc_channel.unary_unary( + self._stubs["get_index_endpoint"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.IndexEndpointService/GetIndexEndpoint", request_serializer=index_endpoint_service.GetIndexEndpointRequest.serialize, response_deserializer=index_endpoint.IndexEndpoint.deserialize, @@ -347,7 +432,7 @@ def list_index_endpoints( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_index_endpoints" not in self._stubs: - self._stubs["list_index_endpoints"] = self.grpc_channel.unary_unary( + self._stubs["list_index_endpoints"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.IndexEndpointService/ListIndexEndpoints", request_serializer=index_endpoint_service.ListIndexEndpointsRequest.serialize, response_deserializer=index_endpoint_service.ListIndexEndpointsResponse.deserialize, @@ -376,7 +461,7 @@ def update_index_endpoint( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_index_endpoint" not in self._stubs: - self._stubs["update_index_endpoint"] = self.grpc_channel.unary_unary( + self._stubs["update_index_endpoint"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.IndexEndpointService/UpdateIndexEndpoint", request_serializer=index_endpoint_service.UpdateIndexEndpointRequest.serialize, response_deserializer=gca_index_endpoint.IndexEndpoint.deserialize, @@ -405,7 +490,7 @@ def delete_index_endpoint( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_index_endpoint" not in self._stubs: - self._stubs["delete_index_endpoint"] = self.grpc_channel.unary_unary( + self._stubs["delete_index_endpoint"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.IndexEndpointService/DeleteIndexEndpoint", request_serializer=index_endpoint_service.DeleteIndexEndpointRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -435,7 +520,7 @@ def deploy_index( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "deploy_index" not in self._stubs: - self._stubs["deploy_index"] = self.grpc_channel.unary_unary( + self._stubs["deploy_index"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.IndexEndpointService/DeployIndex", request_serializer=index_endpoint_service.DeployIndexRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -466,7 +551,7 @@ def undeploy_index( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "undeploy_index" not in self._stubs: - self._stubs["undeploy_index"] = self.grpc_channel.unary_unary( + self._stubs["undeploy_index"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.IndexEndpointService/UndeployIndex", request_serializer=index_endpoint_service.UndeployIndexRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -496,7 +581,7 @@ def mutate_deployed_index( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "mutate_deployed_index" not in self._stubs: - self._stubs["mutate_deployed_index"] = self.grpc_channel.unary_unary( + self._stubs["mutate_deployed_index"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.IndexEndpointService/MutateDeployedIndex", request_serializer=index_endpoint_service.MutateDeployedIndexRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -604,7 +689,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: @@ -620,7 +705,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, @@ -637,7 +722,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -654,7 +739,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -671,7 +756,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, @@ -690,7 +775,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, @@ -709,7 +794,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -726,7 +811,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -751,7 +836,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -777,7 +862,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -806,7 +891,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1/services/index_endpoint_service/transports/rest.py b/google/cloud/aiplatform_v1/services/index_endpoint_service/transports/rest.py index 0d830d3121..bd5d20e18e 100644 --- a/google/cloud/aiplatform_v1/services/index_endpoint_service/transports/rest.py +++ b/google/cloud/aiplatform_v1/services/index_endpoint_service/transports/rest.py @@ -13,9 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging +import json # type: ignore from google.auth.transport.requests import AuthorizedSession # type: ignore -import json # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.api_core import exceptions as core_exceptions from google.api_core import retry as retries @@ -49,6 +50,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, @@ -145,9 +154,10 @@ def post_update_index_endpoint(self, response): def pre_create_index_endpoint( self, request: index_endpoint_service.CreateIndexEndpointRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - index_endpoint_service.CreateIndexEndpointRequest, Sequence[Tuple[str, str]] + index_endpoint_service.CreateIndexEndpointRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for create_index_endpoint @@ -170,9 +180,10 @@ def post_create_index_endpoint( def pre_delete_index_endpoint( self, request: index_endpoint_service.DeleteIndexEndpointRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - index_endpoint_service.DeleteIndexEndpointRequest, Sequence[Tuple[str, str]] + index_endpoint_service.DeleteIndexEndpointRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for delete_index_endpoint @@ -195,8 +206,11 @@ def post_delete_index_endpoint( def pre_deploy_index( self, request: index_endpoint_service.DeployIndexRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[index_endpoint_service.DeployIndexRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + index_endpoint_service.DeployIndexRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for deploy_index Override in a subclass to manipulate the request or metadata @@ -218,9 +232,10 @@ def post_deploy_index( def pre_get_index_endpoint( self, request: index_endpoint_service.GetIndexEndpointRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - index_endpoint_service.GetIndexEndpointRequest, Sequence[Tuple[str, str]] + index_endpoint_service.GetIndexEndpointRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for get_index_endpoint @@ -243,9 +258,10 @@ def post_get_index_endpoint( def pre_list_index_endpoints( self, request: index_endpoint_service.ListIndexEndpointsRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - index_endpoint_service.ListIndexEndpointsRequest, Sequence[Tuple[str, str]] + index_endpoint_service.ListIndexEndpointsRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for list_index_endpoints @@ -268,9 +284,10 @@ def post_list_index_endpoints( def pre_mutate_deployed_index( self, request: index_endpoint_service.MutateDeployedIndexRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - index_endpoint_service.MutateDeployedIndexRequest, Sequence[Tuple[str, str]] + index_endpoint_service.MutateDeployedIndexRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for mutate_deployed_index @@ -293,8 +310,11 @@ def post_mutate_deployed_index( def pre_undeploy_index( self, request: index_endpoint_service.UndeployIndexRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[index_endpoint_service.UndeployIndexRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + index_endpoint_service.UndeployIndexRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for undeploy_index Override in a subclass to manipulate the request or metadata @@ -316,9 +336,10 @@ def post_undeploy_index( def pre_update_index_endpoint( self, request: index_endpoint_service.UpdateIndexEndpointRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - index_endpoint_service.UpdateIndexEndpointRequest, Sequence[Tuple[str, str]] + index_endpoint_service.UpdateIndexEndpointRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for update_index_endpoint @@ -341,8 +362,10 @@ def post_update_index_endpoint( def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -364,8 +387,10 @@ def post_get_location( def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -387,8 +412,10 @@ def post_list_locations( def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -408,8 +435,10 @@ def post_get_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -429,8 +458,11 @@ def post_set_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -452,8 +484,10 @@ def post_test_iam_permissions( def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -473,8 +507,10 @@ def post_cancel_operation(self, response: None) -> None: 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 @@ -494,8 +530,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 @@ -517,8 +555,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 @@ -540,8 +580,10 @@ def post_list_operations( def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -2563,7 +2605,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 index endpoint method over HTTP. @@ -2574,8 +2616,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: @@ -2588,6 +2632,7 @@ def __call__( http_options = ( _BaseIndexEndpointServiceRestTransport._BaseCreateIndexEndpoint._get_http_options() ) + request, metadata = self._interceptor.pre_create_index_endpoint( request, metadata ) @@ -2604,6 +2649,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.aiplatform_v1.IndexEndpointServiceClient.CreateIndexEndpoint", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexEndpointService", + "rpcName": "CreateIndexEndpoint", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( IndexEndpointServiceRestTransport._CreateIndexEndpoint._get_response( @@ -2625,7 +2697,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_index_endpoint(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.aiplatform_v1.IndexEndpointServiceClient.create_index_endpoint", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexEndpointService", + "rpcName": "CreateIndexEndpoint", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _DeleteIndexEndpoint( @@ -2664,7 +2758,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 index endpoint method over HTTP. @@ -2675,8 +2769,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: @@ -2689,6 +2785,7 @@ def __call__( http_options = ( _BaseIndexEndpointServiceRestTransport._BaseDeleteIndexEndpoint._get_http_options() ) + request, metadata = self._interceptor.pre_delete_index_endpoint( request, metadata ) @@ -2701,6 +2798,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.aiplatform_v1.IndexEndpointServiceClient.DeleteIndexEndpoint", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexEndpointService", + "rpcName": "DeleteIndexEndpoint", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( IndexEndpointServiceRestTransport._DeleteIndexEndpoint._get_response( @@ -2721,7 +2845,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_index_endpoint(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.aiplatform_v1.IndexEndpointServiceClient.delete_index_endpoint", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexEndpointService", + "rpcName": "DeleteIndexEndpoint", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _DeployIndex( @@ -2761,7 +2907,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 deploy index method over HTTP. @@ -2772,8 +2918,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: @@ -2786,6 +2934,7 @@ def __call__( http_options = ( _BaseIndexEndpointServiceRestTransport._BaseDeployIndex._get_http_options() ) + request, metadata = self._interceptor.pre_deploy_index(request, metadata) transcoded_request = _BaseIndexEndpointServiceRestTransport._BaseDeployIndex._get_transcoded_request( http_options, request @@ -2800,6 +2949,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.aiplatform_v1.IndexEndpointServiceClient.DeployIndex", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexEndpointService", + "rpcName": "DeployIndex", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = IndexEndpointServiceRestTransport._DeployIndex._get_response( self._host, @@ -2819,7 +2995,29 @@ def __call__( # Return the response resp = operations_pb2.Operation() json_format.Parse(response.content, resp, ignore_unknown_fields=True) + resp = self._interceptor.post_deploy_index(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.aiplatform_v1.IndexEndpointServiceClient.deploy_index", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexEndpointService", + "rpcName": "DeployIndex", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _GetIndexEndpoint( @@ -2858,7 +3056,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]]] = (), ) -> index_endpoint.IndexEndpoint: r"""Call the get index endpoint method over HTTP. @@ -2869,8 +3067,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: ~.index_endpoint.IndexEndpoint: @@ -2883,6 +3083,7 @@ def __call__( http_options = ( _BaseIndexEndpointServiceRestTransport._BaseGetIndexEndpoint._get_http_options() ) + request, metadata = self._interceptor.pre_get_index_endpoint( request, metadata ) @@ -2895,6 +3096,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.aiplatform_v1.IndexEndpointServiceClient.GetIndexEndpoint", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexEndpointService", + "rpcName": "GetIndexEndpoint", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( IndexEndpointServiceRestTransport._GetIndexEndpoint._get_response( @@ -2917,7 +3145,29 @@ def __call__( pb_resp = index_endpoint.IndexEndpoint.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_index_endpoint(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = index_endpoint.IndexEndpoint.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.aiplatform_v1.IndexEndpointServiceClient.get_index_endpoint", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexEndpointService", + "rpcName": "GetIndexEndpoint", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListIndexEndpoints( @@ -2956,7 +3206,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]]] = (), ) -> index_endpoint_service.ListIndexEndpointsResponse: r"""Call the list index endpoints method over HTTP. @@ -2967,8 +3217,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: ~.index_endpoint_service.ListIndexEndpointsResponse: @@ -2980,6 +3232,7 @@ def __call__( http_options = ( _BaseIndexEndpointServiceRestTransport._BaseListIndexEndpoints._get_http_options() ) + request, metadata = self._interceptor.pre_list_index_endpoints( request, metadata ) @@ -2992,6 +3245,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.aiplatform_v1.IndexEndpointServiceClient.ListIndexEndpoints", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexEndpointService", + "rpcName": "ListIndexEndpoints", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( IndexEndpointServiceRestTransport._ListIndexEndpoints._get_response( @@ -3014,7 +3294,33 @@ def __call__( pb_resp = index_endpoint_service.ListIndexEndpointsResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_index_endpoints(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + index_endpoint_service.ListIndexEndpointsResponse.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.aiplatform_v1.IndexEndpointServiceClient.list_index_endpoints", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexEndpointService", + "rpcName": "ListIndexEndpoints", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _MutateDeployedIndex( @@ -3054,7 +3360,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 mutate deployed index method over HTTP. @@ -3065,8 +3371,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: @@ -3079,6 +3387,7 @@ def __call__( http_options = ( _BaseIndexEndpointServiceRestTransport._BaseMutateDeployedIndex._get_http_options() ) + request, metadata = self._interceptor.pre_mutate_deployed_index( request, metadata ) @@ -3095,6 +3404,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.aiplatform_v1.IndexEndpointServiceClient.MutateDeployedIndex", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexEndpointService", + "rpcName": "MutateDeployedIndex", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( IndexEndpointServiceRestTransport._MutateDeployedIndex._get_response( @@ -3116,7 +3452,29 @@ def __call__( # Return the response resp = operations_pb2.Operation() json_format.Parse(response.content, resp, ignore_unknown_fields=True) + resp = self._interceptor.post_mutate_deployed_index(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.aiplatform_v1.IndexEndpointServiceClient.mutate_deployed_index", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexEndpointService", + "rpcName": "MutateDeployedIndex", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _UndeployIndex( @@ -3156,7 +3514,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 undeploy index method over HTTP. @@ -3167,8 +3525,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: @@ -3181,6 +3541,7 @@ def __call__( http_options = ( _BaseIndexEndpointServiceRestTransport._BaseUndeployIndex._get_http_options() ) + request, metadata = self._interceptor.pre_undeploy_index(request, metadata) transcoded_request = _BaseIndexEndpointServiceRestTransport._BaseUndeployIndex._get_transcoded_request( http_options, request @@ -3195,6 +3556,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.aiplatform_v1.IndexEndpointServiceClient.UndeployIndex", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexEndpointService", + "rpcName": "UndeployIndex", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = IndexEndpointServiceRestTransport._UndeployIndex._get_response( self._host, @@ -3214,7 +3602,29 @@ def __call__( # Return the response resp = operations_pb2.Operation() json_format.Parse(response.content, resp, ignore_unknown_fields=True) + resp = self._interceptor.post_undeploy_index(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.aiplatform_v1.IndexEndpointServiceClient.undeploy_index", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexEndpointService", + "rpcName": "UndeployIndex", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _UpdateIndexEndpoint( @@ -3254,7 +3664,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]]] = (), ) -> gca_index_endpoint.IndexEndpoint: r"""Call the update index endpoint method over HTTP. @@ -3265,8 +3675,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: ~.gca_index_endpoint.IndexEndpoint: @@ -3279,6 +3691,7 @@ def __call__( http_options = ( _BaseIndexEndpointServiceRestTransport._BaseUpdateIndexEndpoint._get_http_options() ) + request, metadata = self._interceptor.pre_update_index_endpoint( request, metadata ) @@ -3295,6 +3708,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.aiplatform_v1.IndexEndpointServiceClient.UpdateIndexEndpoint", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexEndpointService", + "rpcName": "UpdateIndexEndpoint", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( IndexEndpointServiceRestTransport._UpdateIndexEndpoint._get_response( @@ -3318,7 +3758,31 @@ def __call__( pb_resp = gca_index_endpoint.IndexEndpoint.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_update_index_endpoint(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gca_index_endpoint.IndexEndpoint.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.aiplatform_v1.IndexEndpointServiceClient.update_index_endpoint", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexEndpointService", + "rpcName": "UpdateIndexEndpoint", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp @property @@ -3443,7 +3907,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]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -3454,8 +3918,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: locations_pb2.Location: Response from GetLocation method. @@ -3464,6 +3930,7 @@ def __call__( http_options = ( _BaseIndexEndpointServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = self._interceptor.pre_get_location(request, metadata) transcoded_request = _BaseIndexEndpointServiceRestTransport._BaseGetLocation._get_transcoded_request( http_options, request @@ -3474,6 +3941,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.aiplatform_v1.IndexEndpointServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexEndpointService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = IndexEndpointServiceRestTransport._GetLocation._get_response( self._host, @@ -3493,6 +3987,27 @@ def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_location(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.aiplatform_v1.IndexEndpointServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexEndpointService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3535,7 +4050,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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -3546,8 +4061,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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -3556,6 +4073,7 @@ def __call__( http_options = ( _BaseIndexEndpointServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = self._interceptor.pre_list_locations(request, metadata) transcoded_request = _BaseIndexEndpointServiceRestTransport._BaseListLocations._get_transcoded_request( http_options, request @@ -3566,6 +4084,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.aiplatform_v1.IndexEndpointServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexEndpointService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = IndexEndpointServiceRestTransport._ListLocations._get_response( self._host, @@ -3585,6 +4130,27 @@ def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_list_locations(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.aiplatform_v1.IndexEndpointServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexEndpointService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3627,7 +4193,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]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -3638,8 +4204,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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -3648,6 +4216,7 @@ def __call__( http_options = ( _BaseIndexEndpointServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_get_iam_policy(request, metadata) transcoded_request = _BaseIndexEndpointServiceRestTransport._BaseGetIamPolicy._get_transcoded_request( http_options, request @@ -3658,6 +4227,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.aiplatform_v1.IndexEndpointServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexEndpointService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = IndexEndpointServiceRestTransport._GetIamPolicy._get_response( self._host, @@ -3677,6 +4273,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_iam_policy(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.aiplatform_v1.IndexEndpointServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexEndpointService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3720,7 +4337,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]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -3731,8 +4348,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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -3741,6 +4360,7 @@ def __call__( http_options = ( _BaseIndexEndpointServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_set_iam_policy(request, metadata) transcoded_request = _BaseIndexEndpointServiceRestTransport._BaseSetIamPolicy._get_transcoded_request( http_options, request @@ -3755,6 +4375,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.aiplatform_v1.IndexEndpointServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexEndpointService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = IndexEndpointServiceRestTransport._SetIamPolicy._get_response( self._host, @@ -3775,6 +4422,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_set_iam_policy(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.aiplatform_v1.IndexEndpointServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexEndpointService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3817,7 +4485,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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -3828,8 +4496,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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -3838,6 +4508,7 @@ def __call__( http_options = ( _BaseIndexEndpointServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -3850,6 +4521,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.aiplatform_v1.IndexEndpointServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexEndpointService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( IndexEndpointServiceRestTransport._TestIamPermissions._get_response( @@ -3871,6 +4569,27 @@ def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_test_iam_permissions(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.aiplatform_v1.IndexEndpointServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexEndpointService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3913,7 +4632,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 cancel operation method over HTTP. @@ -3924,13 +4643,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 = ( _BaseIndexEndpointServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = self._interceptor.pre_cancel_operation( request, metadata ) @@ -3943,6 +4665,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.aiplatform_v1.IndexEndpointServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexEndpointService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = IndexEndpointServiceRestTransport._CancelOperation._get_response( self._host, @@ -4000,7 +4749,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. @@ -4011,13 +4760,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 = ( _BaseIndexEndpointServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = self._interceptor.pre_delete_operation( request, metadata ) @@ -4030,6 +4782,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.aiplatform_v1.IndexEndpointServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexEndpointService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = IndexEndpointServiceRestTransport._DeleteOperation._get_response( self._host, @@ -4087,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]]] = (), ) -> operations_pb2.Operation: r"""Call the get operation method over HTTP. @@ -4098,8 +4877,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. @@ -4108,6 +4889,7 @@ def __call__( http_options = ( _BaseIndexEndpointServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = self._interceptor.pre_get_operation(request, metadata) transcoded_request = _BaseIndexEndpointServiceRestTransport._BaseGetOperation._get_transcoded_request( http_options, request @@ -4118,6 +4900,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.aiplatform_v1.IndexEndpointServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexEndpointService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = IndexEndpointServiceRestTransport._GetOperation._get_response( self._host, @@ -4137,6 +4946,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.aiplatform_v1.IndexEndpointServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexEndpointService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4179,7 +5009,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. @@ -4190,8 +5020,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. @@ -4200,6 +5032,7 @@ def __call__( http_options = ( _BaseIndexEndpointServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = self._interceptor.pre_list_operations(request, metadata) transcoded_request = _BaseIndexEndpointServiceRestTransport._BaseListOperations._get_transcoded_request( http_options, request @@ -4210,6 +5043,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.aiplatform_v1.IndexEndpointServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexEndpointService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = IndexEndpointServiceRestTransport._ListOperations._get_response( self._host, @@ -4229,6 +5089,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.aiplatform_v1.IndexEndpointServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexEndpointService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4271,7 +5152,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 wait operation method over HTTP. @@ -4282,8 +5163,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 WaitOperation method. @@ -4292,6 +5175,7 @@ def __call__( http_options = ( _BaseIndexEndpointServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = self._interceptor.pre_wait_operation(request, metadata) transcoded_request = _BaseIndexEndpointServiceRestTransport._BaseWaitOperation._get_transcoded_request( http_options, request @@ -4302,6 +5186,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.aiplatform_v1.IndexEndpointServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexEndpointService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = IndexEndpointServiceRestTransport._WaitOperation._get_response( self._host, @@ -4321,6 +5232,27 @@ def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = self._interceptor.post_wait_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.aiplatform_v1.IndexEndpointServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexEndpointService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1/services/index_endpoint_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1/services/index_endpoint_service/transports/rest_asyncio.py index 90a2ffc221..8c4035f19e 100644 --- a/google/cloud/aiplatform_v1/services/index_endpoint_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1/services/index_endpoint_service/transports/rest_asyncio.py @@ -60,6 +60,18 @@ from .base import DEFAULT_CLIENT_INFO as BASE_DEFAULT_CLIENT_INFO + +import logging + +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__) + try: OptionalRetry = Union[retries.AsyncRetry, gapic_v1.method._MethodDefault, None] except AttributeError: # pragma: NO COVER @@ -160,9 +172,10 @@ async def post_update_index_endpoint(self, response): async def pre_create_index_endpoint( self, request: index_endpoint_service.CreateIndexEndpointRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - index_endpoint_service.CreateIndexEndpointRequest, Sequence[Tuple[str, str]] + index_endpoint_service.CreateIndexEndpointRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for create_index_endpoint @@ -185,9 +198,10 @@ async def post_create_index_endpoint( async def pre_delete_index_endpoint( self, request: index_endpoint_service.DeleteIndexEndpointRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - index_endpoint_service.DeleteIndexEndpointRequest, Sequence[Tuple[str, str]] + index_endpoint_service.DeleteIndexEndpointRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for delete_index_endpoint @@ -210,8 +224,11 @@ async def post_delete_index_endpoint( async def pre_deploy_index( self, request: index_endpoint_service.DeployIndexRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[index_endpoint_service.DeployIndexRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + index_endpoint_service.DeployIndexRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for deploy_index Override in a subclass to manipulate the request or metadata @@ -233,9 +250,10 @@ async def post_deploy_index( async def pre_get_index_endpoint( self, request: index_endpoint_service.GetIndexEndpointRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - index_endpoint_service.GetIndexEndpointRequest, Sequence[Tuple[str, str]] + index_endpoint_service.GetIndexEndpointRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for get_index_endpoint @@ -258,9 +276,10 @@ async def post_get_index_endpoint( async def pre_list_index_endpoints( self, request: index_endpoint_service.ListIndexEndpointsRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - index_endpoint_service.ListIndexEndpointsRequest, Sequence[Tuple[str, str]] + index_endpoint_service.ListIndexEndpointsRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for list_index_endpoints @@ -283,9 +302,10 @@ async def post_list_index_endpoints( async def pre_mutate_deployed_index( self, request: index_endpoint_service.MutateDeployedIndexRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - index_endpoint_service.MutateDeployedIndexRequest, Sequence[Tuple[str, str]] + index_endpoint_service.MutateDeployedIndexRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for mutate_deployed_index @@ -308,8 +328,11 @@ async def post_mutate_deployed_index( async def pre_undeploy_index( self, request: index_endpoint_service.UndeployIndexRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[index_endpoint_service.UndeployIndexRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + index_endpoint_service.UndeployIndexRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for undeploy_index Override in a subclass to manipulate the request or metadata @@ -331,9 +354,10 @@ async def post_undeploy_index( async def pre_update_index_endpoint( self, request: index_endpoint_service.UpdateIndexEndpointRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - index_endpoint_service.UpdateIndexEndpointRequest, Sequence[Tuple[str, str]] + index_endpoint_service.UpdateIndexEndpointRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for update_index_endpoint @@ -356,8 +380,10 @@ async def post_update_index_endpoint( async def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -379,8 +405,10 @@ async def post_get_location( async def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -402,8 +430,10 @@ async def post_list_locations( async def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -425,8 +455,10 @@ async def post_get_iam_policy( async def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -448,8 +480,11 @@ async def post_set_iam_policy( async def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -471,8 +506,10 @@ async def post_test_iam_permissions( async def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -492,8 +529,10 @@ async def post_cancel_operation(self, response: None) -> None: async 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 @@ -513,8 +552,10 @@ async def post_delete_operation(self, response: None) -> None: async 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 @@ -536,8 +577,10 @@ async def post_get_operation( async 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 @@ -559,8 +602,10 @@ async def post_list_operations( async def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -781,7 +826,7 @@ async 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 index endpoint method over HTTP. @@ -792,8 +837,10 @@ async def __call__( 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: @@ -806,6 +853,7 @@ async def __call__( http_options = ( _BaseIndexEndpointServiceRestTransport._BaseCreateIndexEndpoint._get_http_options() ) + request, metadata = await self._interceptor.pre_create_index_endpoint( request, metadata ) @@ -822,6 +870,33 @@ async 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.aiplatform_v1.IndexEndpointServiceClient.CreateIndexEndpoint", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexEndpointService", + "rpcName": "CreateIndexEndpoint", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncIndexEndpointServiceRestTransport._CreateIndexEndpoint._get_response( self._host, @@ -850,6 +925,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_create_index_endpoint(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.IndexEndpointServiceAsyncClient.create_index_endpoint", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexEndpointService", + "rpcName": "CreateIndexEndpoint", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _DeleteIndexEndpoint( @@ -888,7 +985,7 @@ async 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 index endpoint method over HTTP. @@ -899,8 +996,10 @@ async def __call__( 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: @@ -913,6 +1012,7 @@ async def __call__( http_options = ( _BaseIndexEndpointServiceRestTransport._BaseDeleteIndexEndpoint._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_index_endpoint( request, metadata ) @@ -925,6 +1025,33 @@ async 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.aiplatform_v1.IndexEndpointServiceClient.DeleteIndexEndpoint", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexEndpointService", + "rpcName": "DeleteIndexEndpoint", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncIndexEndpointServiceRestTransport._DeleteIndexEndpoint._get_response( self._host, @@ -952,6 +1079,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_delete_index_endpoint(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.IndexEndpointServiceAsyncClient.delete_index_endpoint", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexEndpointService", + "rpcName": "DeleteIndexEndpoint", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _DeployIndex( @@ -991,7 +1140,7 @@ async 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 deploy index method over HTTP. @@ -1002,8 +1151,10 @@ async def __call__( 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: @@ -1016,6 +1167,7 @@ async def __call__( http_options = ( _BaseIndexEndpointServiceRestTransport._BaseDeployIndex._get_http_options() ) + request, metadata = await self._interceptor.pre_deploy_index( request, metadata ) @@ -1032,6 +1184,33 @@ async 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.aiplatform_v1.IndexEndpointServiceClient.DeployIndex", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexEndpointService", + "rpcName": "DeployIndex", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncIndexEndpointServiceRestTransport._DeployIndex._get_response( @@ -1062,6 +1241,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_deploy_index(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.IndexEndpointServiceAsyncClient.deploy_index", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexEndpointService", + "rpcName": "DeployIndex", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _GetIndexEndpoint( @@ -1100,7 +1301,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> index_endpoint.IndexEndpoint: r"""Call the get index endpoint method over HTTP. @@ -1111,8 +1312,10 @@ async def __call__( 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: ~.index_endpoint.IndexEndpoint: @@ -1125,6 +1328,7 @@ async def __call__( http_options = ( _BaseIndexEndpointServiceRestTransport._BaseGetIndexEndpoint._get_http_options() ) + request, metadata = await self._interceptor.pre_get_index_endpoint( request, metadata ) @@ -1137,6 +1341,33 @@ async 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.aiplatform_v1.IndexEndpointServiceClient.GetIndexEndpoint", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexEndpointService", + "rpcName": "GetIndexEndpoint", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncIndexEndpointServiceRestTransport._GetIndexEndpoint._get_response( self._host, @@ -1164,6 +1395,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_get_index_endpoint(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = index_endpoint.IndexEndpoint.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.IndexEndpointServiceAsyncClient.get_index_endpoint", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexEndpointService", + "rpcName": "GetIndexEndpoint", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ListIndexEndpoints( @@ -1202,7 +1455,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> index_endpoint_service.ListIndexEndpointsResponse: r"""Call the list index endpoints method over HTTP. @@ -1213,8 +1466,10 @@ async def __call__( 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: ~.index_endpoint_service.ListIndexEndpointsResponse: @@ -1226,6 +1481,7 @@ async def __call__( http_options = ( _BaseIndexEndpointServiceRestTransport._BaseListIndexEndpoints._get_http_options() ) + request, metadata = await self._interceptor.pre_list_index_endpoints( request, metadata ) @@ -1238,6 +1494,33 @@ async 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.aiplatform_v1.IndexEndpointServiceClient.ListIndexEndpoints", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexEndpointService", + "rpcName": "ListIndexEndpoints", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncIndexEndpointServiceRestTransport._ListIndexEndpoints._get_response( self._host, @@ -1265,6 +1548,32 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_list_index_endpoints(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + index_endpoint_service.ListIndexEndpointsResponse.to_json( + response + ) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.IndexEndpointServiceAsyncClient.list_index_endpoints", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexEndpointService", + "rpcName": "ListIndexEndpoints", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _MutateDeployedIndex( @@ -1304,7 +1613,7 @@ async 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 mutate deployed index method over HTTP. @@ -1315,8 +1624,10 @@ async def __call__( 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: @@ -1329,6 +1640,7 @@ async def __call__( http_options = ( _BaseIndexEndpointServiceRestTransport._BaseMutateDeployedIndex._get_http_options() ) + request, metadata = await self._interceptor.pre_mutate_deployed_index( request, metadata ) @@ -1345,6 +1657,33 @@ async 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.aiplatform_v1.IndexEndpointServiceClient.MutateDeployedIndex", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexEndpointService", + "rpcName": "MutateDeployedIndex", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncIndexEndpointServiceRestTransport._MutateDeployedIndex._get_response( self._host, @@ -1373,6 +1712,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_mutate_deployed_index(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.IndexEndpointServiceAsyncClient.mutate_deployed_index", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexEndpointService", + "rpcName": "MutateDeployedIndex", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _UndeployIndex( @@ -1412,7 +1773,7 @@ async 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 undeploy index method over HTTP. @@ -1423,8 +1784,10 @@ async def __call__( 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: @@ -1437,6 +1800,7 @@ async def __call__( http_options = ( _BaseIndexEndpointServiceRestTransport._BaseUndeployIndex._get_http_options() ) + request, metadata = await self._interceptor.pre_undeploy_index( request, metadata ) @@ -1453,6 +1817,33 @@ async 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.aiplatform_v1.IndexEndpointServiceClient.UndeployIndex", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexEndpointService", + "rpcName": "UndeployIndex", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncIndexEndpointServiceRestTransport._UndeployIndex._get_response( self._host, @@ -1481,6 +1872,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_undeploy_index(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.IndexEndpointServiceAsyncClient.undeploy_index", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexEndpointService", + "rpcName": "UndeployIndex", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _UpdateIndexEndpoint( @@ -1520,7 +1933,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> gca_index_endpoint.IndexEndpoint: r"""Call the update index endpoint method over HTTP. @@ -1531,8 +1944,10 @@ async def __call__( 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: ~.gca_index_endpoint.IndexEndpoint: @@ -1545,6 +1960,7 @@ async def __call__( http_options = ( _BaseIndexEndpointServiceRestTransport._BaseUpdateIndexEndpoint._get_http_options() ) + request, metadata = await self._interceptor.pre_update_index_endpoint( request, metadata ) @@ -1561,6 +1977,33 @@ async 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.aiplatform_v1.IndexEndpointServiceClient.UpdateIndexEndpoint", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexEndpointService", + "rpcName": "UpdateIndexEndpoint", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncIndexEndpointServiceRestTransport._UpdateIndexEndpoint._get_response( self._host, @@ -1589,6 +2032,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_update_index_endpoint(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gca_index_endpoint.IndexEndpoint.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.IndexEndpointServiceAsyncClient.update_index_endpoint", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexEndpointService", + "rpcName": "UpdateIndexEndpoint", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp @property @@ -3574,7 +4041,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -3585,8 +4052,10 @@ async def __call__( 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: locations_pb2.Location: Response from GetLocation method. @@ -3595,6 +4064,7 @@ async def __call__( http_options = ( _BaseIndexEndpointServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_location( request, metadata ) @@ -3607,6 +4077,33 @@ async 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.aiplatform_v1.IndexEndpointServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexEndpointService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncIndexEndpointServiceRestTransport._GetLocation._get_response( @@ -3634,6 +4131,27 @@ async def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_location(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.aiplatform_v1.IndexEndpointServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexEndpointService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3676,7 +4194,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -3687,8 +4205,10 @@ async def __call__( 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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -3697,6 +4217,7 @@ async def __call__( http_options = ( _BaseIndexEndpointServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_locations( request, metadata ) @@ -3709,6 +4230,33 @@ async 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.aiplatform_v1.IndexEndpointServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexEndpointService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncIndexEndpointServiceRestTransport._ListLocations._get_response( self._host, @@ -3734,6 +4282,27 @@ async def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_list_locations(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.aiplatform_v1.IndexEndpointServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexEndpointService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3776,7 +4345,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -3787,8 +4356,10 @@ async def __call__( 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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -3797,6 +4368,7 @@ async def __call__( http_options = ( _BaseIndexEndpointServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_get_iam_policy( request, metadata ) @@ -3809,6 +4381,33 @@ async 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.aiplatform_v1.IndexEndpointServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexEndpointService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncIndexEndpointServiceRestTransport._GetIamPolicy._get_response( self._host, @@ -3834,6 +4433,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_iam_policy(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.aiplatform_v1.IndexEndpointServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexEndpointService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3877,7 +4497,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -3888,8 +4508,10 @@ async def __call__( 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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -3898,6 +4520,7 @@ async def __call__( http_options = ( _BaseIndexEndpointServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_set_iam_policy( request, metadata ) @@ -3914,6 +4537,33 @@ async 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.aiplatform_v1.IndexEndpointServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexEndpointService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncIndexEndpointServiceRestTransport._SetIamPolicy._get_response( self._host, @@ -3940,6 +4590,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_set_iam_policy(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.aiplatform_v1.IndexEndpointServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexEndpointService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3982,7 +4653,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -3993,8 +4664,10 @@ async def __call__( 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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -4003,6 +4676,7 @@ async def __call__( http_options = ( _BaseIndexEndpointServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = await self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -4015,6 +4689,33 @@ async 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.aiplatform_v1.IndexEndpointServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexEndpointService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncIndexEndpointServiceRestTransport._TestIamPermissions._get_response( self._host, @@ -4040,6 +4741,27 @@ async def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_test_iam_permissions(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.aiplatform_v1.IndexEndpointServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexEndpointService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4082,7 +4804,7 @@ async 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 cancel operation method over HTTP. @@ -4093,13 +4815,16 @@ async def __call__( 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`. """ http_options = ( _BaseIndexEndpointServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_cancel_operation( request, metadata ) @@ -4112,6 +4837,33 @@ async 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.aiplatform_v1.IndexEndpointServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexEndpointService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncIndexEndpointServiceRestTransport._CancelOperation._get_response( self._host, @@ -4175,7 +4927,7 @@ async 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. @@ -4186,13 +4938,16 @@ async def __call__( 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`. """ http_options = ( _BaseIndexEndpointServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_operation( request, metadata ) @@ -4205,6 +4960,33 @@ async 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.aiplatform_v1.IndexEndpointServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexEndpointService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncIndexEndpointServiceRestTransport._DeleteOperation._get_response( self._host, @@ -4268,7 +5050,7 @@ async 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. @@ -4279,8 +5061,10 @@ async def __call__( 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: Response from GetOperation method. @@ -4289,6 +5073,7 @@ async def __call__( http_options = ( _BaseIndexEndpointServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_operation( request, metadata ) @@ -4301,6 +5086,33 @@ async 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.aiplatform_v1.IndexEndpointServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexEndpointService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncIndexEndpointServiceRestTransport._GetOperation._get_response( self._host, @@ -4326,6 +5138,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1.IndexEndpointServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexEndpointService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4368,7 +5201,7 @@ async 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. @@ -4379,8 +5212,10 @@ async def __call__( 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 from ListOperations method. @@ -4389,6 +5224,7 @@ async def __call__( http_options = ( _BaseIndexEndpointServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_operations( request, metadata ) @@ -4401,6 +5237,33 @@ async 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.aiplatform_v1.IndexEndpointServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexEndpointService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncIndexEndpointServiceRestTransport._ListOperations._get_response( self._host, @@ -4426,6 +5289,27 @@ async def __call__( resp = operations_pb2.ListOperationsResponse() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1.IndexEndpointServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexEndpointService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4468,7 +5352,7 @@ async 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 wait operation method over HTTP. @@ -4479,8 +5363,10 @@ async def __call__( 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: Response from WaitOperation method. @@ -4489,6 +5375,7 @@ async def __call__( http_options = ( _BaseIndexEndpointServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_wait_operation( request, metadata ) @@ -4501,6 +5388,33 @@ async 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.aiplatform_v1.IndexEndpointServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexEndpointService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncIndexEndpointServiceRestTransport._WaitOperation._get_response( self._host, @@ -4526,6 +5440,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_wait_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.aiplatform_v1.IndexEndpointServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexEndpointService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1/services/index_service/async_client.py b/google/cloud/aiplatform_v1/services/index_service/async_client.py index 8edfd48cc9..aae705c1d8 100644 --- a/google/cloud/aiplatform_v1/services/index_service/async_client.py +++ b/google/cloud/aiplatform_v1/services/index_service/async_client.py @@ -13,6 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging as std_logging from collections import OrderedDict import re from typing import ( @@ -64,6 +65,15 @@ from .transports.grpc_asyncio import IndexServiceGrpcAsyncIOTransport from .client import IndexServiceClient +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 IndexServiceAsyncClient: """A service for creating and managing Vertex AI's Index @@ -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.aiplatform_v1.IndexServiceAsyncClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexService", + "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.aiplatform.v1.IndexService", + "credentialsType": None, + }, + ) + async def create_index( self, request: Optional[Union[index_service.CreateIndexRequest, dict]] = None, @@ -279,7 +311,7 @@ async def create_index( index: Optional[gca_index.Index] = 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"""Creates an Index. @@ -337,8 +369,10 @@ async def sample_create_index(): 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: @@ -412,7 +446,7 @@ async def get_index( 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]]] = (), ) -> index.Index: r"""Gets an Index. @@ -456,8 +490,10 @@ async def sample_get_index(): 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.aiplatform_v1.types.Index: @@ -520,7 +556,7 @@ async def list_indexes( 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.ListIndexesAsyncPager: r"""Lists Indexes in a Location. @@ -566,8 +602,10 @@ async def sample_list_indexes(): 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.aiplatform_v1.services.index_service.pagers.ListIndexesAsyncPager: @@ -643,7 +681,7 @@ async def update_index( 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"""Updates an Index. @@ -702,8 +740,10 @@ async def sample_update_index(): 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: @@ -779,7 +819,7 @@ async def delete_index( 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"""Deletes an Index. An Index can only be deleted when all its [DeployedIndexes][google.cloud.aiplatform.v1.Index.deployed_indexes] @@ -830,8 +870,10 @@ async def sample_delete_index(): 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: @@ -909,7 +951,7 @@ async def upsert_datapoints( *, 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]]] = (), ) -> index_service.UpsertDatapointsResponse: r"""Add/update Datapoints into an Index. @@ -946,8 +988,10 @@ async def sample_upsert_datapoints(): 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.aiplatform_v1.types.UpsertDatapointsResponse: @@ -993,7 +1037,7 @@ async def remove_datapoints( *, 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]]] = (), ) -> index_service.RemoveDatapointsResponse: r"""Remove Datapoints from an Index. @@ -1030,8 +1074,10 @@ async def sample_remove_datapoints(): 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.aiplatform_v1.types.RemoveDatapointsResponse: @@ -1077,7 +1123,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. @@ -1088,8 +1134,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. @@ -1130,7 +1178,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. @@ -1141,8 +1189,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. @@ -1183,7 +1233,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. @@ -1199,8 +1249,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 """ @@ -1237,7 +1289,7 @@ async def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -1252,8 +1304,10 @@ async def cancel_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 """ @@ -1290,7 +1344,7 @@ async def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -1307,8 +1361,10 @@ async def wait_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. @@ -1349,7 +1405,7 @@ async def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -1362,8 +1418,10 @@ async def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -1468,7 +1526,7 @@ async def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -1482,8 +1540,10 @@ async def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -1588,7 +1648,7 @@ async def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -1603,8 +1663,10 @@ async def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -1648,7 +1710,7 @@ async def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -1659,8 +1721,10 @@ async def get_location( 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: ~.location_pb2.Location: Location object. @@ -1701,7 +1765,7 @@ async def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -1712,8 +1776,10 @@ async def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1/services/index_service/client.py b/google/cloud/aiplatform_v1/services/index_service/client.py index ddbb1569b0..f05d36dbcb 100644 --- a/google/cloud/aiplatform_v1/services/index_service/client.py +++ b/google/cloud/aiplatform_v1/services/index_service/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 ( @@ -48,6 +49,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 as gac_operation # type: ignore from google.api_core import operation_async # type: ignore from google.cloud.aiplatform_v1.services.index_service import pagers @@ -628,6 +638,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( @@ -715,6 +729,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.aiplatform_v1.IndexServiceClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexService", + "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.aiplatform.v1.IndexService", + "credentialsType": None, + }, + ) + def create_index( self, request: Optional[Union[index_service.CreateIndexRequest, dict]] = None, @@ -723,7 +760,7 @@ def create_index( index: Optional[gca_index.Index] = 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]]] = (), ) -> gac_operation.Operation: r"""Creates an Index. @@ -781,8 +818,10 @@ def sample_create_index(): 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: @@ -853,7 +892,7 @@ def get_index( 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]]] = (), ) -> index.Index: r"""Gets an Index. @@ -897,8 +936,10 @@ def sample_get_index(): 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.aiplatform_v1.types.Index: @@ -958,7 +999,7 @@ def list_indexes( 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.ListIndexesPager: r"""Lists Indexes in a Location. @@ -1004,8 +1045,10 @@ def sample_list_indexes(): 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.aiplatform_v1.services.index_service.pagers.ListIndexesPager: @@ -1078,7 +1121,7 @@ def update_index( 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]]] = (), ) -> gac_operation.Operation: r"""Updates an Index. @@ -1137,8 +1180,10 @@ def sample_update_index(): 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: @@ -1211,7 +1256,7 @@ def delete_index( 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]]] = (), ) -> gac_operation.Operation: r"""Deletes an Index. An Index can only be deleted when all its [DeployedIndexes][google.cloud.aiplatform.v1.Index.deployed_indexes] @@ -1262,8 +1307,10 @@ def sample_delete_index(): 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: @@ -1338,7 +1385,7 @@ def upsert_datapoints( *, 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]]] = (), ) -> index_service.UpsertDatapointsResponse: r"""Add/update Datapoints into an Index. @@ -1375,8 +1422,10 @@ def sample_upsert_datapoints(): 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.aiplatform_v1.types.UpsertDatapointsResponse: @@ -1420,7 +1469,7 @@ def remove_datapoints( *, 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]]] = (), ) -> index_service.RemoveDatapointsResponse: r"""Remove Datapoints from an Index. @@ -1457,8 +1506,10 @@ def sample_remove_datapoints(): 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.aiplatform_v1.types.RemoveDatapointsResponse: @@ -1515,7 +1566,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. @@ -1526,8 +1577,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. @@ -1568,7 +1621,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. @@ -1579,8 +1632,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. @@ -1621,7 +1676,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. @@ -1637,8 +1692,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 """ @@ -1675,7 +1732,7 @@ def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -1690,8 +1747,10 @@ def cancel_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 """ @@ -1728,7 +1787,7 @@ def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -1745,8 +1804,10 @@ def wait_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. @@ -1787,7 +1848,7 @@ def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -1800,8 +1861,10 @@ def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -1906,7 +1969,7 @@ def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -1920,8 +1983,10 @@ def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -2026,7 +2091,7 @@ def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -2041,8 +2106,10 @@ def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -2084,7 +2151,7 @@ def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -2095,8 +2162,10 @@ def get_location( 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: ~.location_pb2.Location: Location object. @@ -2137,7 +2206,7 @@ def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -2148,8 +2217,10 @@ def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1/services/index_service/pagers.py b/google/cloud/aiplatform_v1/services/index_service/pagers.py index 4cc04cabc3..fcaffeb57b 100644 --- a/google/cloud/aiplatform_v1/services/index_service/pagers.py +++ b/google/cloud/aiplatform_v1/services/index_service/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 = index_service.ListIndexesRequest(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 = index_service.ListIndexesRequest(request) diff --git a/google/cloud/aiplatform_v1/services/index_service/transports/grpc.py b/google/cloud/aiplatform_v1/services/index_service/transports/grpc.py index 9236b07aee..81c04a3dc5 100644 --- a/google/cloud/aiplatform_v1/services/index_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1/services/index_service/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 import warnings from typing import Callable, Dict, Optional, Sequence, Tuple, Union @@ -22,8 +25,11 @@ import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from google.cloud.aiplatform_v1.types import index from google.cloud.aiplatform_v1.types import index_service @@ -33,6 +39,81 @@ from google.longrunning import operations_pb2 # type: ignore from .base import IndexServiceTransport, DEFAULT_CLIENT_INFO +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.aiplatform.v1.IndexService", + "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.aiplatform.v1.IndexService", + "rpcName": client_call_details.method, + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class IndexServiceGrpcTransport(IndexServiceTransport): """gRPC backend transport for IndexService. @@ -188,7 +269,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 @@ -252,7 +338,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 @@ -276,7 +364,7 @@ def create_index( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_index" not in self._stubs: - self._stubs["create_index"] = self.grpc_channel.unary_unary( + self._stubs["create_index"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.IndexService/CreateIndex", request_serializer=index_service.CreateIndexRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -300,7 +388,7 @@ def get_index(self) -> Callable[[index_service.GetIndexRequest], index.Index]: # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_index" not in self._stubs: - self._stubs["get_index"] = self.grpc_channel.unary_unary( + self._stubs["get_index"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.IndexService/GetIndex", request_serializer=index_service.GetIndexRequest.serialize, response_deserializer=index.Index.deserialize, @@ -328,7 +416,7 @@ def list_indexes( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_indexes" not in self._stubs: - self._stubs["list_indexes"] = self.grpc_channel.unary_unary( + self._stubs["list_indexes"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.IndexService/ListIndexes", request_serializer=index_service.ListIndexesRequest.serialize, response_deserializer=index_service.ListIndexesResponse.deserialize, @@ -354,7 +442,7 @@ def update_index( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_index" not in self._stubs: - self._stubs["update_index"] = self.grpc_channel.unary_unary( + self._stubs["update_index"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.IndexService/UpdateIndex", request_serializer=index_service.UpdateIndexRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -382,7 +470,7 @@ def delete_index( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_index" not in self._stubs: - self._stubs["delete_index"] = self.grpc_channel.unary_unary( + self._stubs["delete_index"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.IndexService/DeleteIndex", request_serializer=index_service.DeleteIndexRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -410,7 +498,7 @@ def upsert_datapoints( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "upsert_datapoints" not in self._stubs: - self._stubs["upsert_datapoints"] = self.grpc_channel.unary_unary( + self._stubs["upsert_datapoints"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.IndexService/UpsertDatapoints", request_serializer=index_service.UpsertDatapointsRequest.serialize, response_deserializer=index_service.UpsertDatapointsResponse.deserialize, @@ -438,7 +526,7 @@ def remove_datapoints( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "remove_datapoints" not in self._stubs: - self._stubs["remove_datapoints"] = self.grpc_channel.unary_unary( + self._stubs["remove_datapoints"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.IndexService/RemoveDatapoints", request_serializer=index_service.RemoveDatapointsRequest.serialize, response_deserializer=index_service.RemoveDatapointsResponse.deserialize, @@ -446,7 +534,7 @@ def remove_datapoints( return self._stubs["remove_datapoints"] def close(self): - self.grpc_channel.close() + self._logged_channel.close() @property def delete_operation( @@ -458,7 +546,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, @@ -475,7 +563,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -492,7 +580,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -509,7 +597,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, @@ -528,7 +616,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, @@ -547,7 +635,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -564,7 +652,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -589,7 +677,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -615,7 +703,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -644,7 +732,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1/services/index_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1/services/index_service/transports/grpc_asyncio.py index 17f1cc87b6..701c0d40b2 100644 --- a/google/cloud/aiplatform_v1/services/index_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1/services/index_service/transports/grpc_asyncio.py @@ -14,6 +14,9 @@ # limitations under the License. # import inspect +import json +import pickle +import logging as std_logging import warnings from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union @@ -24,8 +27,11 @@ from google.api_core import operations_v1 from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from grpc.experimental import aio # type: ignore from google.cloud.aiplatform_v1.types import index @@ -37,6 +43,82 @@ from .base import IndexServiceTransport, DEFAULT_CLIENT_INFO from .grpc import IndexServiceGrpcTransport +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.aiplatform.v1.IndexService", + "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.aiplatform.v1.IndexService", + "rpcName": str(client_call_details.method), + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class IndexServiceGrpcAsyncIOTransport(IndexServiceTransport): """gRPC AsyncIO backend transport for IndexService. @@ -235,10 +317,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 @@ -261,7 +346,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. @@ -288,7 +373,7 @@ def create_index( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_index" not in self._stubs: - self._stubs["create_index"] = self.grpc_channel.unary_unary( + self._stubs["create_index"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.IndexService/CreateIndex", request_serializer=index_service.CreateIndexRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -314,7 +399,7 @@ def get_index( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_index" not in self._stubs: - self._stubs["get_index"] = self.grpc_channel.unary_unary( + self._stubs["get_index"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.IndexService/GetIndex", request_serializer=index_service.GetIndexRequest.serialize, response_deserializer=index.Index.deserialize, @@ -342,7 +427,7 @@ def list_indexes( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_indexes" not in self._stubs: - self._stubs["list_indexes"] = self.grpc_channel.unary_unary( + self._stubs["list_indexes"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.IndexService/ListIndexes", request_serializer=index_service.ListIndexesRequest.serialize, response_deserializer=index_service.ListIndexesResponse.deserialize, @@ -370,7 +455,7 @@ def update_index( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_index" not in self._stubs: - self._stubs["update_index"] = self.grpc_channel.unary_unary( + self._stubs["update_index"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.IndexService/UpdateIndex", request_serializer=index_service.UpdateIndexRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -400,7 +485,7 @@ def delete_index( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_index" not in self._stubs: - self._stubs["delete_index"] = self.grpc_channel.unary_unary( + self._stubs["delete_index"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.IndexService/DeleteIndex", request_serializer=index_service.DeleteIndexRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -429,7 +514,7 @@ def upsert_datapoints( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "upsert_datapoints" not in self._stubs: - self._stubs["upsert_datapoints"] = self.grpc_channel.unary_unary( + self._stubs["upsert_datapoints"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.IndexService/UpsertDatapoints", request_serializer=index_service.UpsertDatapointsRequest.serialize, response_deserializer=index_service.UpsertDatapointsResponse.deserialize, @@ -458,7 +543,7 @@ def remove_datapoints( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "remove_datapoints" not in self._stubs: - self._stubs["remove_datapoints"] = self.grpc_channel.unary_unary( + self._stubs["remove_datapoints"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.IndexService/RemoveDatapoints", request_serializer=index_service.RemoveDatapointsRequest.serialize, response_deserializer=index_service.RemoveDatapointsResponse.deserialize, @@ -561,7 +646,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: @@ -577,7 +662,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, @@ -594,7 +679,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -611,7 +696,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -628,7 +713,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, @@ -647,7 +732,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, @@ -666,7 +751,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -683,7 +768,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -708,7 +793,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -734,7 +819,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -763,7 +848,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1/services/index_service/transports/rest.py b/google/cloud/aiplatform_v1/services/index_service/transports/rest.py index 1a03941068..f96b259ec2 100644 --- a/google/cloud/aiplatform_v1/services/index_service/transports/rest.py +++ b/google/cloud/aiplatform_v1/services/index_service/transports/rest.py @@ -13,9 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging +import json # type: ignore from google.auth.transport.requests import AuthorizedSession # type: ignore -import json # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.api_core import exceptions as core_exceptions from google.api_core import retry as retries @@ -48,6 +49,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, @@ -136,8 +145,10 @@ def post_upsert_datapoints(self, response): def pre_create_index( self, request: index_service.CreateIndexRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[index_service.CreateIndexRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + index_service.CreateIndexRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for create_index Override in a subclass to manipulate the request or metadata @@ -159,8 +170,10 @@ def post_create_index( def pre_delete_index( self, request: index_service.DeleteIndexRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[index_service.DeleteIndexRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + index_service.DeleteIndexRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for delete_index Override in a subclass to manipulate the request or metadata @@ -182,8 +195,8 @@ def post_delete_index( def pre_get_index( self, request: index_service.GetIndexRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[index_service.GetIndexRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[index_service.GetIndexRequest, Sequence[Tuple[str, Union[str, bytes]]]]: """Pre-rpc interceptor for get_index Override in a subclass to manipulate the request or metadata @@ -203,8 +216,10 @@ def post_get_index(self, response: index.Index) -> index.Index: def pre_list_indexes( self, request: index_service.ListIndexesRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[index_service.ListIndexesRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + index_service.ListIndexesRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_indexes Override in a subclass to manipulate the request or metadata @@ -226,8 +241,10 @@ def post_list_indexes( def pre_remove_datapoints( self, request: index_service.RemoveDatapointsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[index_service.RemoveDatapointsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + index_service.RemoveDatapointsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for remove_datapoints Override in a subclass to manipulate the request or metadata @@ -249,8 +266,10 @@ def post_remove_datapoints( def pre_update_index( self, request: index_service.UpdateIndexRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[index_service.UpdateIndexRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + index_service.UpdateIndexRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for update_index Override in a subclass to manipulate the request or metadata @@ -272,8 +291,10 @@ def post_update_index( def pre_upsert_datapoints( self, request: index_service.UpsertDatapointsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[index_service.UpsertDatapointsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + index_service.UpsertDatapointsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for upsert_datapoints Override in a subclass to manipulate the request or metadata @@ -295,8 +316,10 @@ def post_upsert_datapoints( def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -318,8 +341,10 @@ def post_get_location( def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -341,8 +366,10 @@ def post_list_locations( def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -362,8 +389,10 @@ def post_get_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -383,8 +412,11 @@ def post_set_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -406,8 +438,10 @@ def post_test_iam_permissions( def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -427,8 +461,10 @@ def post_cancel_operation(self, response: None) -> None: 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 @@ -448,8 +484,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 @@ -471,8 +509,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 @@ -494,8 +534,10 @@ def post_list_operations( def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -2517,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]]] = (), ) -> operations_pb2.Operation: r"""Call the create index method over HTTP. @@ -2528,8 +2570,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: @@ -2542,6 +2586,7 @@ def __call__( http_options = ( _BaseIndexServiceRestTransport._BaseCreateIndex._get_http_options() ) + request, metadata = self._interceptor.pre_create_index(request, metadata) transcoded_request = ( _BaseIndexServiceRestTransport._BaseCreateIndex._get_transcoded_request( @@ -2562,6 +2607,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.aiplatform_v1.IndexServiceClient.CreateIndex", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexService", + "rpcName": "CreateIndex", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = IndexServiceRestTransport._CreateIndex._get_response( self._host, @@ -2581,7 +2653,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_index(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.aiplatform_v1.IndexServiceClient.create_index", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexService", + "rpcName": "CreateIndex", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _DeleteIndex( @@ -2619,7 +2713,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 index method over HTTP. @@ -2630,8 +2724,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: @@ -2644,6 +2740,7 @@ def __call__( http_options = ( _BaseIndexServiceRestTransport._BaseDeleteIndex._get_http_options() ) + request, metadata = self._interceptor.pre_delete_index(request, metadata) transcoded_request = ( _BaseIndexServiceRestTransport._BaseDeleteIndex._get_transcoded_request( @@ -2658,6 +2755,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.aiplatform_v1.IndexServiceClient.DeleteIndex", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexService", + "rpcName": "DeleteIndex", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = IndexServiceRestTransport._DeleteIndex._get_response( self._host, @@ -2676,7 +2800,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_index(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.aiplatform_v1.IndexServiceClient.delete_index", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexService", + "rpcName": "DeleteIndex", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _GetIndex(_BaseIndexServiceRestTransport._BaseGetIndex, IndexServiceRestStub): @@ -2712,7 +2858,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]]] = (), ) -> index.Index: r"""Call the get index method over HTTP. @@ -2723,8 +2869,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: ~.index.Index: @@ -2738,6 +2886,7 @@ def __call__( http_options = ( _BaseIndexServiceRestTransport._BaseGetIndex._get_http_options() ) + request, metadata = self._interceptor.pre_get_index(request, metadata) transcoded_request = ( _BaseIndexServiceRestTransport._BaseGetIndex._get_transcoded_request( @@ -2752,6 +2901,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 = 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.aiplatform_v1.IndexServiceClient.GetIndex", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexService", + "rpcName": "GetIndex", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = IndexServiceRestTransport._GetIndex._get_response( self._host, @@ -2772,7 +2948,29 @@ def __call__( pb_resp = index.Index.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_index(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = index.Index.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.aiplatform_v1.IndexServiceClient.get_index", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexService", + "rpcName": "GetIndex", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListIndexes( @@ -2810,7 +3008,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]]] = (), ) -> index_service.ListIndexesResponse: r"""Call the list indexes method over HTTP. @@ -2821,8 +3019,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: ~.index_service.ListIndexesResponse: @@ -2834,6 +3034,7 @@ def __call__( http_options = ( _BaseIndexServiceRestTransport._BaseListIndexes._get_http_options() ) + request, metadata = self._interceptor.pre_list_indexes(request, metadata) transcoded_request = ( _BaseIndexServiceRestTransport._BaseListIndexes._get_transcoded_request( @@ -2848,6 +3049,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 = 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.aiplatform_v1.IndexServiceClient.ListIndexes", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexService", + "rpcName": "ListIndexes", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = IndexServiceRestTransport._ListIndexes._get_response( self._host, @@ -2868,7 +3096,31 @@ def __call__( pb_resp = index_service.ListIndexesResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_indexes(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = index_service.ListIndexesResponse.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.aiplatform_v1.IndexServiceClient.list_indexes", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexService", + "rpcName": "ListIndexes", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _RemoveDatapoints( @@ -2907,7 +3159,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]]] = (), ) -> index_service.RemoveDatapointsResponse: r"""Call the remove datapoints method over HTTP. @@ -2918,8 +3170,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: ~.index_service.RemoveDatapointsResponse: @@ -2931,6 +3185,7 @@ def __call__( http_options = ( _BaseIndexServiceRestTransport._BaseRemoveDatapoints._get_http_options() ) + request, metadata = self._interceptor.pre_remove_datapoints( request, metadata ) @@ -2947,6 +3202,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.aiplatform_v1.IndexServiceClient.RemoveDatapoints", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexService", + "rpcName": "RemoveDatapoints", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = IndexServiceRestTransport._RemoveDatapoints._get_response( self._host, @@ -2968,7 +3250,31 @@ def __call__( pb_resp = index_service.RemoveDatapointsResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_remove_datapoints(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = index_service.RemoveDatapointsResponse.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.aiplatform_v1.IndexServiceClient.remove_datapoints", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexService", + "rpcName": "RemoveDatapoints", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _UpdateIndex( @@ -3007,7 +3313,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 index method over HTTP. @@ -3018,8 +3324,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: @@ -3032,6 +3340,7 @@ def __call__( http_options = ( _BaseIndexServiceRestTransport._BaseUpdateIndex._get_http_options() ) + request, metadata = self._interceptor.pre_update_index(request, metadata) transcoded_request = ( _BaseIndexServiceRestTransport._BaseUpdateIndex._get_transcoded_request( @@ -3052,6 +3361,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.aiplatform_v1.IndexServiceClient.UpdateIndex", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexService", + "rpcName": "UpdateIndex", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = IndexServiceRestTransport._UpdateIndex._get_response( self._host, @@ -3071,7 +3407,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_index(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.aiplatform_v1.IndexServiceClient.update_index", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexService", + "rpcName": "UpdateIndex", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _UpsertDatapoints( @@ -3110,7 +3468,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]]] = (), ) -> index_service.UpsertDatapointsResponse: r"""Call the upsert datapoints method over HTTP. @@ -3121,8 +3479,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: ~.index_service.UpsertDatapointsResponse: @@ -3134,6 +3494,7 @@ def __call__( http_options = ( _BaseIndexServiceRestTransport._BaseUpsertDatapoints._get_http_options() ) + request, metadata = self._interceptor.pre_upsert_datapoints( request, metadata ) @@ -3150,6 +3511,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.aiplatform_v1.IndexServiceClient.UpsertDatapoints", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexService", + "rpcName": "UpsertDatapoints", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = IndexServiceRestTransport._UpsertDatapoints._get_response( self._host, @@ -3171,7 +3559,31 @@ def __call__( pb_resp = index_service.UpsertDatapointsResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_upsert_datapoints(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = index_service.UpsertDatapointsResponse.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.aiplatform_v1.IndexServiceClient.upsert_datapoints", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexService", + "rpcName": "UpsertDatapoints", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp @property @@ -3273,7 +3685,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]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -3284,8 +3696,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: locations_pb2.Location: Response from GetLocation method. @@ -3294,6 +3708,7 @@ def __call__( http_options = ( _BaseIndexServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = self._interceptor.pre_get_location(request, metadata) transcoded_request = ( _BaseIndexServiceRestTransport._BaseGetLocation._get_transcoded_request( @@ -3308,6 +3723,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.aiplatform_v1.IndexServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = IndexServiceRestTransport._GetLocation._get_response( self._host, @@ -3327,6 +3769,27 @@ def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_location(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.aiplatform_v1.IndexServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3368,7 +3831,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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -3379,8 +3842,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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -3389,6 +3854,7 @@ def __call__( http_options = ( _BaseIndexServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = self._interceptor.pre_list_locations(request, metadata) transcoded_request = _BaseIndexServiceRestTransport._BaseListLocations._get_transcoded_request( http_options, request @@ -3399,6 +3865,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.aiplatform_v1.IndexServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = IndexServiceRestTransport._ListLocations._get_response( self._host, @@ -3418,6 +3911,27 @@ def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_list_locations(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.aiplatform_v1.IndexServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3459,7 +3973,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]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -3470,8 +3984,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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -3480,6 +3996,7 @@ def __call__( http_options = ( _BaseIndexServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_get_iam_policy(request, metadata) transcoded_request = _BaseIndexServiceRestTransport._BaseGetIamPolicy._get_transcoded_request( http_options, request @@ -3492,6 +4009,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.aiplatform_v1.IndexServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = IndexServiceRestTransport._GetIamPolicy._get_response( self._host, @@ -3511,6 +4055,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_iam_policy(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.aiplatform_v1.IndexServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3553,7 +4118,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]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -3564,8 +4129,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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -3574,6 +4141,7 @@ def __call__( http_options = ( _BaseIndexServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_set_iam_policy(request, metadata) transcoded_request = _BaseIndexServiceRestTransport._BaseSetIamPolicy._get_transcoded_request( http_options, request @@ -3592,6 +4160,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.aiplatform_v1.IndexServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = IndexServiceRestTransport._SetIamPolicy._get_response( self._host, @@ -3612,6 +4207,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_set_iam_policy(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.aiplatform_v1.IndexServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3653,7 +4269,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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -3664,8 +4280,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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -3674,6 +4292,7 @@ def __call__( http_options = ( _BaseIndexServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -3686,6 +4305,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.aiplatform_v1.IndexServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = IndexServiceRestTransport._TestIamPermissions._get_response( self._host, @@ -3705,6 +4351,27 @@ def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_test_iam_permissions(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.aiplatform_v1.IndexServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3746,7 +4413,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 cancel operation method over HTTP. @@ -3757,13 +4424,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 = ( _BaseIndexServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = self._interceptor.pre_cancel_operation( request, metadata ) @@ -3776,6 +4446,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.aiplatform_v1.IndexServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = IndexServiceRestTransport._CancelOperation._get_response( self._host, @@ -3832,7 +4529,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. @@ -3843,13 +4540,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 = ( _BaseIndexServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = self._interceptor.pre_delete_operation( request, metadata ) @@ -3862,6 +4562,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.aiplatform_v1.IndexServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = IndexServiceRestTransport._DeleteOperation._get_response( self._host, @@ -3918,7 +4645,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. @@ -3929,8 +4656,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. @@ -3939,6 +4668,7 @@ def __call__( http_options = ( _BaseIndexServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = self._interceptor.pre_get_operation(request, metadata) transcoded_request = _BaseIndexServiceRestTransport._BaseGetOperation._get_transcoded_request( http_options, request @@ -3951,6 +4681,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.aiplatform_v1.IndexServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = IndexServiceRestTransport._GetOperation._get_response( self._host, @@ -3970,6 +4727,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.aiplatform_v1.IndexServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4011,7 +4789,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. @@ -4022,8 +4800,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. @@ -4032,6 +4812,7 @@ def __call__( http_options = ( _BaseIndexServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = self._interceptor.pre_list_operations(request, metadata) transcoded_request = _BaseIndexServiceRestTransport._BaseListOperations._get_transcoded_request( http_options, request @@ -4042,6 +4823,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.aiplatform_v1.IndexServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = IndexServiceRestTransport._ListOperations._get_response( self._host, @@ -4061,6 +4869,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.aiplatform_v1.IndexServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4102,7 +4931,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 wait operation method over HTTP. @@ -4113,8 +4942,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 WaitOperation method. @@ -4123,6 +4954,7 @@ def __call__( http_options = ( _BaseIndexServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = self._interceptor.pre_wait_operation(request, metadata) transcoded_request = _BaseIndexServiceRestTransport._BaseWaitOperation._get_transcoded_request( http_options, request @@ -4133,6 +4965,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.aiplatform_v1.IndexServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = IndexServiceRestTransport._WaitOperation._get_response( self._host, @@ -4152,6 +5011,27 @@ def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = self._interceptor.post_wait_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.aiplatform_v1.IndexServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1/services/index_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1/services/index_service/transports/rest_asyncio.py index d52b6832a1..0802cb3570 100644 --- a/google/cloud/aiplatform_v1/services/index_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1/services/index_service/transports/rest_asyncio.py @@ -59,6 +59,18 @@ from .base import DEFAULT_CLIENT_INFO as BASE_DEFAULT_CLIENT_INFO + +import logging + +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__) + try: OptionalRetry = Union[retries.AsyncRetry, gapic_v1.method._MethodDefault, None] except AttributeError: # pragma: NO COVER @@ -151,8 +163,10 @@ async def post_upsert_datapoints(self, response): async def pre_create_index( self, request: index_service.CreateIndexRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[index_service.CreateIndexRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + index_service.CreateIndexRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for create_index Override in a subclass to manipulate the request or metadata @@ -174,8 +188,10 @@ async def post_create_index( async def pre_delete_index( self, request: index_service.DeleteIndexRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[index_service.DeleteIndexRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + index_service.DeleteIndexRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for delete_index Override in a subclass to manipulate the request or metadata @@ -197,8 +213,8 @@ async def post_delete_index( async def pre_get_index( self, request: index_service.GetIndexRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[index_service.GetIndexRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[index_service.GetIndexRequest, Sequence[Tuple[str, Union[str, bytes]]]]: """Pre-rpc interceptor for get_index Override in a subclass to manipulate the request or metadata @@ -218,8 +234,10 @@ async def post_get_index(self, response: index.Index) -> index.Index: async def pre_list_indexes( self, request: index_service.ListIndexesRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[index_service.ListIndexesRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + index_service.ListIndexesRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_indexes Override in a subclass to manipulate the request or metadata @@ -241,8 +259,10 @@ async def post_list_indexes( async def pre_remove_datapoints( self, request: index_service.RemoveDatapointsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[index_service.RemoveDatapointsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + index_service.RemoveDatapointsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for remove_datapoints Override in a subclass to manipulate the request or metadata @@ -264,8 +284,10 @@ async def post_remove_datapoints( async def pre_update_index( self, request: index_service.UpdateIndexRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[index_service.UpdateIndexRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + index_service.UpdateIndexRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for update_index Override in a subclass to manipulate the request or metadata @@ -287,8 +309,10 @@ async def post_update_index( async def pre_upsert_datapoints( self, request: index_service.UpsertDatapointsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[index_service.UpsertDatapointsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + index_service.UpsertDatapointsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for upsert_datapoints Override in a subclass to manipulate the request or metadata @@ -310,8 +334,10 @@ async def post_upsert_datapoints( async def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -333,8 +359,10 @@ async def post_get_location( async def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -356,8 +384,10 @@ async def post_list_locations( async def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -379,8 +409,10 @@ async def post_get_iam_policy( async def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -402,8 +434,11 @@ async def post_set_iam_policy( async def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -425,8 +460,10 @@ async def post_test_iam_permissions( async def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -446,8 +483,10 @@ async def post_cancel_operation(self, response: None) -> None: async 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 @@ -467,8 +506,10 @@ async def post_delete_operation(self, response: None) -> None: async 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 @@ -490,8 +531,10 @@ async def post_get_operation( async 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 @@ -513,8 +556,10 @@ async def post_list_operations( async def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -730,7 +775,7 @@ async 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 index method over HTTP. @@ -741,8 +786,10 @@ async def __call__( 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: @@ -755,6 +802,7 @@ async def __call__( http_options = ( _BaseIndexServiceRestTransport._BaseCreateIndex._get_http_options() ) + request, metadata = await self._interceptor.pre_create_index( request, metadata ) @@ -777,6 +825,33 @@ async 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.aiplatform_v1.IndexServiceClient.CreateIndex", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexService", + "rpcName": "CreateIndex", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncIndexServiceRestTransport._CreateIndex._get_response( self._host, @@ -805,6 +880,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_create_index(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.IndexServiceAsyncClient.create_index", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexService", + "rpcName": "CreateIndex", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _DeleteIndex( @@ -842,7 +939,7 @@ async 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 index method over HTTP. @@ -853,8 +950,10 @@ async def __call__( 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: @@ -867,6 +966,7 @@ async def __call__( http_options = ( _BaseIndexServiceRestTransport._BaseDeleteIndex._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_index( request, metadata ) @@ -883,6 +983,33 @@ async 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.aiplatform_v1.IndexServiceClient.DeleteIndex", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexService", + "rpcName": "DeleteIndex", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncIndexServiceRestTransport._DeleteIndex._get_response( self._host, @@ -910,6 +1037,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_delete_index(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.IndexServiceAsyncClient.delete_index", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexService", + "rpcName": "DeleteIndex", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _GetIndex( @@ -947,7 +1096,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> index.Index: r"""Call the get index method over HTTP. @@ -958,8 +1107,10 @@ async def __call__( 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: ~.index.Index: @@ -973,6 +1124,7 @@ async def __call__( http_options = ( _BaseIndexServiceRestTransport._BaseGetIndex._get_http_options() ) + request, metadata = await self._interceptor.pre_get_index(request, metadata) transcoded_request = ( _BaseIndexServiceRestTransport._BaseGetIndex._get_transcoded_request( @@ -987,6 +1139,33 @@ async 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 = 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.aiplatform_v1.IndexServiceClient.GetIndex", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexService", + "rpcName": "GetIndex", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncIndexServiceRestTransport._GetIndex._get_response( self._host, @@ -1014,6 +1193,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_get_index(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = index.Index.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.IndexServiceAsyncClient.get_index", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexService", + "rpcName": "GetIndex", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ListIndexes( @@ -1051,7 +1252,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> index_service.ListIndexesResponse: r"""Call the list indexes method over HTTP. @@ -1062,8 +1263,10 @@ async def __call__( 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: ~.index_service.ListIndexesResponse: @@ -1075,6 +1278,7 @@ async def __call__( http_options = ( _BaseIndexServiceRestTransport._BaseListIndexes._get_http_options() ) + request, metadata = await self._interceptor.pre_list_indexes( request, metadata ) @@ -1091,6 +1295,33 @@ async 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 = 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.aiplatform_v1.IndexServiceClient.ListIndexes", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexService", + "rpcName": "ListIndexes", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncIndexServiceRestTransport._ListIndexes._get_response( self._host, @@ -1118,6 +1349,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_list_indexes(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = index_service.ListIndexesResponse.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.IndexServiceAsyncClient.list_indexes", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexService", + "rpcName": "ListIndexes", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _RemoveDatapoints( @@ -1156,7 +1411,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> index_service.RemoveDatapointsResponse: r"""Call the remove datapoints method over HTTP. @@ -1167,8 +1422,10 @@ async def __call__( 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: ~.index_service.RemoveDatapointsResponse: @@ -1180,6 +1437,7 @@ async def __call__( http_options = ( _BaseIndexServiceRestTransport._BaseRemoveDatapoints._get_http_options() ) + request, metadata = await self._interceptor.pre_remove_datapoints( request, metadata ) @@ -1196,6 +1454,33 @@ async 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.aiplatform_v1.IndexServiceClient.RemoveDatapoints", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexService", + "rpcName": "RemoveDatapoints", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncIndexServiceRestTransport._RemoveDatapoints._get_response( @@ -1226,6 +1511,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_remove_datapoints(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = index_service.RemoveDatapointsResponse.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.IndexServiceAsyncClient.remove_datapoints", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexService", + "rpcName": "RemoveDatapoints", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _UpdateIndex( @@ -1264,7 +1573,7 @@ async 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 index method over HTTP. @@ -1275,8 +1584,10 @@ async def __call__( 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: @@ -1289,6 +1600,7 @@ async def __call__( http_options = ( _BaseIndexServiceRestTransport._BaseUpdateIndex._get_http_options() ) + request, metadata = await self._interceptor.pre_update_index( request, metadata ) @@ -1311,6 +1623,33 @@ async 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.aiplatform_v1.IndexServiceClient.UpdateIndex", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexService", + "rpcName": "UpdateIndex", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncIndexServiceRestTransport._UpdateIndex._get_response( self._host, @@ -1339,6 +1678,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_update_index(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.IndexServiceAsyncClient.update_index", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexService", + "rpcName": "UpdateIndex", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _UpsertDatapoints( @@ -1377,7 +1738,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> index_service.UpsertDatapointsResponse: r"""Call the upsert datapoints method over HTTP. @@ -1388,8 +1749,10 @@ async def __call__( 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: ~.index_service.UpsertDatapointsResponse: @@ -1401,6 +1764,7 @@ async def __call__( http_options = ( _BaseIndexServiceRestTransport._BaseUpsertDatapoints._get_http_options() ) + request, metadata = await self._interceptor.pre_upsert_datapoints( request, metadata ) @@ -1417,6 +1781,33 @@ async 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.aiplatform_v1.IndexServiceClient.UpsertDatapoints", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexService", + "rpcName": "UpsertDatapoints", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncIndexServiceRestTransport._UpsertDatapoints._get_response( @@ -1447,6 +1838,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_upsert_datapoints(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = index_service.UpsertDatapointsResponse.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.IndexServiceAsyncClient.upsert_datapoints", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexService", + "rpcName": "UpsertDatapoints", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp @property @@ -3411,7 +3826,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -3422,8 +3837,10 @@ async def __call__( 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: locations_pb2.Location: Response from GetLocation method. @@ -3432,6 +3849,7 @@ async def __call__( http_options = ( _BaseIndexServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_location( request, metadata ) @@ -3448,6 +3866,33 @@ async 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.aiplatform_v1.IndexServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncIndexServiceRestTransport._GetLocation._get_response( self._host, @@ -3473,6 +3918,27 @@ async def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_location(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.aiplatform_v1.IndexServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3514,7 +3980,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -3525,8 +3991,10 @@ async def __call__( 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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -3535,6 +4003,7 @@ async def __call__( http_options = ( _BaseIndexServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_locations( request, metadata ) @@ -3547,6 +4016,33 @@ async 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.aiplatform_v1.IndexServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncIndexServiceRestTransport._ListLocations._get_response( @@ -3574,6 +4070,27 @@ async def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_list_locations(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.aiplatform_v1.IndexServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3615,7 +4132,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -3626,8 +4143,10 @@ async def __call__( 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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -3636,6 +4155,7 @@ async def __call__( http_options = ( _BaseIndexServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_get_iam_policy( request, metadata ) @@ -3650,6 +4170,33 @@ async 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.aiplatform_v1.IndexServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncIndexServiceRestTransport._GetIamPolicy._get_response( self._host, @@ -3675,6 +4222,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_iam_policy(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.aiplatform_v1.IndexServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3717,7 +4285,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -3728,8 +4296,10 @@ async def __call__( 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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -3738,6 +4308,7 @@ async def __call__( http_options = ( _BaseIndexServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_set_iam_policy( request, metadata ) @@ -3758,6 +4329,33 @@ async 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.aiplatform_v1.IndexServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncIndexServiceRestTransport._SetIamPolicy._get_response( self._host, @@ -3784,6 +4382,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_set_iam_policy(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.aiplatform_v1.IndexServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3826,7 +4445,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -3837,8 +4456,10 @@ async def __call__( 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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -3847,6 +4468,7 @@ async def __call__( http_options = ( _BaseIndexServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = await self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -3859,6 +4481,33 @@ async 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.aiplatform_v1.IndexServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncIndexServiceRestTransport._TestIamPermissions._get_response( @@ -3886,6 +4535,27 @@ async def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_test_iam_permissions(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.aiplatform_v1.IndexServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3927,7 +4597,7 @@ async 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 cancel operation method over HTTP. @@ -3938,13 +4608,16 @@ async def __call__( 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`. """ http_options = ( _BaseIndexServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_cancel_operation( request, metadata ) @@ -3957,6 +4630,33 @@ async 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.aiplatform_v1.IndexServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncIndexServiceRestTransport._CancelOperation._get_response( @@ -4021,7 +4721,7 @@ async 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. @@ -4032,13 +4732,16 @@ async def __call__( 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`. """ http_options = ( _BaseIndexServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_operation( request, metadata ) @@ -4051,6 +4754,33 @@ async 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.aiplatform_v1.IndexServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncIndexServiceRestTransport._DeleteOperation._get_response( @@ -4115,7 +4845,7 @@ async 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. @@ -4126,8 +4856,10 @@ async def __call__( 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: Response from GetOperation method. @@ -4136,6 +4868,7 @@ async def __call__( http_options = ( _BaseIndexServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_operation( request, metadata ) @@ -4150,6 +4883,33 @@ async 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.aiplatform_v1.IndexServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncIndexServiceRestTransport._GetOperation._get_response( self._host, @@ -4175,6 +4935,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1.IndexServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4216,7 +4997,7 @@ async 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. @@ -4227,8 +5008,10 @@ async def __call__( 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 from ListOperations method. @@ -4237,6 +5020,7 @@ async def __call__( http_options = ( _BaseIndexServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_operations( request, metadata ) @@ -4249,6 +5033,33 @@ async 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.aiplatform_v1.IndexServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncIndexServiceRestTransport._ListOperations._get_response( @@ -4276,6 +5087,27 @@ async def __call__( resp = operations_pb2.ListOperationsResponse() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1.IndexServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4317,7 +5149,7 @@ async 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 wait operation method over HTTP. @@ -4328,8 +5160,10 @@ async def __call__( 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: Response from WaitOperation method. @@ -4338,6 +5172,7 @@ async def __call__( http_options = ( _BaseIndexServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_wait_operation( request, metadata ) @@ -4350,6 +5185,33 @@ async 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.aiplatform_v1.IndexServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncIndexServiceRestTransport._WaitOperation._get_response( @@ -4377,6 +5239,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_wait_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.aiplatform_v1.IndexServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.IndexService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1/services/job_service/async_client.py b/google/cloud/aiplatform_v1/services/job_service/async_client.py index e366f67ac1..3fd9161648 100644 --- a/google/cloud/aiplatform_v1/services/job_service/async_client.py +++ b/google/cloud/aiplatform_v1/services/job_service/async_client.py @@ -13,6 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging as std_logging from collections import OrderedDict import re from typing import ( @@ -91,6 +92,15 @@ from .transports.grpc_asyncio import JobServiceGrpcAsyncIOTransport from .client import JobServiceClient +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 JobServiceAsyncClient: """A service for creating and managing Vertex AI's jobs.""" @@ -340,6 +350,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.aiplatform_v1.JobServiceAsyncClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "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.aiplatform.v1.JobService", + "credentialsType": None, + }, + ) + async def create_custom_job( self, request: Optional[Union[job_service.CreateCustomJobRequest, dict]] = None, @@ -348,7 +380,7 @@ async def create_custom_job( custom_job: Optional[gca_custom_job.CustomJob] = 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]]] = (), ) -> gca_custom_job.CustomJob: r"""Creates a CustomJob. A created CustomJob right away will be attempted to be run. @@ -404,8 +436,10 @@ async def sample_create_custom_job(): 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.aiplatform_v1.types.CustomJob: @@ -474,7 +508,7 @@ async def get_custom_job( 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]]] = (), ) -> custom_job.CustomJob: r"""Gets a CustomJob. @@ -518,8 +552,10 @@ async def sample_get_custom_job(): 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.aiplatform_v1.types.CustomJob: @@ -586,7 +622,7 @@ async def list_custom_jobs( 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.ListCustomJobsAsyncPager: r"""Lists CustomJobs in a Location. @@ -632,8 +668,10 @@ async def sample_list_custom_jobs(): 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.aiplatform_v1.services.job_service.pagers.ListCustomJobsAsyncPager: @@ -708,7 +746,7 @@ async def delete_custom_job( 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"""Deletes a CustomJob. @@ -757,8 +795,10 @@ async def sample_delete_custom_job(): 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: @@ -837,7 +877,7 @@ async def cancel_custom_job( 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"""Cancels a CustomJob. Starts asynchronous cancellation on the CustomJob. The server makes a best effort to cancel the job, but @@ -890,8 +930,10 @@ async def sample_cancel_custom_job(): 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 @@ -944,7 +986,7 @@ async def create_data_labeling_job( data_labeling_job: Optional[gca_data_labeling_job.DataLabelingJob] = 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]]] = (), ) -> gca_data_labeling_job.DataLabelingJob: r"""Creates a DataLabelingJob. @@ -1004,8 +1046,10 @@ async def sample_create_data_labeling_job(): 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.aiplatform_v1.types.DataLabelingJob: @@ -1069,7 +1113,7 @@ async def get_data_labeling_job( 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]]] = (), ) -> data_labeling_job.DataLabelingJob: r"""Gets a DataLabelingJob. @@ -1113,8 +1157,10 @@ async def sample_get_data_labeling_job(): 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.aiplatform_v1.types.DataLabelingJob: @@ -1176,7 +1222,7 @@ async def list_data_labeling_jobs( 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.ListDataLabelingJobsAsyncPager: r"""Lists DataLabelingJobs in a Location. @@ -1221,8 +1267,10 @@ async def sample_list_data_labeling_jobs(): 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.aiplatform_v1.services.job_service.pagers.ListDataLabelingJobsAsyncPager: @@ -1297,7 +1345,7 @@ async def delete_data_labeling_job( 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"""Deletes a DataLabelingJob. @@ -1346,8 +1394,10 @@ async def sample_delete_data_labeling_job(): 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: @@ -1426,7 +1476,7 @@ async def cancel_data_labeling_job( 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"""Cancels a DataLabelingJob. Success of cancellation is not guaranteed. @@ -1468,8 +1518,10 @@ async def sample_cancel_data_labeling_job(): 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 @@ -1526,7 +1578,7 @@ async def create_hyperparameter_tuning_job( ] = 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]]] = (), ) -> gca_hyperparameter_tuning_job.HyperparameterTuningJob: r"""Creates a HyperparameterTuningJob @@ -1590,8 +1642,10 @@ async def sample_create_hyperparameter_tuning_job(): 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.aiplatform_v1.types.HyperparameterTuningJob: @@ -1658,7 +1712,7 @@ async def get_hyperparameter_tuning_job( 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]]] = (), ) -> hyperparameter_tuning_job.HyperparameterTuningJob: r"""Gets a HyperparameterTuningJob @@ -1703,8 +1757,10 @@ async def sample_get_hyperparameter_tuning_job(): 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.aiplatform_v1.types.HyperparameterTuningJob: @@ -1769,7 +1825,7 @@ async def list_hyperparameter_tuning_jobs( 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.ListHyperparameterTuningJobsAsyncPager: r"""Lists HyperparameterTuningJobs in a Location. @@ -1815,8 +1871,10 @@ async def sample_list_hyperparameter_tuning_jobs(): 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.aiplatform_v1.services.job_service.pagers.ListHyperparameterTuningJobsAsyncPager: @@ -1893,7 +1951,7 @@ async def delete_hyperparameter_tuning_job( 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"""Deletes a HyperparameterTuningJob. @@ -1942,8 +2000,10 @@ async def sample_delete_hyperparameter_tuning_job(): 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: @@ -2024,7 +2084,7 @@ async def cancel_hyperparameter_tuning_job( 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"""Cancels a HyperparameterTuningJob. Starts asynchronous cancellation on the HyperparameterTuningJob. The server makes a @@ -2079,8 +2139,10 @@ async def sample_cancel_hyperparameter_tuning_job(): 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_nas_job( nas_job: Optional[gca_nas_job.NasJob] = 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]]] = (), ) -> gca_nas_job.NasJob: r"""Creates a NasJob @@ -2190,8 +2252,10 @@ async def sample_create_nas_job(): 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.aiplatform_v1.types.NasJob: @@ -2254,7 +2318,7 @@ async def get_nas_job( 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]]] = (), ) -> nas_job.NasJob: r"""Gets a NasJob @@ -2298,8 +2362,10 @@ async def sample_get_nas_job(): 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.aiplatform_v1.types.NasJob: @@ -2360,7 +2426,7 @@ async def list_nas_jobs( 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.ListNasJobsAsyncPager: r"""Lists NasJobs in a Location. @@ -2406,8 +2472,10 @@ async def sample_list_nas_jobs(): 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.aiplatform_v1.services.job_service.pagers.ListNasJobsAsyncPager: @@ -2482,7 +2550,7 @@ async def delete_nas_job( 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"""Deletes a NasJob. @@ -2531,8 +2599,10 @@ async def sample_delete_nas_job(): 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: @@ -2611,7 +2681,7 @@ async def cancel_nas_job( 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"""Cancels a NasJob. Starts asynchronous cancellation on the NasJob. The server makes a best effort to cancel the job, but @@ -2664,8 +2734,10 @@ async def sample_cancel_nas_job(): 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 @@ -2717,7 +2789,7 @@ async def get_nas_trial_detail( 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]]] = (), ) -> nas_job.NasTrialDetail: r"""Gets a NasTrialDetail. @@ -2762,8 +2834,10 @@ async def sample_get_nas_trial_detail(): 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.aiplatform_v1.types.NasTrialDetail: @@ -2826,7 +2900,7 @@ async def list_nas_trial_details( 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.ListNasTrialDetailsAsyncPager: r"""List top NasTrialDetails of a NasJob. @@ -2871,8 +2945,10 @@ async def sample_list_nas_trial_details(): 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.aiplatform_v1.services.job_service.pagers.ListNasTrialDetailsAsyncPager: @@ -2952,7 +3028,7 @@ async def create_batch_prediction_job( ] = 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]]] = (), ) -> gca_batch_prediction_job.BatchPredictionJob: r"""Creates a BatchPredictionJob. A BatchPredictionJob once created will right away be attempted to start. @@ -3013,8 +3089,10 @@ async def sample_create_batch_prediction_job(): 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.aiplatform_v1.types.BatchPredictionJob: @@ -3082,7 +3160,7 @@ async def get_batch_prediction_job( 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]]] = (), ) -> batch_prediction_job.BatchPredictionJob: r"""Gets a BatchPredictionJob @@ -3127,8 +3205,10 @@ async def sample_get_batch_prediction_job(): 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.aiplatform_v1.types.BatchPredictionJob: @@ -3196,7 +3276,7 @@ async def list_batch_prediction_jobs( 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.ListBatchPredictionJobsAsyncPager: r"""Lists BatchPredictionJobs in a Location. @@ -3242,8 +3322,10 @@ async def sample_list_batch_prediction_jobs(): 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.aiplatform_v1.services.job_service.pagers.ListBatchPredictionJobsAsyncPager: @@ -3320,7 +3402,7 @@ async def delete_batch_prediction_job( 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"""Deletes a BatchPredictionJob. Can only be called on jobs that already finished. @@ -3370,8 +3452,10 @@ async def sample_delete_batch_prediction_job(): 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: @@ -3452,7 +3536,7 @@ async def cancel_batch_prediction_job( 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"""Cancels a BatchPredictionJob. @@ -3505,8 +3589,10 @@ async def sample_cancel_batch_prediction_job(): 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 @@ -3563,7 +3649,7 @@ async def create_model_deployment_monitoring_job( ] = 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]]] = (), ) -> gca_model_deployment_monitoring_job.ModelDeploymentMonitoringJob: r"""Creates a ModelDeploymentMonitoringJob. It will run periodically on a configured interval. @@ -3621,8 +3707,10 @@ async def sample_create_model_deployment_monitoring_job(): 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.aiplatform_v1.types.ModelDeploymentMonitoringJob: @@ -3695,7 +3783,7 @@ async def search_model_deployment_monitoring_stats_anomalies( deployed_model_id: 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.SearchModelDeploymentMonitoringStatsAnomaliesAsyncPager: r"""Searches Model Monitoring Statistics generated within a given time window. @@ -3750,8 +3838,10 @@ async def sample_search_model_deployment_monitoring_stats_anomalies(): 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.aiplatform_v1.services.job_service.pagers.SearchModelDeploymentMonitoringStatsAnomaliesAsyncPager: @@ -3841,7 +3931,7 @@ async def get_model_deployment_monitoring_job( 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]]] = (), ) -> model_deployment_monitoring_job.ModelDeploymentMonitoringJob: r"""Gets a ModelDeploymentMonitoringJob. @@ -3886,8 +3976,10 @@ async def sample_get_model_deployment_monitoring_job(): 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.aiplatform_v1.types.ModelDeploymentMonitoringJob: @@ -3953,7 +4045,7 @@ async def list_model_deployment_monitoring_jobs( 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.ListModelDeploymentMonitoringJobsAsyncPager: r"""Lists ModelDeploymentMonitoringJobs in a Location. @@ -3999,8 +4091,10 @@ async def sample_list_model_deployment_monitoring_jobs(): 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.aiplatform_v1.services.job_service.pagers.ListModelDeploymentMonitoringJobsAsyncPager: @@ -4082,7 +4176,7 @@ async def update_model_deployment_monitoring_job( 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"""Updates a ModelDeploymentMonitoringJob. @@ -4168,8 +4262,10 @@ async def sample_update_model_deployment_monitoring_job(): 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: @@ -4254,7 +4350,7 @@ async def delete_model_deployment_monitoring_job( 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"""Deletes a ModelDeploymentMonitoringJob. @@ -4303,8 +4399,10 @@ async def sample_delete_model_deployment_monitoring_job(): 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: @@ -4387,7 +4485,7 @@ async def pause_model_deployment_monitoring_job( 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"""Pauses a ModelDeploymentMonitoringJob. If the job is running, the server makes a best effort to cancel the job. Will mark @@ -4432,8 +4530,10 @@ async def sample_pause_model_deployment_monitoring_job(): 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 @@ -4489,7 +4589,7 @@ async def resume_model_deployment_monitoring_job( 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"""Resumes a paused ModelDeploymentMonitoringJob. It will start to run from next scheduled time. A deleted @@ -4533,8 +4633,10 @@ async def sample_resume_model_deployment_monitoring_job(): 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 @@ -4587,7 +4689,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. @@ -4598,8 +4700,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. @@ -4640,7 +4744,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. @@ -4651,8 +4755,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. @@ -4693,7 +4799,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. @@ -4709,8 +4815,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 """ @@ -4747,7 +4855,7 @@ async def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -4762,8 +4870,10 @@ async def cancel_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 """ @@ -4800,7 +4910,7 @@ async def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -4817,8 +4927,10 @@ async def wait_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. @@ -4859,7 +4971,7 @@ async def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -4872,8 +4984,10 @@ async def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -4978,7 +5092,7 @@ async def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -4992,8 +5106,10 @@ async def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -5098,7 +5214,7 @@ async def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -5113,8 +5229,10 @@ async def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -5158,7 +5276,7 @@ async def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -5169,8 +5287,10 @@ async def get_location( 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: ~.location_pb2.Location: Location object. @@ -5211,7 +5331,7 @@ async def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -5222,8 +5342,10 @@ async def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1/services/job_service/client.py b/google/cloud/aiplatform_v1/services/job_service/client.py index 462f4c877f..92c13b8bd2 100644 --- a/google/cloud/aiplatform_v1/services/job_service/client.py +++ b/google/cloud/aiplatform_v1/services/job_service/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 ( @@ -48,6 +49,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 as gac_operation # type: ignore from google.api_core import operation_async # type: ignore from google.cloud.aiplatform_v1.services.job_service import pagers @@ -986,6 +996,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( @@ -1073,6 +1087,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.aiplatform_v1.JobServiceClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "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.aiplatform.v1.JobService", + "credentialsType": None, + }, + ) + def create_custom_job( self, request: Optional[Union[job_service.CreateCustomJobRequest, dict]] = None, @@ -1081,7 +1118,7 @@ def create_custom_job( custom_job: Optional[gca_custom_job.CustomJob] = 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]]] = (), ) -> gca_custom_job.CustomJob: r"""Creates a CustomJob. A created CustomJob right away will be attempted to be run. @@ -1137,8 +1174,10 @@ def sample_create_custom_job(): 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.aiplatform_v1.types.CustomJob: @@ -1204,7 +1243,7 @@ def get_custom_job( 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]]] = (), ) -> custom_job.CustomJob: r"""Gets a CustomJob. @@ -1248,8 +1287,10 @@ def sample_get_custom_job(): 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.aiplatform_v1.types.CustomJob: @@ -1313,7 +1354,7 @@ def list_custom_jobs( 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.ListCustomJobsPager: r"""Lists CustomJobs in a Location. @@ -1359,8 +1400,10 @@ def sample_list_custom_jobs(): 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.aiplatform_v1.services.job_service.pagers.ListCustomJobsPager: @@ -1432,7 +1475,7 @@ def delete_custom_job( 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]]] = (), ) -> gac_operation.Operation: r"""Deletes a CustomJob. @@ -1481,8 +1524,10 @@ def sample_delete_custom_job(): 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: @@ -1558,7 +1603,7 @@ def cancel_custom_job( 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"""Cancels a CustomJob. Starts asynchronous cancellation on the CustomJob. The server makes a best effort to cancel the job, but @@ -1611,8 +1656,10 @@ def sample_cancel_custom_job(): 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 @@ -1662,7 +1709,7 @@ def create_data_labeling_job( data_labeling_job: Optional[gca_data_labeling_job.DataLabelingJob] = 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]]] = (), ) -> gca_data_labeling_job.DataLabelingJob: r"""Creates a DataLabelingJob. @@ -1722,8 +1769,10 @@ def sample_create_data_labeling_job(): 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.aiplatform_v1.types.DataLabelingJob: @@ -1784,7 +1833,7 @@ def get_data_labeling_job( 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]]] = (), ) -> data_labeling_job.DataLabelingJob: r"""Gets a DataLabelingJob. @@ -1828,8 +1877,10 @@ def sample_get_data_labeling_job(): 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.aiplatform_v1.types.DataLabelingJob: @@ -1888,7 +1939,7 @@ def list_data_labeling_jobs( 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.ListDataLabelingJobsPager: r"""Lists DataLabelingJobs in a Location. @@ -1933,8 +1984,10 @@ def sample_list_data_labeling_jobs(): 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.aiplatform_v1.services.job_service.pagers.ListDataLabelingJobsPager: @@ -2006,7 +2059,7 @@ def delete_data_labeling_job( 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]]] = (), ) -> gac_operation.Operation: r"""Deletes a DataLabelingJob. @@ -2055,8 +2108,10 @@ def sample_delete_data_labeling_job(): 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: @@ -2132,7 +2187,7 @@ def cancel_data_labeling_job( 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"""Cancels a DataLabelingJob. Success of cancellation is not guaranteed. @@ -2174,8 +2229,10 @@ def sample_cancel_data_labeling_job(): 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 @@ -2229,7 +2286,7 @@ def create_hyperparameter_tuning_job( ] = 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]]] = (), ) -> gca_hyperparameter_tuning_job.HyperparameterTuningJob: r"""Creates a HyperparameterTuningJob @@ -2293,8 +2350,10 @@ def sample_create_hyperparameter_tuning_job(): 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.aiplatform_v1.types.HyperparameterTuningJob: @@ -2360,7 +2419,7 @@ def get_hyperparameter_tuning_job( 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]]] = (), ) -> hyperparameter_tuning_job.HyperparameterTuningJob: r"""Gets a HyperparameterTuningJob @@ -2405,8 +2464,10 @@ def sample_get_hyperparameter_tuning_job(): 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.aiplatform_v1.types.HyperparameterTuningJob: @@ -2470,7 +2531,7 @@ def list_hyperparameter_tuning_jobs( 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.ListHyperparameterTuningJobsPager: r"""Lists HyperparameterTuningJobs in a Location. @@ -2516,8 +2577,10 @@ def sample_list_hyperparameter_tuning_jobs(): 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.aiplatform_v1.services.job_service.pagers.ListHyperparameterTuningJobsPager: @@ -2593,7 +2656,7 @@ def delete_hyperparameter_tuning_job( 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]]] = (), ) -> gac_operation.Operation: r"""Deletes a HyperparameterTuningJob. @@ -2642,8 +2705,10 @@ def sample_delete_hyperparameter_tuning_job(): 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: @@ -2723,7 +2788,7 @@ def cancel_hyperparameter_tuning_job( 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"""Cancels a HyperparameterTuningJob. Starts asynchronous cancellation on the HyperparameterTuningJob. The server makes a @@ -2778,8 +2843,10 @@ def sample_cancel_hyperparameter_tuning_job(): 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 @@ -2831,7 +2898,7 @@ def create_nas_job( nas_job: Optional[gca_nas_job.NasJob] = 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]]] = (), ) -> gca_nas_job.NasJob: r"""Creates a NasJob @@ -2888,8 +2955,10 @@ def sample_create_nas_job(): 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.aiplatform_v1.types.NasJob: @@ -2949,7 +3018,7 @@ def get_nas_job( 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]]] = (), ) -> nas_job.NasJob: r"""Gets a NasJob @@ -2993,8 +3062,10 @@ def sample_get_nas_job(): 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.aiplatform_v1.types.NasJob: @@ -3052,7 +3123,7 @@ def list_nas_jobs( 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.ListNasJobsPager: r"""Lists NasJobs in a Location. @@ -3098,8 +3169,10 @@ def sample_list_nas_jobs(): 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.aiplatform_v1.services.job_service.pagers.ListNasJobsPager: @@ -3171,7 +3244,7 @@ def delete_nas_job( 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]]] = (), ) -> gac_operation.Operation: r"""Deletes a NasJob. @@ -3220,8 +3293,10 @@ def sample_delete_nas_job(): 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: @@ -3297,7 +3372,7 @@ def cancel_nas_job( 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"""Cancels a NasJob. Starts asynchronous cancellation on the NasJob. The server makes a best effort to cancel the job, but @@ -3350,8 +3425,10 @@ def sample_cancel_nas_job(): 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 @@ -3400,7 +3477,7 @@ def get_nas_trial_detail( 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]]] = (), ) -> nas_job.NasTrialDetail: r"""Gets a NasTrialDetail. @@ -3445,8 +3522,10 @@ def sample_get_nas_trial_detail(): 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.aiplatform_v1.types.NasTrialDetail: @@ -3506,7 +3585,7 @@ def list_nas_trial_details( 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.ListNasTrialDetailsPager: r"""List top NasTrialDetails of a NasJob. @@ -3551,8 +3630,10 @@ def sample_list_nas_trial_details(): 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.aiplatform_v1.services.job_service.pagers.ListNasTrialDetailsPager: @@ -3629,7 +3710,7 @@ def create_batch_prediction_job( ] = 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]]] = (), ) -> gca_batch_prediction_job.BatchPredictionJob: r"""Creates a BatchPredictionJob. A BatchPredictionJob once created will right away be attempted to start. @@ -3690,8 +3771,10 @@ def sample_create_batch_prediction_job(): 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.aiplatform_v1.types.BatchPredictionJob: @@ -3758,7 +3841,7 @@ def get_batch_prediction_job( 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]]] = (), ) -> batch_prediction_job.BatchPredictionJob: r"""Gets a BatchPredictionJob @@ -3803,8 +3886,10 @@ def sample_get_batch_prediction_job(): 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.aiplatform_v1.types.BatchPredictionJob: @@ -3869,7 +3954,7 @@ def list_batch_prediction_jobs( 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.ListBatchPredictionJobsPager: r"""Lists BatchPredictionJobs in a Location. @@ -3915,8 +4000,10 @@ def sample_list_batch_prediction_jobs(): 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.aiplatform_v1.services.job_service.pagers.ListBatchPredictionJobsPager: @@ -3992,7 +4079,7 @@ def delete_batch_prediction_job( 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]]] = (), ) -> gac_operation.Operation: r"""Deletes a BatchPredictionJob. Can only be called on jobs that already finished. @@ -4042,8 +4129,10 @@ def sample_delete_batch_prediction_job(): 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: @@ -4123,7 +4212,7 @@ def cancel_batch_prediction_job( 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"""Cancels a BatchPredictionJob. @@ -4176,8 +4265,10 @@ def sample_cancel_batch_prediction_job(): 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 @@ -4233,7 +4324,7 @@ def create_model_deployment_monitoring_job( ] = 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]]] = (), ) -> gca_model_deployment_monitoring_job.ModelDeploymentMonitoringJob: r"""Creates a ModelDeploymentMonitoringJob. It will run periodically on a configured interval. @@ -4291,8 +4382,10 @@ def sample_create_model_deployment_monitoring_job(): 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.aiplatform_v1.types.ModelDeploymentMonitoringJob: @@ -4366,7 +4459,7 @@ def search_model_deployment_monitoring_stats_anomalies( deployed_model_id: 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.SearchModelDeploymentMonitoringStatsAnomaliesPager: r"""Searches Model Monitoring Statistics generated within a given time window. @@ -4421,8 +4514,10 @@ def sample_search_model_deployment_monitoring_stats_anomalies(): 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.aiplatform_v1.services.job_service.pagers.SearchModelDeploymentMonitoringStatsAnomaliesPager: @@ -4513,7 +4608,7 @@ def get_model_deployment_monitoring_job( 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]]] = (), ) -> model_deployment_monitoring_job.ModelDeploymentMonitoringJob: r"""Gets a ModelDeploymentMonitoringJob. @@ -4558,8 +4653,10 @@ def sample_get_model_deployment_monitoring_job(): 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.aiplatform_v1.types.ModelDeploymentMonitoringJob: @@ -4624,7 +4721,7 @@ def list_model_deployment_monitoring_jobs( 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.ListModelDeploymentMonitoringJobsPager: r"""Lists ModelDeploymentMonitoringJobs in a Location. @@ -4670,8 +4767,10 @@ def sample_list_model_deployment_monitoring_jobs(): 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.aiplatform_v1.services.job_service.pagers.ListModelDeploymentMonitoringJobsPager: @@ -4752,7 +4851,7 @@ def update_model_deployment_monitoring_job( 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]]] = (), ) -> gac_operation.Operation: r"""Updates a ModelDeploymentMonitoringJob. @@ -4838,8 +4937,10 @@ def sample_update_model_deployment_monitoring_job(): 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: @@ -4925,7 +5026,7 @@ def delete_model_deployment_monitoring_job( 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]]] = (), ) -> gac_operation.Operation: r"""Deletes a ModelDeploymentMonitoringJob. @@ -4974,8 +5075,10 @@ def sample_delete_model_deployment_monitoring_job(): 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: @@ -5057,7 +5160,7 @@ def pause_model_deployment_monitoring_job( 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"""Pauses a ModelDeploymentMonitoringJob. If the job is running, the server makes a best effort to cancel the job. Will mark @@ -5102,8 +5205,10 @@ def sample_pause_model_deployment_monitoring_job(): 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 @@ -5158,7 +5263,7 @@ def resume_model_deployment_monitoring_job( 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"""Resumes a paused ModelDeploymentMonitoringJob. It will start to run from next scheduled time. A deleted @@ -5202,8 +5307,10 @@ def sample_resume_model_deployment_monitoring_job(): 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 @@ -5268,7 +5375,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. @@ -5279,8 +5386,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. @@ -5321,7 +5430,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. @@ -5332,8 +5441,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. @@ -5374,7 +5485,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. @@ -5390,8 +5501,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 """ @@ -5428,7 +5541,7 @@ def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -5443,8 +5556,10 @@ def cancel_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 """ @@ -5481,7 +5596,7 @@ def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -5498,8 +5613,10 @@ def wait_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. @@ -5540,7 +5657,7 @@ def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -5553,8 +5670,10 @@ def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -5659,7 +5778,7 @@ def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -5673,8 +5792,10 @@ def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -5779,7 +5900,7 @@ def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -5794,8 +5915,10 @@ def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -5837,7 +5960,7 @@ def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -5848,8 +5971,10 @@ def get_location( 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: ~.location_pb2.Location: Location object. @@ -5890,7 +6015,7 @@ def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -5901,8 +6026,10 @@ def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1/services/job_service/pagers.py b/google/cloud/aiplatform_v1/services/job_service/pagers.py index d02340c10a..cf28266666 100644 --- a/google/cloud/aiplatform_v1/services/job_service/pagers.py +++ b/google/cloud/aiplatform_v1/services/job_service/pagers.py @@ -75,7 +75,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. @@ -89,8 +89,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 = job_service.ListCustomJobsRequest(request) @@ -149,7 +151,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. @@ -163,8 +165,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 = job_service.ListCustomJobsRequest(request) @@ -227,7 +231,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. @@ -241,8 +245,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 = job_service.ListDataLabelingJobsRequest(request) @@ -301,7 +307,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. @@ -315,8 +321,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 = job_service.ListDataLabelingJobsRequest(request) @@ -379,7 +387,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. @@ -393,8 +401,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 = job_service.ListHyperparameterTuningJobsRequest(request) @@ -455,7 +465,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. @@ -469,8 +479,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 = job_service.ListHyperparameterTuningJobsRequest(request) @@ -537,7 +549,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. @@ -551,8 +563,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 = job_service.ListNasJobsRequest(request) @@ -611,7 +625,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. @@ -625,8 +639,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 = job_service.ListNasJobsRequest(request) @@ -689,7 +705,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. @@ -703,8 +719,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 = job_service.ListNasTrialDetailsRequest(request) @@ -763,7 +781,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. @@ -777,8 +795,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 = job_service.ListNasTrialDetailsRequest(request) @@ -841,7 +861,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. @@ -855,8 +875,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 = job_service.ListBatchPredictionJobsRequest(request) @@ -915,7 +937,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. @@ -929,8 +951,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 = job_service.ListBatchPredictionJobsRequest(request) @@ -995,7 +1019,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. @@ -1009,8 +1033,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 = ( @@ -1080,7 +1106,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. @@ -1094,8 +1120,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 = ( @@ -1168,7 +1196,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. @@ -1182,8 +1210,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 = job_service.ListModelDeploymentMonitoringJobsRequest(request) @@ -1246,7 +1276,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. @@ -1260,8 +1290,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 = job_service.ListModelDeploymentMonitoringJobsRequest(request) diff --git a/google/cloud/aiplatform_v1/services/job_service/transports/grpc.py b/google/cloud/aiplatform_v1/services/job_service/transports/grpc.py index f04e7816a8..6575c13a51 100644 --- a/google/cloud/aiplatform_v1/services/job_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1/services/job_service/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 import warnings from typing import Callable, Dict, Optional, Sequence, Tuple, Union @@ -22,8 +25,11 @@ import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from google.cloud.aiplatform_v1.types import batch_prediction_job from google.cloud.aiplatform_v1.types import ( @@ -51,6 +57,81 @@ from google.protobuf import empty_pb2 # type: ignore from .base import JobServiceTransport, DEFAULT_CLIENT_INFO +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.aiplatform.v1.JobService", + "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.aiplatform.v1.JobService", + "rpcName": client_call_details.method, + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class JobServiceGrpcTransport(JobServiceTransport): """gRPC backend transport for JobService. @@ -205,7 +286,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 @@ -269,7 +355,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 @@ -294,7 +382,7 @@ def create_custom_job( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_custom_job" not in self._stubs: - self._stubs["create_custom_job"] = self.grpc_channel.unary_unary( + self._stubs["create_custom_job"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.JobService/CreateCustomJob", request_serializer=job_service.CreateCustomJobRequest.serialize, response_deserializer=gca_custom_job.CustomJob.deserialize, @@ -320,7 +408,7 @@ def get_custom_job( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_custom_job" not in self._stubs: - self._stubs["get_custom_job"] = self.grpc_channel.unary_unary( + self._stubs["get_custom_job"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.JobService/GetCustomJob", request_serializer=job_service.GetCustomJobRequest.serialize, response_deserializer=custom_job.CustomJob.deserialize, @@ -348,7 +436,7 @@ def list_custom_jobs( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_custom_jobs" not in self._stubs: - self._stubs["list_custom_jobs"] = self.grpc_channel.unary_unary( + self._stubs["list_custom_jobs"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.JobService/ListCustomJobs", request_serializer=job_service.ListCustomJobsRequest.serialize, response_deserializer=job_service.ListCustomJobsResponse.deserialize, @@ -374,7 +462,7 @@ def delete_custom_job( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_custom_job" not in self._stubs: - self._stubs["delete_custom_job"] = self.grpc_channel.unary_unary( + self._stubs["delete_custom_job"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.JobService/DeleteCustomJob", request_serializer=job_service.DeleteCustomJobRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -412,7 +500,7 @@ def cancel_custom_job( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_custom_job" not in self._stubs: - self._stubs["cancel_custom_job"] = self.grpc_channel.unary_unary( + self._stubs["cancel_custom_job"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.JobService/CancelCustomJob", request_serializer=job_service.CancelCustomJobRequest.serialize, response_deserializer=empty_pb2.Empty.FromString, @@ -441,7 +529,7 @@ def create_data_labeling_job( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_data_labeling_job" not in self._stubs: - self._stubs["create_data_labeling_job"] = self.grpc_channel.unary_unary( + self._stubs["create_data_labeling_job"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.JobService/CreateDataLabelingJob", request_serializer=job_service.CreateDataLabelingJobRequest.serialize, response_deserializer=gca_data_labeling_job.DataLabelingJob.deserialize, @@ -469,7 +557,7 @@ def get_data_labeling_job( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_data_labeling_job" not in self._stubs: - self._stubs["get_data_labeling_job"] = self.grpc_channel.unary_unary( + self._stubs["get_data_labeling_job"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.JobService/GetDataLabelingJob", request_serializer=job_service.GetDataLabelingJobRequest.serialize, response_deserializer=data_labeling_job.DataLabelingJob.deserialize, @@ -498,7 +586,7 @@ def list_data_labeling_jobs( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_data_labeling_jobs" not in self._stubs: - self._stubs["list_data_labeling_jobs"] = self.grpc_channel.unary_unary( + self._stubs["list_data_labeling_jobs"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.JobService/ListDataLabelingJobs", request_serializer=job_service.ListDataLabelingJobsRequest.serialize, response_deserializer=job_service.ListDataLabelingJobsResponse.deserialize, @@ -524,7 +612,7 @@ def delete_data_labeling_job( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_data_labeling_job" not in self._stubs: - self._stubs["delete_data_labeling_job"] = self.grpc_channel.unary_unary( + self._stubs["delete_data_labeling_job"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.JobService/DeleteDataLabelingJob", request_serializer=job_service.DeleteDataLabelingJobRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -551,7 +639,7 @@ def cancel_data_labeling_job( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_data_labeling_job" not in self._stubs: - self._stubs["cancel_data_labeling_job"] = self.grpc_channel.unary_unary( + self._stubs["cancel_data_labeling_job"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.JobService/CancelDataLabelingJob", request_serializer=job_service.CancelDataLabelingJobRequest.serialize, response_deserializer=empty_pb2.Empty.FromString, @@ -583,7 +671,7 @@ def create_hyperparameter_tuning_job( if "create_hyperparameter_tuning_job" not in self._stubs: self._stubs[ "create_hyperparameter_tuning_job" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.JobService/CreateHyperparameterTuningJob", request_serializer=job_service.CreateHyperparameterTuningJobRequest.serialize, response_deserializer=gca_hyperparameter_tuning_job.HyperparameterTuningJob.deserialize, @@ -614,7 +702,7 @@ def get_hyperparameter_tuning_job( if "get_hyperparameter_tuning_job" not in self._stubs: self._stubs[ "get_hyperparameter_tuning_job" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.JobService/GetHyperparameterTuningJob", request_serializer=job_service.GetHyperparameterTuningJobRequest.serialize, response_deserializer=hyperparameter_tuning_job.HyperparameterTuningJob.deserialize, @@ -646,7 +734,7 @@ def list_hyperparameter_tuning_jobs( if "list_hyperparameter_tuning_jobs" not in self._stubs: self._stubs[ "list_hyperparameter_tuning_jobs" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.JobService/ListHyperparameterTuningJobs", request_serializer=job_service.ListHyperparameterTuningJobsRequest.serialize, response_deserializer=job_service.ListHyperparameterTuningJobsResponse.deserialize, @@ -677,7 +765,7 @@ def delete_hyperparameter_tuning_job( if "delete_hyperparameter_tuning_job" not in self._stubs: self._stubs[ "delete_hyperparameter_tuning_job" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.JobService/DeleteHyperparameterTuningJob", request_serializer=job_service.DeleteHyperparameterTuningJobRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -719,7 +807,7 @@ def cancel_hyperparameter_tuning_job( if "cancel_hyperparameter_tuning_job" not in self._stubs: self._stubs[ "cancel_hyperparameter_tuning_job" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.JobService/CancelHyperparameterTuningJob", request_serializer=job_service.CancelHyperparameterTuningJobRequest.serialize, response_deserializer=empty_pb2.Empty.FromString, @@ -745,7 +833,7 @@ def create_nas_job( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_nas_job" not in self._stubs: - self._stubs["create_nas_job"] = self.grpc_channel.unary_unary( + self._stubs["create_nas_job"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.JobService/CreateNasJob", request_serializer=job_service.CreateNasJobRequest.serialize, response_deserializer=gca_nas_job.NasJob.deserialize, @@ -769,7 +857,7 @@ def get_nas_job(self) -> Callable[[job_service.GetNasJobRequest], nas_job.NasJob # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_nas_job" not in self._stubs: - self._stubs["get_nas_job"] = self.grpc_channel.unary_unary( + self._stubs["get_nas_job"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.JobService/GetNasJob", request_serializer=job_service.GetNasJobRequest.serialize, response_deserializer=nas_job.NasJob.deserialize, @@ -795,7 +883,7 @@ def list_nas_jobs( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_nas_jobs" not in self._stubs: - self._stubs["list_nas_jobs"] = self.grpc_channel.unary_unary( + self._stubs["list_nas_jobs"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.JobService/ListNasJobs", request_serializer=job_service.ListNasJobsRequest.serialize, response_deserializer=job_service.ListNasJobsResponse.deserialize, @@ -821,7 +909,7 @@ def delete_nas_job( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_nas_job" not in self._stubs: - self._stubs["delete_nas_job"] = self.grpc_channel.unary_unary( + self._stubs["delete_nas_job"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.JobService/DeleteNasJob", request_serializer=job_service.DeleteNasJobRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -859,7 +947,7 @@ def cancel_nas_job( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_nas_job" not in self._stubs: - self._stubs["cancel_nas_job"] = self.grpc_channel.unary_unary( + self._stubs["cancel_nas_job"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.JobService/CancelNasJob", request_serializer=job_service.CancelNasJobRequest.serialize, response_deserializer=empty_pb2.Empty.FromString, @@ -885,7 +973,7 @@ def get_nas_trial_detail( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_nas_trial_detail" not in self._stubs: - self._stubs["get_nas_trial_detail"] = self.grpc_channel.unary_unary( + self._stubs["get_nas_trial_detail"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.JobService/GetNasTrialDetail", request_serializer=job_service.GetNasTrialDetailRequest.serialize, response_deserializer=nas_job.NasTrialDetail.deserialize, @@ -914,7 +1002,7 @@ def list_nas_trial_details( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_nas_trial_details" not in self._stubs: - self._stubs["list_nas_trial_details"] = self.grpc_channel.unary_unary( + self._stubs["list_nas_trial_details"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.JobService/ListNasTrialDetails", request_serializer=job_service.ListNasTrialDetailsRequest.serialize, response_deserializer=job_service.ListNasTrialDetailsResponse.deserialize, @@ -944,7 +1032,9 @@ def create_batch_prediction_job( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_batch_prediction_job" not in self._stubs: - self._stubs["create_batch_prediction_job"] = self.grpc_channel.unary_unary( + self._stubs[ + "create_batch_prediction_job" + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.JobService/CreateBatchPredictionJob", request_serializer=job_service.CreateBatchPredictionJobRequest.serialize, response_deserializer=gca_batch_prediction_job.BatchPredictionJob.deserialize, @@ -973,7 +1063,7 @@ def get_batch_prediction_job( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_batch_prediction_job" not in self._stubs: - self._stubs["get_batch_prediction_job"] = self.grpc_channel.unary_unary( + self._stubs["get_batch_prediction_job"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.JobService/GetBatchPredictionJob", request_serializer=job_service.GetBatchPredictionJobRequest.serialize, response_deserializer=batch_prediction_job.BatchPredictionJob.deserialize, @@ -1002,7 +1092,9 @@ def list_batch_prediction_jobs( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_batch_prediction_jobs" not in self._stubs: - self._stubs["list_batch_prediction_jobs"] = self.grpc_channel.unary_unary( + self._stubs[ + "list_batch_prediction_jobs" + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.JobService/ListBatchPredictionJobs", request_serializer=job_service.ListBatchPredictionJobsRequest.serialize, response_deserializer=job_service.ListBatchPredictionJobsResponse.deserialize, @@ -1031,7 +1123,9 @@ def delete_batch_prediction_job( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_batch_prediction_job" not in self._stubs: - self._stubs["delete_batch_prediction_job"] = self.grpc_channel.unary_unary( + self._stubs[ + "delete_batch_prediction_job" + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.JobService/DeleteBatchPredictionJob", request_serializer=job_service.DeleteBatchPredictionJobRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -1068,7 +1162,9 @@ def cancel_batch_prediction_job( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_batch_prediction_job" not in self._stubs: - self._stubs["cancel_batch_prediction_job"] = self.grpc_channel.unary_unary( + self._stubs[ + "cancel_batch_prediction_job" + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.JobService/CancelBatchPredictionJob", request_serializer=job_service.CancelBatchPredictionJobRequest.serialize, response_deserializer=empty_pb2.Empty.FromString, @@ -1101,7 +1197,7 @@ def create_model_deployment_monitoring_job( if "create_model_deployment_monitoring_job" not in self._stubs: self._stubs[ "create_model_deployment_monitoring_job" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.JobService/CreateModelDeploymentMonitoringJob", request_serializer=job_service.CreateModelDeploymentMonitoringJobRequest.serialize, response_deserializer=gca_model_deployment_monitoring_job.ModelDeploymentMonitoringJob.deserialize, @@ -1134,7 +1230,7 @@ def search_model_deployment_monitoring_stats_anomalies( if "search_model_deployment_monitoring_stats_anomalies" not in self._stubs: self._stubs[ "search_model_deployment_monitoring_stats_anomalies" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.JobService/SearchModelDeploymentMonitoringStatsAnomalies", request_serializer=job_service.SearchModelDeploymentMonitoringStatsAnomaliesRequest.serialize, response_deserializer=job_service.SearchModelDeploymentMonitoringStatsAnomaliesResponse.deserialize, @@ -1166,7 +1262,7 @@ def get_model_deployment_monitoring_job( if "get_model_deployment_monitoring_job" not in self._stubs: self._stubs[ "get_model_deployment_monitoring_job" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.JobService/GetModelDeploymentMonitoringJob", request_serializer=job_service.GetModelDeploymentMonitoringJobRequest.serialize, response_deserializer=model_deployment_monitoring_job.ModelDeploymentMonitoringJob.deserialize, @@ -1198,7 +1294,7 @@ def list_model_deployment_monitoring_jobs( if "list_model_deployment_monitoring_jobs" not in self._stubs: self._stubs[ "list_model_deployment_monitoring_jobs" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.JobService/ListModelDeploymentMonitoringJobs", request_serializer=job_service.ListModelDeploymentMonitoringJobsRequest.serialize, response_deserializer=job_service.ListModelDeploymentMonitoringJobsResponse.deserialize, @@ -1230,7 +1326,7 @@ def update_model_deployment_monitoring_job( if "update_model_deployment_monitoring_job" not in self._stubs: self._stubs[ "update_model_deployment_monitoring_job" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.JobService/UpdateModelDeploymentMonitoringJob", request_serializer=job_service.UpdateModelDeploymentMonitoringJobRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -1262,7 +1358,7 @@ def delete_model_deployment_monitoring_job( if "delete_model_deployment_monitoring_job" not in self._stubs: self._stubs[ "delete_model_deployment_monitoring_job" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.JobService/DeleteModelDeploymentMonitoringJob", request_serializer=job_service.DeleteModelDeploymentMonitoringJobRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -1296,7 +1392,7 @@ def pause_model_deployment_monitoring_job( if "pause_model_deployment_monitoring_job" not in self._stubs: self._stubs[ "pause_model_deployment_monitoring_job" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.JobService/PauseModelDeploymentMonitoringJob", request_serializer=job_service.PauseModelDeploymentMonitoringJobRequest.serialize, response_deserializer=empty_pb2.Empty.FromString, @@ -1329,7 +1425,7 @@ def resume_model_deployment_monitoring_job( if "resume_model_deployment_monitoring_job" not in self._stubs: self._stubs[ "resume_model_deployment_monitoring_job" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.JobService/ResumeModelDeploymentMonitoringJob", request_serializer=job_service.ResumeModelDeploymentMonitoringJobRequest.serialize, response_deserializer=empty_pb2.Empty.FromString, @@ -1337,7 +1433,7 @@ def resume_model_deployment_monitoring_job( return self._stubs["resume_model_deployment_monitoring_job"] def close(self): - self.grpc_channel.close() + self._logged_channel.close() @property def delete_operation( @@ -1349,7 +1445,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, @@ -1366,7 +1462,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -1383,7 +1479,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -1400,7 +1496,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, @@ -1419,7 +1515,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, @@ -1438,7 +1534,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -1455,7 +1551,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -1480,7 +1576,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -1506,7 +1602,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -1535,7 +1631,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1/services/job_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1/services/job_service/transports/grpc_asyncio.py index 79277892a3..ff8edbe28d 100644 --- a/google/cloud/aiplatform_v1/services/job_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1/services/job_service/transports/grpc_asyncio.py @@ -14,6 +14,9 @@ # limitations under the License. # import inspect +import json +import pickle +import logging as std_logging import warnings from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union @@ -24,8 +27,11 @@ from google.api_core import operations_v1 from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from grpc.experimental import aio # type: ignore from google.cloud.aiplatform_v1.types import batch_prediction_job @@ -55,6 +61,82 @@ from .base import JobServiceTransport, DEFAULT_CLIENT_INFO from .grpc import JobServiceGrpcTransport +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.aiplatform.v1.JobService", + "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.aiplatform.v1.JobService", + "rpcName": str(client_call_details.method), + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class JobServiceGrpcAsyncIOTransport(JobServiceTransport): """gRPC AsyncIO backend transport for JobService. @@ -252,10 +334,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 @@ -278,7 +363,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. @@ -306,7 +391,7 @@ def create_custom_job( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_custom_job" not in self._stubs: - self._stubs["create_custom_job"] = self.grpc_channel.unary_unary( + self._stubs["create_custom_job"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.JobService/CreateCustomJob", request_serializer=job_service.CreateCustomJobRequest.serialize, response_deserializer=gca_custom_job.CustomJob.deserialize, @@ -332,7 +417,7 @@ def get_custom_job( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_custom_job" not in self._stubs: - self._stubs["get_custom_job"] = self.grpc_channel.unary_unary( + self._stubs["get_custom_job"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.JobService/GetCustomJob", request_serializer=job_service.GetCustomJobRequest.serialize, response_deserializer=custom_job.CustomJob.deserialize, @@ -361,7 +446,7 @@ def list_custom_jobs( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_custom_jobs" not in self._stubs: - self._stubs["list_custom_jobs"] = self.grpc_channel.unary_unary( + self._stubs["list_custom_jobs"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.JobService/ListCustomJobs", request_serializer=job_service.ListCustomJobsRequest.serialize, response_deserializer=job_service.ListCustomJobsResponse.deserialize, @@ -389,7 +474,7 @@ def delete_custom_job( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_custom_job" not in self._stubs: - self._stubs["delete_custom_job"] = self.grpc_channel.unary_unary( + self._stubs["delete_custom_job"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.JobService/DeleteCustomJob", request_serializer=job_service.DeleteCustomJobRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -427,7 +512,7 @@ def cancel_custom_job( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_custom_job" not in self._stubs: - self._stubs["cancel_custom_job"] = self.grpc_channel.unary_unary( + self._stubs["cancel_custom_job"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.JobService/CancelCustomJob", request_serializer=job_service.CancelCustomJobRequest.serialize, response_deserializer=empty_pb2.Empty.FromString, @@ -456,7 +541,7 @@ def create_data_labeling_job( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_data_labeling_job" not in self._stubs: - self._stubs["create_data_labeling_job"] = self.grpc_channel.unary_unary( + self._stubs["create_data_labeling_job"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.JobService/CreateDataLabelingJob", request_serializer=job_service.CreateDataLabelingJobRequest.serialize, response_deserializer=gca_data_labeling_job.DataLabelingJob.deserialize, @@ -485,7 +570,7 @@ def get_data_labeling_job( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_data_labeling_job" not in self._stubs: - self._stubs["get_data_labeling_job"] = self.grpc_channel.unary_unary( + self._stubs["get_data_labeling_job"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.JobService/GetDataLabelingJob", request_serializer=job_service.GetDataLabelingJobRequest.serialize, response_deserializer=data_labeling_job.DataLabelingJob.deserialize, @@ -514,7 +599,7 @@ def list_data_labeling_jobs( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_data_labeling_jobs" not in self._stubs: - self._stubs["list_data_labeling_jobs"] = self.grpc_channel.unary_unary( + self._stubs["list_data_labeling_jobs"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.JobService/ListDataLabelingJobs", request_serializer=job_service.ListDataLabelingJobsRequest.serialize, response_deserializer=job_service.ListDataLabelingJobsResponse.deserialize, @@ -542,7 +627,7 @@ def delete_data_labeling_job( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_data_labeling_job" not in self._stubs: - self._stubs["delete_data_labeling_job"] = self.grpc_channel.unary_unary( + self._stubs["delete_data_labeling_job"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.JobService/DeleteDataLabelingJob", request_serializer=job_service.DeleteDataLabelingJobRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -571,7 +656,7 @@ def cancel_data_labeling_job( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_data_labeling_job" not in self._stubs: - self._stubs["cancel_data_labeling_job"] = self.grpc_channel.unary_unary( + self._stubs["cancel_data_labeling_job"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.JobService/CancelDataLabelingJob", request_serializer=job_service.CancelDataLabelingJobRequest.serialize, response_deserializer=empty_pb2.Empty.FromString, @@ -603,7 +688,7 @@ def create_hyperparameter_tuning_job( if "create_hyperparameter_tuning_job" not in self._stubs: self._stubs[ "create_hyperparameter_tuning_job" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.JobService/CreateHyperparameterTuningJob", request_serializer=job_service.CreateHyperparameterTuningJobRequest.serialize, response_deserializer=gca_hyperparameter_tuning_job.HyperparameterTuningJob.deserialize, @@ -634,7 +719,7 @@ def get_hyperparameter_tuning_job( if "get_hyperparameter_tuning_job" not in self._stubs: self._stubs[ "get_hyperparameter_tuning_job" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.JobService/GetHyperparameterTuningJob", request_serializer=job_service.GetHyperparameterTuningJobRequest.serialize, response_deserializer=hyperparameter_tuning_job.HyperparameterTuningJob.deserialize, @@ -666,7 +751,7 @@ def list_hyperparameter_tuning_jobs( if "list_hyperparameter_tuning_jobs" not in self._stubs: self._stubs[ "list_hyperparameter_tuning_jobs" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.JobService/ListHyperparameterTuningJobs", request_serializer=job_service.ListHyperparameterTuningJobsRequest.serialize, response_deserializer=job_service.ListHyperparameterTuningJobsResponse.deserialize, @@ -698,7 +783,7 @@ def delete_hyperparameter_tuning_job( if "delete_hyperparameter_tuning_job" not in self._stubs: self._stubs[ "delete_hyperparameter_tuning_job" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.JobService/DeleteHyperparameterTuningJob", request_serializer=job_service.DeleteHyperparameterTuningJobRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -742,7 +827,7 @@ def cancel_hyperparameter_tuning_job( if "cancel_hyperparameter_tuning_job" not in self._stubs: self._stubs[ "cancel_hyperparameter_tuning_job" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.JobService/CancelHyperparameterTuningJob", request_serializer=job_service.CancelHyperparameterTuningJobRequest.serialize, response_deserializer=empty_pb2.Empty.FromString, @@ -768,7 +853,7 @@ def create_nas_job( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_nas_job" not in self._stubs: - self._stubs["create_nas_job"] = self.grpc_channel.unary_unary( + self._stubs["create_nas_job"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.JobService/CreateNasJob", request_serializer=job_service.CreateNasJobRequest.serialize, response_deserializer=gca_nas_job.NasJob.deserialize, @@ -794,7 +879,7 @@ def get_nas_job( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_nas_job" not in self._stubs: - self._stubs["get_nas_job"] = self.grpc_channel.unary_unary( + self._stubs["get_nas_job"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.JobService/GetNasJob", request_serializer=job_service.GetNasJobRequest.serialize, response_deserializer=nas_job.NasJob.deserialize, @@ -822,7 +907,7 @@ def list_nas_jobs( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_nas_jobs" not in self._stubs: - self._stubs["list_nas_jobs"] = self.grpc_channel.unary_unary( + self._stubs["list_nas_jobs"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.JobService/ListNasJobs", request_serializer=job_service.ListNasJobsRequest.serialize, response_deserializer=job_service.ListNasJobsResponse.deserialize, @@ -850,7 +935,7 @@ def delete_nas_job( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_nas_job" not in self._stubs: - self._stubs["delete_nas_job"] = self.grpc_channel.unary_unary( + self._stubs["delete_nas_job"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.JobService/DeleteNasJob", request_serializer=job_service.DeleteNasJobRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -888,7 +973,7 @@ def cancel_nas_job( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_nas_job" not in self._stubs: - self._stubs["cancel_nas_job"] = self.grpc_channel.unary_unary( + self._stubs["cancel_nas_job"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.JobService/CancelNasJob", request_serializer=job_service.CancelNasJobRequest.serialize, response_deserializer=empty_pb2.Empty.FromString, @@ -916,7 +1001,7 @@ def get_nas_trial_detail( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_nas_trial_detail" not in self._stubs: - self._stubs["get_nas_trial_detail"] = self.grpc_channel.unary_unary( + self._stubs["get_nas_trial_detail"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.JobService/GetNasTrialDetail", request_serializer=job_service.GetNasTrialDetailRequest.serialize, response_deserializer=nas_job.NasTrialDetail.deserialize, @@ -945,7 +1030,7 @@ def list_nas_trial_details( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_nas_trial_details" not in self._stubs: - self._stubs["list_nas_trial_details"] = self.grpc_channel.unary_unary( + self._stubs["list_nas_trial_details"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.JobService/ListNasTrialDetails", request_serializer=job_service.ListNasTrialDetailsRequest.serialize, response_deserializer=job_service.ListNasTrialDetailsResponse.deserialize, @@ -975,7 +1060,9 @@ def create_batch_prediction_job( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_batch_prediction_job" not in self._stubs: - self._stubs["create_batch_prediction_job"] = self.grpc_channel.unary_unary( + self._stubs[ + "create_batch_prediction_job" + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.JobService/CreateBatchPredictionJob", request_serializer=job_service.CreateBatchPredictionJobRequest.serialize, response_deserializer=gca_batch_prediction_job.BatchPredictionJob.deserialize, @@ -1004,7 +1091,7 @@ def get_batch_prediction_job( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_batch_prediction_job" not in self._stubs: - self._stubs["get_batch_prediction_job"] = self.grpc_channel.unary_unary( + self._stubs["get_batch_prediction_job"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.JobService/GetBatchPredictionJob", request_serializer=job_service.GetBatchPredictionJobRequest.serialize, response_deserializer=batch_prediction_job.BatchPredictionJob.deserialize, @@ -1033,7 +1120,9 @@ def list_batch_prediction_jobs( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_batch_prediction_jobs" not in self._stubs: - self._stubs["list_batch_prediction_jobs"] = self.grpc_channel.unary_unary( + self._stubs[ + "list_batch_prediction_jobs" + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.JobService/ListBatchPredictionJobs", request_serializer=job_service.ListBatchPredictionJobsRequest.serialize, response_deserializer=job_service.ListBatchPredictionJobsResponse.deserialize, @@ -1063,7 +1152,9 @@ def delete_batch_prediction_job( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_batch_prediction_job" not in self._stubs: - self._stubs["delete_batch_prediction_job"] = self.grpc_channel.unary_unary( + self._stubs[ + "delete_batch_prediction_job" + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.JobService/DeleteBatchPredictionJob", request_serializer=job_service.DeleteBatchPredictionJobRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -1102,7 +1193,9 @@ def cancel_batch_prediction_job( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_batch_prediction_job" not in self._stubs: - self._stubs["cancel_batch_prediction_job"] = self.grpc_channel.unary_unary( + self._stubs[ + "cancel_batch_prediction_job" + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.JobService/CancelBatchPredictionJob", request_serializer=job_service.CancelBatchPredictionJobRequest.serialize, response_deserializer=empty_pb2.Empty.FromString, @@ -1135,7 +1228,7 @@ def create_model_deployment_monitoring_job( if "create_model_deployment_monitoring_job" not in self._stubs: self._stubs[ "create_model_deployment_monitoring_job" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.JobService/CreateModelDeploymentMonitoringJob", request_serializer=job_service.CreateModelDeploymentMonitoringJobRequest.serialize, response_deserializer=gca_model_deployment_monitoring_job.ModelDeploymentMonitoringJob.deserialize, @@ -1168,7 +1261,7 @@ def search_model_deployment_monitoring_stats_anomalies( if "search_model_deployment_monitoring_stats_anomalies" not in self._stubs: self._stubs[ "search_model_deployment_monitoring_stats_anomalies" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.JobService/SearchModelDeploymentMonitoringStatsAnomalies", request_serializer=job_service.SearchModelDeploymentMonitoringStatsAnomaliesRequest.serialize, response_deserializer=job_service.SearchModelDeploymentMonitoringStatsAnomaliesResponse.deserialize, @@ -1200,7 +1293,7 @@ def get_model_deployment_monitoring_job( if "get_model_deployment_monitoring_job" not in self._stubs: self._stubs[ "get_model_deployment_monitoring_job" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.JobService/GetModelDeploymentMonitoringJob", request_serializer=job_service.GetModelDeploymentMonitoringJobRequest.serialize, response_deserializer=model_deployment_monitoring_job.ModelDeploymentMonitoringJob.deserialize, @@ -1232,7 +1325,7 @@ def list_model_deployment_monitoring_jobs( if "list_model_deployment_monitoring_jobs" not in self._stubs: self._stubs[ "list_model_deployment_monitoring_jobs" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.JobService/ListModelDeploymentMonitoringJobs", request_serializer=job_service.ListModelDeploymentMonitoringJobsRequest.serialize, response_deserializer=job_service.ListModelDeploymentMonitoringJobsResponse.deserialize, @@ -1264,7 +1357,7 @@ def update_model_deployment_monitoring_job( if "update_model_deployment_monitoring_job" not in self._stubs: self._stubs[ "update_model_deployment_monitoring_job" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.JobService/UpdateModelDeploymentMonitoringJob", request_serializer=job_service.UpdateModelDeploymentMonitoringJobRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -1296,7 +1389,7 @@ def delete_model_deployment_monitoring_job( if "delete_model_deployment_monitoring_job" not in self._stubs: self._stubs[ "delete_model_deployment_monitoring_job" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.JobService/DeleteModelDeploymentMonitoringJob", request_serializer=job_service.DeleteModelDeploymentMonitoringJobRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -1331,7 +1424,7 @@ def pause_model_deployment_monitoring_job( if "pause_model_deployment_monitoring_job" not in self._stubs: self._stubs[ "pause_model_deployment_monitoring_job" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.JobService/PauseModelDeploymentMonitoringJob", request_serializer=job_service.PauseModelDeploymentMonitoringJobRequest.serialize, response_deserializer=empty_pb2.Empty.FromString, @@ -1365,7 +1458,7 @@ def resume_model_deployment_monitoring_job( if "resume_model_deployment_monitoring_job" not in self._stubs: self._stubs[ "resume_model_deployment_monitoring_job" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.JobService/ResumeModelDeploymentMonitoringJob", request_serializer=job_service.ResumeModelDeploymentMonitoringJobRequest.serialize, response_deserializer=empty_pb2.Empty.FromString, @@ -1608,7 +1701,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: @@ -1624,7 +1717,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, @@ -1641,7 +1734,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -1658,7 +1751,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -1675,7 +1768,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, @@ -1694,7 +1787,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, @@ -1713,7 +1806,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -1730,7 +1823,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -1755,7 +1848,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -1781,7 +1874,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -1810,7 +1903,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1/services/job_service/transports/rest.py b/google/cloud/aiplatform_v1/services/job_service/transports/rest.py index 808cc81461..12afe3778f 100644 --- a/google/cloud/aiplatform_v1/services/job_service/transports/rest.py +++ b/google/cloud/aiplatform_v1/services/job_service/transports/rest.py @@ -13,9 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging +import json # type: ignore from google.auth.transport.requests import AuthorizedSession # type: ignore -import json # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.api_core import exceptions as core_exceptions from google.api_core import retry as retries @@ -66,6 +67,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, @@ -350,8 +359,11 @@ def post_update_model_deployment_monitoring_job(self, response): def pre_cancel_batch_prediction_job( self, request: job_service.CancelBatchPredictionJobRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[job_service.CancelBatchPredictionJobRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + job_service.CancelBatchPredictionJobRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for cancel_batch_prediction_job Override in a subclass to manipulate the request or metadata @@ -362,8 +374,10 @@ def pre_cancel_batch_prediction_job( def pre_cancel_custom_job( self, request: job_service.CancelCustomJobRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[job_service.CancelCustomJobRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + job_service.CancelCustomJobRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_custom_job Override in a subclass to manipulate the request or metadata @@ -374,8 +388,11 @@ def pre_cancel_custom_job( def pre_cancel_data_labeling_job( self, request: job_service.CancelDataLabelingJobRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[job_service.CancelDataLabelingJobRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + job_service.CancelDataLabelingJobRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for cancel_data_labeling_job Override in a subclass to manipulate the request or metadata @@ -386,9 +403,10 @@ def pre_cancel_data_labeling_job( def pre_cancel_hyperparameter_tuning_job( self, request: job_service.CancelHyperparameterTuningJobRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - job_service.CancelHyperparameterTuningJobRequest, Sequence[Tuple[str, str]] + job_service.CancelHyperparameterTuningJobRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for cancel_hyperparameter_tuning_job @@ -400,8 +418,10 @@ def pre_cancel_hyperparameter_tuning_job( def pre_cancel_nas_job( self, request: job_service.CancelNasJobRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[job_service.CancelNasJobRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + job_service.CancelNasJobRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_nas_job Override in a subclass to manipulate the request or metadata @@ -412,8 +432,11 @@ def pre_cancel_nas_job( def pre_create_batch_prediction_job( self, request: job_service.CreateBatchPredictionJobRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[job_service.CreateBatchPredictionJobRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + job_service.CreateBatchPredictionJobRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for create_batch_prediction_job Override in a subclass to manipulate the request or metadata @@ -435,8 +458,10 @@ def post_create_batch_prediction_job( def pre_create_custom_job( self, request: job_service.CreateCustomJobRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[job_service.CreateCustomJobRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + job_service.CreateCustomJobRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for create_custom_job Override in a subclass to manipulate the request or metadata @@ -458,8 +483,11 @@ def post_create_custom_job( def pre_create_data_labeling_job( self, request: job_service.CreateDataLabelingJobRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[job_service.CreateDataLabelingJobRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + job_service.CreateDataLabelingJobRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for create_data_labeling_job Override in a subclass to manipulate the request or metadata @@ -481,9 +509,10 @@ def post_create_data_labeling_job( def pre_create_hyperparameter_tuning_job( self, request: job_service.CreateHyperparameterTuningJobRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - job_service.CreateHyperparameterTuningJobRequest, Sequence[Tuple[str, str]] + job_service.CreateHyperparameterTuningJobRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for create_hyperparameter_tuning_job @@ -506,9 +535,10 @@ def post_create_hyperparameter_tuning_job( def pre_create_model_deployment_monitoring_job( self, request: job_service.CreateModelDeploymentMonitoringJobRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - job_service.CreateModelDeploymentMonitoringJobRequest, Sequence[Tuple[str, str]] + job_service.CreateModelDeploymentMonitoringJobRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for create_model_deployment_monitoring_job @@ -531,8 +561,10 @@ def post_create_model_deployment_monitoring_job( def pre_create_nas_job( self, request: job_service.CreateNasJobRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[job_service.CreateNasJobRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + job_service.CreateNasJobRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for create_nas_job Override in a subclass to manipulate the request or metadata @@ -552,8 +584,11 @@ def post_create_nas_job(self, response: gca_nas_job.NasJob) -> gca_nas_job.NasJo def pre_delete_batch_prediction_job( self, request: job_service.DeleteBatchPredictionJobRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[job_service.DeleteBatchPredictionJobRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + job_service.DeleteBatchPredictionJobRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for delete_batch_prediction_job Override in a subclass to manipulate the request or metadata @@ -575,8 +610,10 @@ def post_delete_batch_prediction_job( def pre_delete_custom_job( self, request: job_service.DeleteCustomJobRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[job_service.DeleteCustomJobRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + job_service.DeleteCustomJobRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for delete_custom_job Override in a subclass to manipulate the request or metadata @@ -598,8 +635,11 @@ def post_delete_custom_job( def pre_delete_data_labeling_job( self, request: job_service.DeleteDataLabelingJobRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[job_service.DeleteDataLabelingJobRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + job_service.DeleteDataLabelingJobRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for delete_data_labeling_job Override in a subclass to manipulate the request or metadata @@ -621,9 +661,10 @@ def post_delete_data_labeling_job( def pre_delete_hyperparameter_tuning_job( self, request: job_service.DeleteHyperparameterTuningJobRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - job_service.DeleteHyperparameterTuningJobRequest, Sequence[Tuple[str, str]] + job_service.DeleteHyperparameterTuningJobRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for delete_hyperparameter_tuning_job @@ -646,9 +687,10 @@ def post_delete_hyperparameter_tuning_job( def pre_delete_model_deployment_monitoring_job( self, request: job_service.DeleteModelDeploymentMonitoringJobRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - job_service.DeleteModelDeploymentMonitoringJobRequest, Sequence[Tuple[str, str]] + job_service.DeleteModelDeploymentMonitoringJobRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for delete_model_deployment_monitoring_job @@ -671,8 +713,10 @@ def post_delete_model_deployment_monitoring_job( def pre_delete_nas_job( self, request: job_service.DeleteNasJobRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[job_service.DeleteNasJobRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + job_service.DeleteNasJobRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for delete_nas_job Override in a subclass to manipulate the request or metadata @@ -694,8 +738,11 @@ def post_delete_nas_job( def pre_get_batch_prediction_job( self, request: job_service.GetBatchPredictionJobRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[job_service.GetBatchPredictionJobRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + job_service.GetBatchPredictionJobRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for get_batch_prediction_job Override in a subclass to manipulate the request or metadata @@ -717,8 +764,10 @@ def post_get_batch_prediction_job( def pre_get_custom_job( self, request: job_service.GetCustomJobRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[job_service.GetCustomJobRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + job_service.GetCustomJobRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_custom_job Override in a subclass to manipulate the request or metadata @@ -740,8 +789,10 @@ def post_get_custom_job( def pre_get_data_labeling_job( self, request: job_service.GetDataLabelingJobRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[job_service.GetDataLabelingJobRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + job_service.GetDataLabelingJobRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_data_labeling_job Override in a subclass to manipulate the request or metadata @@ -763,9 +814,10 @@ def post_get_data_labeling_job( def pre_get_hyperparameter_tuning_job( self, request: job_service.GetHyperparameterTuningJobRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - job_service.GetHyperparameterTuningJobRequest, Sequence[Tuple[str, str]] + job_service.GetHyperparameterTuningJobRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for get_hyperparameter_tuning_job @@ -788,9 +840,10 @@ def post_get_hyperparameter_tuning_job( def pre_get_model_deployment_monitoring_job( self, request: job_service.GetModelDeploymentMonitoringJobRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - job_service.GetModelDeploymentMonitoringJobRequest, Sequence[Tuple[str, str]] + job_service.GetModelDeploymentMonitoringJobRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for get_model_deployment_monitoring_job @@ -811,8 +864,10 @@ def post_get_model_deployment_monitoring_job( return response def pre_get_nas_job( - self, request: job_service.GetNasJobRequest, metadata: Sequence[Tuple[str, str]] - ) -> Tuple[job_service.GetNasJobRequest, Sequence[Tuple[str, str]]]: + self, + request: job_service.GetNasJobRequest, + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[job_service.GetNasJobRequest, Sequence[Tuple[str, Union[str, bytes]]]]: """Pre-rpc interceptor for get_nas_job Override in a subclass to manipulate the request or metadata @@ -832,8 +887,10 @@ def post_get_nas_job(self, response: nas_job.NasJob) -> nas_job.NasJob: def pre_get_nas_trial_detail( self, request: job_service.GetNasTrialDetailRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[job_service.GetNasTrialDetailRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + job_service.GetNasTrialDetailRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_nas_trial_detail Override in a subclass to manipulate the request or metadata @@ -855,8 +912,11 @@ def post_get_nas_trial_detail( def pre_list_batch_prediction_jobs( self, request: job_service.ListBatchPredictionJobsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[job_service.ListBatchPredictionJobsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + job_service.ListBatchPredictionJobsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for list_batch_prediction_jobs Override in a subclass to manipulate the request or metadata @@ -878,8 +938,10 @@ def post_list_batch_prediction_jobs( def pre_list_custom_jobs( self, request: job_service.ListCustomJobsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[job_service.ListCustomJobsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + job_service.ListCustomJobsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_custom_jobs Override in a subclass to manipulate the request or metadata @@ -901,8 +963,10 @@ def post_list_custom_jobs( def pre_list_data_labeling_jobs( self, request: job_service.ListDataLabelingJobsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[job_service.ListDataLabelingJobsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + job_service.ListDataLabelingJobsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_data_labeling_jobs Override in a subclass to manipulate the request or metadata @@ -924,9 +988,10 @@ def post_list_data_labeling_jobs( def pre_list_hyperparameter_tuning_jobs( self, request: job_service.ListHyperparameterTuningJobsRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - job_service.ListHyperparameterTuningJobsRequest, Sequence[Tuple[str, str]] + job_service.ListHyperparameterTuningJobsRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for list_hyperparameter_tuning_jobs @@ -949,9 +1014,10 @@ def post_list_hyperparameter_tuning_jobs( def pre_list_model_deployment_monitoring_jobs( self, request: job_service.ListModelDeploymentMonitoringJobsRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - job_service.ListModelDeploymentMonitoringJobsRequest, Sequence[Tuple[str, str]] + job_service.ListModelDeploymentMonitoringJobsRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for list_model_deployment_monitoring_jobs @@ -974,8 +1040,8 @@ def post_list_model_deployment_monitoring_jobs( def pre_list_nas_jobs( self, request: job_service.ListNasJobsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[job_service.ListNasJobsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[job_service.ListNasJobsRequest, Sequence[Tuple[str, Union[str, bytes]]]]: """Pre-rpc interceptor for list_nas_jobs Override in a subclass to manipulate the request or metadata @@ -997,8 +1063,10 @@ def post_list_nas_jobs( def pre_list_nas_trial_details( self, request: job_service.ListNasTrialDetailsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[job_service.ListNasTrialDetailsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + job_service.ListNasTrialDetailsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_nas_trial_details Override in a subclass to manipulate the request or metadata @@ -1020,9 +1088,10 @@ def post_list_nas_trial_details( def pre_pause_model_deployment_monitoring_job( self, request: job_service.PauseModelDeploymentMonitoringJobRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - job_service.PauseModelDeploymentMonitoringJobRequest, Sequence[Tuple[str, str]] + job_service.PauseModelDeploymentMonitoringJobRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for pause_model_deployment_monitoring_job @@ -1034,9 +1103,10 @@ def pre_pause_model_deployment_monitoring_job( def pre_resume_model_deployment_monitoring_job( self, request: job_service.ResumeModelDeploymentMonitoringJobRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - job_service.ResumeModelDeploymentMonitoringJobRequest, Sequence[Tuple[str, str]] + job_service.ResumeModelDeploymentMonitoringJobRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for resume_model_deployment_monitoring_job @@ -1048,10 +1118,10 @@ def pre_resume_model_deployment_monitoring_job( def pre_search_model_deployment_monitoring_stats_anomalies( self, request: job_service.SearchModelDeploymentMonitoringStatsAnomaliesRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ job_service.SearchModelDeploymentMonitoringStatsAnomaliesRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for search_model_deployment_monitoring_stats_anomalies @@ -1075,9 +1145,10 @@ def post_search_model_deployment_monitoring_stats_anomalies( def pre_update_model_deployment_monitoring_job( self, request: job_service.UpdateModelDeploymentMonitoringJobRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - job_service.UpdateModelDeploymentMonitoringJobRequest, Sequence[Tuple[str, str]] + job_service.UpdateModelDeploymentMonitoringJobRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for update_model_deployment_monitoring_job @@ -1100,8 +1171,10 @@ def post_update_model_deployment_monitoring_job( def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -1123,8 +1196,10 @@ def post_get_location( def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -1146,8 +1221,10 @@ def post_list_locations( def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -1167,8 +1244,10 @@ def post_get_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -1188,8 +1267,11 @@ def post_set_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -1211,8 +1293,10 @@ def post_test_iam_permissions( def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -1232,8 +1316,10 @@ def post_cancel_operation(self, response: None) -> None: 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 @@ -1253,8 +1339,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 @@ -1276,8 +1364,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 @@ -1299,8 +1389,10 @@ def post_list_operations( def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -3321,7 +3413,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 cancel batch prediction job method over HTTP. @@ -3333,13 +3425,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 = ( _BaseJobServiceRestTransport._BaseCancelBatchPredictionJob._get_http_options() ) + request, metadata = self._interceptor.pre_cancel_batch_prediction_job( request, metadata ) @@ -3356,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 = 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.aiplatform_v1.JobServiceClient.CancelBatchPredictionJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "CancelBatchPredictionJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = JobServiceRestTransport._CancelBatchPredictionJob._get_response( self._host, @@ -3408,7 +3530,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 cancel custom job method over HTTP. @@ -3419,13 +3541,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 = ( _BaseJobServiceRestTransport._BaseCancelCustomJob._get_http_options() ) + request, metadata = self._interceptor.pre_cancel_custom_job( request, metadata ) @@ -3442,6 +3567,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.aiplatform_v1.JobServiceClient.CancelCustomJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "CancelCustomJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = JobServiceRestTransport._CancelCustomJob._get_response( self._host, @@ -3494,7 +3646,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 cancel data labeling job method over HTTP. @@ -3505,13 +3657,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 = ( _BaseJobServiceRestTransport._BaseCancelDataLabelingJob._get_http_options() ) + request, metadata = self._interceptor.pre_cancel_data_labeling_job( request, metadata ) @@ -3528,6 +3683,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.aiplatform_v1.JobServiceClient.CancelDataLabelingJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "CancelDataLabelingJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = JobServiceRestTransport._CancelDataLabelingJob._get_response( self._host, @@ -3581,7 +3763,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 cancel hyperparameter tuning job method over HTTP. @@ -3593,13 +3775,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 = ( _BaseJobServiceRestTransport._BaseCancelHyperparameterTuningJob._get_http_options() ) + request, metadata = self._interceptor.pre_cancel_hyperparameter_tuning_job( request, metadata ) @@ -3616,6 +3801,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.aiplatform_v1.JobServiceClient.CancelHyperparameterTuningJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "CancelHyperparameterTuningJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( JobServiceRestTransport._CancelHyperparameterTuningJob._get_response( @@ -3670,7 +3882,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 cancel nas job method over HTTP. @@ -3681,13 +3893,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 = ( _BaseJobServiceRestTransport._BaseCancelNasJob._get_http_options() ) + request, metadata = self._interceptor.pre_cancel_nas_job(request, metadata) transcoded_request = ( _BaseJobServiceRestTransport._BaseCancelNasJob._get_transcoded_request( @@ -3708,6 +3923,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.aiplatform_v1.JobServiceClient.CancelNasJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "CancelNasJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = JobServiceRestTransport._CancelNasJob._get_response( self._host, @@ -3760,7 +4002,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]]] = (), ) -> gca_batch_prediction_job.BatchPredictionJob: r"""Call the create batch prediction job method over HTTP. @@ -3772,8 +4014,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: ~.gca_batch_prediction_job.BatchPredictionJob: @@ -3790,6 +4034,7 @@ def __call__( http_options = ( _BaseJobServiceRestTransport._BaseCreateBatchPredictionJob._get_http_options() ) + request, metadata = self._interceptor.pre_create_batch_prediction_job( request, metadata ) @@ -3806,6 +4051,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.aiplatform_v1.JobServiceClient.CreateBatchPredictionJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "CreateBatchPredictionJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = JobServiceRestTransport._CreateBatchPredictionJob._get_response( self._host, @@ -3827,7 +4099,31 @@ def __call__( pb_resp = gca_batch_prediction_job.BatchPredictionJob.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_create_batch_prediction_job(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + gca_batch_prediction_job.BatchPredictionJob.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.aiplatform_v1.JobServiceClient.create_batch_prediction_job", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "CreateBatchPredictionJob", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _CreateCustomJob( @@ -3866,7 +4162,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]]] = (), ) -> gca_custom_job.CustomJob: r"""Call the create custom job method over HTTP. @@ -3877,8 +4173,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: ~.gca_custom_job.CustomJob: @@ -3896,6 +4194,7 @@ def __call__( http_options = ( _BaseJobServiceRestTransport._BaseCreateCustomJob._get_http_options() ) + request, metadata = self._interceptor.pre_create_custom_job( request, metadata ) @@ -3912,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 = 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.aiplatform_v1.JobServiceClient.CreateCustomJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "CreateCustomJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = JobServiceRestTransport._CreateCustomJob._get_response( self._host, @@ -3933,7 +4259,29 @@ def __call__( pb_resp = gca_custom_job.CustomJob.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_create_custom_job(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gca_custom_job.CustomJob.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.aiplatform_v1.JobServiceClient.create_custom_job", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "CreateCustomJob", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _CreateDataLabelingJob( @@ -3972,7 +4320,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]]] = (), ) -> gca_data_labeling_job.DataLabelingJob: r"""Call the create data labeling job method over HTTP. @@ -3983,8 +4331,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: ~.gca_data_labeling_job.DataLabelingJob: @@ -3997,6 +4347,7 @@ def __call__( http_options = ( _BaseJobServiceRestTransport._BaseCreateDataLabelingJob._get_http_options() ) + request, metadata = self._interceptor.pre_create_data_labeling_job( request, metadata ) @@ -4013,6 +4364,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.aiplatform_v1.JobServiceClient.CreateDataLabelingJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "CreateDataLabelingJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = JobServiceRestTransport._CreateDataLabelingJob._get_response( self._host, @@ -4034,7 +4412,31 @@ def __call__( pb_resp = gca_data_labeling_job.DataLabelingJob.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_create_data_labeling_job(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gca_data_labeling_job.DataLabelingJob.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.aiplatform_v1.JobServiceClient.create_data_labeling_job", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "CreateDataLabelingJob", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _CreateHyperparameterTuningJob( @@ -4074,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]]] = (), ) -> gca_hyperparameter_tuning_job.HyperparameterTuningJob: r"""Call the create hyperparameter tuning job method over HTTP. @@ -4086,8 +4488,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: ~.gca_hyperparameter_tuning_job.HyperparameterTuningJob: @@ -4101,6 +4505,7 @@ def __call__( http_options = ( _BaseJobServiceRestTransport._BaseCreateHyperparameterTuningJob._get_http_options() ) + request, metadata = self._interceptor.pre_create_hyperparameter_tuning_job( request, metadata ) @@ -4117,6 +4522,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.aiplatform_v1.JobServiceClient.CreateHyperparameterTuningJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "CreateHyperparameterTuningJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( JobServiceRestTransport._CreateHyperparameterTuningJob._get_response( @@ -4140,7 +4572,33 @@ def __call__( pb_resp = gca_hyperparameter_tuning_job.HyperparameterTuningJob.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_create_hyperparameter_tuning_job(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + gca_hyperparameter_tuning_job.HyperparameterTuningJob.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.aiplatform_v1.JobServiceClient.create_hyperparameter_tuning_job", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "CreateHyperparameterTuningJob", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _CreateModelDeploymentMonitoringJob( @@ -4180,7 +4638,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]]] = (), ) -> gca_model_deployment_monitoring_job.ModelDeploymentMonitoringJob: r"""Call the create model deployment monitoring job method over HTTP. @@ -4192,8 +4650,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: ~.gca_model_deployment_monitoring_job.ModelDeploymentMonitoringJob: @@ -4208,6 +4668,7 @@ def __call__( http_options = ( _BaseJobServiceRestTransport._BaseCreateModelDeploymentMonitoringJob._get_http_options() ) + ( request, metadata, @@ -4227,6 +4688,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.aiplatform_v1.JobServiceClient.CreateModelDeploymentMonitoringJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "CreateModelDeploymentMonitoringJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = JobServiceRestTransport._CreateModelDeploymentMonitoringJob._get_response( self._host, @@ -4252,7 +4740,31 @@ def __call__( ) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_create_model_deployment_monitoring_job(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gca_model_deployment_monitoring_job.ModelDeploymentMonitoringJob.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.aiplatform_v1.JobServiceClient.create_model_deployment_monitoring_job", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "CreateModelDeploymentMonitoringJob", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _CreateNasJob( @@ -4291,7 +4803,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]]] = (), ) -> gca_nas_job.NasJob: r"""Call the create nas job method over HTTP. @@ -4302,8 +4814,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: ~.gca_nas_job.NasJob: @@ -4315,6 +4829,7 @@ def __call__( http_options = ( _BaseJobServiceRestTransport._BaseCreateNasJob._get_http_options() ) + request, metadata = self._interceptor.pre_create_nas_job(request, metadata) transcoded_request = ( _BaseJobServiceRestTransport._BaseCreateNasJob._get_transcoded_request( @@ -4335,6 +4850,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 = 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.aiplatform_v1.JobServiceClient.CreateNasJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "CreateNasJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = JobServiceRestTransport._CreateNasJob._get_response( self._host, @@ -4356,7 +4898,29 @@ def __call__( pb_resp = gca_nas_job.NasJob.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_create_nas_job(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gca_nas_job.NasJob.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.aiplatform_v1.JobServiceClient.create_nas_job", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "CreateNasJob", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _DeleteBatchPredictionJob( @@ -4394,7 +4958,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 batch prediction job method over HTTP. @@ -4406,8 +4970,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: @@ -4420,6 +4986,7 @@ def __call__( http_options = ( _BaseJobServiceRestTransport._BaseDeleteBatchPredictionJob._get_http_options() ) + request, metadata = self._interceptor.pre_delete_batch_prediction_job( request, metadata ) @@ -4432,6 +4999,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.aiplatform_v1.JobServiceClient.DeleteBatchPredictionJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "DeleteBatchPredictionJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = JobServiceRestTransport._DeleteBatchPredictionJob._get_response( self._host, @@ -4450,7 +5044,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_batch_prediction_job(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.aiplatform_v1.JobServiceClient.delete_batch_prediction_job", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "DeleteBatchPredictionJob", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _DeleteCustomJob( @@ -4488,7 +5104,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 custom job method over HTTP. @@ -4499,8 +5115,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: @@ -4513,6 +5131,7 @@ def __call__( http_options = ( _BaseJobServiceRestTransport._BaseDeleteCustomJob._get_http_options() ) + request, metadata = self._interceptor.pre_delete_custom_job( request, metadata ) @@ -4525,6 +5144,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.aiplatform_v1.JobServiceClient.DeleteCustomJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "DeleteCustomJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = JobServiceRestTransport._DeleteCustomJob._get_response( self._host, @@ -4543,7 +5189,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_custom_job(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.aiplatform_v1.JobServiceClient.delete_custom_job", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "DeleteCustomJob", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _DeleteDataLabelingJob( @@ -4581,7 +5249,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 data labeling job method over HTTP. @@ -4592,8 +5260,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: @@ -4606,6 +5276,7 @@ def __call__( http_options = ( _BaseJobServiceRestTransport._BaseDeleteDataLabelingJob._get_http_options() ) + request, metadata = self._interceptor.pre_delete_data_labeling_job( request, metadata ) @@ -4618,6 +5289,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.aiplatform_v1.JobServiceClient.DeleteDataLabelingJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "DeleteDataLabelingJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = JobServiceRestTransport._DeleteDataLabelingJob._get_response( self._host, @@ -4636,7 +5334,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_data_labeling_job(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.aiplatform_v1.JobServiceClient.delete_data_labeling_job", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "DeleteDataLabelingJob", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _DeleteHyperparameterTuningJob( @@ -4675,7 +5395,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 hyperparameter tuning job method over HTTP. @@ -4687,8 +5407,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: @@ -4701,6 +5423,7 @@ def __call__( http_options = ( _BaseJobServiceRestTransport._BaseDeleteHyperparameterTuningJob._get_http_options() ) + request, metadata = self._interceptor.pre_delete_hyperparameter_tuning_job( request, metadata ) @@ -4713,6 +5436,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.aiplatform_v1.JobServiceClient.DeleteHyperparameterTuningJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "DeleteHyperparameterTuningJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( JobServiceRestTransport._DeleteHyperparameterTuningJob._get_response( @@ -4733,7 +5483,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_hyperparameter_tuning_job(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.aiplatform_v1.JobServiceClient.delete_hyperparameter_tuning_job", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "DeleteHyperparameterTuningJob", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _DeleteModelDeploymentMonitoringJob( @@ -4772,7 +5544,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 model deployment monitoring job method over HTTP. @@ -4784,8 +5556,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: @@ -4798,6 +5572,7 @@ def __call__( http_options = ( _BaseJobServiceRestTransport._BaseDeleteModelDeploymentMonitoringJob._get_http_options() ) + ( request, metadata, @@ -4813,6 +5588,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.aiplatform_v1.JobServiceClient.DeleteModelDeploymentMonitoringJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "DeleteModelDeploymentMonitoringJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = JobServiceRestTransport._DeleteModelDeploymentMonitoringJob._get_response( self._host, @@ -4831,7 +5633,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_model_deployment_monitoring_job(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.aiplatform_v1.JobServiceClient.delete_model_deployment_monitoring_job", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "DeleteModelDeploymentMonitoringJob", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _DeleteNasJob( @@ -4869,7 +5693,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 nas job method over HTTP. @@ -4880,8 +5704,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: @@ -4894,6 +5720,7 @@ def __call__( http_options = ( _BaseJobServiceRestTransport._BaseDeleteNasJob._get_http_options() ) + request, metadata = self._interceptor.pre_delete_nas_job(request, metadata) transcoded_request = ( _BaseJobServiceRestTransport._BaseDeleteNasJob._get_transcoded_request( @@ -4908,6 +5735,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.aiplatform_v1.JobServiceClient.DeleteNasJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "DeleteNasJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = JobServiceRestTransport._DeleteNasJob._get_response( self._host, @@ -4926,7 +5780,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_nas_job(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.aiplatform_v1.JobServiceClient.delete_nas_job", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "DeleteNasJob", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _GetBatchPredictionJob( @@ -4964,7 +5840,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]]] = (), ) -> batch_prediction_job.BatchPredictionJob: r"""Call the get batch prediction job method over HTTP. @@ -4975,8 +5851,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: ~.batch_prediction_job.BatchPredictionJob: @@ -4993,6 +5871,7 @@ def __call__( http_options = ( _BaseJobServiceRestTransport._BaseGetBatchPredictionJob._get_http_options() ) + request, metadata = self._interceptor.pre_get_batch_prediction_job( request, metadata ) @@ -5005,6 +5884,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.aiplatform_v1.JobServiceClient.GetBatchPredictionJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "GetBatchPredictionJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = JobServiceRestTransport._GetBatchPredictionJob._get_response( self._host, @@ -5025,7 +5931,31 @@ def __call__( pb_resp = batch_prediction_job.BatchPredictionJob.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_batch_prediction_job(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = batch_prediction_job.BatchPredictionJob.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.aiplatform_v1.JobServiceClient.get_batch_prediction_job", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "GetBatchPredictionJob", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _GetCustomJob( @@ -5063,7 +5993,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]]] = (), ) -> custom_job.CustomJob: r"""Call the get custom job method over HTTP. @@ -5074,8 +6004,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: ~.custom_job.CustomJob: @@ -5093,6 +6025,7 @@ def __call__( http_options = ( _BaseJobServiceRestTransport._BaseGetCustomJob._get_http_options() ) + request, metadata = self._interceptor.pre_get_custom_job(request, metadata) transcoded_request = ( _BaseJobServiceRestTransport._BaseGetCustomJob._get_transcoded_request( @@ -5107,6 +6040,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 = 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.aiplatform_v1.JobServiceClient.GetCustomJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "GetCustomJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = JobServiceRestTransport._GetCustomJob._get_response( self._host, @@ -5127,7 +6087,29 @@ def __call__( pb_resp = custom_job.CustomJob.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_custom_job(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = custom_job.CustomJob.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.aiplatform_v1.JobServiceClient.get_custom_job", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "GetCustomJob", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _GetDataLabelingJob( @@ -5165,7 +6147,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]]] = (), ) -> data_labeling_job.DataLabelingJob: r"""Call the get data labeling job method over HTTP. @@ -5176,8 +6158,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: ~.data_labeling_job.DataLabelingJob: @@ -5190,6 +6174,7 @@ def __call__( http_options = ( _BaseJobServiceRestTransport._BaseGetDataLabelingJob._get_http_options() ) + request, metadata = self._interceptor.pre_get_data_labeling_job( request, metadata ) @@ -5202,6 +6187,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.aiplatform_v1.JobServiceClient.GetDataLabelingJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "GetDataLabelingJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = JobServiceRestTransport._GetDataLabelingJob._get_response( self._host, @@ -5222,7 +6234,31 @@ def __call__( pb_resp = data_labeling_job.DataLabelingJob.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_data_labeling_job(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = data_labeling_job.DataLabelingJob.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.aiplatform_v1.JobServiceClient.get_data_labeling_job", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "GetDataLabelingJob", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _GetHyperparameterTuningJob( @@ -5260,7 +6296,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]]] = (), ) -> hyperparameter_tuning_job.HyperparameterTuningJob: r"""Call the get hyperparameter tuning job method over HTTP. @@ -5272,8 +6308,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: ~.hyperparameter_tuning_job.HyperparameterTuningJob: @@ -5287,6 +6325,7 @@ def __call__( http_options = ( _BaseJobServiceRestTransport._BaseGetHyperparameterTuningJob._get_http_options() ) + request, metadata = self._interceptor.pre_get_hyperparameter_tuning_job( request, metadata ) @@ -5299,6 +6338,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.aiplatform_v1.JobServiceClient.GetHyperparameterTuningJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "GetHyperparameterTuningJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( JobServiceRestTransport._GetHyperparameterTuningJob._get_response( @@ -5321,7 +6387,33 @@ def __call__( pb_resp = hyperparameter_tuning_job.HyperparameterTuningJob.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_hyperparameter_tuning_job(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + hyperparameter_tuning_job.HyperparameterTuningJob.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.aiplatform_v1.JobServiceClient.get_hyperparameter_tuning_job", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "GetHyperparameterTuningJob", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _GetModelDeploymentMonitoringJob( @@ -5360,7 +6452,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]]] = (), ) -> model_deployment_monitoring_job.ModelDeploymentMonitoringJob: r"""Call the get model deployment monitoring job method over HTTP. @@ -5372,8 +6464,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: ~.model_deployment_monitoring_job.ModelDeploymentMonitoringJob: @@ -5388,6 +6482,7 @@ def __call__( http_options = ( _BaseJobServiceRestTransport._BaseGetModelDeploymentMonitoringJob._get_http_options() ) + ( request, metadata, @@ -5403,6 +6498,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.aiplatform_v1.JobServiceClient.GetModelDeploymentMonitoringJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "GetModelDeploymentMonitoringJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( JobServiceRestTransport._GetModelDeploymentMonitoringJob._get_response( @@ -5427,7 +6549,31 @@ def __call__( ) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_model_deployment_monitoring_job(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = model_deployment_monitoring_job.ModelDeploymentMonitoringJob.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.aiplatform_v1.JobServiceClient.get_model_deployment_monitoring_job", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "GetModelDeploymentMonitoringJob", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _GetNasJob(_BaseJobServiceRestTransport._BaseGetNasJob, JobServiceRestStub): @@ -5463,7 +6609,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]]] = (), ) -> nas_job.NasJob: r"""Call the get nas job method over HTTP. @@ -5474,8 +6620,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: ~.nas_job.NasJob: @@ -5487,6 +6635,7 @@ def __call__( http_options = ( _BaseJobServiceRestTransport._BaseGetNasJob._get_http_options() ) + request, metadata = self._interceptor.pre_get_nas_job(request, metadata) transcoded_request = ( _BaseJobServiceRestTransport._BaseGetNasJob._get_transcoded_request( @@ -5501,6 +6650,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 = 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.aiplatform_v1.JobServiceClient.GetNasJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "GetNasJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = JobServiceRestTransport._GetNasJob._get_response( self._host, @@ -5521,7 +6697,29 @@ def __call__( pb_resp = nas_job.NasJob.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_nas_job(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = nas_job.NasJob.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.aiplatform_v1.JobServiceClient.get_nas_job", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "GetNasJob", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _GetNasTrialDetail( @@ -5559,7 +6757,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]]] = (), ) -> nas_job.NasTrialDetail: r"""Call the get nas trial detail method over HTTP. @@ -5570,8 +6768,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: ~.nas_job.NasTrialDetail: @@ -5585,6 +6785,7 @@ def __call__( http_options = ( _BaseJobServiceRestTransport._BaseGetNasTrialDetail._get_http_options() ) + request, metadata = self._interceptor.pre_get_nas_trial_detail( request, metadata ) @@ -5597,6 +6798,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.aiplatform_v1.JobServiceClient.GetNasTrialDetail", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "GetNasTrialDetail", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = JobServiceRestTransport._GetNasTrialDetail._get_response( self._host, @@ -5617,7 +6845,29 @@ def __call__( pb_resp = nas_job.NasTrialDetail.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_nas_trial_detail(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = nas_job.NasTrialDetail.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.aiplatform_v1.JobServiceClient.get_nas_trial_detail", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "GetNasTrialDetail", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListBatchPredictionJobs( @@ -5655,7 +6905,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]]] = (), ) -> job_service.ListBatchPredictionJobsResponse: r"""Call the list batch prediction jobs method over HTTP. @@ -5667,8 +6917,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: ~.job_service.ListBatchPredictionJobsResponse: @@ -5680,6 +6932,7 @@ def __call__( http_options = ( _BaseJobServiceRestTransport._BaseListBatchPredictionJobs._get_http_options() ) + request, metadata = self._interceptor.pre_list_batch_prediction_jobs( request, metadata ) @@ -5692,6 +6945,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.aiplatform_v1.JobServiceClient.ListBatchPredictionJobs", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "ListBatchPredictionJobs", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = JobServiceRestTransport._ListBatchPredictionJobs._get_response( self._host, @@ -5712,7 +6992,31 @@ def __call__( pb_resp = job_service.ListBatchPredictionJobsResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_batch_prediction_jobs(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + job_service.ListBatchPredictionJobsResponse.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.aiplatform_v1.JobServiceClient.list_batch_prediction_jobs", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "ListBatchPredictionJobs", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListCustomJobs( @@ -5750,7 +7054,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]]] = (), ) -> job_service.ListCustomJobsResponse: r"""Call the list custom jobs method over HTTP. @@ -5761,8 +7065,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: ~.job_service.ListCustomJobsResponse: @@ -5774,6 +7080,7 @@ def __call__( http_options = ( _BaseJobServiceRestTransport._BaseListCustomJobs._get_http_options() ) + request, metadata = self._interceptor.pre_list_custom_jobs( request, metadata ) @@ -5788,6 +7095,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 = 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.aiplatform_v1.JobServiceClient.ListCustomJobs", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "ListCustomJobs", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = JobServiceRestTransport._ListCustomJobs._get_response( self._host, @@ -5808,7 +7142,31 @@ def __call__( pb_resp = job_service.ListCustomJobsResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_custom_jobs(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = job_service.ListCustomJobsResponse.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.aiplatform_v1.JobServiceClient.list_custom_jobs", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "ListCustomJobs", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListDataLabelingJobs( @@ -5846,7 +7204,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]]] = (), ) -> job_service.ListDataLabelingJobsResponse: r"""Call the list data labeling jobs method over HTTP. @@ -5857,8 +7215,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: ~.job_service.ListDataLabelingJobsResponse: @@ -5870,6 +7230,7 @@ def __call__( http_options = ( _BaseJobServiceRestTransport._BaseListDataLabelingJobs._get_http_options() ) + request, metadata = self._interceptor.pre_list_data_labeling_jobs( request, metadata ) @@ -5882,6 +7243,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.aiplatform_v1.JobServiceClient.ListDataLabelingJobs", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "ListDataLabelingJobs", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = JobServiceRestTransport._ListDataLabelingJobs._get_response( self._host, @@ -5902,7 +7290,31 @@ def __call__( pb_resp = job_service.ListDataLabelingJobsResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_data_labeling_jobs(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = job_service.ListDataLabelingJobsResponse.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.aiplatform_v1.JobServiceClient.list_data_labeling_jobs", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "ListDataLabelingJobs", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListHyperparameterTuningJobs( @@ -5941,7 +7353,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]]] = (), ) -> job_service.ListHyperparameterTuningJobsResponse: r"""Call the list hyperparameter tuning jobs method over HTTP. @@ -5953,8 +7365,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: ~.job_service.ListHyperparameterTuningJobsResponse: @@ -5966,6 +7380,7 @@ def __call__( http_options = ( _BaseJobServiceRestTransport._BaseListHyperparameterTuningJobs._get_http_options() ) + request, metadata = self._interceptor.pre_list_hyperparameter_tuning_jobs( request, metadata ) @@ -5978,6 +7393,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.aiplatform_v1.JobServiceClient.ListHyperparameterTuningJobs", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "ListHyperparameterTuningJobs", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( JobServiceRestTransport._ListHyperparameterTuningJobs._get_response( @@ -6000,7 +7442,33 @@ def __call__( pb_resp = job_service.ListHyperparameterTuningJobsResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_hyperparameter_tuning_jobs(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + job_service.ListHyperparameterTuningJobsResponse.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.aiplatform_v1.JobServiceClient.list_hyperparameter_tuning_jobs", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "ListHyperparameterTuningJobs", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListModelDeploymentMonitoringJobs( @@ -6039,7 +7507,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]]] = (), ) -> job_service.ListModelDeploymentMonitoringJobsResponse: r"""Call the list model deployment monitoring jobs method over HTTP. @@ -6051,8 +7519,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: ~.job_service.ListModelDeploymentMonitoringJobsResponse: @@ -6064,6 +7534,7 @@ def __call__( http_options = ( _BaseJobServiceRestTransport._BaseListModelDeploymentMonitoringJobs._get_http_options() ) + ( request, metadata, @@ -6079,6 +7550,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.aiplatform_v1.JobServiceClient.ListModelDeploymentMonitoringJobs", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "ListModelDeploymentMonitoringJobs", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = JobServiceRestTransport._ListModelDeploymentMonitoringJobs._get_response( self._host, @@ -6099,7 +7597,33 @@ def __call__( pb_resp = job_service.ListModelDeploymentMonitoringJobsResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_model_deployment_monitoring_jobs(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + job_service.ListModelDeploymentMonitoringJobsResponse.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.aiplatform_v1.JobServiceClient.list_model_deployment_monitoring_jobs", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "ListModelDeploymentMonitoringJobs", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListNasJobs( @@ -6137,7 +7661,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]]] = (), ) -> job_service.ListNasJobsResponse: r"""Call the list nas jobs method over HTTP. @@ -6148,8 +7672,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: ~.job_service.ListNasJobsResponse: @@ -6161,6 +7687,7 @@ def __call__( http_options = ( _BaseJobServiceRestTransport._BaseListNasJobs._get_http_options() ) + request, metadata = self._interceptor.pre_list_nas_jobs(request, metadata) transcoded_request = ( _BaseJobServiceRestTransport._BaseListNasJobs._get_transcoded_request( @@ -6175,6 +7702,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 = 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.aiplatform_v1.JobServiceClient.ListNasJobs", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "ListNasJobs", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = JobServiceRestTransport._ListNasJobs._get_response( self._host, @@ -6195,7 +7749,29 @@ def __call__( pb_resp = job_service.ListNasJobsResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_nas_jobs(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = job_service.ListNasJobsResponse.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.aiplatform_v1.JobServiceClient.list_nas_jobs", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "ListNasJobs", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListNasTrialDetails( @@ -6233,7 +7809,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]]] = (), ) -> job_service.ListNasTrialDetailsResponse: r"""Call the list nas trial details method over HTTP. @@ -6244,8 +7820,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: ~.job_service.ListNasTrialDetailsResponse: @@ -6257,6 +7835,7 @@ def __call__( http_options = ( _BaseJobServiceRestTransport._BaseListNasTrialDetails._get_http_options() ) + request, metadata = self._interceptor.pre_list_nas_trial_details( request, metadata ) @@ -6269,6 +7848,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.aiplatform_v1.JobServiceClient.ListNasTrialDetails", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "ListNasTrialDetails", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = JobServiceRestTransport._ListNasTrialDetails._get_response( self._host, @@ -6289,7 +7895,31 @@ def __call__( pb_resp = job_service.ListNasTrialDetailsResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_nas_trial_details(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = job_service.ListNasTrialDetailsResponse.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.aiplatform_v1.JobServiceClient.list_nas_trial_details", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "ListNasTrialDetails", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _PauseModelDeploymentMonitoringJob( @@ -6329,7 +7959,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 pause model deployment monitoring job method over HTTP. @@ -6341,13 +7971,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 = ( _BaseJobServiceRestTransport._BasePauseModelDeploymentMonitoringJob._get_http_options() ) + ( request, metadata, @@ -6367,6 +8000,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.aiplatform_v1.JobServiceClient.PauseModelDeploymentMonitoringJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "PauseModelDeploymentMonitoringJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = JobServiceRestTransport._PauseModelDeploymentMonitoringJob._get_response( self._host, @@ -6420,7 +8080,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 resume model deployment monitoring job method over HTTP. @@ -6432,13 +8092,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 = ( _BaseJobServiceRestTransport._BaseResumeModelDeploymentMonitoringJob._get_http_options() ) + ( request, metadata, @@ -6458,6 +8121,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.aiplatform_v1.JobServiceClient.ResumeModelDeploymentMonitoringJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "ResumeModelDeploymentMonitoringJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = JobServiceRestTransport._ResumeModelDeploymentMonitoringJob._get_response( self._host, @@ -6513,7 +8203,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]]] = (), ) -> job_service.SearchModelDeploymentMonitoringStatsAnomaliesResponse: r"""Call the search model deployment monitoring stats anomalies method over HTTP. @@ -6525,8 +8215,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: ~.job_service.SearchModelDeploymentMonitoringStatsAnomaliesResponse: @@ -6538,6 +8230,7 @@ def __call__( http_options = ( _BaseJobServiceRestTransport._BaseSearchModelDeploymentMonitoringStatsAnomalies._get_http_options() ) + ( request, metadata, @@ -6557,6 +8250,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.aiplatform_v1.JobServiceClient.SearchModelDeploymentMonitoringStatsAnomalies", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "SearchModelDeploymentMonitoringStatsAnomalies", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = JobServiceRestTransport._SearchModelDeploymentMonitoringStatsAnomalies._get_response( self._host, @@ -6582,9 +8302,33 @@ def __call__( ) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_search_model_deployment_monitoring_stats_anomalies( resp ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = job_service.SearchModelDeploymentMonitoringStatsAnomaliesResponse.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.aiplatform_v1.JobServiceClient.search_model_deployment_monitoring_stats_anomalies", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "SearchModelDeploymentMonitoringStatsAnomalies", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _UpdateModelDeploymentMonitoringJob( @@ -6624,7 +8368,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 model deployment monitoring job method over HTTP. @@ -6636,8 +8380,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: @@ -6650,6 +8396,7 @@ def __call__( http_options = ( _BaseJobServiceRestTransport._BaseUpdateModelDeploymentMonitoringJob._get_http_options() ) + ( request, metadata, @@ -6669,6 +8416,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.aiplatform_v1.JobServiceClient.UpdateModelDeploymentMonitoringJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "UpdateModelDeploymentMonitoringJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = JobServiceRestTransport._UpdateModelDeploymentMonitoringJob._get_response( self._host, @@ -6688,7 +8462,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_model_deployment_monitoring_job(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.aiplatform_v1.JobServiceClient.update_model_deployment_monitoring_job", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "UpdateModelDeploymentMonitoringJob", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp @property @@ -7065,7 +8861,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]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -7076,8 +8872,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: locations_pb2.Location: Response from GetLocation method. @@ -7086,6 +8884,7 @@ def __call__( http_options = ( _BaseJobServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = self._interceptor.pre_get_location(request, metadata) transcoded_request = ( _BaseJobServiceRestTransport._BaseGetLocation._get_transcoded_request( @@ -7100,6 +8899,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.aiplatform_v1.JobServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = JobServiceRestTransport._GetLocation._get_response( self._host, @@ -7119,6 +8945,27 @@ def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_location(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.aiplatform_v1.JobServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -7160,7 +9007,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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -7171,8 +9018,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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -7181,6 +9030,7 @@ def __call__( http_options = ( _BaseJobServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = self._interceptor.pre_list_locations(request, metadata) transcoded_request = ( _BaseJobServiceRestTransport._BaseListLocations._get_transcoded_request( @@ -7195,6 +9045,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.aiplatform_v1.JobServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = JobServiceRestTransport._ListLocations._get_response( self._host, @@ -7214,6 +9091,27 @@ def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_list_locations(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.aiplatform_v1.JobServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -7255,7 +9153,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]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -7266,8 +9164,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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -7276,6 +9176,7 @@ def __call__( http_options = ( _BaseJobServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_get_iam_policy(request, metadata) transcoded_request = ( _BaseJobServiceRestTransport._BaseGetIamPolicy._get_transcoded_request( @@ -7290,6 +9191,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.aiplatform_v1.JobServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = JobServiceRestTransport._GetIamPolicy._get_response( self._host, @@ -7309,6 +9237,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_iam_policy(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.aiplatform_v1.JobServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -7351,7 +9300,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]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -7362,8 +9311,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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -7372,6 +9323,7 @@ def __call__( http_options = ( _BaseJobServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_set_iam_policy(request, metadata) transcoded_request = ( _BaseJobServiceRestTransport._BaseSetIamPolicy._get_transcoded_request( @@ -7392,6 +9344,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.aiplatform_v1.JobServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = JobServiceRestTransport._SetIamPolicy._get_response( self._host, @@ -7412,6 +9391,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_set_iam_policy(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.aiplatform_v1.JobServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -7453,7 +9453,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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -7464,8 +9464,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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -7474,6 +9476,7 @@ def __call__( http_options = ( _BaseJobServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -7486,6 +9489,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.aiplatform_v1.JobServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = JobServiceRestTransport._TestIamPermissions._get_response( self._host, @@ -7505,6 +9535,27 @@ def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_test_iam_permissions(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.aiplatform_v1.JobServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -7546,7 +9597,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 cancel operation method over HTTP. @@ -7557,13 +9608,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 = ( _BaseJobServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = self._interceptor.pre_cancel_operation( request, metadata ) @@ -7576,6 +9630,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.aiplatform_v1.JobServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = JobServiceRestTransport._CancelOperation._get_response( self._host, @@ -7632,7 +9713,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. @@ -7643,13 +9724,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 = ( _BaseJobServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = self._interceptor.pre_delete_operation( request, metadata ) @@ -7662,6 +9746,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.aiplatform_v1.JobServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = JobServiceRestTransport._DeleteOperation._get_response( self._host, @@ -7718,7 +9829,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. @@ -7729,8 +9840,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. @@ -7739,6 +9852,7 @@ def __call__( http_options = ( _BaseJobServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = self._interceptor.pre_get_operation(request, metadata) transcoded_request = ( _BaseJobServiceRestTransport._BaseGetOperation._get_transcoded_request( @@ -7753,6 +9867,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.aiplatform_v1.JobServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = JobServiceRestTransport._GetOperation._get_response( self._host, @@ -7772,6 +9913,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.aiplatform_v1.JobServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -7813,7 +9975,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. @@ -7824,8 +9986,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. @@ -7834,6 +9998,7 @@ def __call__( http_options = ( _BaseJobServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = self._interceptor.pre_list_operations(request, metadata) transcoded_request = _BaseJobServiceRestTransport._BaseListOperations._get_transcoded_request( http_options, request @@ -7846,6 +10011,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.aiplatform_v1.JobServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = JobServiceRestTransport._ListOperations._get_response( self._host, @@ -7865,6 +10057,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.aiplatform_v1.JobServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -7906,7 +10119,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 wait operation method over HTTP. @@ -7917,8 +10130,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 WaitOperation method. @@ -7927,6 +10142,7 @@ def __call__( http_options = ( _BaseJobServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = self._interceptor.pre_wait_operation(request, metadata) transcoded_request = ( _BaseJobServiceRestTransport._BaseWaitOperation._get_transcoded_request( @@ -7941,6 +10157,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.aiplatform_v1.JobServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = JobServiceRestTransport._WaitOperation._get_response( self._host, @@ -7960,6 +10203,27 @@ def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = self._interceptor.post_wait_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.aiplatform_v1.JobServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1/services/job_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1/services/job_service/transports/rest_asyncio.py index 545bdfa92c..509ed81bd7 100644 --- a/google/cloud/aiplatform_v1/services/job_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1/services/job_service/transports/rest_asyncio.py @@ -77,6 +77,18 @@ from .base import DEFAULT_CLIENT_INFO as BASE_DEFAULT_CLIENT_INFO + +import logging + +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__) + try: OptionalRetry = Union[retries.AsyncRetry, gapic_v1.method._MethodDefault, None] except AttributeError: # pragma: NO COVER @@ -365,8 +377,11 @@ async def post_update_model_deployment_monitoring_job(self, response): async def pre_cancel_batch_prediction_job( self, request: job_service.CancelBatchPredictionJobRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[job_service.CancelBatchPredictionJobRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + job_service.CancelBatchPredictionJobRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for cancel_batch_prediction_job Override in a subclass to manipulate the request or metadata @@ -377,8 +392,10 @@ async def pre_cancel_batch_prediction_job( async def pre_cancel_custom_job( self, request: job_service.CancelCustomJobRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[job_service.CancelCustomJobRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + job_service.CancelCustomJobRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_custom_job Override in a subclass to manipulate the request or metadata @@ -389,8 +406,11 @@ async def pre_cancel_custom_job( async def pre_cancel_data_labeling_job( self, request: job_service.CancelDataLabelingJobRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[job_service.CancelDataLabelingJobRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + job_service.CancelDataLabelingJobRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for cancel_data_labeling_job Override in a subclass to manipulate the request or metadata @@ -401,9 +421,10 @@ async def pre_cancel_data_labeling_job( async def pre_cancel_hyperparameter_tuning_job( self, request: job_service.CancelHyperparameterTuningJobRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - job_service.CancelHyperparameterTuningJobRequest, Sequence[Tuple[str, str]] + job_service.CancelHyperparameterTuningJobRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for cancel_hyperparameter_tuning_job @@ -415,8 +436,10 @@ async def pre_cancel_hyperparameter_tuning_job( async def pre_cancel_nas_job( self, request: job_service.CancelNasJobRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[job_service.CancelNasJobRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + job_service.CancelNasJobRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_nas_job Override in a subclass to manipulate the request or metadata @@ -427,8 +450,11 @@ async def pre_cancel_nas_job( async def pre_create_batch_prediction_job( self, request: job_service.CreateBatchPredictionJobRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[job_service.CreateBatchPredictionJobRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + job_service.CreateBatchPredictionJobRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for create_batch_prediction_job Override in a subclass to manipulate the request or metadata @@ -450,8 +476,10 @@ async def post_create_batch_prediction_job( async def pre_create_custom_job( self, request: job_service.CreateCustomJobRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[job_service.CreateCustomJobRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + job_service.CreateCustomJobRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for create_custom_job Override in a subclass to manipulate the request or metadata @@ -473,8 +501,11 @@ async def post_create_custom_job( async def pre_create_data_labeling_job( self, request: job_service.CreateDataLabelingJobRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[job_service.CreateDataLabelingJobRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + job_service.CreateDataLabelingJobRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for create_data_labeling_job Override in a subclass to manipulate the request or metadata @@ -496,9 +527,10 @@ async def post_create_data_labeling_job( async def pre_create_hyperparameter_tuning_job( self, request: job_service.CreateHyperparameterTuningJobRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - job_service.CreateHyperparameterTuningJobRequest, Sequence[Tuple[str, str]] + job_service.CreateHyperparameterTuningJobRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for create_hyperparameter_tuning_job @@ -521,9 +553,10 @@ async def post_create_hyperparameter_tuning_job( async def pre_create_model_deployment_monitoring_job( self, request: job_service.CreateModelDeploymentMonitoringJobRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - job_service.CreateModelDeploymentMonitoringJobRequest, Sequence[Tuple[str, str]] + job_service.CreateModelDeploymentMonitoringJobRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for create_model_deployment_monitoring_job @@ -546,8 +579,10 @@ async def post_create_model_deployment_monitoring_job( async def pre_create_nas_job( self, request: job_service.CreateNasJobRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[job_service.CreateNasJobRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + job_service.CreateNasJobRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for create_nas_job Override in a subclass to manipulate the request or metadata @@ -569,8 +604,11 @@ async def post_create_nas_job( async def pre_delete_batch_prediction_job( self, request: job_service.DeleteBatchPredictionJobRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[job_service.DeleteBatchPredictionJobRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + job_service.DeleteBatchPredictionJobRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for delete_batch_prediction_job Override in a subclass to manipulate the request or metadata @@ -592,8 +630,10 @@ async def post_delete_batch_prediction_job( async def pre_delete_custom_job( self, request: job_service.DeleteCustomJobRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[job_service.DeleteCustomJobRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + job_service.DeleteCustomJobRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for delete_custom_job Override in a subclass to manipulate the request or metadata @@ -615,8 +655,11 @@ async def post_delete_custom_job( async def pre_delete_data_labeling_job( self, request: job_service.DeleteDataLabelingJobRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[job_service.DeleteDataLabelingJobRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + job_service.DeleteDataLabelingJobRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for delete_data_labeling_job Override in a subclass to manipulate the request or metadata @@ -638,9 +681,10 @@ async def post_delete_data_labeling_job( async def pre_delete_hyperparameter_tuning_job( self, request: job_service.DeleteHyperparameterTuningJobRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - job_service.DeleteHyperparameterTuningJobRequest, Sequence[Tuple[str, str]] + job_service.DeleteHyperparameterTuningJobRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for delete_hyperparameter_tuning_job @@ -663,9 +707,10 @@ async def post_delete_hyperparameter_tuning_job( async def pre_delete_model_deployment_monitoring_job( self, request: job_service.DeleteModelDeploymentMonitoringJobRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - job_service.DeleteModelDeploymentMonitoringJobRequest, Sequence[Tuple[str, str]] + job_service.DeleteModelDeploymentMonitoringJobRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for delete_model_deployment_monitoring_job @@ -688,8 +733,10 @@ async def post_delete_model_deployment_monitoring_job( async def pre_delete_nas_job( self, request: job_service.DeleteNasJobRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[job_service.DeleteNasJobRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + job_service.DeleteNasJobRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for delete_nas_job Override in a subclass to manipulate the request or metadata @@ -711,8 +758,11 @@ async def post_delete_nas_job( async def pre_get_batch_prediction_job( self, request: job_service.GetBatchPredictionJobRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[job_service.GetBatchPredictionJobRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + job_service.GetBatchPredictionJobRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for get_batch_prediction_job Override in a subclass to manipulate the request or metadata @@ -734,8 +784,10 @@ async def post_get_batch_prediction_job( async def pre_get_custom_job( self, request: job_service.GetCustomJobRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[job_service.GetCustomJobRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + job_service.GetCustomJobRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_custom_job Override in a subclass to manipulate the request or metadata @@ -757,8 +809,10 @@ async def post_get_custom_job( async def pre_get_data_labeling_job( self, request: job_service.GetDataLabelingJobRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[job_service.GetDataLabelingJobRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + job_service.GetDataLabelingJobRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_data_labeling_job Override in a subclass to manipulate the request or metadata @@ -780,9 +834,10 @@ async def post_get_data_labeling_job( async def pre_get_hyperparameter_tuning_job( self, request: job_service.GetHyperparameterTuningJobRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - job_service.GetHyperparameterTuningJobRequest, Sequence[Tuple[str, str]] + job_service.GetHyperparameterTuningJobRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for get_hyperparameter_tuning_job @@ -805,9 +860,10 @@ async def post_get_hyperparameter_tuning_job( async def pre_get_model_deployment_monitoring_job( self, request: job_service.GetModelDeploymentMonitoringJobRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - job_service.GetModelDeploymentMonitoringJobRequest, Sequence[Tuple[str, str]] + job_service.GetModelDeploymentMonitoringJobRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for get_model_deployment_monitoring_job @@ -828,8 +884,10 @@ async def post_get_model_deployment_monitoring_job( return response async def pre_get_nas_job( - self, request: job_service.GetNasJobRequest, metadata: Sequence[Tuple[str, str]] - ) -> Tuple[job_service.GetNasJobRequest, Sequence[Tuple[str, str]]]: + self, + request: job_service.GetNasJobRequest, + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[job_service.GetNasJobRequest, Sequence[Tuple[str, Union[str, bytes]]]]: """Pre-rpc interceptor for get_nas_job Override in a subclass to manipulate the request or metadata @@ -849,8 +907,10 @@ async def post_get_nas_job(self, response: nas_job.NasJob) -> nas_job.NasJob: async def pre_get_nas_trial_detail( self, request: job_service.GetNasTrialDetailRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[job_service.GetNasTrialDetailRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + job_service.GetNasTrialDetailRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_nas_trial_detail Override in a subclass to manipulate the request or metadata @@ -872,8 +932,11 @@ async def post_get_nas_trial_detail( async def pre_list_batch_prediction_jobs( self, request: job_service.ListBatchPredictionJobsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[job_service.ListBatchPredictionJobsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + job_service.ListBatchPredictionJobsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for list_batch_prediction_jobs Override in a subclass to manipulate the request or metadata @@ -895,8 +958,10 @@ async def post_list_batch_prediction_jobs( async def pre_list_custom_jobs( self, request: job_service.ListCustomJobsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[job_service.ListCustomJobsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + job_service.ListCustomJobsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_custom_jobs Override in a subclass to manipulate the request or metadata @@ -918,8 +983,10 @@ async def post_list_custom_jobs( async def pre_list_data_labeling_jobs( self, request: job_service.ListDataLabelingJobsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[job_service.ListDataLabelingJobsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + job_service.ListDataLabelingJobsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_data_labeling_jobs Override in a subclass to manipulate the request or metadata @@ -941,9 +1008,10 @@ async def post_list_data_labeling_jobs( async def pre_list_hyperparameter_tuning_jobs( self, request: job_service.ListHyperparameterTuningJobsRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - job_service.ListHyperparameterTuningJobsRequest, Sequence[Tuple[str, str]] + job_service.ListHyperparameterTuningJobsRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for list_hyperparameter_tuning_jobs @@ -966,9 +1034,10 @@ async def post_list_hyperparameter_tuning_jobs( async def pre_list_model_deployment_monitoring_jobs( self, request: job_service.ListModelDeploymentMonitoringJobsRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - job_service.ListModelDeploymentMonitoringJobsRequest, Sequence[Tuple[str, str]] + job_service.ListModelDeploymentMonitoringJobsRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for list_model_deployment_monitoring_jobs @@ -991,8 +1060,8 @@ async def post_list_model_deployment_monitoring_jobs( async def pre_list_nas_jobs( self, request: job_service.ListNasJobsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[job_service.ListNasJobsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[job_service.ListNasJobsRequest, Sequence[Tuple[str, Union[str, bytes]]]]: """Pre-rpc interceptor for list_nas_jobs Override in a subclass to manipulate the request or metadata @@ -1014,8 +1083,10 @@ async def post_list_nas_jobs( async def pre_list_nas_trial_details( self, request: job_service.ListNasTrialDetailsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[job_service.ListNasTrialDetailsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + job_service.ListNasTrialDetailsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_nas_trial_details Override in a subclass to manipulate the request or metadata @@ -1037,9 +1108,10 @@ async def post_list_nas_trial_details( async def pre_pause_model_deployment_monitoring_job( self, request: job_service.PauseModelDeploymentMonitoringJobRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - job_service.PauseModelDeploymentMonitoringJobRequest, Sequence[Tuple[str, str]] + job_service.PauseModelDeploymentMonitoringJobRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for pause_model_deployment_monitoring_job @@ -1051,9 +1123,10 @@ async def pre_pause_model_deployment_monitoring_job( async def pre_resume_model_deployment_monitoring_job( self, request: job_service.ResumeModelDeploymentMonitoringJobRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - job_service.ResumeModelDeploymentMonitoringJobRequest, Sequence[Tuple[str, str]] + job_service.ResumeModelDeploymentMonitoringJobRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for resume_model_deployment_monitoring_job @@ -1065,10 +1138,10 @@ async def pre_resume_model_deployment_monitoring_job( async def pre_search_model_deployment_monitoring_stats_anomalies( self, request: job_service.SearchModelDeploymentMonitoringStatsAnomaliesRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ job_service.SearchModelDeploymentMonitoringStatsAnomaliesRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for search_model_deployment_monitoring_stats_anomalies @@ -1092,9 +1165,10 @@ async def post_search_model_deployment_monitoring_stats_anomalies( async def pre_update_model_deployment_monitoring_job( self, request: job_service.UpdateModelDeploymentMonitoringJobRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - job_service.UpdateModelDeploymentMonitoringJobRequest, Sequence[Tuple[str, str]] + job_service.UpdateModelDeploymentMonitoringJobRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for update_model_deployment_monitoring_job @@ -1117,8 +1191,10 @@ async def post_update_model_deployment_monitoring_job( async def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -1140,8 +1216,10 @@ async def post_get_location( async def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -1163,8 +1241,10 @@ async def post_list_locations( async def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -1186,8 +1266,10 @@ async def post_get_iam_policy( async def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -1209,8 +1291,11 @@ async def post_set_iam_policy( async def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -1232,8 +1317,10 @@ async def post_test_iam_permissions( async def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -1253,8 +1340,10 @@ async def post_cancel_operation(self, response: None) -> None: async 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 @@ -1274,8 +1363,10 @@ async def post_delete_operation(self, response: None) -> None: async 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 @@ -1297,8 +1388,10 @@ async def post_get_operation( async 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 @@ -1320,8 +1413,10 @@ async def post_list_operations( async def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -1677,7 +1772,7 @@ async 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 cancel batch prediction job method over HTTP. @@ -1689,13 +1784,16 @@ async def __call__( 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`. """ http_options = ( _BaseJobServiceRestTransport._BaseCancelBatchPredictionJob._get_http_options() ) + request, metadata = await self._interceptor.pre_cancel_batch_prediction_job( request, metadata ) @@ -1712,6 +1810,33 @@ async 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.aiplatform_v1.JobServiceClient.CancelBatchPredictionJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "CancelBatchPredictionJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncJobServiceRestTransport._CancelBatchPredictionJob._get_response( self._host, @@ -1770,7 +1895,7 @@ async 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 cancel custom job method over HTTP. @@ -1781,13 +1906,16 @@ async def __call__( 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`. """ http_options = ( _BaseJobServiceRestTransport._BaseCancelCustomJob._get_http_options() ) + request, metadata = await self._interceptor.pre_cancel_custom_job( request, metadata ) @@ -1804,6 +1932,33 @@ async 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.aiplatform_v1.JobServiceClient.CancelCustomJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "CancelCustomJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncJobServiceRestTransport._CancelCustomJob._get_response( @@ -1864,7 +2019,7 @@ async 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 cancel data labeling job method over HTTP. @@ -1875,13 +2030,16 @@ async def __call__( 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`. """ http_options = ( _BaseJobServiceRestTransport._BaseCancelDataLabelingJob._get_http_options() ) + request, metadata = await self._interceptor.pre_cancel_data_labeling_job( request, metadata ) @@ -1898,6 +2056,33 @@ async 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.aiplatform_v1.JobServiceClient.CancelDataLabelingJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "CancelDataLabelingJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncJobServiceRestTransport._CancelDataLabelingJob._get_response( @@ -1959,7 +2144,7 @@ async 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 cancel hyperparameter tuning job method over HTTP. @@ -1971,13 +2156,16 @@ async def __call__( 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`. """ http_options = ( _BaseJobServiceRestTransport._BaseCancelHyperparameterTuningJob._get_http_options() ) + ( request, metadata, @@ -1997,6 +2185,33 @@ async 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.aiplatform_v1.JobServiceClient.CancelHyperparameterTuningJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "CancelHyperparameterTuningJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncJobServiceRestTransport._CancelHyperparameterTuningJob._get_response( self._host, @@ -2055,7 +2270,7 @@ async 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 cancel nas job method over HTTP. @@ -2066,13 +2281,16 @@ async def __call__( 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`. """ http_options = ( _BaseJobServiceRestTransport._BaseCancelNasJob._get_http_options() ) + request, metadata = await self._interceptor.pre_cancel_nas_job( request, metadata ) @@ -2095,6 +2313,33 @@ async 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.aiplatform_v1.JobServiceClient.CancelNasJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "CancelNasJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncJobServiceRestTransport._CancelNasJob._get_response( self._host, @@ -2154,7 +2399,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> gca_batch_prediction_job.BatchPredictionJob: r"""Call the create batch prediction job method over HTTP. @@ -2166,8 +2411,10 @@ async def __call__( 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: ~.gca_batch_prediction_job.BatchPredictionJob: @@ -2184,6 +2431,7 @@ async def __call__( http_options = ( _BaseJobServiceRestTransport._BaseCreateBatchPredictionJob._get_http_options() ) + request, metadata = await self._interceptor.pre_create_batch_prediction_job( request, metadata ) @@ -2200,6 +2448,33 @@ async 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.aiplatform_v1.JobServiceClient.CreateBatchPredictionJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "CreateBatchPredictionJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncJobServiceRestTransport._CreateBatchPredictionJob._get_response( self._host, @@ -2228,6 +2503,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_create_batch_prediction_job(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + gca_batch_prediction_job.BatchPredictionJob.to_json(response) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.JobServiceAsyncClient.create_batch_prediction_job", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "CreateBatchPredictionJob", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _CreateCustomJob( @@ -2266,7 +2565,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> gca_custom_job.CustomJob: r"""Call the create custom job method over HTTP. @@ -2277,8 +2576,10 @@ async def __call__( 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: ~.gca_custom_job.CustomJob: @@ -2296,6 +2597,7 @@ async def __call__( http_options = ( _BaseJobServiceRestTransport._BaseCreateCustomJob._get_http_options() ) + request, metadata = await self._interceptor.pre_create_custom_job( request, metadata ) @@ -2312,6 +2614,33 @@ async 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.aiplatform_v1.JobServiceClient.CreateCustomJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "CreateCustomJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncJobServiceRestTransport._CreateCustomJob._get_response( @@ -2342,6 +2671,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_create_custom_job(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gca_custom_job.CustomJob.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.JobServiceAsyncClient.create_custom_job", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "CreateCustomJob", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _CreateDataLabelingJob( @@ -2380,7 +2731,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> gca_data_labeling_job.DataLabelingJob: r"""Call the create data labeling job method over HTTP. @@ -2391,8 +2742,10 @@ async def __call__( 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: ~.gca_data_labeling_job.DataLabelingJob: @@ -2405,6 +2758,7 @@ async def __call__( http_options = ( _BaseJobServiceRestTransport._BaseCreateDataLabelingJob._get_http_options() ) + request, metadata = await self._interceptor.pre_create_data_labeling_job( request, metadata ) @@ -2421,6 +2775,33 @@ async 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.aiplatform_v1.JobServiceClient.CreateDataLabelingJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "CreateDataLabelingJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncJobServiceRestTransport._CreateDataLabelingJob._get_response( @@ -2451,6 +2832,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_create_data_labeling_job(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gca_data_labeling_job.DataLabelingJob.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.JobServiceAsyncClient.create_data_labeling_job", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "CreateDataLabelingJob", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _CreateHyperparameterTuningJob( @@ -2490,7 +2895,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> gca_hyperparameter_tuning_job.HyperparameterTuningJob: r"""Call the create hyperparameter tuning job method over HTTP. @@ -2502,8 +2907,10 @@ async def __call__( 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: ~.gca_hyperparameter_tuning_job.HyperparameterTuningJob: @@ -2517,6 +2924,7 @@ async def __call__( http_options = ( _BaseJobServiceRestTransport._BaseCreateHyperparameterTuningJob._get_http_options() ) + ( request, metadata, @@ -2536,6 +2944,33 @@ async 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.aiplatform_v1.JobServiceClient.CreateHyperparameterTuningJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "CreateHyperparameterTuningJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncJobServiceRestTransport._CreateHyperparameterTuningJob._get_response( self._host, @@ -2564,6 +2999,32 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_create_hyperparameter_tuning_job(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + gca_hyperparameter_tuning_job.HyperparameterTuningJob.to_json( + response + ) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.JobServiceAsyncClient.create_hyperparameter_tuning_job", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "CreateHyperparameterTuningJob", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _CreateModelDeploymentMonitoringJob( @@ -2605,7 +3066,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> gca_model_deployment_monitoring_job.ModelDeploymentMonitoringJob: r"""Call the create model deployment monitoring job method over HTTP. @@ -2617,8 +3078,10 @@ async def __call__( 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: ~.gca_model_deployment_monitoring_job.ModelDeploymentMonitoringJob: @@ -2633,6 +3096,7 @@ async def __call__( http_options = ( _BaseJobServiceRestTransport._BaseCreateModelDeploymentMonitoringJob._get_http_options() ) + ( request, metadata, @@ -2652,6 +3116,33 @@ async 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.aiplatform_v1.JobServiceClient.CreateModelDeploymentMonitoringJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "CreateModelDeploymentMonitoringJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncJobServiceRestTransport._CreateModelDeploymentMonitoringJob._get_response( self._host, @@ -2686,6 +3177,30 @@ async def __call__( resp = await self._interceptor.post_create_model_deployment_monitoring_job( resp ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gca_model_deployment_monitoring_job.ModelDeploymentMonitoringJob.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.JobServiceAsyncClient.create_model_deployment_monitoring_job", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "CreateModelDeploymentMonitoringJob", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _CreateNasJob( @@ -2724,7 +3239,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> gca_nas_job.NasJob: r"""Call the create nas job method over HTTP. @@ -2735,8 +3250,10 @@ async def __call__( 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: ~.gca_nas_job.NasJob: @@ -2748,6 +3265,7 @@ async def __call__( http_options = ( _BaseJobServiceRestTransport._BaseCreateNasJob._get_http_options() ) + request, metadata = await self._interceptor.pre_create_nas_job( request, metadata ) @@ -2770,6 +3288,33 @@ async 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 = 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.aiplatform_v1.JobServiceClient.CreateNasJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "CreateNasJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncJobServiceRestTransport._CreateNasJob._get_response( self._host, @@ -2798,6 +3343,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_create_nas_job(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gca_nas_job.NasJob.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.JobServiceAsyncClient.create_nas_job", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "CreateNasJob", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _DeleteBatchPredictionJob( @@ -2836,7 +3403,7 @@ async 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 batch prediction job method over HTTP. @@ -2848,8 +3415,10 @@ async def __call__( 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: @@ -2862,6 +3431,7 @@ async def __call__( http_options = ( _BaseJobServiceRestTransport._BaseDeleteBatchPredictionJob._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_batch_prediction_job( request, metadata ) @@ -2874,6 +3444,33 @@ async 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.aiplatform_v1.JobServiceClient.DeleteBatchPredictionJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "DeleteBatchPredictionJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncJobServiceRestTransport._DeleteBatchPredictionJob._get_response( self._host, @@ -2901,6 +3498,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_delete_batch_prediction_job(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.JobServiceAsyncClient.delete_batch_prediction_job", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "DeleteBatchPredictionJob", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _DeleteCustomJob( @@ -2938,7 +3557,7 @@ async 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 custom job method over HTTP. @@ -2949,8 +3568,10 @@ async def __call__( 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: @@ -2963,6 +3584,7 @@ async def __call__( http_options = ( _BaseJobServiceRestTransport._BaseDeleteCustomJob._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_custom_job( request, metadata ) @@ -2975,6 +3597,33 @@ async 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.aiplatform_v1.JobServiceClient.DeleteCustomJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "DeleteCustomJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncJobServiceRestTransport._DeleteCustomJob._get_response( @@ -3004,6 +3653,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_delete_custom_job(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.JobServiceAsyncClient.delete_custom_job", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "DeleteCustomJob", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _DeleteDataLabelingJob( @@ -3041,7 +3712,7 @@ async 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 data labeling job method over HTTP. @@ -3052,8 +3723,10 @@ async def __call__( 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: @@ -3066,6 +3739,7 @@ async def __call__( http_options = ( _BaseJobServiceRestTransport._BaseDeleteDataLabelingJob._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_data_labeling_job( request, metadata ) @@ -3078,6 +3752,33 @@ async 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.aiplatform_v1.JobServiceClient.DeleteDataLabelingJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "DeleteDataLabelingJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncJobServiceRestTransport._DeleteDataLabelingJob._get_response( @@ -3107,6 +3808,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_delete_data_labeling_job(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.JobServiceAsyncClient.delete_data_labeling_job", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "DeleteDataLabelingJob", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _DeleteHyperparameterTuningJob( @@ -3145,7 +3868,7 @@ async 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 hyperparameter tuning job method over HTTP. @@ -3157,8 +3880,10 @@ async def __call__( 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: @@ -3171,6 +3896,7 @@ async def __call__( http_options = ( _BaseJobServiceRestTransport._BaseDeleteHyperparameterTuningJob._get_http_options() ) + ( request, metadata, @@ -3186,6 +3912,33 @@ async 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.aiplatform_v1.JobServiceClient.DeleteHyperparameterTuningJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "DeleteHyperparameterTuningJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncJobServiceRestTransport._DeleteHyperparameterTuningJob._get_response( self._host, @@ -3213,6 +3966,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_delete_hyperparameter_tuning_job(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.JobServiceAsyncClient.delete_hyperparameter_tuning_job", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "DeleteHyperparameterTuningJob", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _DeleteModelDeploymentMonitoringJob( @@ -3253,7 +4028,7 @@ async 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 model deployment monitoring job method over HTTP. @@ -3265,8 +4040,10 @@ async def __call__( 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: @@ -3279,6 +4056,7 @@ async def __call__( http_options = ( _BaseJobServiceRestTransport._BaseDeleteModelDeploymentMonitoringJob._get_http_options() ) + ( request, metadata, @@ -3294,6 +4072,33 @@ async 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.aiplatform_v1.JobServiceClient.DeleteModelDeploymentMonitoringJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "DeleteModelDeploymentMonitoringJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncJobServiceRestTransport._DeleteModelDeploymentMonitoringJob._get_response( self._host, @@ -3323,6 +4128,28 @@ async def __call__( resp = await self._interceptor.post_delete_model_deployment_monitoring_job( 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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.JobServiceAsyncClient.delete_model_deployment_monitoring_job", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "DeleteModelDeploymentMonitoringJob", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _DeleteNasJob( @@ -3360,7 +4187,7 @@ async 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 nas job method over HTTP. @@ -3371,8 +4198,10 @@ async def __call__( 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: @@ -3385,6 +4214,7 @@ async def __call__( http_options = ( _BaseJobServiceRestTransport._BaseDeleteNasJob._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_nas_job( request, metadata ) @@ -3401,6 +4231,33 @@ async 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.aiplatform_v1.JobServiceClient.DeleteNasJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "DeleteNasJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncJobServiceRestTransport._DeleteNasJob._get_response( self._host, @@ -3428,6 +4285,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_delete_nas_job(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.JobServiceAsyncClient.delete_nas_job", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "DeleteNasJob", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _GetBatchPredictionJob( @@ -3465,7 +4344,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> batch_prediction_job.BatchPredictionJob: r"""Call the get batch prediction job method over HTTP. @@ -3476,8 +4355,10 @@ async def __call__( 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: ~.batch_prediction_job.BatchPredictionJob: @@ -3494,6 +4375,7 @@ async def __call__( http_options = ( _BaseJobServiceRestTransport._BaseGetBatchPredictionJob._get_http_options() ) + request, metadata = await self._interceptor.pre_get_batch_prediction_job( request, metadata ) @@ -3506,6 +4388,33 @@ async 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.aiplatform_v1.JobServiceClient.GetBatchPredictionJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "GetBatchPredictionJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncJobServiceRestTransport._GetBatchPredictionJob._get_response( @@ -3535,6 +4444,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_get_batch_prediction_job(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = batch_prediction_job.BatchPredictionJob.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.JobServiceAsyncClient.get_batch_prediction_job", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "GetBatchPredictionJob", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _GetCustomJob( @@ -3572,7 +4505,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> custom_job.CustomJob: r"""Call the get custom job method over HTTP. @@ -3583,8 +4516,10 @@ async def __call__( 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: ~.custom_job.CustomJob: @@ -3602,6 +4537,7 @@ async def __call__( http_options = ( _BaseJobServiceRestTransport._BaseGetCustomJob._get_http_options() ) + request, metadata = await self._interceptor.pre_get_custom_job( request, metadata ) @@ -3618,6 +4554,33 @@ async 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 = 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.aiplatform_v1.JobServiceClient.GetCustomJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "GetCustomJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncJobServiceRestTransport._GetCustomJob._get_response( self._host, @@ -3645,6 +4608,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_get_custom_job(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = custom_job.CustomJob.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.JobServiceAsyncClient.get_custom_job", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "GetCustomJob", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _GetDataLabelingJob( @@ -3682,7 +4667,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> data_labeling_job.DataLabelingJob: r"""Call the get data labeling job method over HTTP. @@ -3693,8 +4678,10 @@ async def __call__( 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: ~.data_labeling_job.DataLabelingJob: @@ -3707,6 +4694,7 @@ async def __call__( http_options = ( _BaseJobServiceRestTransport._BaseGetDataLabelingJob._get_http_options() ) + request, metadata = await self._interceptor.pre_get_data_labeling_job( request, metadata ) @@ -3719,6 +4707,33 @@ async 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.aiplatform_v1.JobServiceClient.GetDataLabelingJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "GetDataLabelingJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncJobServiceRestTransport._GetDataLabelingJob._get_response( @@ -3748,6 +4763,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_get_data_labeling_job(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = data_labeling_job.DataLabelingJob.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.JobServiceAsyncClient.get_data_labeling_job", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "GetDataLabelingJob", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _GetHyperparameterTuningJob( @@ -3786,7 +4825,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> hyperparameter_tuning_job.HyperparameterTuningJob: r"""Call the get hyperparameter tuning job method over HTTP. @@ -3798,8 +4837,10 @@ async def __call__( 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: ~.hyperparameter_tuning_job.HyperparameterTuningJob: @@ -3813,6 +4854,7 @@ async def __call__( http_options = ( _BaseJobServiceRestTransport._BaseGetHyperparameterTuningJob._get_http_options() ) + ( request, metadata, @@ -3828,6 +4870,33 @@ async 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.aiplatform_v1.JobServiceClient.GetHyperparameterTuningJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "GetHyperparameterTuningJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncJobServiceRestTransport._GetHyperparameterTuningJob._get_response( self._host, @@ -3855,6 +4924,32 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_get_hyperparameter_tuning_job(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + hyperparameter_tuning_job.HyperparameterTuningJob.to_json( + response + ) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.JobServiceAsyncClient.get_hyperparameter_tuning_job", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "GetHyperparameterTuningJob", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _GetModelDeploymentMonitoringJob( @@ -3893,7 +4988,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> model_deployment_monitoring_job.ModelDeploymentMonitoringJob: r"""Call the get model deployment monitoring job method over HTTP. @@ -3905,8 +5000,10 @@ async def __call__( 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: ~.model_deployment_monitoring_job.ModelDeploymentMonitoringJob: @@ -3921,6 +5018,7 @@ async def __call__( http_options = ( _BaseJobServiceRestTransport._BaseGetModelDeploymentMonitoringJob._get_http_options() ) + ( request, metadata, @@ -3936,6 +5034,33 @@ async 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.aiplatform_v1.JobServiceClient.GetModelDeploymentMonitoringJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "GetModelDeploymentMonitoringJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncJobServiceRestTransport._GetModelDeploymentMonitoringJob._get_response( self._host, @@ -3967,6 +5092,30 @@ async def __call__( resp = await self._interceptor.post_get_model_deployment_monitoring_job( resp ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = model_deployment_monitoring_job.ModelDeploymentMonitoringJob.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.JobServiceAsyncClient.get_model_deployment_monitoring_job", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "GetModelDeploymentMonitoringJob", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _GetNasJob( @@ -4004,7 +5153,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> nas_job.NasJob: r"""Call the get nas job method over HTTP. @@ -4015,8 +5164,10 @@ async def __call__( 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: ~.nas_job.NasJob: @@ -4028,6 +5179,7 @@ async def __call__( http_options = ( _BaseJobServiceRestTransport._BaseGetNasJob._get_http_options() ) + request, metadata = await self._interceptor.pre_get_nas_job( request, metadata ) @@ -4044,6 +5196,33 @@ async 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 = 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.aiplatform_v1.JobServiceClient.GetNasJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "GetNasJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncJobServiceRestTransport._GetNasJob._get_response( self._host, @@ -4071,6 +5250,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_get_nas_job(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = nas_job.NasJob.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.JobServiceAsyncClient.get_nas_job", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "GetNasJob", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _GetNasTrialDetail( @@ -4108,7 +5309,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> nas_job.NasTrialDetail: r"""Call the get nas trial detail method over HTTP. @@ -4119,8 +5320,10 @@ async def __call__( 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: ~.nas_job.NasTrialDetail: @@ -4134,6 +5337,7 @@ async def __call__( http_options = ( _BaseJobServiceRestTransport._BaseGetNasTrialDetail._get_http_options() ) + request, metadata = await self._interceptor.pre_get_nas_trial_detail( request, metadata ) @@ -4146,6 +5350,33 @@ async 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.aiplatform_v1.JobServiceClient.GetNasTrialDetail", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "GetNasTrialDetail", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncJobServiceRestTransport._GetNasTrialDetail._get_response( @@ -4175,6 +5406,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_get_nas_trial_detail(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = nas_job.NasTrialDetail.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.JobServiceAsyncClient.get_nas_trial_detail", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "GetNasTrialDetail", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ListBatchPredictionJobs( @@ -4213,7 +5466,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> job_service.ListBatchPredictionJobsResponse: r"""Call the list batch prediction jobs method over HTTP. @@ -4225,8 +5478,10 @@ async def __call__( 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: ~.job_service.ListBatchPredictionJobsResponse: @@ -4238,6 +5493,7 @@ async def __call__( http_options = ( _BaseJobServiceRestTransport._BaseListBatchPredictionJobs._get_http_options() ) + request, metadata = await self._interceptor.pre_list_batch_prediction_jobs( request, metadata ) @@ -4250,6 +5506,33 @@ async 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.aiplatform_v1.JobServiceClient.ListBatchPredictionJobs", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "ListBatchPredictionJobs", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncJobServiceRestTransport._ListBatchPredictionJobs._get_response( self._host, @@ -4277,6 +5560,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_list_batch_prediction_jobs(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + job_service.ListBatchPredictionJobsResponse.to_json(response) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.JobServiceAsyncClient.list_batch_prediction_jobs", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "ListBatchPredictionJobs", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ListCustomJobs( @@ -4314,7 +5621,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> job_service.ListCustomJobsResponse: r"""Call the list custom jobs method over HTTP. @@ -4325,8 +5632,10 @@ async def __call__( 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: ~.job_service.ListCustomJobsResponse: @@ -4338,6 +5647,7 @@ async def __call__( http_options = ( _BaseJobServiceRestTransport._BaseListCustomJobs._get_http_options() ) + request, metadata = await self._interceptor.pre_list_custom_jobs( request, metadata ) @@ -4352,6 +5662,33 @@ async 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 = 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.aiplatform_v1.JobServiceClient.ListCustomJobs", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "ListCustomJobs", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncJobServiceRestTransport._ListCustomJobs._get_response( self._host, @@ -4379,6 +5716,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_list_custom_jobs(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = job_service.ListCustomJobsResponse.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.JobServiceAsyncClient.list_custom_jobs", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "ListCustomJobs", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ListDataLabelingJobs( @@ -4416,7 +5777,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> job_service.ListDataLabelingJobsResponse: r"""Call the list data labeling jobs method over HTTP. @@ -4427,8 +5788,10 @@ async def __call__( 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: ~.job_service.ListDataLabelingJobsResponse: @@ -4440,6 +5803,7 @@ async def __call__( http_options = ( _BaseJobServiceRestTransport._BaseListDataLabelingJobs._get_http_options() ) + request, metadata = await self._interceptor.pre_list_data_labeling_jobs( request, metadata ) @@ -4452,6 +5816,33 @@ async 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.aiplatform_v1.JobServiceClient.ListDataLabelingJobs", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "ListDataLabelingJobs", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncJobServiceRestTransport._ListDataLabelingJobs._get_response( @@ -4481,6 +5872,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_list_data_labeling_jobs(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = job_service.ListDataLabelingJobsResponse.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.JobServiceAsyncClient.list_data_labeling_jobs", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "ListDataLabelingJobs", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ListHyperparameterTuningJobs( @@ -4519,7 +5934,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> job_service.ListHyperparameterTuningJobsResponse: r"""Call the list hyperparameter tuning jobs method over HTTP. @@ -4531,8 +5946,10 @@ async def __call__( 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: ~.job_service.ListHyperparameterTuningJobsResponse: @@ -4544,6 +5961,7 @@ async def __call__( http_options = ( _BaseJobServiceRestTransport._BaseListHyperparameterTuningJobs._get_http_options() ) + ( request, metadata, @@ -4559,6 +5977,33 @@ async 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.aiplatform_v1.JobServiceClient.ListHyperparameterTuningJobs", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "ListHyperparameterTuningJobs", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncJobServiceRestTransport._ListHyperparameterTuningJobs._get_response( self._host, @@ -4586,6 +6031,32 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_list_hyperparameter_tuning_jobs(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + job_service.ListHyperparameterTuningJobsResponse.to_json( + response + ) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.JobServiceAsyncClient.list_hyperparameter_tuning_jobs", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "ListHyperparameterTuningJobs", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ListModelDeploymentMonitoringJobs( @@ -4626,7 +6097,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> job_service.ListModelDeploymentMonitoringJobsResponse: r"""Call the list model deployment monitoring jobs method over HTTP. @@ -4638,8 +6109,10 @@ async def __call__( 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: ~.job_service.ListModelDeploymentMonitoringJobsResponse: @@ -4651,6 +6124,7 @@ async def __call__( http_options = ( _BaseJobServiceRestTransport._BaseListModelDeploymentMonitoringJobs._get_http_options() ) + ( request, metadata, @@ -4666,6 +6140,33 @@ async 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.aiplatform_v1.JobServiceClient.ListModelDeploymentMonitoringJobs", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "ListModelDeploymentMonitoringJobs", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncJobServiceRestTransport._ListModelDeploymentMonitoringJobs._get_response( self._host, @@ -4695,6 +6196,32 @@ async def __call__( resp = await self._interceptor.post_list_model_deployment_monitoring_jobs( resp ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + job_service.ListModelDeploymentMonitoringJobsResponse.to_json( + response + ) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.JobServiceAsyncClient.list_model_deployment_monitoring_jobs", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "ListModelDeploymentMonitoringJobs", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ListNasJobs( @@ -4732,7 +6259,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> job_service.ListNasJobsResponse: r"""Call the list nas jobs method over HTTP. @@ -4743,8 +6270,10 @@ async def __call__( 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: ~.job_service.ListNasJobsResponse: @@ -4756,6 +6285,7 @@ async def __call__( http_options = ( _BaseJobServiceRestTransport._BaseListNasJobs._get_http_options() ) + request, metadata = await self._interceptor.pre_list_nas_jobs( request, metadata ) @@ -4772,6 +6302,33 @@ async 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 = 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.aiplatform_v1.JobServiceClient.ListNasJobs", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "ListNasJobs", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncJobServiceRestTransport._ListNasJobs._get_response( self._host, @@ -4799,6 +6356,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_list_nas_jobs(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = job_service.ListNasJobsResponse.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.JobServiceAsyncClient.list_nas_jobs", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "ListNasJobs", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ListNasTrialDetails( @@ -4836,7 +6415,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> job_service.ListNasTrialDetailsResponse: r"""Call the list nas trial details method over HTTP. @@ -4847,8 +6426,10 @@ async def __call__( 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: ~.job_service.ListNasTrialDetailsResponse: @@ -4860,6 +6441,7 @@ async def __call__( http_options = ( _BaseJobServiceRestTransport._BaseListNasTrialDetails._get_http_options() ) + request, metadata = await self._interceptor.pre_list_nas_trial_details( request, metadata ) @@ -4872,6 +6454,33 @@ async 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.aiplatform_v1.JobServiceClient.ListNasTrialDetails", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "ListNasTrialDetails", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncJobServiceRestTransport._ListNasTrialDetails._get_response( @@ -4901,6 +6510,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_list_nas_trial_details(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = job_service.ListNasTrialDetailsResponse.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.JobServiceAsyncClient.list_nas_trial_details", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "ListNasTrialDetails", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _PauseModelDeploymentMonitoringJob( @@ -4942,7 +6575,7 @@ async 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 pause model deployment monitoring job method over HTTP. @@ -4954,13 +6587,16 @@ async def __call__( 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`. """ http_options = ( _BaseJobServiceRestTransport._BasePauseModelDeploymentMonitoringJob._get_http_options() ) + ( request, metadata, @@ -4980,6 +6616,33 @@ async 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.aiplatform_v1.JobServiceClient.PauseModelDeploymentMonitoringJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "PauseModelDeploymentMonitoringJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncJobServiceRestTransport._PauseModelDeploymentMonitoringJob._get_response( self._host, @@ -5041,7 +6704,7 @@ async 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 resume model deployment monitoring job method over HTTP. @@ -5053,13 +6716,16 @@ async def __call__( 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`. """ http_options = ( _BaseJobServiceRestTransport._BaseResumeModelDeploymentMonitoringJob._get_http_options() ) + ( request, metadata, @@ -5079,6 +6745,33 @@ async 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.aiplatform_v1.JobServiceClient.ResumeModelDeploymentMonitoringJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "ResumeModelDeploymentMonitoringJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncJobServiceRestTransport._ResumeModelDeploymentMonitoringJob._get_response( self._host, @@ -5140,7 +6833,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> job_service.SearchModelDeploymentMonitoringStatsAnomaliesResponse: r"""Call the search model deployment monitoring stats anomalies method over HTTP. @@ -5152,8 +6845,10 @@ async def __call__( 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: ~.job_service.SearchModelDeploymentMonitoringStatsAnomaliesResponse: @@ -5165,6 +6860,7 @@ async def __call__( http_options = ( _BaseJobServiceRestTransport._BaseSearchModelDeploymentMonitoringStatsAnomalies._get_http_options() ) + ( request, metadata, @@ -5184,6 +6880,33 @@ async 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.aiplatform_v1.JobServiceClient.SearchModelDeploymentMonitoringStatsAnomalies", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "SearchModelDeploymentMonitoringStatsAnomalies", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncJobServiceRestTransport._SearchModelDeploymentMonitoringStatsAnomalies._get_response( self._host, @@ -5218,6 +6941,30 @@ async def __call__( resp = await self._interceptor.post_search_model_deployment_monitoring_stats_anomalies( resp ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = job_service.SearchModelDeploymentMonitoringStatsAnomaliesResponse.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.JobServiceAsyncClient.search_model_deployment_monitoring_stats_anomalies", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "SearchModelDeploymentMonitoringStatsAnomalies", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _UpdateModelDeploymentMonitoringJob( @@ -5259,7 +7006,7 @@ async 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 model deployment monitoring job method over HTTP. @@ -5271,8 +7018,10 @@ async def __call__( 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: @@ -5285,6 +7034,7 @@ async def __call__( http_options = ( _BaseJobServiceRestTransport._BaseUpdateModelDeploymentMonitoringJob._get_http_options() ) + ( request, metadata, @@ -5304,6 +7054,33 @@ async 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.aiplatform_v1.JobServiceClient.UpdateModelDeploymentMonitoringJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "UpdateModelDeploymentMonitoringJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncJobServiceRestTransport._UpdateModelDeploymentMonitoringJob._get_response( self._host, @@ -5334,6 +7111,28 @@ async def __call__( resp = await self._interceptor.post_update_model_deployment_monitoring_job( 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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.JobServiceAsyncClient.update_model_deployment_monitoring_job", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "UpdateModelDeploymentMonitoringJob", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp @property @@ -7517,7 +9316,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -7528,8 +9327,10 @@ async def __call__( 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: locations_pb2.Location: Response from GetLocation method. @@ -7538,6 +9339,7 @@ async def __call__( http_options = ( _BaseJobServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_location( request, metadata ) @@ -7554,6 +9356,33 @@ async 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.aiplatform_v1.JobServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncJobServiceRestTransport._GetLocation._get_response( self._host, @@ -7579,6 +9408,27 @@ async def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_location(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.aiplatform_v1.JobServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -7620,7 +9470,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -7631,8 +9481,10 @@ async def __call__( 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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -7641,6 +9493,7 @@ async def __call__( http_options = ( _BaseJobServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_locations( request, metadata ) @@ -7657,6 +9510,33 @@ async 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.aiplatform_v1.JobServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncJobServiceRestTransport._ListLocations._get_response( self._host, @@ -7682,6 +9562,27 @@ async def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_list_locations(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.aiplatform_v1.JobServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -7723,7 +9624,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -7734,8 +9635,10 @@ async def __call__( 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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -7744,6 +9647,7 @@ async def __call__( http_options = ( _BaseJobServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_get_iam_policy( request, metadata ) @@ -7760,6 +9664,33 @@ async 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.aiplatform_v1.JobServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncJobServiceRestTransport._GetIamPolicy._get_response( self._host, @@ -7785,6 +9716,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_iam_policy(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.aiplatform_v1.JobServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -7827,7 +9779,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -7838,8 +9790,10 @@ async def __call__( 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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -7848,6 +9802,7 @@ async def __call__( http_options = ( _BaseJobServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_set_iam_policy( request, metadata ) @@ -7870,6 +9825,33 @@ async 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.aiplatform_v1.JobServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncJobServiceRestTransport._SetIamPolicy._get_response( self._host, @@ -7896,6 +9878,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_set_iam_policy(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.aiplatform_v1.JobServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -7937,7 +9940,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -7948,8 +9951,10 @@ async def __call__( 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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -7958,6 +9963,7 @@ async def __call__( http_options = ( _BaseJobServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = await self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -7970,6 +9976,33 @@ async 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.aiplatform_v1.JobServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncJobServiceRestTransport._TestIamPermissions._get_response( @@ -7997,6 +10030,27 @@ async def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_test_iam_permissions(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.aiplatform_v1.JobServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -8038,7 +10092,7 @@ async 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 cancel operation method over HTTP. @@ -8049,13 +10103,16 @@ async def __call__( 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`. """ http_options = ( _BaseJobServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_cancel_operation( request, metadata ) @@ -8068,6 +10125,33 @@ async 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.aiplatform_v1.JobServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncJobServiceRestTransport._CancelOperation._get_response( @@ -8132,7 +10216,7 @@ async 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. @@ -8143,13 +10227,16 @@ async def __call__( 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`. """ http_options = ( _BaseJobServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_operation( request, metadata ) @@ -8162,6 +10249,33 @@ async 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.aiplatform_v1.JobServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncJobServiceRestTransport._DeleteOperation._get_response( @@ -8226,7 +10340,7 @@ async 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. @@ -8237,8 +10351,10 @@ async def __call__( 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: Response from GetOperation method. @@ -8247,6 +10363,7 @@ async def __call__( http_options = ( _BaseJobServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_operation( request, metadata ) @@ -8263,6 +10380,33 @@ async 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.aiplatform_v1.JobServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncJobServiceRestTransport._GetOperation._get_response( self._host, @@ -8288,6 +10432,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1.JobServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -8329,7 +10494,7 @@ async 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. @@ -8340,8 +10505,10 @@ async def __call__( 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 from ListOperations method. @@ -8350,6 +10517,7 @@ async def __call__( http_options = ( _BaseJobServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_operations( request, metadata ) @@ -8364,6 +10532,33 @@ async 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.aiplatform_v1.JobServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncJobServiceRestTransport._ListOperations._get_response( self._host, @@ -8389,6 +10584,27 @@ async def __call__( resp = operations_pb2.ListOperationsResponse() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1.JobServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -8430,7 +10646,7 @@ async 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 wait operation method over HTTP. @@ -8441,8 +10657,10 @@ async def __call__( 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: Response from WaitOperation method. @@ -8451,6 +10669,7 @@ async def __call__( http_options = ( _BaseJobServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_wait_operation( request, metadata ) @@ -8467,6 +10686,33 @@ async 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.aiplatform_v1.JobServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncJobServiceRestTransport._WaitOperation._get_response( self._host, @@ -8492,6 +10738,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_wait_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.aiplatform_v1.JobServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.JobService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1/services/llm_utility_service/async_client.py b/google/cloud/aiplatform_v1/services/llm_utility_service/async_client.py index 0d6e2f7781..60f695b40d 100644 --- a/google/cloud/aiplatform_v1/services/llm_utility_service/async_client.py +++ b/google/cloud/aiplatform_v1/services/llm_utility_service/async_client.py @@ -13,6 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging as std_logging from collections import OrderedDict import re from typing import ( @@ -54,6 +55,15 @@ from .transports.grpc_asyncio import LlmUtilityServiceGrpcAsyncIOTransport from .client import LlmUtilityServiceClient +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 LlmUtilityServiceAsyncClient: """Service for LLM related utility functions.""" @@ -265,6 +275,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.aiplatform_v1.LlmUtilityServiceAsyncClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1.LlmUtilityService", + "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.aiplatform.v1.LlmUtilityService", + "credentialsType": None, + }, + ) + async def count_tokens( self, request: Optional[Union[prediction_service.CountTokensRequest, dict]] = None, @@ -273,7 +305,7 @@ async def count_tokens( instances: Optional[MutableSequence[struct_pb2.Value]] = 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]]] = (), ) -> prediction_service.CountTokensResponse: r"""Perform a token counting. @@ -326,8 +358,10 @@ async def sample_count_tokens(): 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.aiplatform_v1.types.CountTokensResponse: @@ -389,7 +423,7 @@ async def compute_tokens( instances: Optional[MutableSequence[struct_pb2.Value]] = 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]]] = (), ) -> llm_utility_service.ComputeTokensResponse: r"""Return a list of tokens based on the input text. @@ -445,8 +479,10 @@ async def sample_compute_tokens(): 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.aiplatform_v1.types.ComputeTokensResponse: @@ -508,7 +544,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. @@ -519,8 +555,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. @@ -561,7 +599,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. @@ -572,8 +610,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. @@ -614,7 +654,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. @@ -630,8 +670,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 """ @@ -668,7 +710,7 @@ async def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -683,8 +725,10 @@ async def cancel_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 """ @@ -721,7 +765,7 @@ async def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -738,8 +782,10 @@ async def wait_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. @@ -780,7 +826,7 @@ async def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -793,8 +839,10 @@ async def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -899,7 +947,7 @@ async def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -913,8 +961,10 @@ async def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -1019,7 +1069,7 @@ async def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -1034,8 +1084,10 @@ async def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -1079,7 +1131,7 @@ async def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -1090,8 +1142,10 @@ async def get_location( 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: ~.location_pb2.Location: Location object. @@ -1132,7 +1186,7 @@ async def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -1143,8 +1197,10 @@ async def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1/services/llm_utility_service/client.py b/google/cloud/aiplatform_v1/services/llm_utility_service/client.py index 835bc9e28b..852812f557 100644 --- a/google/cloud/aiplatform_v1/services/llm_utility_service/client.py +++ b/google/cloud/aiplatform_v1/services/llm_utility_service/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 ( @@ -48,6 +49,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.cloud.aiplatform_v1.types import llm_utility_service from google.cloud.aiplatform_v1.types import prediction_service from google.cloud.location import locations_pb2 # type: ignore @@ -622,6 +632,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( @@ -713,6 +727,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.aiplatform_v1.LlmUtilityServiceClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1.LlmUtilityService", + "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.aiplatform.v1.LlmUtilityService", + "credentialsType": None, + }, + ) + def count_tokens( self, request: Optional[Union[prediction_service.CountTokensRequest, dict]] = None, @@ -721,7 +758,7 @@ def count_tokens( instances: Optional[MutableSequence[struct_pb2.Value]] = 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]]] = (), ) -> prediction_service.CountTokensResponse: r"""Perform a token counting. @@ -774,8 +811,10 @@ def sample_count_tokens(): 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.aiplatform_v1.types.CountTokensResponse: @@ -834,7 +873,7 @@ def compute_tokens( instances: Optional[MutableSequence[struct_pb2.Value]] = 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]]] = (), ) -> llm_utility_service.ComputeTokensResponse: r"""Return a list of tokens based on the input text. @@ -890,8 +929,10 @@ def sample_compute_tokens(): 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.aiplatform_v1.types.ComputeTokensResponse: @@ -963,7 +1004,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. @@ -974,8 +1015,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. @@ -1016,7 +1059,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. @@ -1027,8 +1070,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. @@ -1069,7 +1114,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. @@ -1085,8 +1130,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 """ @@ -1123,7 +1170,7 @@ def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -1138,8 +1185,10 @@ def cancel_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 """ @@ -1176,7 +1225,7 @@ def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -1193,8 +1242,10 @@ def wait_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. @@ -1235,7 +1286,7 @@ def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -1248,8 +1299,10 @@ def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -1354,7 +1407,7 @@ def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -1368,8 +1421,10 @@ def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -1474,7 +1529,7 @@ def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -1489,8 +1544,10 @@ def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -1532,7 +1589,7 @@ def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -1543,8 +1600,10 @@ def get_location( 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: ~.location_pb2.Location: Location object. @@ -1585,7 +1644,7 @@ def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -1596,8 +1655,10 @@ def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1/services/llm_utility_service/transports/grpc.py b/google/cloud/aiplatform_v1/services/llm_utility_service/transports/grpc.py index 31234d7b83..9ef8b91291 100644 --- a/google/cloud/aiplatform_v1/services/llm_utility_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1/services/llm_utility_service/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 import warnings from typing import Callable, Dict, Optional, Sequence, Tuple, Union @@ -21,8 +24,11 @@ import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from google.cloud.aiplatform_v1.types import llm_utility_service from google.cloud.aiplatform_v1.types import prediction_service @@ -32,6 +38,81 @@ from google.longrunning import operations_pb2 # type: ignore from .base import LlmUtilityServiceTransport, DEFAULT_CLIENT_INFO +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.aiplatform.v1.LlmUtilityService", + "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.aiplatform.v1.LlmUtilityService", + "rpcName": client_call_details.method, + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class LlmUtilityServiceGrpcTransport(LlmUtilityServiceTransport): """gRPC backend transport for LlmUtilityService. @@ -185,7 +266,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 @@ -261,7 +347,7 @@ def count_tokens( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "count_tokens" not in self._stubs: - self._stubs["count_tokens"] = self.grpc_channel.unary_unary( + self._stubs["count_tokens"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.LlmUtilityService/CountTokens", request_serializer=prediction_service.CountTokensRequest.serialize, response_deserializer=prediction_service.CountTokensResponse.deserialize, @@ -290,7 +376,7 @@ def compute_tokens( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "compute_tokens" not in self._stubs: - self._stubs["compute_tokens"] = self.grpc_channel.unary_unary( + self._stubs["compute_tokens"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.LlmUtilityService/ComputeTokens", request_serializer=llm_utility_service.ComputeTokensRequest.serialize, response_deserializer=llm_utility_service.ComputeTokensResponse.deserialize, @@ -298,7 +384,7 @@ def compute_tokens( return self._stubs["compute_tokens"] def close(self): - self.grpc_channel.close() + self._logged_channel.close() @property def delete_operation( @@ -310,7 +396,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, @@ -327,7 +413,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -344,7 +430,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -361,7 +447,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, @@ -380,7 +466,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, @@ -399,7 +485,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -416,7 +502,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -441,7 +527,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -467,7 +553,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -496,7 +582,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1/services/llm_utility_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1/services/llm_utility_service/transports/grpc_asyncio.py index 406b0bab99..7fc6cf561d 100644 --- a/google/cloud/aiplatform_v1/services/llm_utility_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1/services/llm_utility_service/transports/grpc_asyncio.py @@ -14,6 +14,9 @@ # limitations under the License. # import inspect +import json +import pickle +import logging as std_logging import warnings from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union @@ -23,8 +26,11 @@ from google.api_core import retry_async as retries from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from grpc.experimental import aio # type: ignore from google.cloud.aiplatform_v1.types import llm_utility_service @@ -36,6 +42,82 @@ from .base import LlmUtilityServiceTransport, DEFAULT_CLIENT_INFO from .grpc import LlmUtilityServiceGrpcTransport +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.aiplatform.v1.LlmUtilityService", + "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.aiplatform.v1.LlmUtilityService", + "rpcName": str(client_call_details.method), + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class LlmUtilityServiceGrpcAsyncIOTransport(LlmUtilityServiceTransport): """gRPC AsyncIO backend transport for LlmUtilityService. @@ -232,10 +314,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 @@ -270,7 +355,7 @@ def count_tokens( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "count_tokens" not in self._stubs: - self._stubs["count_tokens"] = self.grpc_channel.unary_unary( + self._stubs["count_tokens"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.LlmUtilityService/CountTokens", request_serializer=prediction_service.CountTokensRequest.serialize, response_deserializer=prediction_service.CountTokensResponse.deserialize, @@ -299,7 +384,7 @@ def compute_tokens( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "compute_tokens" not in self._stubs: - self._stubs["compute_tokens"] = self.grpc_channel.unary_unary( + self._stubs["compute_tokens"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.LlmUtilityService/ComputeTokens", request_serializer=llm_utility_service.ComputeTokensRequest.serialize, response_deserializer=llm_utility_service.ComputeTokensResponse.deserialize, @@ -377,7 +462,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: @@ -393,7 +478,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, @@ -410,7 +495,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -427,7 +512,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -444,7 +529,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, @@ -463,7 +548,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, @@ -482,7 +567,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -499,7 +584,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -524,7 +609,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -550,7 +635,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -579,7 +664,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1/services/llm_utility_service/transports/rest.py b/google/cloud/aiplatform_v1/services/llm_utility_service/transports/rest.py index b1a9e31e52..2f2e854c77 100644 --- a/google/cloud/aiplatform_v1/services/llm_utility_service/transports/rest.py +++ b/google/cloud/aiplatform_v1/services/llm_utility_service/transports/rest.py @@ -13,9 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging +import json # type: ignore from google.auth.transport.requests import AuthorizedSession # type: ignore -import json # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.api_core import exceptions as core_exceptions from google.api_core import retry as retries @@ -47,6 +48,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, @@ -95,8 +104,11 @@ def post_count_tokens(self, response): def pre_compute_tokens( self, request: llm_utility_service.ComputeTokensRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[llm_utility_service.ComputeTokensRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + llm_utility_service.ComputeTokensRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for compute_tokens Override in a subclass to manipulate the request or metadata @@ -118,8 +130,10 @@ def post_compute_tokens( def pre_count_tokens( self, request: prediction_service.CountTokensRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[prediction_service.CountTokensRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + prediction_service.CountTokensRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for count_tokens Override in a subclass to manipulate the request or metadata @@ -141,8 +155,10 @@ def post_count_tokens( def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -164,8 +180,10 @@ def post_get_location( def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -187,8 +205,10 @@ def post_list_locations( def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -208,8 +228,10 @@ def post_get_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -229,8 +251,11 @@ def post_set_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -252,8 +277,10 @@ def post_test_iam_permissions( def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -273,8 +300,10 @@ def post_cancel_operation(self, response: None) -> None: 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 @@ -294,8 +323,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 @@ -317,8 +348,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 @@ -340,8 +373,10 @@ def post_list_operations( def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -484,7 +519,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]]] = (), ) -> llm_utility_service.ComputeTokensResponse: r"""Call the compute tokens method over HTTP. @@ -495,8 +530,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: ~.llm_utility_service.ComputeTokensResponse: @@ -508,6 +545,7 @@ def __call__( http_options = ( _BaseLlmUtilityServiceRestTransport._BaseComputeTokens._get_http_options() ) + request, metadata = self._interceptor.pre_compute_tokens(request, metadata) transcoded_request = _BaseLlmUtilityServiceRestTransport._BaseComputeTokens._get_transcoded_request( http_options, request @@ -522,6 +560,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.aiplatform_v1.LlmUtilityServiceClient.ComputeTokens", + extra={ + "serviceName": "google.cloud.aiplatform.v1.LlmUtilityService", + "rpcName": "ComputeTokens", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = LlmUtilityServiceRestTransport._ComputeTokens._get_response( self._host, @@ -543,7 +608,31 @@ def __call__( pb_resp = llm_utility_service.ComputeTokensResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_compute_tokens(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + llm_utility_service.ComputeTokensResponse.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.aiplatform_v1.LlmUtilityServiceClient.compute_tokens", + extra={ + "serviceName": "google.cloud.aiplatform.v1.LlmUtilityService", + "rpcName": "ComputeTokens", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _CountTokens( @@ -582,7 +671,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]]] = (), ) -> prediction_service.CountTokensResponse: r"""Call the count tokens method over HTTP. @@ -592,8 +681,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: ~.prediction_service.CountTokensResponse: @@ -603,6 +694,7 @@ def __call__( http_options = ( _BaseLlmUtilityServiceRestTransport._BaseCountTokens._get_http_options() ) + request, metadata = self._interceptor.pre_count_tokens(request, metadata) transcoded_request = _BaseLlmUtilityServiceRestTransport._BaseCountTokens._get_transcoded_request( http_options, request @@ -617,6 +709,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.aiplatform_v1.LlmUtilityServiceClient.CountTokens", + extra={ + "serviceName": "google.cloud.aiplatform.v1.LlmUtilityService", + "rpcName": "CountTokens", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = LlmUtilityServiceRestTransport._CountTokens._get_response( self._host, @@ -638,7 +757,31 @@ def __call__( pb_resp = prediction_service.CountTokensResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_count_tokens(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = prediction_service.CountTokensResponse.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.aiplatform_v1.LlmUtilityServiceClient.count_tokens", + extra={ + "serviceName": "google.cloud.aiplatform.v1.LlmUtilityService", + "rpcName": "CountTokens", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp @property @@ -701,7 +844,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]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -712,8 +855,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: locations_pb2.Location: Response from GetLocation method. @@ -722,6 +867,7 @@ def __call__( http_options = ( _BaseLlmUtilityServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = self._interceptor.pre_get_location(request, metadata) transcoded_request = _BaseLlmUtilityServiceRestTransport._BaseGetLocation._get_transcoded_request( http_options, request @@ -732,6 +878,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.aiplatform_v1.LlmUtilityServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.LlmUtilityService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = LlmUtilityServiceRestTransport._GetLocation._get_response( self._host, @@ -751,6 +924,27 @@ def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_location(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.aiplatform_v1.LlmUtilityServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.LlmUtilityService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -793,7 +987,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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -804,8 +998,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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -814,6 +1010,7 @@ def __call__( http_options = ( _BaseLlmUtilityServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = self._interceptor.pre_list_locations(request, metadata) transcoded_request = _BaseLlmUtilityServiceRestTransport._BaseListLocations._get_transcoded_request( http_options, request @@ -824,6 +1021,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.aiplatform_v1.LlmUtilityServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.LlmUtilityService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = LlmUtilityServiceRestTransport._ListLocations._get_response( self._host, @@ -843,6 +1067,27 @@ def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_list_locations(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.aiplatform_v1.LlmUtilityServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.LlmUtilityService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -884,7 +1129,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]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -895,8 +1140,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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -905,6 +1152,7 @@ def __call__( http_options = ( _BaseLlmUtilityServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_get_iam_policy(request, metadata) transcoded_request = _BaseLlmUtilityServiceRestTransport._BaseGetIamPolicy._get_transcoded_request( http_options, request @@ -915,6 +1163,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.aiplatform_v1.LlmUtilityServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.LlmUtilityService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = LlmUtilityServiceRestTransport._GetIamPolicy._get_response( self._host, @@ -934,6 +1209,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_iam_policy(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.aiplatform_v1.LlmUtilityServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.LlmUtilityService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -976,7 +1272,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]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -987,8 +1283,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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -997,6 +1295,7 @@ def __call__( http_options = ( _BaseLlmUtilityServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_set_iam_policy(request, metadata) transcoded_request = _BaseLlmUtilityServiceRestTransport._BaseSetIamPolicy._get_transcoded_request( http_options, request @@ -1011,6 +1310,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.aiplatform_v1.LlmUtilityServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.LlmUtilityService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = LlmUtilityServiceRestTransport._SetIamPolicy._get_response( self._host, @@ -1031,6 +1357,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_set_iam_policy(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.aiplatform_v1.LlmUtilityServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.LlmUtilityService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1073,7 +1420,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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -1084,8 +1431,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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -1094,6 +1443,7 @@ def __call__( http_options = ( _BaseLlmUtilityServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -1106,6 +1456,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.aiplatform_v1.LlmUtilityServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.LlmUtilityService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = LlmUtilityServiceRestTransport._TestIamPermissions._get_response( self._host, @@ -1125,6 +1502,27 @@ def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_test_iam_permissions(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.aiplatform_v1.LlmUtilityServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.LlmUtilityService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1167,7 +1565,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 cancel operation method over HTTP. @@ -1178,13 +1576,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 = ( _BaseLlmUtilityServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = self._interceptor.pre_cancel_operation( request, metadata ) @@ -1197,6 +1598,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.aiplatform_v1.LlmUtilityServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.LlmUtilityService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = LlmUtilityServiceRestTransport._CancelOperation._get_response( self._host, @@ -1254,7 +1682,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. @@ -1265,13 +1693,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 = ( _BaseLlmUtilityServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = self._interceptor.pre_delete_operation( request, metadata ) @@ -1284,6 +1715,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.aiplatform_v1.LlmUtilityServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.LlmUtilityService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = LlmUtilityServiceRestTransport._DeleteOperation._get_response( self._host, @@ -1340,7 +1798,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. @@ -1351,8 +1809,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. @@ -1361,6 +1821,7 @@ def __call__( http_options = ( _BaseLlmUtilityServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = self._interceptor.pre_get_operation(request, metadata) transcoded_request = _BaseLlmUtilityServiceRestTransport._BaseGetOperation._get_transcoded_request( http_options, request @@ -1371,6 +1832,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.aiplatform_v1.LlmUtilityServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.LlmUtilityService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = LlmUtilityServiceRestTransport._GetOperation._get_response( self._host, @@ -1390,6 +1878,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.aiplatform_v1.LlmUtilityServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.LlmUtilityService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1432,7 +1941,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. @@ -1443,8 +1952,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. @@ -1453,6 +1964,7 @@ def __call__( http_options = ( _BaseLlmUtilityServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = self._interceptor.pre_list_operations(request, metadata) transcoded_request = _BaseLlmUtilityServiceRestTransport._BaseListOperations._get_transcoded_request( http_options, request @@ -1463,6 +1975,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.aiplatform_v1.LlmUtilityServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.LlmUtilityService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = LlmUtilityServiceRestTransport._ListOperations._get_response( self._host, @@ -1482,6 +2021,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.aiplatform_v1.LlmUtilityServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.LlmUtilityService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1524,7 +2084,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 wait operation method over HTTP. @@ -1535,8 +2095,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 WaitOperation method. @@ -1545,6 +2107,7 @@ def __call__( http_options = ( _BaseLlmUtilityServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = self._interceptor.pre_wait_operation(request, metadata) transcoded_request = _BaseLlmUtilityServiceRestTransport._BaseWaitOperation._get_transcoded_request( http_options, request @@ -1555,6 +2118,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.aiplatform_v1.LlmUtilityServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.LlmUtilityService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = LlmUtilityServiceRestTransport._WaitOperation._get_response( self._host, @@ -1574,6 +2164,27 @@ def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = self._interceptor.post_wait_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.aiplatform_v1.LlmUtilityServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.LlmUtilityService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1/services/llm_utility_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1/services/llm_utility_service/transports/rest_asyncio.py index b49be6ab5b..4d1c7daaeb 100644 --- a/google/cloud/aiplatform_v1/services/llm_utility_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1/services/llm_utility_service/transports/rest_asyncio.py @@ -57,6 +57,18 @@ from .base import DEFAULT_CLIENT_INFO as BASE_DEFAULT_CLIENT_INFO + +import logging + +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__) + try: OptionalRetry = Union[retries.AsyncRetry, gapic_v1.method._MethodDefault, None] except AttributeError: # pragma: NO COVER @@ -109,8 +121,11 @@ async def post_count_tokens(self, response): async def pre_compute_tokens( self, request: llm_utility_service.ComputeTokensRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[llm_utility_service.ComputeTokensRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + llm_utility_service.ComputeTokensRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for compute_tokens Override in a subclass to manipulate the request or metadata @@ -132,8 +147,10 @@ async def post_compute_tokens( async def pre_count_tokens( self, request: prediction_service.CountTokensRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[prediction_service.CountTokensRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + prediction_service.CountTokensRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for count_tokens Override in a subclass to manipulate the request or metadata @@ -155,8 +172,10 @@ async def post_count_tokens( async def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -178,8 +197,10 @@ async def post_get_location( async def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -201,8 +222,10 @@ async def post_list_locations( async def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -224,8 +247,10 @@ async def post_get_iam_policy( async def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -247,8 +272,11 @@ async def post_set_iam_policy( async def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -270,8 +298,10 @@ async def post_test_iam_permissions( async def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -291,8 +321,10 @@ async def post_cancel_operation(self, response: None) -> None: async 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 @@ -312,8 +344,10 @@ async def post_delete_operation(self, response: None) -> None: async 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 @@ -335,8 +369,10 @@ async def post_get_operation( async 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 @@ -358,8 +394,10 @@ async def post_list_operations( async def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -547,7 +585,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> llm_utility_service.ComputeTokensResponse: r"""Call the compute tokens method over HTTP. @@ -558,8 +596,10 @@ async def __call__( 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: ~.llm_utility_service.ComputeTokensResponse: @@ -571,6 +611,7 @@ async def __call__( http_options = ( _BaseLlmUtilityServiceRestTransport._BaseComputeTokens._get_http_options() ) + request, metadata = await self._interceptor.pre_compute_tokens( request, metadata ) @@ -587,6 +628,33 @@ async 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.aiplatform_v1.LlmUtilityServiceClient.ComputeTokens", + extra={ + "serviceName": "google.cloud.aiplatform.v1.LlmUtilityService", + "rpcName": "ComputeTokens", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncLlmUtilityServiceRestTransport._ComputeTokens._get_response( @@ -617,6 +685,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_compute_tokens(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + llm_utility_service.ComputeTokensResponse.to_json(response) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.LlmUtilityServiceAsyncClient.compute_tokens", + extra={ + "serviceName": "google.cloud.aiplatform.v1.LlmUtilityService", + "rpcName": "ComputeTokens", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _CountTokens( @@ -656,7 +748,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> prediction_service.CountTokensResponse: r"""Call the count tokens method over HTTP. @@ -666,8 +758,10 @@ async def __call__( 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: ~.prediction_service.CountTokensResponse: @@ -677,6 +771,7 @@ async def __call__( http_options = ( _BaseLlmUtilityServiceRestTransport._BaseCountTokens._get_http_options() ) + request, metadata = await self._interceptor.pre_count_tokens( request, metadata ) @@ -693,6 +788,33 @@ async 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.aiplatform_v1.LlmUtilityServiceClient.CountTokens", + extra={ + "serviceName": "google.cloud.aiplatform.v1.LlmUtilityService", + "rpcName": "CountTokens", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncLlmUtilityServiceRestTransport._CountTokens._get_response( @@ -723,6 +845,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_count_tokens(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = prediction_service.CountTokensResponse.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.LlmUtilityServiceAsyncClient.count_tokens", + extra={ + "serviceName": "google.cloud.aiplatform.v1.LlmUtilityService", + "rpcName": "CountTokens", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp @property @@ -782,7 +928,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -793,8 +939,10 @@ async def __call__( 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: locations_pb2.Location: Response from GetLocation method. @@ -803,6 +951,7 @@ async def __call__( http_options = ( _BaseLlmUtilityServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_location( request, metadata ) @@ -815,6 +964,33 @@ async 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.aiplatform_v1.LlmUtilityServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.LlmUtilityService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncLlmUtilityServiceRestTransport._GetLocation._get_response( @@ -842,6 +1018,27 @@ async def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_location(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.aiplatform_v1.LlmUtilityServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.LlmUtilityService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -884,7 +1081,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -895,8 +1092,10 @@ async def __call__( 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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -905,6 +1104,7 @@ async def __call__( http_options = ( _BaseLlmUtilityServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_locations( request, metadata ) @@ -917,6 +1117,33 @@ async 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.aiplatform_v1.LlmUtilityServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.LlmUtilityService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncLlmUtilityServiceRestTransport._ListLocations._get_response( @@ -944,6 +1171,27 @@ async def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_list_locations(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.aiplatform_v1.LlmUtilityServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.LlmUtilityService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -986,7 +1234,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -997,8 +1245,10 @@ async def __call__( 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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -1007,6 +1257,7 @@ async def __call__( http_options = ( _BaseLlmUtilityServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_get_iam_policy( request, metadata ) @@ -1019,6 +1270,33 @@ async 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.aiplatform_v1.LlmUtilityServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.LlmUtilityService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncLlmUtilityServiceRestTransport._GetIamPolicy._get_response( @@ -1046,6 +1324,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_iam_policy(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.aiplatform_v1.LlmUtilityServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.LlmUtilityService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1089,7 +1388,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -1100,8 +1399,10 @@ async def __call__( 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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -1110,6 +1411,7 @@ async def __call__( http_options = ( _BaseLlmUtilityServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_set_iam_policy( request, metadata ) @@ -1126,6 +1428,33 @@ async 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.aiplatform_v1.LlmUtilityServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.LlmUtilityService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncLlmUtilityServiceRestTransport._SetIamPolicy._get_response( @@ -1154,6 +1483,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_set_iam_policy(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.aiplatform_v1.LlmUtilityServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.LlmUtilityService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1196,7 +1546,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -1207,8 +1557,10 @@ async def __call__( 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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -1217,6 +1569,7 @@ async def __call__( http_options = ( _BaseLlmUtilityServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = await self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -1229,6 +1582,33 @@ async 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.aiplatform_v1.LlmUtilityServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.LlmUtilityService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncLlmUtilityServiceRestTransport._TestIamPermissions._get_response( self._host, @@ -1254,6 +1634,27 @@ async def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_test_iam_permissions(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.aiplatform_v1.LlmUtilityServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.LlmUtilityService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1296,7 +1697,7 @@ async 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 cancel operation method over HTTP. @@ -1307,13 +1708,16 @@ async def __call__( 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`. """ http_options = ( _BaseLlmUtilityServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_cancel_operation( request, metadata ) @@ -1326,6 +1730,33 @@ async 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.aiplatform_v1.LlmUtilityServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.LlmUtilityService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncLlmUtilityServiceRestTransport._CancelOperation._get_response( self._host, @@ -1389,7 +1820,7 @@ async 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. @@ -1400,13 +1831,16 @@ async def __call__( 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`. """ http_options = ( _BaseLlmUtilityServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_operation( request, metadata ) @@ -1419,6 +1853,33 @@ async 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.aiplatform_v1.LlmUtilityServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.LlmUtilityService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncLlmUtilityServiceRestTransport._DeleteOperation._get_response( self._host, @@ -1482,7 +1943,7 @@ async 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. @@ -1493,8 +1954,10 @@ async def __call__( 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: Response from GetOperation method. @@ -1503,6 +1966,7 @@ async def __call__( http_options = ( _BaseLlmUtilityServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_operation( request, metadata ) @@ -1515,6 +1979,33 @@ async 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.aiplatform_v1.LlmUtilityServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.LlmUtilityService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncLlmUtilityServiceRestTransport._GetOperation._get_response( @@ -1542,6 +2033,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1.LlmUtilityServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.LlmUtilityService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1584,7 +2096,7 @@ async 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. @@ -1595,8 +2107,10 @@ async def __call__( 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 from ListOperations method. @@ -1605,6 +2119,7 @@ async def __call__( http_options = ( _BaseLlmUtilityServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_operations( request, metadata ) @@ -1617,6 +2132,33 @@ async 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.aiplatform_v1.LlmUtilityServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.LlmUtilityService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncLlmUtilityServiceRestTransport._ListOperations._get_response( @@ -1644,6 +2186,27 @@ async def __call__( resp = operations_pb2.ListOperationsResponse() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1.LlmUtilityServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.LlmUtilityService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1686,7 +2249,7 @@ async 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 wait operation method over HTTP. @@ -1697,8 +2260,10 @@ async def __call__( 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: Response from WaitOperation method. @@ -1707,6 +2272,7 @@ async def __call__( http_options = ( _BaseLlmUtilityServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_wait_operation( request, metadata ) @@ -1719,6 +2285,33 @@ async 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.aiplatform_v1.LlmUtilityServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.LlmUtilityService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncLlmUtilityServiceRestTransport._WaitOperation._get_response( @@ -1746,6 +2339,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_wait_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.aiplatform_v1.LlmUtilityServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.LlmUtilityService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1/services/match_service/async_client.py b/google/cloud/aiplatform_v1/services/match_service/async_client.py index 30979052bd..32302ae228 100644 --- a/google/cloud/aiplatform_v1/services/match_service/async_client.py +++ b/google/cloud/aiplatform_v1/services/match_service/async_client.py @@ -13,6 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging as std_logging from collections import OrderedDict import re from typing import ( @@ -53,6 +54,15 @@ from .transports.grpc_asyncio import MatchServiceGrpcAsyncIOTransport from .client import MatchServiceClient +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 MatchServiceAsyncClient: """MatchService is a Google managed service for efficient vector @@ -258,13 +268,35 @@ 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.aiplatform_v1.MatchServiceAsyncClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MatchService", + "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.aiplatform.v1.MatchService", + "credentialsType": None, + }, + ) + async def find_neighbors( self, request: Optional[Union[match_service.FindNeighborsRequest, dict]] = 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]]] = (), ) -> match_service.FindNeighborsResponse: r"""Finds the nearest neighbors of each vector within the request. @@ -302,8 +334,10 @@ async def sample_find_neighbors(): 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.aiplatform_v1.types.FindNeighborsResponse: @@ -351,7 +385,7 @@ async def read_index_datapoints( *, 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]]] = (), ) -> match_service.ReadIndexDatapointsResponse: r"""Reads the datapoints/vectors of the given IDs. A maximum of 1000 datapoints can be retrieved in a @@ -390,8 +424,10 @@ async def sample_read_index_datapoints(): 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.aiplatform_v1.types.ReadIndexDatapointsResponse: @@ -439,7 +475,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. @@ -450,8 +486,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. @@ -492,7 +530,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. @@ -503,8 +541,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. @@ -545,7 +585,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. @@ -561,8 +601,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 """ @@ -599,7 +641,7 @@ async def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -614,8 +656,10 @@ async def cancel_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 """ @@ -652,7 +696,7 @@ async def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -669,8 +713,10 @@ async def wait_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. @@ -711,7 +757,7 @@ async def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -724,8 +770,10 @@ async def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -830,7 +878,7 @@ async def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -844,8 +892,10 @@ async def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -950,7 +1000,7 @@ async def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -965,8 +1015,10 @@ async def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -1010,7 +1062,7 @@ async def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -1021,8 +1073,10 @@ async def get_location( 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: ~.location_pb2.Location: Location object. @@ -1063,7 +1117,7 @@ async def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -1074,8 +1128,10 @@ async def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1/services/match_service/client.py b/google/cloud/aiplatform_v1/services/match_service/client.py index 3cf5a3011b..49d424c2b6 100644 --- a/google/cloud/aiplatform_v1/services/match_service/client.py +++ b/google/cloud/aiplatform_v1/services/match_service/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 ( @@ -48,6 +49,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.cloud.aiplatform_v1.types import index from google.cloud.aiplatform_v1.types import match_service from google.cloud.location import locations_pb2 # type: ignore @@ -595,6 +605,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( @@ -682,13 +696,36 @@ 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.aiplatform_v1.MatchServiceClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MatchService", + "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.aiplatform.v1.MatchService", + "credentialsType": None, + }, + ) + def find_neighbors( self, request: Optional[Union[match_service.FindNeighborsRequest, dict]] = 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]]] = (), ) -> match_service.FindNeighborsResponse: r"""Finds the nearest neighbors of each vector within the request. @@ -726,8 +763,10 @@ def sample_find_neighbors(): 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.aiplatform_v1.types.FindNeighborsResponse: @@ -773,7 +812,7 @@ def read_index_datapoints( *, 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]]] = (), ) -> match_service.ReadIndexDatapointsResponse: r"""Reads the datapoints/vectors of the given IDs. A maximum of 1000 datapoints can be retrieved in a @@ -812,8 +851,10 @@ def sample_read_index_datapoints(): 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.aiplatform_v1.types.ReadIndexDatapointsResponse: @@ -872,7 +913,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. @@ -883,8 +924,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. @@ -925,7 +968,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. @@ -936,8 +979,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. @@ -978,7 +1023,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. @@ -994,8 +1039,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 """ @@ -1032,7 +1079,7 @@ def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -1047,8 +1094,10 @@ def cancel_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 """ @@ -1085,7 +1134,7 @@ def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -1102,8 +1151,10 @@ def wait_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. @@ -1144,7 +1195,7 @@ def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -1157,8 +1208,10 @@ def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -1263,7 +1316,7 @@ def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -1277,8 +1330,10 @@ def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -1383,7 +1438,7 @@ def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -1398,8 +1453,10 @@ def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -1441,7 +1498,7 @@ def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -1452,8 +1509,10 @@ def get_location( 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: ~.location_pb2.Location: Location object. @@ -1494,7 +1553,7 @@ def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -1505,8 +1564,10 @@ def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1/services/match_service/transports/grpc.py b/google/cloud/aiplatform_v1/services/match_service/transports/grpc.py index 07419ab8bc..5629478cf5 100644 --- a/google/cloud/aiplatform_v1/services/match_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1/services/match_service/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 import warnings from typing import Callable, Dict, Optional, Sequence, Tuple, Union @@ -21,8 +24,11 @@ import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from google.cloud.aiplatform_v1.types import match_service from google.cloud.location import locations_pb2 # type: ignore @@ -31,6 +37,81 @@ from google.longrunning import operations_pb2 # type: ignore from .base import MatchServiceTransport, DEFAULT_CLIENT_INFO +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.aiplatform.v1.MatchService", + "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.aiplatform.v1.MatchService", + "rpcName": client_call_details.method, + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class MatchServiceGrpcTransport(MatchServiceTransport): """gRPC backend transport for MatchService. @@ -185,7 +266,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 @@ -262,7 +348,7 @@ def find_neighbors( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "find_neighbors" not in self._stubs: - self._stubs["find_neighbors"] = self.grpc_channel.unary_unary( + self._stubs["find_neighbors"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.MatchService/FindNeighbors", request_serializer=match_service.FindNeighborsRequest.serialize, response_deserializer=match_service.FindNeighborsResponse.deserialize, @@ -293,7 +379,7 @@ def read_index_datapoints( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "read_index_datapoints" not in self._stubs: - self._stubs["read_index_datapoints"] = self.grpc_channel.unary_unary( + self._stubs["read_index_datapoints"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.MatchService/ReadIndexDatapoints", request_serializer=match_service.ReadIndexDatapointsRequest.serialize, response_deserializer=match_service.ReadIndexDatapointsResponse.deserialize, @@ -301,7 +387,7 @@ def read_index_datapoints( return self._stubs["read_index_datapoints"] def close(self): - self.grpc_channel.close() + self._logged_channel.close() @property def delete_operation( @@ -313,7 +399,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, @@ -330,7 +416,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -347,7 +433,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -364,7 +450,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, @@ -383,7 +469,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, @@ -402,7 +488,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -419,7 +505,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -444,7 +530,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -470,7 +556,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -499,7 +585,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1/services/match_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1/services/match_service/transports/grpc_asyncio.py index f8fe8e30af..f7f8b526f9 100644 --- a/google/cloud/aiplatform_v1/services/match_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1/services/match_service/transports/grpc_asyncio.py @@ -14,6 +14,9 @@ # limitations under the License. # import inspect +import json +import pickle +import logging as std_logging import warnings from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union @@ -23,8 +26,11 @@ from google.api_core import retry_async as retries from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from grpc.experimental import aio # type: ignore from google.cloud.aiplatform_v1.types import match_service @@ -35,6 +41,82 @@ from .base import MatchServiceTransport, DEFAULT_CLIENT_INFO from .grpc import MatchServiceGrpcTransport +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.aiplatform.v1.MatchService", + "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.aiplatform.v1.MatchService", + "rpcName": str(client_call_details.method), + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class MatchServiceGrpcAsyncIOTransport(MatchServiceTransport): """gRPC AsyncIO backend transport for MatchService. @@ -232,10 +314,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 @@ -271,7 +356,7 @@ def find_neighbors( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "find_neighbors" not in self._stubs: - self._stubs["find_neighbors"] = self.grpc_channel.unary_unary( + self._stubs["find_neighbors"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.MatchService/FindNeighbors", request_serializer=match_service.FindNeighborsRequest.serialize, response_deserializer=match_service.FindNeighborsResponse.deserialize, @@ -302,7 +387,7 @@ def read_index_datapoints( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "read_index_datapoints" not in self._stubs: - self._stubs["read_index_datapoints"] = self.grpc_channel.unary_unary( + self._stubs["read_index_datapoints"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.MatchService/ReadIndexDatapoints", request_serializer=match_service.ReadIndexDatapointsRequest.serialize, response_deserializer=match_service.ReadIndexDatapointsResponse.deserialize, @@ -380,7 +465,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: @@ -396,7 +481,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, @@ -413,7 +498,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -430,7 +515,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -447,7 +532,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, @@ -466,7 +551,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, @@ -485,7 +570,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -502,7 +587,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -527,7 +612,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -553,7 +638,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -582,7 +667,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1/services/match_service/transports/rest.py b/google/cloud/aiplatform_v1/services/match_service/transports/rest.py index 663e107a1a..7ee3ea6e99 100644 --- a/google/cloud/aiplatform_v1/services/match_service/transports/rest.py +++ b/google/cloud/aiplatform_v1/services/match_service/transports/rest.py @@ -13,9 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging +import json # type: ignore from google.auth.transport.requests import AuthorizedSession # type: ignore -import json # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.api_core import exceptions as core_exceptions from google.api_core import retry as retries @@ -46,6 +47,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, @@ -94,8 +103,10 @@ def post_read_index_datapoints(self, response): def pre_find_neighbors( self, request: match_service.FindNeighborsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[match_service.FindNeighborsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + match_service.FindNeighborsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for find_neighbors Override in a subclass to manipulate the request or metadata @@ -117,8 +128,11 @@ def post_find_neighbors( def pre_read_index_datapoints( self, request: match_service.ReadIndexDatapointsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[match_service.ReadIndexDatapointsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + match_service.ReadIndexDatapointsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for read_index_datapoints Override in a subclass to manipulate the request or metadata @@ -140,8 +154,10 @@ def post_read_index_datapoints( def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -163,8 +179,10 @@ def post_get_location( def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -186,8 +204,10 @@ def post_list_locations( def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -207,8 +227,10 @@ def post_get_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -228,8 +250,11 @@ def post_set_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -251,8 +276,10 @@ def post_test_iam_permissions( def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -272,8 +299,10 @@ def post_cancel_operation(self, response: None) -> None: 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 @@ -293,8 +322,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 @@ -316,8 +347,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 @@ -339,8 +372,10 @@ def post_list_operations( def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -483,7 +518,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]]] = (), ) -> match_service.FindNeighborsResponse: r"""Call the find neighbors method over HTTP. @@ -494,8 +529,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: ~.match_service.FindNeighborsResponse: @@ -507,6 +544,7 @@ def __call__( http_options = ( _BaseMatchServiceRestTransport._BaseFindNeighbors._get_http_options() ) + request, metadata = self._interceptor.pre_find_neighbors(request, metadata) transcoded_request = _BaseMatchServiceRestTransport._BaseFindNeighbors._get_transcoded_request( http_options, request @@ -521,6 +559,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.aiplatform_v1.MatchServiceClient.FindNeighbors", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MatchService", + "rpcName": "FindNeighbors", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MatchServiceRestTransport._FindNeighbors._get_response( self._host, @@ -542,7 +607,31 @@ def __call__( pb_resp = match_service.FindNeighborsResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_find_neighbors(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = match_service.FindNeighborsResponse.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.aiplatform_v1.MatchServiceClient.find_neighbors", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MatchService", + "rpcName": "FindNeighbors", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ReadIndexDatapoints( @@ -581,7 +670,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]]] = (), ) -> match_service.ReadIndexDatapointsResponse: r"""Call the read index datapoints method over HTTP. @@ -592,8 +681,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: ~.match_service.ReadIndexDatapointsResponse: @@ -605,6 +696,7 @@ def __call__( http_options = ( _BaseMatchServiceRestTransport._BaseReadIndexDatapoints._get_http_options() ) + request, metadata = self._interceptor.pre_read_index_datapoints( request, metadata ) @@ -621,6 +713,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.aiplatform_v1.MatchServiceClient.ReadIndexDatapoints", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MatchService", + "rpcName": "ReadIndexDatapoints", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MatchServiceRestTransport._ReadIndexDatapoints._get_response( self._host, @@ -642,7 +761,31 @@ def __call__( pb_resp = match_service.ReadIndexDatapointsResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_read_index_datapoints(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + match_service.ReadIndexDatapointsResponse.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.aiplatform_v1.MatchServiceClient.read_index_datapoints", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MatchService", + "rpcName": "ReadIndexDatapoints", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp @property @@ -705,7 +848,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]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -716,8 +859,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: locations_pb2.Location: Response from GetLocation method. @@ -726,6 +871,7 @@ def __call__( http_options = ( _BaseMatchServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = self._interceptor.pre_get_location(request, metadata) transcoded_request = ( _BaseMatchServiceRestTransport._BaseGetLocation._get_transcoded_request( @@ -740,6 +886,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.aiplatform_v1.MatchServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MatchService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MatchServiceRestTransport._GetLocation._get_response( self._host, @@ -759,6 +932,27 @@ def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_location(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.aiplatform_v1.MatchServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MatchService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -800,7 +994,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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -811,8 +1005,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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -821,6 +1017,7 @@ def __call__( http_options = ( _BaseMatchServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = self._interceptor.pre_list_locations(request, metadata) transcoded_request = _BaseMatchServiceRestTransport._BaseListLocations._get_transcoded_request( http_options, request @@ -831,6 +1028,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.aiplatform_v1.MatchServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MatchService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MatchServiceRestTransport._ListLocations._get_response( self._host, @@ -850,6 +1074,27 @@ def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_list_locations(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.aiplatform_v1.MatchServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MatchService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -891,7 +1136,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]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -902,8 +1147,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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -912,6 +1159,7 @@ def __call__( http_options = ( _BaseMatchServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_get_iam_policy(request, metadata) transcoded_request = _BaseMatchServiceRestTransport._BaseGetIamPolicy._get_transcoded_request( http_options, request @@ -924,6 +1172,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.aiplatform_v1.MatchServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MatchService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MatchServiceRestTransport._GetIamPolicy._get_response( self._host, @@ -943,6 +1218,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_iam_policy(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.aiplatform_v1.MatchServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MatchService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -985,7 +1281,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]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -996,8 +1292,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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -1006,6 +1304,7 @@ def __call__( http_options = ( _BaseMatchServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_set_iam_policy(request, metadata) transcoded_request = _BaseMatchServiceRestTransport._BaseSetIamPolicy._get_transcoded_request( http_options, request @@ -1024,6 +1323,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.aiplatform_v1.MatchServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MatchService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MatchServiceRestTransport._SetIamPolicy._get_response( self._host, @@ -1044,6 +1370,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_set_iam_policy(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.aiplatform_v1.MatchServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MatchService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1085,7 +1432,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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -1096,8 +1443,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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -1106,6 +1455,7 @@ def __call__( http_options = ( _BaseMatchServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -1118,6 +1468,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.aiplatform_v1.MatchServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MatchService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MatchServiceRestTransport._TestIamPermissions._get_response( self._host, @@ -1137,6 +1514,27 @@ def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_test_iam_permissions(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.aiplatform_v1.MatchServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MatchService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1178,7 +1576,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 cancel operation method over HTTP. @@ -1189,13 +1587,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 = ( _BaseMatchServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = self._interceptor.pre_cancel_operation( request, metadata ) @@ -1208,6 +1609,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.aiplatform_v1.MatchServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MatchService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MatchServiceRestTransport._CancelOperation._get_response( self._host, @@ -1264,7 +1692,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. @@ -1275,13 +1703,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 = ( _BaseMatchServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = self._interceptor.pre_delete_operation( request, metadata ) @@ -1294,6 +1725,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.aiplatform_v1.MatchServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MatchService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MatchServiceRestTransport._DeleteOperation._get_response( self._host, @@ -1350,7 +1808,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. @@ -1361,8 +1819,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. @@ -1371,6 +1831,7 @@ def __call__( http_options = ( _BaseMatchServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = self._interceptor.pre_get_operation(request, metadata) transcoded_request = _BaseMatchServiceRestTransport._BaseGetOperation._get_transcoded_request( http_options, request @@ -1383,6 +1844,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.aiplatform_v1.MatchServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MatchService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MatchServiceRestTransport._GetOperation._get_response( self._host, @@ -1402,6 +1890,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.aiplatform_v1.MatchServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MatchService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1443,7 +1952,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. @@ -1454,8 +1963,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. @@ -1464,6 +1975,7 @@ def __call__( http_options = ( _BaseMatchServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = self._interceptor.pre_list_operations(request, metadata) transcoded_request = _BaseMatchServiceRestTransport._BaseListOperations._get_transcoded_request( http_options, request @@ -1474,6 +1986,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.aiplatform_v1.MatchServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MatchService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MatchServiceRestTransport._ListOperations._get_response( self._host, @@ -1493,6 +2032,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.aiplatform_v1.MatchServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MatchService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1534,7 +2094,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 wait operation method over HTTP. @@ -1545,8 +2105,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 WaitOperation method. @@ -1555,6 +2117,7 @@ def __call__( http_options = ( _BaseMatchServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = self._interceptor.pre_wait_operation(request, metadata) transcoded_request = _BaseMatchServiceRestTransport._BaseWaitOperation._get_transcoded_request( http_options, request @@ -1565,6 +2128,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.aiplatform_v1.MatchServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MatchService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MatchServiceRestTransport._WaitOperation._get_response( self._host, @@ -1584,6 +2174,27 @@ def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = self._interceptor.post_wait_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.aiplatform_v1.MatchServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MatchService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1/services/match_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1/services/match_service/transports/rest_asyncio.py index 001b864028..5a1dbd3c4c 100644 --- a/google/cloud/aiplatform_v1/services/match_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1/services/match_service/transports/rest_asyncio.py @@ -56,6 +56,18 @@ from .base import DEFAULT_CLIENT_INFO as BASE_DEFAULT_CLIENT_INFO + +import logging + +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__) + try: OptionalRetry = Union[retries.AsyncRetry, gapic_v1.method._MethodDefault, None] except AttributeError: # pragma: NO COVER @@ -108,8 +120,10 @@ async def post_read_index_datapoints(self, response): async def pre_find_neighbors( self, request: match_service.FindNeighborsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[match_service.FindNeighborsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + match_service.FindNeighborsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for find_neighbors Override in a subclass to manipulate the request or metadata @@ -131,8 +145,11 @@ async def post_find_neighbors( async def pre_read_index_datapoints( self, request: match_service.ReadIndexDatapointsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[match_service.ReadIndexDatapointsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + match_service.ReadIndexDatapointsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for read_index_datapoints Override in a subclass to manipulate the request or metadata @@ -154,8 +171,10 @@ async def post_read_index_datapoints( async def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -177,8 +196,10 @@ async def post_get_location( async def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -200,8 +221,10 @@ async def post_list_locations( async def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -223,8 +246,10 @@ async def post_get_iam_policy( async def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -246,8 +271,11 @@ async def post_set_iam_policy( async def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -269,8 +297,10 @@ async def post_test_iam_permissions( async def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -290,8 +320,10 @@ async def post_cancel_operation(self, response: None) -> None: async 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 @@ -311,8 +343,10 @@ async def post_delete_operation(self, response: None) -> None: async 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 @@ -334,8 +368,10 @@ async def post_get_operation( async 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 @@ -357,8 +393,10 @@ async def post_list_operations( async def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -546,7 +584,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> match_service.FindNeighborsResponse: r"""Call the find neighbors method over HTTP. @@ -557,8 +595,10 @@ async def __call__( 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: ~.match_service.FindNeighborsResponse: @@ -570,6 +610,7 @@ async def __call__( http_options = ( _BaseMatchServiceRestTransport._BaseFindNeighbors._get_http_options() ) + request, metadata = await self._interceptor.pre_find_neighbors( request, metadata ) @@ -586,6 +627,33 @@ async 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.aiplatform_v1.MatchServiceClient.FindNeighbors", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MatchService", + "rpcName": "FindNeighbors", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncMatchServiceRestTransport._FindNeighbors._get_response( @@ -616,6 +684,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_find_neighbors(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = match_service.FindNeighborsResponse.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.MatchServiceAsyncClient.find_neighbors", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MatchService", + "rpcName": "FindNeighbors", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ReadIndexDatapoints( @@ -655,7 +747,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> match_service.ReadIndexDatapointsResponse: r"""Call the read index datapoints method over HTTP. @@ -666,8 +758,10 @@ async def __call__( 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: ~.match_service.ReadIndexDatapointsResponse: @@ -679,6 +773,7 @@ async def __call__( http_options = ( _BaseMatchServiceRestTransport._BaseReadIndexDatapoints._get_http_options() ) + request, metadata = await self._interceptor.pre_read_index_datapoints( request, metadata ) @@ -695,6 +790,33 @@ async 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.aiplatform_v1.MatchServiceClient.ReadIndexDatapoints", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MatchService", + "rpcName": "ReadIndexDatapoints", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncMatchServiceRestTransport._ReadIndexDatapoints._get_response( @@ -725,6 +847,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_read_index_datapoints(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + match_service.ReadIndexDatapointsResponse.to_json(response) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.MatchServiceAsyncClient.read_index_datapoints", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MatchService", + "rpcName": "ReadIndexDatapoints", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp @property @@ -783,7 +929,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -794,8 +940,10 @@ async def __call__( 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: locations_pb2.Location: Response from GetLocation method. @@ -804,6 +952,7 @@ async def __call__( http_options = ( _BaseMatchServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_location( request, metadata ) @@ -820,6 +969,33 @@ async 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.aiplatform_v1.MatchServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MatchService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncMatchServiceRestTransport._GetLocation._get_response( self._host, @@ -845,6 +1021,27 @@ async def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_location(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.aiplatform_v1.MatchServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MatchService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -886,7 +1083,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -897,8 +1094,10 @@ async def __call__( 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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -907,6 +1106,7 @@ async def __call__( http_options = ( _BaseMatchServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_locations( request, metadata ) @@ -919,6 +1119,33 @@ async 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.aiplatform_v1.MatchServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MatchService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncMatchServiceRestTransport._ListLocations._get_response( @@ -946,6 +1173,27 @@ async def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_list_locations(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.aiplatform_v1.MatchServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MatchService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -987,7 +1235,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -998,8 +1246,10 @@ async def __call__( 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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -1008,6 +1258,7 @@ async def __call__( http_options = ( _BaseMatchServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_get_iam_policy( request, metadata ) @@ -1022,6 +1273,33 @@ async 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.aiplatform_v1.MatchServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MatchService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncMatchServiceRestTransport._GetIamPolicy._get_response( self._host, @@ -1047,6 +1325,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_iam_policy(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.aiplatform_v1.MatchServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MatchService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1089,7 +1388,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -1100,8 +1399,10 @@ async def __call__( 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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -1110,6 +1411,7 @@ async def __call__( http_options = ( _BaseMatchServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_set_iam_policy( request, metadata ) @@ -1130,6 +1432,33 @@ async 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.aiplatform_v1.MatchServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MatchService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncMatchServiceRestTransport._SetIamPolicy._get_response( self._host, @@ -1156,6 +1485,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_set_iam_policy(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.aiplatform_v1.MatchServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MatchService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1198,7 +1548,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -1209,8 +1559,10 @@ async def __call__( 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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -1219,6 +1571,7 @@ async def __call__( http_options = ( _BaseMatchServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = await self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -1231,6 +1584,33 @@ async 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.aiplatform_v1.MatchServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MatchService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncMatchServiceRestTransport._TestIamPermissions._get_response( @@ -1258,6 +1638,27 @@ async def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_test_iam_permissions(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.aiplatform_v1.MatchServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MatchService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1299,7 +1700,7 @@ async 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 cancel operation method over HTTP. @@ -1310,13 +1711,16 @@ async def __call__( 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`. """ http_options = ( _BaseMatchServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_cancel_operation( request, metadata ) @@ -1329,6 +1733,33 @@ async 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.aiplatform_v1.MatchServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MatchService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncMatchServiceRestTransport._CancelOperation._get_response( @@ -1393,7 +1824,7 @@ async 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. @@ -1404,13 +1835,16 @@ async def __call__( 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`. """ http_options = ( _BaseMatchServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_operation( request, metadata ) @@ -1423,6 +1857,33 @@ async 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.aiplatform_v1.MatchServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MatchService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncMatchServiceRestTransport._DeleteOperation._get_response( @@ -1487,7 +1948,7 @@ async 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. @@ -1498,8 +1959,10 @@ async def __call__( 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: Response from GetOperation method. @@ -1508,6 +1971,7 @@ async def __call__( http_options = ( _BaseMatchServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_operation( request, metadata ) @@ -1522,6 +1986,33 @@ async 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.aiplatform_v1.MatchServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MatchService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncMatchServiceRestTransport._GetOperation._get_response( self._host, @@ -1547,6 +2038,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1.MatchServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MatchService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1588,7 +2100,7 @@ async 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. @@ -1599,8 +2111,10 @@ async def __call__( 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 from ListOperations method. @@ -1609,6 +2123,7 @@ async def __call__( http_options = ( _BaseMatchServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_operations( request, metadata ) @@ -1621,6 +2136,33 @@ async 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.aiplatform_v1.MatchServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MatchService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncMatchServiceRestTransport._ListOperations._get_response( @@ -1648,6 +2190,27 @@ async def __call__( resp = operations_pb2.ListOperationsResponse() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1.MatchServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MatchService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1689,7 +2252,7 @@ async 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 wait operation method over HTTP. @@ -1700,8 +2263,10 @@ async def __call__( 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: Response from WaitOperation method. @@ -1710,6 +2275,7 @@ async def __call__( http_options = ( _BaseMatchServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_wait_operation( request, metadata ) @@ -1722,6 +2288,33 @@ async 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.aiplatform_v1.MatchServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MatchService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncMatchServiceRestTransport._WaitOperation._get_response( @@ -1749,6 +2342,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_wait_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.aiplatform_v1.MatchServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MatchService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1/services/metadata_service/async_client.py b/google/cloud/aiplatform_v1/services/metadata_service/async_client.py index 157ebb1936..2d90d265e4 100644 --- a/google/cloud/aiplatform_v1/services/metadata_service/async_client.py +++ b/google/cloud/aiplatform_v1/services/metadata_service/async_client.py @@ -13,6 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging as std_logging from collections import OrderedDict import re from typing import ( @@ -73,6 +74,15 @@ from .transports.grpc_asyncio import MetadataServiceGrpcAsyncIOTransport from .client import MetadataServiceClient +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 MetadataServiceAsyncClient: """Service for reading and writing metadata entries.""" @@ -292,6 +302,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.aiplatform_v1.MetadataServiceAsyncClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "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.aiplatform.v1.MetadataService", + "credentialsType": None, + }, + ) + async def create_metadata_store( self, request: Optional[ @@ -303,7 +335,7 @@ async def create_metadata_store( metadata_store_id: 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"""Initializes a MetadataStore, including allocation of resources. @@ -375,8 +407,10 @@ async def sample_create_metadata_store(): 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: @@ -451,7 +485,7 @@ async def get_metadata_store( 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]]] = (), ) -> metadata_store.MetadataStore: r"""Retrieves a specific MetadataStore. @@ -496,8 +530,10 @@ async def sample_get_metadata_store(): 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.aiplatform_v1.types.MetadataStore: @@ -561,7 +597,7 @@ async def list_metadata_stores( 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.ListMetadataStoresAsyncPager: r"""Lists MetadataStores for a Location. @@ -607,8 +643,10 @@ async def sample_list_metadata_stores(): 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.aiplatform_v1.services.metadata_service.pagers.ListMetadataStoresAsyncPager: @@ -685,7 +723,7 @@ async def delete_metadata_store( 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"""Deletes a single MetadataStore and all its child resources (Artifacts, Executions, and Contexts). @@ -735,8 +773,10 @@ async def sample_delete_metadata_store(): 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: @@ -817,7 +857,7 @@ async def create_artifact( artifact_id: 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]]] = (), ) -> gca_artifact.Artifact: r"""Creates an Artifact associated with a MetadataStore. @@ -882,8 +922,10 @@ async def sample_create_artifact(): 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.aiplatform_v1.types.Artifact: @@ -946,7 +988,7 @@ async def get_artifact( 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]]] = (), ) -> artifact.Artifact: r"""Retrieves a specific Artifact. @@ -991,8 +1033,10 @@ async def sample_get_artifact(): 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.aiplatform_v1.types.Artifact: @@ -1051,7 +1095,7 @@ async def list_artifacts( 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.ListArtifactsAsyncPager: r"""Lists Artifacts in the MetadataStore. @@ -1097,8 +1141,10 @@ async def sample_list_artifacts(): 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.aiplatform_v1.services.metadata_service.pagers.ListArtifactsAsyncPager: @@ -1174,7 +1220,7 @@ async def update_artifact( 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]]] = (), ) -> gca_artifact.Artifact: r"""Updates a stored Artifact. @@ -1228,8 +1274,10 @@ async def sample_update_artifact(): 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.aiplatform_v1.types.Artifact: @@ -1292,7 +1340,7 @@ async def delete_artifact( 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"""Deletes an Artifact. @@ -1341,8 +1389,10 @@ async def sample_delete_artifact(): 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: @@ -1421,7 +1471,7 @@ async def purge_artifacts( 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]]] = (), ) -> operation_async.AsyncOperation: r"""Purges Artifacts. @@ -1471,8 +1521,10 @@ async def sample_purge_artifacts(): 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: @@ -1545,7 +1597,7 @@ async def create_context( context_id: 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]]] = (), ) -> gca_context.Context: r"""Creates a Context associated with a MetadataStore. @@ -1610,8 +1662,10 @@ async def sample_create_context(): 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.aiplatform_v1.types.Context: @@ -1674,7 +1728,7 @@ async def get_context( 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]]] = (), ) -> context.Context: r"""Retrieves a specific Context. @@ -1719,8 +1773,10 @@ async def sample_get_context(): 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.aiplatform_v1.types.Context: @@ -1779,7 +1835,7 @@ async def list_contexts( 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.ListContextsAsyncPager: r"""Lists Contexts on the MetadataStore. @@ -1825,8 +1881,10 @@ async def sample_list_contexts(): 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.aiplatform_v1.services.metadata_service.pagers.ListContextsAsyncPager: @@ -1902,7 +1960,7 @@ async def update_context( 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]]] = (), ) -> gca_context.Context: r"""Updates a stored Context. @@ -1955,8 +2013,10 @@ async def sample_update_context(): 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.aiplatform_v1.types.Context: @@ -2019,7 +2079,7 @@ async def delete_context( 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"""Deletes a stored Context. @@ -2068,8 +2128,10 @@ async def sample_delete_context(): 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: @@ -2148,7 +2210,7 @@ async def purge_contexts( 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]]] = (), ) -> operation_async.AsyncOperation: r"""Purges Contexts. @@ -2198,8 +2260,10 @@ async def sample_purge_contexts(): 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: @@ -2274,7 +2338,7 @@ async def add_context_artifacts_and_executions( executions: Optional[MutableSequence[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]]] = (), ) -> metadata_service.AddContextArtifactsAndExecutionsResponse: r"""Adds a set of Artifacts and Executions to a Context. If any of the Artifacts or Executions have already been @@ -2341,8 +2405,10 @@ async def sample_add_context_artifacts_and_executions(): 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.aiplatform_v1.types.AddContextArtifactsAndExecutionsResponse: @@ -2412,7 +2478,7 @@ async def add_context_children( child_contexts: Optional[MutableSequence[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]]] = (), ) -> metadata_service.AddContextChildrenResponse: r"""Adds a set of Contexts as children to a parent Context. If any of the child Contexts have already been added to the parent @@ -2469,8 +2535,10 @@ async def sample_add_context_children(): 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.aiplatform_v1.types.AddContextChildrenResponse: @@ -2536,7 +2604,7 @@ async def remove_context_children( child_contexts: Optional[MutableSequence[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]]] = (), ) -> metadata_service.RemoveContextChildrenResponse: r"""Remove a set of children contexts from a parent Context. If any of the child Contexts were NOT added to @@ -2591,8 +2659,10 @@ async def sample_remove_context_children(): 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.aiplatform_v1.types.RemoveContextChildrenResponse: @@ -2657,7 +2727,7 @@ async def query_context_lineage_subgraph( context: 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]]] = (), ) -> lineage_subgraph.LineageSubgraph: r"""Retrieves Artifacts and Executions within the specified Context, connected by Event edges and returned @@ -2710,8 +2780,10 @@ async def sample_query_context_lineage_subgraph(): 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.aiplatform_v1.types.LineageSubgraph: @@ -2775,7 +2847,7 @@ async def create_execution( execution_id: 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]]] = (), ) -> gca_execution.Execution: r"""Creates an Execution associated with a MetadataStore. @@ -2840,8 +2912,10 @@ async def sample_create_execution(): 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.aiplatform_v1.types.Execution: @@ -2904,7 +2978,7 @@ async def get_execution( 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]]] = (), ) -> execution.Execution: r"""Retrieves a specific Execution. @@ -2949,8 +3023,10 @@ async def sample_get_execution(): 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.aiplatform_v1.types.Execution: @@ -3009,7 +3085,7 @@ async def list_executions( 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.ListExecutionsAsyncPager: r"""Lists Executions in the MetadataStore. @@ -3055,8 +3131,10 @@ async def sample_list_executions(): 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.aiplatform_v1.services.metadata_service.pagers.ListExecutionsAsyncPager: @@ -3132,7 +3210,7 @@ async def update_execution( 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]]] = (), ) -> gca_execution.Execution: r"""Updates a stored Execution. @@ -3186,8 +3264,10 @@ async def sample_update_execution(): 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.aiplatform_v1.types.Execution: @@ -3250,7 +3330,7 @@ async def delete_execution( 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"""Deletes an Execution. @@ -3299,8 +3379,10 @@ async def sample_delete_execution(): 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: @@ -3379,7 +3461,7 @@ async def purge_executions( 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]]] = (), ) -> operation_async.AsyncOperation: r"""Purges Executions. @@ -3429,8 +3511,10 @@ async def sample_purge_executions(): 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: @@ -3504,7 +3588,7 @@ async def add_execution_events( events: Optional[MutableSequence[event.Event]] = 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]]] = (), ) -> metadata_service.AddExecutionEventsResponse: r"""Adds Events to the specified Execution. An Event indicates whether an Artifact was used as an input or @@ -3558,8 +3642,10 @@ async def sample_add_execution_events(): 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.aiplatform_v1.types.AddExecutionEventsResponse: @@ -3626,7 +3712,7 @@ async def query_execution_inputs_and_outputs( execution: 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]]] = (), ) -> lineage_subgraph.LineageSubgraph: r"""Obtains the set of input and output Artifacts for this Execution, in the form of LineageSubgraph that also @@ -3674,8 +3760,10 @@ async def sample_query_execution_inputs_and_outputs(): 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.aiplatform_v1.types.LineageSubgraph: @@ -3745,7 +3833,7 @@ async def create_metadata_schema( metadata_schema_id: 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]]] = (), ) -> gca_metadata_schema.MetadataSchema: r"""Creates a MetadataSchema. @@ -3816,8 +3904,10 @@ async def sample_create_metadata_schema(): 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.aiplatform_v1.types.MetadataSchema: @@ -3882,7 +3972,7 @@ async def get_metadata_schema( 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]]] = (), ) -> metadata_schema.MetadataSchema: r"""Retrieves a specific MetadataSchema. @@ -3927,8 +4017,10 @@ async def sample_get_metadata_schema(): 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.aiplatform_v1.types.MetadataSchema: @@ -3989,7 +4081,7 @@ async def list_metadata_schemas( 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.ListMetadataSchemasAsyncPager: r"""Lists MetadataSchemas. @@ -4035,8 +4127,10 @@ async def sample_list_metadata_schemas(): 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.aiplatform_v1.services.metadata_service.pagers.ListMetadataSchemasAsyncPager: @@ -4113,7 +4207,7 @@ async def query_artifact_lineage_subgraph( artifact: 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]]] = (), ) -> lineage_subgraph.LineageSubgraph: r"""Retrieves lineage of an Artifact represented through Artifacts and Executions connected by Event edges and @@ -4166,8 +4260,10 @@ async def sample_query_artifact_lineage_subgraph(): 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.aiplatform_v1.types.LineageSubgraph: @@ -4230,7 +4326,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. @@ -4241,8 +4337,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. @@ -4283,7 +4381,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. @@ -4294,8 +4392,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. @@ -4336,7 +4436,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. @@ -4352,8 +4452,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 """ @@ -4390,7 +4492,7 @@ async def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -4405,8 +4507,10 @@ async def cancel_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 """ @@ -4443,7 +4547,7 @@ async def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -4460,8 +4564,10 @@ async def wait_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. @@ -4502,7 +4608,7 @@ async def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -4515,8 +4621,10 @@ async def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -4621,7 +4729,7 @@ async def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -4635,8 +4743,10 @@ async def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -4741,7 +4851,7 @@ async def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -4756,8 +4866,10 @@ async def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -4801,7 +4913,7 @@ async def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -4812,8 +4924,10 @@ async def get_location( 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: ~.location_pb2.Location: Location object. @@ -4854,7 +4968,7 @@ async def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -4865,8 +4979,10 @@ async def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1/services/metadata_service/client.py b/google/cloud/aiplatform_v1/services/metadata_service/client.py index 866dc260d0..44a0ec4e44 100644 --- a/google/cloud/aiplatform_v1/services/metadata_service/client.py +++ b/google/cloud/aiplatform_v1/services/metadata_service/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 ( @@ -48,6 +49,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 as gac_operation # type: ignore from google.api_core import operation_async # type: ignore from google.cloud.aiplatform_v1.services.metadata_service import pagers @@ -713,6 +723,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( @@ -803,6 +817,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.aiplatform_v1.MetadataServiceClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "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.aiplatform.v1.MetadataService", + "credentialsType": None, + }, + ) + def create_metadata_store( self, request: Optional[ @@ -814,7 +851,7 @@ def create_metadata_store( metadata_store_id: 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]]] = (), ) -> gac_operation.Operation: r"""Initializes a MetadataStore, including allocation of resources. @@ -886,8 +923,10 @@ def sample_create_metadata_store(): 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: @@ -959,7 +998,7 @@ def get_metadata_store( 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]]] = (), ) -> metadata_store.MetadataStore: r"""Retrieves a specific MetadataStore. @@ -1004,8 +1043,10 @@ def sample_get_metadata_store(): 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.aiplatform_v1.types.MetadataStore: @@ -1066,7 +1107,7 @@ def list_metadata_stores( 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.ListMetadataStoresPager: r"""Lists MetadataStores for a Location. @@ -1112,8 +1153,10 @@ def sample_list_metadata_stores(): 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.aiplatform_v1.services.metadata_service.pagers.ListMetadataStoresPager: @@ -1187,7 +1230,7 @@ def delete_metadata_store( 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]]] = (), ) -> gac_operation.Operation: r"""Deletes a single MetadataStore and all its child resources (Artifacts, Executions, and Contexts). @@ -1237,8 +1280,10 @@ def sample_delete_metadata_store(): 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: @@ -1316,7 +1361,7 @@ def create_artifact( artifact_id: 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]]] = (), ) -> gca_artifact.Artifact: r"""Creates an Artifact associated with a MetadataStore. @@ -1381,8 +1426,10 @@ def sample_create_artifact(): 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.aiplatform_v1.types.Artifact: @@ -1442,7 +1489,7 @@ def get_artifact( 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]]] = (), ) -> artifact.Artifact: r"""Retrieves a specific Artifact. @@ -1487,8 +1534,10 @@ def sample_get_artifact(): 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.aiplatform_v1.types.Artifact: @@ -1544,7 +1593,7 @@ def list_artifacts( 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.ListArtifactsPager: r"""Lists Artifacts in the MetadataStore. @@ -1590,8 +1639,10 @@ def sample_list_artifacts(): 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.aiplatform_v1.services.metadata_service.pagers.ListArtifactsPager: @@ -1664,7 +1715,7 @@ def update_artifact( 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]]] = (), ) -> gca_artifact.Artifact: r"""Updates a stored Artifact. @@ -1718,8 +1769,10 @@ def sample_update_artifact(): 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.aiplatform_v1.types.Artifact: @@ -1779,7 +1832,7 @@ def delete_artifact( 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]]] = (), ) -> gac_operation.Operation: r"""Deletes an Artifact. @@ -1828,8 +1881,10 @@ def sample_delete_artifact(): 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: @@ -1905,7 +1960,7 @@ def purge_artifacts( 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]]] = (), ) -> gac_operation.Operation: r"""Purges Artifacts. @@ -1955,8 +2010,10 @@ def sample_purge_artifacts(): 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: @@ -2026,7 +2083,7 @@ def create_context( context_id: 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]]] = (), ) -> gca_context.Context: r"""Creates a Context associated with a MetadataStore. @@ -2091,8 +2148,10 @@ def sample_create_context(): 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.aiplatform_v1.types.Context: @@ -2152,7 +2211,7 @@ def get_context( 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]]] = (), ) -> context.Context: r"""Retrieves a specific Context. @@ -2197,8 +2256,10 @@ def sample_get_context(): 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.aiplatform_v1.types.Context: @@ -2254,7 +2315,7 @@ def list_contexts( 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.ListContextsPager: r"""Lists Contexts on the MetadataStore. @@ -2300,8 +2361,10 @@ def sample_list_contexts(): 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.aiplatform_v1.services.metadata_service.pagers.ListContextsPager: @@ -2374,7 +2437,7 @@ def update_context( 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]]] = (), ) -> gca_context.Context: r"""Updates a stored Context. @@ -2427,8 +2490,10 @@ def sample_update_context(): 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.aiplatform_v1.types.Context: @@ -2488,7 +2553,7 @@ def delete_context( 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]]] = (), ) -> gac_operation.Operation: r"""Deletes a stored Context. @@ -2537,8 +2602,10 @@ def sample_delete_context(): 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: @@ -2614,7 +2681,7 @@ def purge_contexts( 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]]] = (), ) -> gac_operation.Operation: r"""Purges Contexts. @@ -2664,8 +2731,10 @@ def sample_purge_contexts(): 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: @@ -2737,7 +2806,7 @@ def add_context_artifacts_and_executions( executions: Optional[MutableSequence[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]]] = (), ) -> metadata_service.AddContextArtifactsAndExecutionsResponse: r"""Adds a set of Artifacts and Executions to a Context. If any of the Artifacts or Executions have already been @@ -2804,8 +2873,10 @@ def sample_add_context_artifacts_and_executions(): 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.aiplatform_v1.types.AddContextArtifactsAndExecutionsResponse: @@ -2874,7 +2945,7 @@ def add_context_children( child_contexts: Optional[MutableSequence[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]]] = (), ) -> metadata_service.AddContextChildrenResponse: r"""Adds a set of Contexts as children to a parent Context. If any of the child Contexts have already been added to the parent @@ -2931,8 +3002,10 @@ def sample_add_context_children(): 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.aiplatform_v1.types.AddContextChildrenResponse: @@ -2995,7 +3068,7 @@ def remove_context_children( child_contexts: Optional[MutableSequence[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]]] = (), ) -> metadata_service.RemoveContextChildrenResponse: r"""Remove a set of children contexts from a parent Context. If any of the child Contexts were NOT added to @@ -3050,8 +3123,10 @@ def sample_remove_context_children(): 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.aiplatform_v1.types.RemoveContextChildrenResponse: @@ -3113,7 +3188,7 @@ def query_context_lineage_subgraph( context: 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]]] = (), ) -> lineage_subgraph.LineageSubgraph: r"""Retrieves Artifacts and Executions within the specified Context, connected by Event edges and returned @@ -3166,8 +3241,10 @@ def sample_query_context_lineage_subgraph(): 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.aiplatform_v1.types.LineageSubgraph: @@ -3230,7 +3307,7 @@ def create_execution( execution_id: 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]]] = (), ) -> gca_execution.Execution: r"""Creates an Execution associated with a MetadataStore. @@ -3295,8 +3372,10 @@ def sample_create_execution(): 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.aiplatform_v1.types.Execution: @@ -3356,7 +3435,7 @@ def get_execution( 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]]] = (), ) -> execution.Execution: r"""Retrieves a specific Execution. @@ -3401,8 +3480,10 @@ def sample_get_execution(): 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.aiplatform_v1.types.Execution: @@ -3458,7 +3539,7 @@ def list_executions( 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.ListExecutionsPager: r"""Lists Executions in the MetadataStore. @@ -3504,8 +3585,10 @@ def sample_list_executions(): 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.aiplatform_v1.services.metadata_service.pagers.ListExecutionsPager: @@ -3578,7 +3661,7 @@ def update_execution( 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]]] = (), ) -> gca_execution.Execution: r"""Updates a stored Execution. @@ -3632,8 +3715,10 @@ def sample_update_execution(): 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.aiplatform_v1.types.Execution: @@ -3693,7 +3778,7 @@ def delete_execution( 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]]] = (), ) -> gac_operation.Operation: r"""Deletes an Execution. @@ -3742,8 +3827,10 @@ def sample_delete_execution(): 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: @@ -3819,7 +3906,7 @@ def purge_executions( 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]]] = (), ) -> gac_operation.Operation: r"""Purges Executions. @@ -3869,8 +3956,10 @@ def sample_purge_executions(): 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: @@ -3941,7 +4030,7 @@ def add_execution_events( events: Optional[MutableSequence[event.Event]] = 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]]] = (), ) -> metadata_service.AddExecutionEventsResponse: r"""Adds Events to the specified Execution. An Event indicates whether an Artifact was used as an input or @@ -3995,8 +4084,10 @@ def sample_add_execution_events(): 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.aiplatform_v1.types.AddExecutionEventsResponse: @@ -4060,7 +4151,7 @@ def query_execution_inputs_and_outputs( execution: 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]]] = (), ) -> lineage_subgraph.LineageSubgraph: r"""Obtains the set of input and output Artifacts for this Execution, in the form of LineageSubgraph that also @@ -4108,8 +4199,10 @@ def sample_query_execution_inputs_and_outputs(): 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.aiplatform_v1.types.LineageSubgraph: @@ -4178,7 +4271,7 @@ def create_metadata_schema( metadata_schema_id: 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]]] = (), ) -> gca_metadata_schema.MetadataSchema: r"""Creates a MetadataSchema. @@ -4249,8 +4342,10 @@ def sample_create_metadata_schema(): 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.aiplatform_v1.types.MetadataSchema: @@ -4312,7 +4407,7 @@ def get_metadata_schema( 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]]] = (), ) -> metadata_schema.MetadataSchema: r"""Retrieves a specific MetadataSchema. @@ -4357,8 +4452,10 @@ def sample_get_metadata_schema(): 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.aiplatform_v1.types.MetadataSchema: @@ -4416,7 +4513,7 @@ def list_metadata_schemas( 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.ListMetadataSchemasPager: r"""Lists MetadataSchemas. @@ -4462,8 +4559,10 @@ def sample_list_metadata_schemas(): 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.aiplatform_v1.services.metadata_service.pagers.ListMetadataSchemasPager: @@ -4537,7 +4636,7 @@ def query_artifact_lineage_subgraph( artifact: 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]]] = (), ) -> lineage_subgraph.LineageSubgraph: r"""Retrieves lineage of an Artifact represented through Artifacts and Executions connected by Event edges and @@ -4590,8 +4689,10 @@ def sample_query_artifact_lineage_subgraph(): 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.aiplatform_v1.types.LineageSubgraph: @@ -4666,7 +4767,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. @@ -4677,8 +4778,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. @@ -4719,7 +4822,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. @@ -4730,8 +4833,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. @@ -4772,7 +4877,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. @@ -4788,8 +4893,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 """ @@ -4826,7 +4933,7 @@ def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -4841,8 +4948,10 @@ def cancel_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 """ @@ -4879,7 +4988,7 @@ def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -4896,8 +5005,10 @@ def wait_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. @@ -4938,7 +5049,7 @@ def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -4951,8 +5062,10 @@ def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -5057,7 +5170,7 @@ def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -5071,8 +5184,10 @@ def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -5177,7 +5292,7 @@ def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -5192,8 +5307,10 @@ def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -5235,7 +5352,7 @@ def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -5246,8 +5363,10 @@ def get_location( 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: ~.location_pb2.Location: Location object. @@ -5288,7 +5407,7 @@ def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -5299,8 +5418,10 @@ def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1/services/metadata_service/pagers.py b/google/cloud/aiplatform_v1/services/metadata_service/pagers.py index 68963a5d4a..31e3d76f68 100644 --- a/google/cloud/aiplatform_v1/services/metadata_service/pagers.py +++ b/google/cloud/aiplatform_v1/services/metadata_service/pagers.py @@ -71,7 +71,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. @@ -85,8 +85,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 = metadata_service.ListMetadataStoresRequest(request) @@ -145,7 +147,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. @@ -159,8 +161,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 = metadata_service.ListMetadataStoresRequest(request) @@ -223,7 +227,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. @@ -237,8 +241,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 = metadata_service.ListArtifactsRequest(request) @@ -297,7 +303,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. @@ -311,8 +317,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 = metadata_service.ListArtifactsRequest(request) @@ -375,7 +383,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. @@ -389,8 +397,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 = metadata_service.ListContextsRequest(request) @@ -449,7 +459,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. @@ -463,8 +473,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 = metadata_service.ListContextsRequest(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 = metadata_service.ListExecutionsRequest(request) @@ -601,7 +615,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. @@ -615,8 +629,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 = metadata_service.ListExecutionsRequest(request) @@ -679,7 +695,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. @@ -693,8 +709,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 = metadata_service.ListMetadataSchemasRequest(request) @@ -753,7 +771,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. @@ -767,8 +785,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 = metadata_service.ListMetadataSchemasRequest(request) diff --git a/google/cloud/aiplatform_v1/services/metadata_service/transports/grpc.py b/google/cloud/aiplatform_v1/services/metadata_service/transports/grpc.py index ee2f419a08..84ee8a5805 100644 --- a/google/cloud/aiplatform_v1/services/metadata_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1/services/metadata_service/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 import warnings from typing import Callable, Dict, Optional, Sequence, Tuple, Union @@ -22,8 +25,11 @@ import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from google.cloud.aiplatform_v1.types import artifact from google.cloud.aiplatform_v1.types import artifact as gca_artifact @@ -42,6 +48,81 @@ from google.longrunning import operations_pb2 # type: ignore from .base import MetadataServiceTransport, DEFAULT_CLIENT_INFO +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.aiplatform.v1.MetadataService", + "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.aiplatform.v1.MetadataService", + "rpcName": client_call_details.method, + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class MetadataServiceGrpcTransport(MetadataServiceTransport): """gRPC backend transport for MetadataService. @@ -196,7 +277,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 @@ -260,7 +346,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 @@ -287,7 +375,7 @@ def create_metadata_store( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_metadata_store" not in self._stubs: - self._stubs["create_metadata_store"] = self.grpc_channel.unary_unary( + self._stubs["create_metadata_store"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.MetadataService/CreateMetadataStore", request_serializer=metadata_service.CreateMetadataStoreRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -315,7 +403,7 @@ def get_metadata_store( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_metadata_store" not in self._stubs: - self._stubs["get_metadata_store"] = self.grpc_channel.unary_unary( + self._stubs["get_metadata_store"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.MetadataService/GetMetadataStore", request_serializer=metadata_service.GetMetadataStoreRequest.serialize, response_deserializer=metadata_store.MetadataStore.deserialize, @@ -344,7 +432,7 @@ def list_metadata_stores( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_metadata_stores" not in self._stubs: - self._stubs["list_metadata_stores"] = self.grpc_channel.unary_unary( + self._stubs["list_metadata_stores"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.MetadataService/ListMetadataStores", request_serializer=metadata_service.ListMetadataStoresRequest.serialize, response_deserializer=metadata_service.ListMetadataStoresResponse.deserialize, @@ -373,7 +461,7 @@ def delete_metadata_store( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_metadata_store" not in self._stubs: - self._stubs["delete_metadata_store"] = self.grpc_channel.unary_unary( + self._stubs["delete_metadata_store"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.MetadataService/DeleteMetadataStore", request_serializer=metadata_service.DeleteMetadataStoreRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -399,7 +487,7 @@ def create_artifact( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_artifact" not in self._stubs: - self._stubs["create_artifact"] = self.grpc_channel.unary_unary( + self._stubs["create_artifact"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.MetadataService/CreateArtifact", request_serializer=metadata_service.CreateArtifactRequest.serialize, response_deserializer=gca_artifact.Artifact.deserialize, @@ -425,7 +513,7 @@ def get_artifact( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_artifact" not in self._stubs: - self._stubs["get_artifact"] = self.grpc_channel.unary_unary( + self._stubs["get_artifact"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.MetadataService/GetArtifact", request_serializer=metadata_service.GetArtifactRequest.serialize, response_deserializer=artifact.Artifact.deserialize, @@ -453,7 +541,7 @@ def list_artifacts( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_artifacts" not in self._stubs: - self._stubs["list_artifacts"] = self.grpc_channel.unary_unary( + self._stubs["list_artifacts"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.MetadataService/ListArtifacts", request_serializer=metadata_service.ListArtifactsRequest.serialize, response_deserializer=metadata_service.ListArtifactsResponse.deserialize, @@ -479,7 +567,7 @@ def update_artifact( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_artifact" not in self._stubs: - self._stubs["update_artifact"] = self.grpc_channel.unary_unary( + self._stubs["update_artifact"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.MetadataService/UpdateArtifact", request_serializer=metadata_service.UpdateArtifactRequest.serialize, response_deserializer=gca_artifact.Artifact.deserialize, @@ -505,7 +593,7 @@ def delete_artifact( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_artifact" not in self._stubs: - self._stubs["delete_artifact"] = self.grpc_channel.unary_unary( + self._stubs["delete_artifact"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.MetadataService/DeleteArtifact", request_serializer=metadata_service.DeleteArtifactRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -531,7 +619,7 @@ def purge_artifacts( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "purge_artifacts" not in self._stubs: - self._stubs["purge_artifacts"] = self.grpc_channel.unary_unary( + self._stubs["purge_artifacts"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.MetadataService/PurgeArtifacts", request_serializer=metadata_service.PurgeArtifactsRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -557,7 +645,7 @@ def create_context( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_context" not in self._stubs: - self._stubs["create_context"] = self.grpc_channel.unary_unary( + self._stubs["create_context"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.MetadataService/CreateContext", request_serializer=metadata_service.CreateContextRequest.serialize, response_deserializer=gca_context.Context.deserialize, @@ -583,7 +671,7 @@ def get_context( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_context" not in self._stubs: - self._stubs["get_context"] = self.grpc_channel.unary_unary( + self._stubs["get_context"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.MetadataService/GetContext", request_serializer=metadata_service.GetContextRequest.serialize, response_deserializer=context.Context.deserialize, @@ -611,7 +699,7 @@ def list_contexts( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_contexts" not in self._stubs: - self._stubs["list_contexts"] = self.grpc_channel.unary_unary( + self._stubs["list_contexts"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.MetadataService/ListContexts", request_serializer=metadata_service.ListContextsRequest.serialize, response_deserializer=metadata_service.ListContextsResponse.deserialize, @@ -637,7 +725,7 @@ def update_context( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_context" not in self._stubs: - self._stubs["update_context"] = self.grpc_channel.unary_unary( + self._stubs["update_context"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.MetadataService/UpdateContext", request_serializer=metadata_service.UpdateContextRequest.serialize, response_deserializer=gca_context.Context.deserialize, @@ -663,7 +751,7 @@ def delete_context( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_context" not in self._stubs: - self._stubs["delete_context"] = self.grpc_channel.unary_unary( + self._stubs["delete_context"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.MetadataService/DeleteContext", request_serializer=metadata_service.DeleteContextRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -689,7 +777,7 @@ def purge_contexts( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "purge_contexts" not in self._stubs: - self._stubs["purge_contexts"] = self.grpc_channel.unary_unary( + self._stubs["purge_contexts"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.MetadataService/PurgeContexts", request_serializer=metadata_service.PurgeContextsRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -723,7 +811,7 @@ def add_context_artifacts_and_executions( if "add_context_artifacts_and_executions" not in self._stubs: self._stubs[ "add_context_artifacts_and_executions" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.MetadataService/AddContextArtifactsAndExecutions", request_serializer=metadata_service.AddContextArtifactsAndExecutionsRequest.serialize, response_deserializer=metadata_service.AddContextArtifactsAndExecutionsResponse.deserialize, @@ -756,7 +844,7 @@ def add_context_children( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "add_context_children" not in self._stubs: - self._stubs["add_context_children"] = self.grpc_channel.unary_unary( + self._stubs["add_context_children"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.MetadataService/AddContextChildren", request_serializer=metadata_service.AddContextChildrenRequest.serialize, response_deserializer=metadata_service.AddContextChildrenResponse.deserialize, @@ -787,7 +875,7 @@ def remove_context_children( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "remove_context_children" not in self._stubs: - self._stubs["remove_context_children"] = self.grpc_channel.unary_unary( + self._stubs["remove_context_children"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.MetadataService/RemoveContextChildren", request_serializer=metadata_service.RemoveContextChildrenRequest.serialize, response_deserializer=metadata_service.RemoveContextChildrenResponse.deserialize, @@ -820,7 +908,7 @@ def query_context_lineage_subgraph( if "query_context_lineage_subgraph" not in self._stubs: self._stubs[ "query_context_lineage_subgraph" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.MetadataService/QueryContextLineageSubgraph", request_serializer=metadata_service.QueryContextLineageSubgraphRequest.serialize, response_deserializer=lineage_subgraph.LineageSubgraph.deserialize, @@ -846,7 +934,7 @@ def create_execution( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_execution" not in self._stubs: - self._stubs["create_execution"] = self.grpc_channel.unary_unary( + self._stubs["create_execution"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.MetadataService/CreateExecution", request_serializer=metadata_service.CreateExecutionRequest.serialize, response_deserializer=gca_execution.Execution.deserialize, @@ -872,7 +960,7 @@ def get_execution( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_execution" not in self._stubs: - self._stubs["get_execution"] = self.grpc_channel.unary_unary( + self._stubs["get_execution"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.MetadataService/GetExecution", request_serializer=metadata_service.GetExecutionRequest.serialize, response_deserializer=execution.Execution.deserialize, @@ -901,7 +989,7 @@ def list_executions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_executions" not in self._stubs: - self._stubs["list_executions"] = self.grpc_channel.unary_unary( + self._stubs["list_executions"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.MetadataService/ListExecutions", request_serializer=metadata_service.ListExecutionsRequest.serialize, response_deserializer=metadata_service.ListExecutionsResponse.deserialize, @@ -927,7 +1015,7 @@ def update_execution( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_execution" not in self._stubs: - self._stubs["update_execution"] = self.grpc_channel.unary_unary( + self._stubs["update_execution"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.MetadataService/UpdateExecution", request_serializer=metadata_service.UpdateExecutionRequest.serialize, response_deserializer=gca_execution.Execution.deserialize, @@ -953,7 +1041,7 @@ def delete_execution( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_execution" not in self._stubs: - self._stubs["delete_execution"] = self.grpc_channel.unary_unary( + self._stubs["delete_execution"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.MetadataService/DeleteExecution", request_serializer=metadata_service.DeleteExecutionRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -979,7 +1067,7 @@ def purge_executions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "purge_executions" not in self._stubs: - self._stubs["purge_executions"] = self.grpc_channel.unary_unary( + self._stubs["purge_executions"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.MetadataService/PurgeExecutions", request_serializer=metadata_service.PurgeExecutionsRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -1012,7 +1100,7 @@ def add_execution_events( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "add_execution_events" not in self._stubs: - self._stubs["add_execution_events"] = self.grpc_channel.unary_unary( + self._stubs["add_execution_events"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.MetadataService/AddExecutionEvents", request_serializer=metadata_service.AddExecutionEventsRequest.serialize, response_deserializer=metadata_service.AddExecutionEventsResponse.deserialize, @@ -1046,7 +1134,7 @@ def query_execution_inputs_and_outputs( if "query_execution_inputs_and_outputs" not in self._stubs: self._stubs[ "query_execution_inputs_and_outputs" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.MetadataService/QueryExecutionInputsAndOutputs", request_serializer=metadata_service.QueryExecutionInputsAndOutputsRequest.serialize, response_deserializer=lineage_subgraph.LineageSubgraph.deserialize, @@ -1075,7 +1163,7 @@ def create_metadata_schema( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_metadata_schema" not in self._stubs: - self._stubs["create_metadata_schema"] = self.grpc_channel.unary_unary( + self._stubs["create_metadata_schema"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.MetadataService/CreateMetadataSchema", request_serializer=metadata_service.CreateMetadataSchemaRequest.serialize, response_deserializer=gca_metadata_schema.MetadataSchema.deserialize, @@ -1103,7 +1191,7 @@ def get_metadata_schema( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_metadata_schema" not in self._stubs: - self._stubs["get_metadata_schema"] = self.grpc_channel.unary_unary( + self._stubs["get_metadata_schema"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.MetadataService/GetMetadataSchema", request_serializer=metadata_service.GetMetadataSchemaRequest.serialize, response_deserializer=metadata_schema.MetadataSchema.deserialize, @@ -1132,7 +1220,7 @@ def list_metadata_schemas( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_metadata_schemas" not in self._stubs: - self._stubs["list_metadata_schemas"] = self.grpc_channel.unary_unary( + self._stubs["list_metadata_schemas"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.MetadataService/ListMetadataSchemas", request_serializer=metadata_service.ListMetadataSchemasRequest.serialize, response_deserializer=metadata_service.ListMetadataSchemasResponse.deserialize, @@ -1166,7 +1254,7 @@ def query_artifact_lineage_subgraph( if "query_artifact_lineage_subgraph" not in self._stubs: self._stubs[ "query_artifact_lineage_subgraph" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.MetadataService/QueryArtifactLineageSubgraph", request_serializer=metadata_service.QueryArtifactLineageSubgraphRequest.serialize, response_deserializer=lineage_subgraph.LineageSubgraph.deserialize, @@ -1174,7 +1262,7 @@ def query_artifact_lineage_subgraph( return self._stubs["query_artifact_lineage_subgraph"] def close(self): - self.grpc_channel.close() + self._logged_channel.close() @property def delete_operation( @@ -1186,7 +1274,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, @@ -1203,7 +1291,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -1220,7 +1308,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -1237,7 +1325,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, @@ -1256,7 +1344,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, @@ -1275,7 +1363,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -1292,7 +1380,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -1317,7 +1405,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -1343,7 +1431,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -1372,7 +1460,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1/services/metadata_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1/services/metadata_service/transports/grpc_asyncio.py index 2df0719813..d8142dcac5 100644 --- a/google/cloud/aiplatform_v1/services/metadata_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1/services/metadata_service/transports/grpc_asyncio.py @@ -14,6 +14,9 @@ # limitations under the License. # import inspect +import json +import pickle +import logging as std_logging import warnings from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union @@ -24,8 +27,11 @@ from google.api_core import operations_v1 from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from grpc.experimental import aio # type: ignore from google.cloud.aiplatform_v1.types import artifact @@ -46,6 +52,82 @@ from .base import MetadataServiceTransport, DEFAULT_CLIENT_INFO from .grpc import MetadataServiceGrpcTransport +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.aiplatform.v1.MetadataService", + "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.aiplatform.v1.MetadataService", + "rpcName": str(client_call_details.method), + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class MetadataServiceGrpcAsyncIOTransport(MetadataServiceTransport): """gRPC AsyncIO backend transport for MetadataService. @@ -243,10 +325,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 @@ -269,7 +354,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. @@ -298,7 +383,7 @@ def create_metadata_store( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_metadata_store" not in self._stubs: - self._stubs["create_metadata_store"] = self.grpc_channel.unary_unary( + self._stubs["create_metadata_store"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.MetadataService/CreateMetadataStore", request_serializer=metadata_service.CreateMetadataStoreRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -327,7 +412,7 @@ def get_metadata_store( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_metadata_store" not in self._stubs: - self._stubs["get_metadata_store"] = self.grpc_channel.unary_unary( + self._stubs["get_metadata_store"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.MetadataService/GetMetadataStore", request_serializer=metadata_service.GetMetadataStoreRequest.serialize, response_deserializer=metadata_store.MetadataStore.deserialize, @@ -356,7 +441,7 @@ def list_metadata_stores( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_metadata_stores" not in self._stubs: - self._stubs["list_metadata_stores"] = self.grpc_channel.unary_unary( + self._stubs["list_metadata_stores"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.MetadataService/ListMetadataStores", request_serializer=metadata_service.ListMetadataStoresRequest.serialize, response_deserializer=metadata_service.ListMetadataStoresResponse.deserialize, @@ -386,7 +471,7 @@ def delete_metadata_store( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_metadata_store" not in self._stubs: - self._stubs["delete_metadata_store"] = self.grpc_channel.unary_unary( + self._stubs["delete_metadata_store"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.MetadataService/DeleteMetadataStore", request_serializer=metadata_service.DeleteMetadataStoreRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -414,7 +499,7 @@ def create_artifact( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_artifact" not in self._stubs: - self._stubs["create_artifact"] = self.grpc_channel.unary_unary( + self._stubs["create_artifact"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.MetadataService/CreateArtifact", request_serializer=metadata_service.CreateArtifactRequest.serialize, response_deserializer=gca_artifact.Artifact.deserialize, @@ -440,7 +525,7 @@ def get_artifact( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_artifact" not in self._stubs: - self._stubs["get_artifact"] = self.grpc_channel.unary_unary( + self._stubs["get_artifact"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.MetadataService/GetArtifact", request_serializer=metadata_service.GetArtifactRequest.serialize, response_deserializer=artifact.Artifact.deserialize, @@ -469,7 +554,7 @@ def list_artifacts( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_artifacts" not in self._stubs: - self._stubs["list_artifacts"] = self.grpc_channel.unary_unary( + self._stubs["list_artifacts"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.MetadataService/ListArtifacts", request_serializer=metadata_service.ListArtifactsRequest.serialize, response_deserializer=metadata_service.ListArtifactsResponse.deserialize, @@ -497,7 +582,7 @@ def update_artifact( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_artifact" not in self._stubs: - self._stubs["update_artifact"] = self.grpc_channel.unary_unary( + self._stubs["update_artifact"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.MetadataService/UpdateArtifact", request_serializer=metadata_service.UpdateArtifactRequest.serialize, response_deserializer=gca_artifact.Artifact.deserialize, @@ -525,7 +610,7 @@ def delete_artifact( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_artifact" not in self._stubs: - self._stubs["delete_artifact"] = self.grpc_channel.unary_unary( + self._stubs["delete_artifact"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.MetadataService/DeleteArtifact", request_serializer=metadata_service.DeleteArtifactRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -553,7 +638,7 @@ def purge_artifacts( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "purge_artifacts" not in self._stubs: - self._stubs["purge_artifacts"] = self.grpc_channel.unary_unary( + self._stubs["purge_artifacts"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.MetadataService/PurgeArtifacts", request_serializer=metadata_service.PurgeArtifactsRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -581,7 +666,7 @@ def create_context( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_context" not in self._stubs: - self._stubs["create_context"] = self.grpc_channel.unary_unary( + self._stubs["create_context"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.MetadataService/CreateContext", request_serializer=metadata_service.CreateContextRequest.serialize, response_deserializer=gca_context.Context.deserialize, @@ -607,7 +692,7 @@ def get_context( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_context" not in self._stubs: - self._stubs["get_context"] = self.grpc_channel.unary_unary( + self._stubs["get_context"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.MetadataService/GetContext", request_serializer=metadata_service.GetContextRequest.serialize, response_deserializer=context.Context.deserialize, @@ -636,7 +721,7 @@ def list_contexts( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_contexts" not in self._stubs: - self._stubs["list_contexts"] = self.grpc_channel.unary_unary( + self._stubs["list_contexts"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.MetadataService/ListContexts", request_serializer=metadata_service.ListContextsRequest.serialize, response_deserializer=metadata_service.ListContextsResponse.deserialize, @@ -664,7 +749,7 @@ def update_context( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_context" not in self._stubs: - self._stubs["update_context"] = self.grpc_channel.unary_unary( + self._stubs["update_context"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.MetadataService/UpdateContext", request_serializer=metadata_service.UpdateContextRequest.serialize, response_deserializer=gca_context.Context.deserialize, @@ -692,7 +777,7 @@ def delete_context( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_context" not in self._stubs: - self._stubs["delete_context"] = self.grpc_channel.unary_unary( + self._stubs["delete_context"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.MetadataService/DeleteContext", request_serializer=metadata_service.DeleteContextRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -720,7 +805,7 @@ def purge_contexts( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "purge_contexts" not in self._stubs: - self._stubs["purge_contexts"] = self.grpc_channel.unary_unary( + self._stubs["purge_contexts"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.MetadataService/PurgeContexts", request_serializer=metadata_service.PurgeContextsRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -754,7 +839,7 @@ def add_context_artifacts_and_executions( if "add_context_artifacts_and_executions" not in self._stubs: self._stubs[ "add_context_artifacts_and_executions" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.MetadataService/AddContextArtifactsAndExecutions", request_serializer=metadata_service.AddContextArtifactsAndExecutionsRequest.serialize, response_deserializer=metadata_service.AddContextArtifactsAndExecutionsResponse.deserialize, @@ -787,7 +872,7 @@ def add_context_children( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "add_context_children" not in self._stubs: - self._stubs["add_context_children"] = self.grpc_channel.unary_unary( + self._stubs["add_context_children"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.MetadataService/AddContextChildren", request_serializer=metadata_service.AddContextChildrenRequest.serialize, response_deserializer=metadata_service.AddContextChildrenResponse.deserialize, @@ -818,7 +903,7 @@ def remove_context_children( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "remove_context_children" not in self._stubs: - self._stubs["remove_context_children"] = self.grpc_channel.unary_unary( + self._stubs["remove_context_children"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.MetadataService/RemoveContextChildren", request_serializer=metadata_service.RemoveContextChildrenRequest.serialize, response_deserializer=metadata_service.RemoveContextChildrenResponse.deserialize, @@ -851,7 +936,7 @@ def query_context_lineage_subgraph( if "query_context_lineage_subgraph" not in self._stubs: self._stubs[ "query_context_lineage_subgraph" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.MetadataService/QueryContextLineageSubgraph", request_serializer=metadata_service.QueryContextLineageSubgraphRequest.serialize, response_deserializer=lineage_subgraph.LineageSubgraph.deserialize, @@ -879,7 +964,7 @@ def create_execution( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_execution" not in self._stubs: - self._stubs["create_execution"] = self.grpc_channel.unary_unary( + self._stubs["create_execution"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.MetadataService/CreateExecution", request_serializer=metadata_service.CreateExecutionRequest.serialize, response_deserializer=gca_execution.Execution.deserialize, @@ -907,7 +992,7 @@ def get_execution( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_execution" not in self._stubs: - self._stubs["get_execution"] = self.grpc_channel.unary_unary( + self._stubs["get_execution"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.MetadataService/GetExecution", request_serializer=metadata_service.GetExecutionRequest.serialize, response_deserializer=execution.Execution.deserialize, @@ -936,7 +1021,7 @@ def list_executions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_executions" not in self._stubs: - self._stubs["list_executions"] = self.grpc_channel.unary_unary( + self._stubs["list_executions"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.MetadataService/ListExecutions", request_serializer=metadata_service.ListExecutionsRequest.serialize, response_deserializer=metadata_service.ListExecutionsResponse.deserialize, @@ -964,7 +1049,7 @@ def update_execution( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_execution" not in self._stubs: - self._stubs["update_execution"] = self.grpc_channel.unary_unary( + self._stubs["update_execution"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.MetadataService/UpdateExecution", request_serializer=metadata_service.UpdateExecutionRequest.serialize, response_deserializer=gca_execution.Execution.deserialize, @@ -992,7 +1077,7 @@ def delete_execution( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_execution" not in self._stubs: - self._stubs["delete_execution"] = self.grpc_channel.unary_unary( + self._stubs["delete_execution"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.MetadataService/DeleteExecution", request_serializer=metadata_service.DeleteExecutionRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -1020,7 +1105,7 @@ def purge_executions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "purge_executions" not in self._stubs: - self._stubs["purge_executions"] = self.grpc_channel.unary_unary( + self._stubs["purge_executions"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.MetadataService/PurgeExecutions", request_serializer=metadata_service.PurgeExecutionsRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -1053,7 +1138,7 @@ def add_execution_events( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "add_execution_events" not in self._stubs: - self._stubs["add_execution_events"] = self.grpc_channel.unary_unary( + self._stubs["add_execution_events"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.MetadataService/AddExecutionEvents", request_serializer=metadata_service.AddExecutionEventsRequest.serialize, response_deserializer=metadata_service.AddExecutionEventsResponse.deserialize, @@ -1087,7 +1172,7 @@ def query_execution_inputs_and_outputs( if "query_execution_inputs_and_outputs" not in self._stubs: self._stubs[ "query_execution_inputs_and_outputs" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.MetadataService/QueryExecutionInputsAndOutputs", request_serializer=metadata_service.QueryExecutionInputsAndOutputsRequest.serialize, response_deserializer=lineage_subgraph.LineageSubgraph.deserialize, @@ -1116,7 +1201,7 @@ def create_metadata_schema( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_metadata_schema" not in self._stubs: - self._stubs["create_metadata_schema"] = self.grpc_channel.unary_unary( + self._stubs["create_metadata_schema"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.MetadataService/CreateMetadataSchema", request_serializer=metadata_service.CreateMetadataSchemaRequest.serialize, response_deserializer=gca_metadata_schema.MetadataSchema.deserialize, @@ -1145,7 +1230,7 @@ def get_metadata_schema( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_metadata_schema" not in self._stubs: - self._stubs["get_metadata_schema"] = self.grpc_channel.unary_unary( + self._stubs["get_metadata_schema"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.MetadataService/GetMetadataSchema", request_serializer=metadata_service.GetMetadataSchemaRequest.serialize, response_deserializer=metadata_schema.MetadataSchema.deserialize, @@ -1174,7 +1259,7 @@ def list_metadata_schemas( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_metadata_schemas" not in self._stubs: - self._stubs["list_metadata_schemas"] = self.grpc_channel.unary_unary( + self._stubs["list_metadata_schemas"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.MetadataService/ListMetadataSchemas", request_serializer=metadata_service.ListMetadataSchemasRequest.serialize, response_deserializer=metadata_service.ListMetadataSchemasResponse.deserialize, @@ -1208,7 +1293,7 @@ def query_artifact_lineage_subgraph( if "query_artifact_lineage_subgraph" not in self._stubs: self._stubs[ "query_artifact_lineage_subgraph" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.MetadataService/QueryArtifactLineageSubgraph", request_serializer=metadata_service.QueryArtifactLineageSubgraphRequest.serialize, response_deserializer=lineage_subgraph.LineageSubgraph.deserialize, @@ -1436,7 +1521,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: @@ -1452,7 +1537,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, @@ -1469,7 +1554,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -1486,7 +1571,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -1503,7 +1588,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, @@ -1522,7 +1607,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, @@ -1541,7 +1626,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -1558,7 +1643,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -1583,7 +1668,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -1609,7 +1694,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -1638,7 +1723,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1/services/metadata_service/transports/rest.py b/google/cloud/aiplatform_v1/services/metadata_service/transports/rest.py index 7f1fb83a9f..62dbd4a8d8 100644 --- a/google/cloud/aiplatform_v1/services/metadata_service/transports/rest.py +++ b/google/cloud/aiplatform_v1/services/metadata_service/transports/rest.py @@ -13,9 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging +import json # type: ignore from google.auth.transport.requests import AuthorizedSession # type: ignore -import json # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.api_core import exceptions as core_exceptions from google.api_core import retry as retries @@ -57,6 +58,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, @@ -345,10 +354,10 @@ def post_update_execution(self, response): def pre_add_context_artifacts_and_executions( self, request: metadata_service.AddContextArtifactsAndExecutionsRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ metadata_service.AddContextArtifactsAndExecutionsRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for add_context_artifacts_and_executions @@ -371,8 +380,11 @@ def post_add_context_artifacts_and_executions( def pre_add_context_children( self, request: metadata_service.AddContextChildrenRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[metadata_service.AddContextChildrenRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + metadata_service.AddContextChildrenRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for add_context_children Override in a subclass to manipulate the request or metadata @@ -394,8 +406,11 @@ def post_add_context_children( def pre_add_execution_events( self, request: metadata_service.AddExecutionEventsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[metadata_service.AddExecutionEventsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + metadata_service.AddExecutionEventsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for add_execution_events Override in a subclass to manipulate the request or metadata @@ -417,8 +432,10 @@ def post_add_execution_events( def pre_create_artifact( self, request: metadata_service.CreateArtifactRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[metadata_service.CreateArtifactRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + metadata_service.CreateArtifactRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for create_artifact Override in a subclass to manipulate the request or metadata @@ -440,8 +457,10 @@ def post_create_artifact( def pre_create_context( self, request: metadata_service.CreateContextRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[metadata_service.CreateContextRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + metadata_service.CreateContextRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for create_context Override in a subclass to manipulate the request or metadata @@ -461,8 +480,10 @@ def post_create_context(self, response: gca_context.Context) -> gca_context.Cont def pre_create_execution( self, request: metadata_service.CreateExecutionRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[metadata_service.CreateExecutionRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + metadata_service.CreateExecutionRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for create_execution Override in a subclass to manipulate the request or metadata @@ -484,8 +505,11 @@ def post_create_execution( def pre_create_metadata_schema( self, request: metadata_service.CreateMetadataSchemaRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[metadata_service.CreateMetadataSchemaRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + metadata_service.CreateMetadataSchemaRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for create_metadata_schema Override in a subclass to manipulate the request or metadata @@ -507,8 +531,11 @@ def post_create_metadata_schema( def pre_create_metadata_store( self, request: metadata_service.CreateMetadataStoreRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[metadata_service.CreateMetadataStoreRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + metadata_service.CreateMetadataStoreRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for create_metadata_store Override in a subclass to manipulate the request or metadata @@ -530,8 +557,10 @@ def post_create_metadata_store( def pre_delete_artifact( self, request: metadata_service.DeleteArtifactRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[metadata_service.DeleteArtifactRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + metadata_service.DeleteArtifactRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for delete_artifact Override in a subclass to manipulate the request or metadata @@ -553,8 +582,10 @@ def post_delete_artifact( def pre_delete_context( self, request: metadata_service.DeleteContextRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[metadata_service.DeleteContextRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + metadata_service.DeleteContextRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for delete_context Override in a subclass to manipulate the request or metadata @@ -576,8 +607,10 @@ def post_delete_context( def pre_delete_execution( self, request: metadata_service.DeleteExecutionRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[metadata_service.DeleteExecutionRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + metadata_service.DeleteExecutionRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for delete_execution Override in a subclass to manipulate the request or metadata @@ -599,8 +632,11 @@ def post_delete_execution( def pre_delete_metadata_store( self, request: metadata_service.DeleteMetadataStoreRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[metadata_service.DeleteMetadataStoreRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + metadata_service.DeleteMetadataStoreRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for delete_metadata_store Override in a subclass to manipulate the request or metadata @@ -622,8 +658,10 @@ def post_delete_metadata_store( def pre_get_artifact( self, request: metadata_service.GetArtifactRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[metadata_service.GetArtifactRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + metadata_service.GetArtifactRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_artifact Override in a subclass to manipulate the request or metadata @@ -643,8 +681,10 @@ def post_get_artifact(self, response: artifact.Artifact) -> artifact.Artifact: def pre_get_context( self, request: metadata_service.GetContextRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[metadata_service.GetContextRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + metadata_service.GetContextRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_context Override in a subclass to manipulate the request or metadata @@ -664,8 +704,10 @@ def post_get_context(self, response: context.Context) -> context.Context: def pre_get_execution( self, request: metadata_service.GetExecutionRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[metadata_service.GetExecutionRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + metadata_service.GetExecutionRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_execution Override in a subclass to manipulate the request or metadata @@ -685,8 +727,11 @@ def post_get_execution(self, response: execution.Execution) -> execution.Executi def pre_get_metadata_schema( self, request: metadata_service.GetMetadataSchemaRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[metadata_service.GetMetadataSchemaRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + metadata_service.GetMetadataSchemaRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for get_metadata_schema Override in a subclass to manipulate the request or metadata @@ -708,8 +753,11 @@ def post_get_metadata_schema( def pre_get_metadata_store( self, request: metadata_service.GetMetadataStoreRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[metadata_service.GetMetadataStoreRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + metadata_service.GetMetadataStoreRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for get_metadata_store Override in a subclass to manipulate the request or metadata @@ -731,8 +779,10 @@ def post_get_metadata_store( def pre_list_artifacts( self, request: metadata_service.ListArtifactsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[metadata_service.ListArtifactsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + metadata_service.ListArtifactsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_artifacts Override in a subclass to manipulate the request or metadata @@ -754,8 +804,10 @@ def post_list_artifacts( def pre_list_contexts( self, request: metadata_service.ListContextsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[metadata_service.ListContextsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + metadata_service.ListContextsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_contexts Override in a subclass to manipulate the request or metadata @@ -777,8 +829,10 @@ def post_list_contexts( def pre_list_executions( self, request: metadata_service.ListExecutionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[metadata_service.ListExecutionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + metadata_service.ListExecutionsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_executions Override in a subclass to manipulate the request or metadata @@ -800,8 +854,11 @@ def post_list_executions( def pre_list_metadata_schemas( self, request: metadata_service.ListMetadataSchemasRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[metadata_service.ListMetadataSchemasRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + metadata_service.ListMetadataSchemasRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for list_metadata_schemas Override in a subclass to manipulate the request or metadata @@ -823,8 +880,11 @@ def post_list_metadata_schemas( def pre_list_metadata_stores( self, request: metadata_service.ListMetadataStoresRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[metadata_service.ListMetadataStoresRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + metadata_service.ListMetadataStoresRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for list_metadata_stores Override in a subclass to manipulate the request or metadata @@ -846,8 +906,10 @@ def post_list_metadata_stores( def pre_purge_artifacts( self, request: metadata_service.PurgeArtifactsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[metadata_service.PurgeArtifactsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + metadata_service.PurgeArtifactsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for purge_artifacts Override in a subclass to manipulate the request or metadata @@ -869,8 +931,10 @@ def post_purge_artifacts( def pre_purge_contexts( self, request: metadata_service.PurgeContextsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[metadata_service.PurgeContextsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + metadata_service.PurgeContextsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for purge_contexts Override in a subclass to manipulate the request or metadata @@ -892,8 +956,10 @@ def post_purge_contexts( def pre_purge_executions( self, request: metadata_service.PurgeExecutionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[metadata_service.PurgeExecutionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + metadata_service.PurgeExecutionsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for purge_executions Override in a subclass to manipulate the request or metadata @@ -915,9 +981,10 @@ def post_purge_executions( def pre_query_artifact_lineage_subgraph( self, request: metadata_service.QueryArtifactLineageSubgraphRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - metadata_service.QueryArtifactLineageSubgraphRequest, Sequence[Tuple[str, str]] + metadata_service.QueryArtifactLineageSubgraphRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for query_artifact_lineage_subgraph @@ -940,9 +1007,10 @@ def post_query_artifact_lineage_subgraph( def pre_query_context_lineage_subgraph( self, request: metadata_service.QueryContextLineageSubgraphRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - metadata_service.QueryContextLineageSubgraphRequest, Sequence[Tuple[str, str]] + metadata_service.QueryContextLineageSubgraphRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for query_context_lineage_subgraph @@ -965,10 +1033,10 @@ def post_query_context_lineage_subgraph( def pre_query_execution_inputs_and_outputs( self, request: metadata_service.QueryExecutionInputsAndOutputsRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ metadata_service.QueryExecutionInputsAndOutputsRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for query_execution_inputs_and_outputs @@ -991,9 +1059,10 @@ def post_query_execution_inputs_and_outputs( def pre_remove_context_children( self, request: metadata_service.RemoveContextChildrenRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - metadata_service.RemoveContextChildrenRequest, Sequence[Tuple[str, str]] + metadata_service.RemoveContextChildrenRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for remove_context_children @@ -1016,8 +1085,10 @@ def post_remove_context_children( def pre_update_artifact( self, request: metadata_service.UpdateArtifactRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[metadata_service.UpdateArtifactRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + metadata_service.UpdateArtifactRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for update_artifact Override in a subclass to manipulate the request or metadata @@ -1039,8 +1110,10 @@ def post_update_artifact( def pre_update_context( self, request: metadata_service.UpdateContextRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[metadata_service.UpdateContextRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + metadata_service.UpdateContextRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for update_context Override in a subclass to manipulate the request or metadata @@ -1060,8 +1133,10 @@ def post_update_context(self, response: gca_context.Context) -> gca_context.Cont def pre_update_execution( self, request: metadata_service.UpdateExecutionRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[metadata_service.UpdateExecutionRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + metadata_service.UpdateExecutionRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for update_execution Override in a subclass to manipulate the request or metadata @@ -1083,8 +1158,10 @@ def post_update_execution( def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -1106,8 +1183,10 @@ def post_get_location( def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -1129,8 +1208,10 @@ def post_list_locations( def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -1150,8 +1231,10 @@ def post_get_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -1171,8 +1254,11 @@ def post_set_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -1194,8 +1280,10 @@ def post_test_iam_permissions( def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -1215,8 +1303,10 @@ def post_cancel_operation(self, response: None) -> None: 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 @@ -1236,8 +1326,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 @@ -1259,8 +1351,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 @@ -1282,8 +1376,10 @@ def post_list_operations( def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -3305,7 +3401,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]]] = (), ) -> metadata_service.AddContextArtifactsAndExecutionsResponse: r"""Call the add context artifacts and executions method over HTTP. @@ -3317,8 +3413,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: ~.metadata_service.AddContextArtifactsAndExecutionsResponse: @@ -3330,6 +3428,7 @@ def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseAddContextArtifactsAndExecutions._get_http_options() ) + ( request, metadata, @@ -3349,6 +3448,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.aiplatform_v1.MetadataServiceClient.AddContextArtifactsAndExecutions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "AddContextArtifactsAndExecutions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MetadataServiceRestTransport._AddContextArtifactsAndExecutions._get_response( self._host, @@ -3370,7 +3496,31 @@ def __call__( pb_resp = metadata_service.AddContextArtifactsAndExecutionsResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_add_context_artifacts_and_executions(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = metadata_service.AddContextArtifactsAndExecutionsResponse.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.aiplatform_v1.MetadataServiceClient.add_context_artifacts_and_executions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "AddContextArtifactsAndExecutions", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _AddContextChildren( @@ -3410,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]]] = (), ) -> metadata_service.AddContextChildrenResponse: r"""Call the add context children method over HTTP. @@ -3421,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: ~.metadata_service.AddContextChildrenResponse: @@ -3434,6 +3586,7 @@ def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseAddContextChildren._get_http_options() ) + request, metadata = self._interceptor.pre_add_context_children( request, metadata ) @@ -3450,6 +3603,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.aiplatform_v1.MetadataServiceClient.AddContextChildren", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "AddContextChildren", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MetadataServiceRestTransport._AddContextChildren._get_response( self._host, @@ -3471,7 +3651,31 @@ def __call__( pb_resp = metadata_service.AddContextChildrenResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_add_context_children(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + metadata_service.AddContextChildrenResponse.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.aiplatform_v1.MetadataServiceClient.add_context_children", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "AddContextChildren", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _AddExecutionEvents( @@ -3511,7 +3715,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]]] = (), ) -> metadata_service.AddExecutionEventsResponse: r"""Call the add execution events method over HTTP. @@ -3522,8 +3726,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: ~.metadata_service.AddExecutionEventsResponse: @@ -3535,6 +3741,7 @@ def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseAddExecutionEvents._get_http_options() ) + request, metadata = self._interceptor.pre_add_execution_events( request, metadata ) @@ -3551,6 +3758,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.aiplatform_v1.MetadataServiceClient.AddExecutionEvents", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "AddExecutionEvents", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MetadataServiceRestTransport._AddExecutionEvents._get_response( self._host, @@ -3572,7 +3806,31 @@ def __call__( pb_resp = metadata_service.AddExecutionEventsResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_add_execution_events(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + metadata_service.AddExecutionEventsResponse.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.aiplatform_v1.MetadataServiceClient.add_execution_events", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "AddExecutionEvents", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _CreateArtifact( @@ -3611,7 +3869,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]]] = (), ) -> gca_artifact.Artifact: r"""Call the create artifact method over HTTP. @@ -3622,8 +3880,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: ~.gca_artifact.Artifact: @@ -3633,6 +3893,7 @@ def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseCreateArtifact._get_http_options() ) + request, metadata = self._interceptor.pre_create_artifact(request, metadata) transcoded_request = _BaseMetadataServiceRestTransport._BaseCreateArtifact._get_transcoded_request( http_options, request @@ -3647,6 +3908,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.aiplatform_v1.MetadataServiceClient.CreateArtifact", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "CreateArtifact", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MetadataServiceRestTransport._CreateArtifact._get_response( self._host, @@ -3668,7 +3956,29 @@ def __call__( pb_resp = gca_artifact.Artifact.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_create_artifact(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gca_artifact.Artifact.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.aiplatform_v1.MetadataServiceClient.create_artifact", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "CreateArtifact", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _CreateContext( @@ -3707,7 +4017,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]]] = (), ) -> gca_context.Context: r"""Call the create context method over HTTP. @@ -3718,8 +4028,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: ~.gca_context.Context: @@ -3729,6 +4041,7 @@ def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseCreateContext._get_http_options() ) + request, metadata = self._interceptor.pre_create_context(request, metadata) transcoded_request = _BaseMetadataServiceRestTransport._BaseCreateContext._get_transcoded_request( http_options, request @@ -3743,6 +4056,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.aiplatform_v1.MetadataServiceClient.CreateContext", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "CreateContext", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MetadataServiceRestTransport._CreateContext._get_response( self._host, @@ -3764,7 +4104,29 @@ def __call__( pb_resp = gca_context.Context.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_create_context(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gca_context.Context.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.aiplatform_v1.MetadataServiceClient.create_context", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "CreateContext", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _CreateExecution( @@ -3803,7 +4165,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]]] = (), ) -> gca_execution.Execution: r"""Call the create execution method over HTTP. @@ -3814,8 +4176,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: ~.gca_execution.Execution: @@ -3825,6 +4189,7 @@ def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseCreateExecution._get_http_options() ) + request, metadata = self._interceptor.pre_create_execution( request, metadata ) @@ -3841,6 +4206,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.aiplatform_v1.MetadataServiceClient.CreateExecution", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "CreateExecution", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MetadataServiceRestTransport._CreateExecution._get_response( self._host, @@ -3862,7 +4254,29 @@ def __call__( pb_resp = gca_execution.Execution.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_create_execution(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gca_execution.Execution.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.aiplatform_v1.MetadataServiceClient.create_execution", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "CreateExecution", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _CreateMetadataSchema( @@ -3902,7 +4316,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]]] = (), ) -> gca_metadata_schema.MetadataSchema: r"""Call the create metadata schema method over HTTP. @@ -3913,8 +4327,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: ~.gca_metadata_schema.MetadataSchema: @@ -3924,6 +4340,7 @@ def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseCreateMetadataSchema._get_http_options() ) + request, metadata = self._interceptor.pre_create_metadata_schema( request, metadata ) @@ -3940,6 +4357,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.aiplatform_v1.MetadataServiceClient.CreateMetadataSchema", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "CreateMetadataSchema", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MetadataServiceRestTransport._CreateMetadataSchema._get_response( self._host, @@ -3961,7 +4405,31 @@ def __call__( pb_resp = gca_metadata_schema.MetadataSchema.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_create_metadata_schema(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gca_metadata_schema.MetadataSchema.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.aiplatform_v1.MetadataServiceClient.create_metadata_schema", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "CreateMetadataSchema", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _CreateMetadataStore( @@ -4001,7 +4469,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 metadata store method over HTTP. @@ -4012,8 +4480,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: @@ -4026,6 +4496,7 @@ def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseCreateMetadataStore._get_http_options() ) + request, metadata = self._interceptor.pre_create_metadata_store( request, metadata ) @@ -4042,6 +4513,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.aiplatform_v1.MetadataServiceClient.CreateMetadataStore", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "CreateMetadataStore", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MetadataServiceRestTransport._CreateMetadataStore._get_response( self._host, @@ -4061,7 +4559,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_metadata_store(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.aiplatform_v1.MetadataServiceClient.create_metadata_store", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "CreateMetadataStore", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _DeleteArtifact( @@ -4099,7 +4619,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 artifact method over HTTP. @@ -4110,8 +4630,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: @@ -4124,6 +4646,7 @@ def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseDeleteArtifact._get_http_options() ) + request, metadata = self._interceptor.pre_delete_artifact(request, metadata) transcoded_request = _BaseMetadataServiceRestTransport._BaseDeleteArtifact._get_transcoded_request( http_options, request @@ -4134,6 +4657,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.aiplatform_v1.MetadataServiceClient.DeleteArtifact", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "DeleteArtifact", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MetadataServiceRestTransport._DeleteArtifact._get_response( self._host, @@ -4152,7 +4702,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_artifact(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.aiplatform_v1.MetadataServiceClient.delete_artifact", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "DeleteArtifact", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _DeleteContext( @@ -4190,7 +4762,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 context method over HTTP. @@ -4201,8 +4773,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: @@ -4215,6 +4789,7 @@ def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseDeleteContext._get_http_options() ) + request, metadata = self._interceptor.pre_delete_context(request, metadata) transcoded_request = _BaseMetadataServiceRestTransport._BaseDeleteContext._get_transcoded_request( http_options, request @@ -4225,6 +4800,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.aiplatform_v1.MetadataServiceClient.DeleteContext", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "DeleteContext", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MetadataServiceRestTransport._DeleteContext._get_response( self._host, @@ -4243,7 +4845,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_context(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.aiplatform_v1.MetadataServiceClient.delete_context", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "DeleteContext", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _DeleteExecution( @@ -4281,7 +4905,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 execution method over HTTP. @@ -4292,8 +4916,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: @@ -4306,6 +4932,7 @@ def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseDeleteExecution._get_http_options() ) + request, metadata = self._interceptor.pre_delete_execution( request, metadata ) @@ -4318,6 +4945,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.aiplatform_v1.MetadataServiceClient.DeleteExecution", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "DeleteExecution", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MetadataServiceRestTransport._DeleteExecution._get_response( self._host, @@ -4336,7 +4990,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_execution(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.aiplatform_v1.MetadataServiceClient.delete_execution", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "DeleteExecution", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _DeleteMetadataStore( @@ -4375,7 +5051,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 metadata store method over HTTP. @@ -4386,8 +5062,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: @@ -4400,6 +5078,7 @@ def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseDeleteMetadataStore._get_http_options() ) + request, metadata = self._interceptor.pre_delete_metadata_store( request, metadata ) @@ -4412,6 +5091,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.aiplatform_v1.MetadataServiceClient.DeleteMetadataStore", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "DeleteMetadataStore", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MetadataServiceRestTransport._DeleteMetadataStore._get_response( self._host, @@ -4430,7 +5136,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_metadata_store(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.aiplatform_v1.MetadataServiceClient.delete_metadata_store", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "DeleteMetadataStore", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _GetArtifact( @@ -4468,7 +5196,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]]] = (), ) -> artifact.Artifact: r"""Call the get artifact method over HTTP. @@ -4479,8 +5207,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: ~.artifact.Artifact: @@ -4490,6 +5220,7 @@ def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseGetArtifact._get_http_options() ) + request, metadata = self._interceptor.pre_get_artifact(request, metadata) transcoded_request = _BaseMetadataServiceRestTransport._BaseGetArtifact._get_transcoded_request( http_options, request @@ -4500,6 +5231,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.aiplatform_v1.MetadataServiceClient.GetArtifact", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "GetArtifact", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MetadataServiceRestTransport._GetArtifact._get_response( self._host, @@ -4520,7 +5278,29 @@ def __call__( pb_resp = artifact.Artifact.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_artifact(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = artifact.Artifact.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.aiplatform_v1.MetadataServiceClient.get_artifact", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "GetArtifact", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _GetContext( @@ -4558,7 +5338,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]]] = (), ) -> context.Context: r"""Call the get context method over HTTP. @@ -4569,8 +5349,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: ~.context.Context: @@ -4580,6 +5362,7 @@ def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseGetContext._get_http_options() ) + request, metadata = self._interceptor.pre_get_context(request, metadata) transcoded_request = _BaseMetadataServiceRestTransport._BaseGetContext._get_transcoded_request( http_options, request @@ -4590,6 +5373,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.aiplatform_v1.MetadataServiceClient.GetContext", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "GetContext", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MetadataServiceRestTransport._GetContext._get_response( self._host, @@ -4610,7 +5420,29 @@ def __call__( pb_resp = context.Context.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_context(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = context.Context.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.aiplatform_v1.MetadataServiceClient.get_context", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "GetContext", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _GetExecution( @@ -4648,7 +5480,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]]] = (), ) -> execution.Execution: r"""Call the get execution method over HTTP. @@ -4659,8 +5491,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: ~.execution.Execution: @@ -4670,6 +5504,7 @@ def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseGetExecution._get_http_options() ) + request, metadata = self._interceptor.pre_get_execution(request, metadata) transcoded_request = _BaseMetadataServiceRestTransport._BaseGetExecution._get_transcoded_request( http_options, request @@ -4680,6 +5515,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.aiplatform_v1.MetadataServiceClient.GetExecution", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "GetExecution", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MetadataServiceRestTransport._GetExecution._get_response( self._host, @@ -4700,7 +5562,29 @@ def __call__( pb_resp = execution.Execution.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_execution(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = execution.Execution.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.aiplatform_v1.MetadataServiceClient.get_execution", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "GetExecution", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _GetMetadataSchema( @@ -4739,7 +5623,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]]] = (), ) -> metadata_schema.MetadataSchema: r"""Call the get metadata schema method over HTTP. @@ -4750,8 +5634,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: ~.metadata_schema.MetadataSchema: @@ -4761,6 +5647,7 @@ def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseGetMetadataSchema._get_http_options() ) + request, metadata = self._interceptor.pre_get_metadata_schema( request, metadata ) @@ -4773,6 +5660,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.aiplatform_v1.MetadataServiceClient.GetMetadataSchema", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "GetMetadataSchema", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MetadataServiceRestTransport._GetMetadataSchema._get_response( self._host, @@ -4793,7 +5707,29 @@ def __call__( pb_resp = metadata_schema.MetadataSchema.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_metadata_schema(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = metadata_schema.MetadataSchema.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.aiplatform_v1.MetadataServiceClient.get_metadata_schema", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "GetMetadataSchema", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _GetMetadataStore( @@ -4831,7 +5767,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]]] = (), ) -> metadata_store.MetadataStore: r"""Call the get metadata store method over HTTP. @@ -4842,8 +5778,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: ~.metadata_store.MetadataStore: @@ -4856,6 +5794,7 @@ def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseGetMetadataStore._get_http_options() ) + request, metadata = self._interceptor.pre_get_metadata_store( request, metadata ) @@ -4868,6 +5807,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.aiplatform_v1.MetadataServiceClient.GetMetadataStore", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "GetMetadataStore", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MetadataServiceRestTransport._GetMetadataStore._get_response( self._host, @@ -4888,7 +5854,29 @@ def __call__( pb_resp = metadata_store.MetadataStore.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_metadata_store(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = metadata_store.MetadataStore.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.aiplatform_v1.MetadataServiceClient.get_metadata_store", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "GetMetadataStore", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListArtifacts( @@ -4926,7 +5914,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]]] = (), ) -> metadata_service.ListArtifactsResponse: r"""Call the list artifacts method over HTTP. @@ -4937,8 +5925,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: ~.metadata_service.ListArtifactsResponse: @@ -4950,6 +5940,7 @@ def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseListArtifacts._get_http_options() ) + request, metadata = self._interceptor.pre_list_artifacts(request, metadata) transcoded_request = _BaseMetadataServiceRestTransport._BaseListArtifacts._get_transcoded_request( http_options, request @@ -4960,6 +5951,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.aiplatform_v1.MetadataServiceClient.ListArtifacts", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "ListArtifacts", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MetadataServiceRestTransport._ListArtifacts._get_response( self._host, @@ -4980,7 +5998,31 @@ def __call__( pb_resp = metadata_service.ListArtifactsResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_artifacts(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = metadata_service.ListArtifactsResponse.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.aiplatform_v1.MetadataServiceClient.list_artifacts", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "ListArtifacts", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListContexts( @@ -5018,7 +6060,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]]] = (), ) -> metadata_service.ListContextsResponse: r"""Call the list contexts method over HTTP. @@ -5029,8 +6071,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: ~.metadata_service.ListContextsResponse: @@ -5042,6 +6086,7 @@ def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseListContexts._get_http_options() ) + request, metadata = self._interceptor.pre_list_contexts(request, metadata) transcoded_request = _BaseMetadataServiceRestTransport._BaseListContexts._get_transcoded_request( http_options, request @@ -5052,6 +6097,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.aiplatform_v1.MetadataServiceClient.ListContexts", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "ListContexts", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MetadataServiceRestTransport._ListContexts._get_response( self._host, @@ -5072,7 +6144,31 @@ def __call__( pb_resp = metadata_service.ListContextsResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_contexts(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = metadata_service.ListContextsResponse.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.aiplatform_v1.MetadataServiceClient.list_contexts", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "ListContexts", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListExecutions( @@ -5110,7 +6206,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]]] = (), ) -> metadata_service.ListExecutionsResponse: r"""Call the list executions method over HTTP. @@ -5121,8 +6217,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: ~.metadata_service.ListExecutionsResponse: @@ -5134,6 +6232,7 @@ def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseListExecutions._get_http_options() ) + request, metadata = self._interceptor.pre_list_executions(request, metadata) transcoded_request = _BaseMetadataServiceRestTransport._BaseListExecutions._get_transcoded_request( http_options, request @@ -5144,6 +6243,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.aiplatform_v1.MetadataServiceClient.ListExecutions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "ListExecutions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MetadataServiceRestTransport._ListExecutions._get_response( self._host, @@ -5164,7 +6290,31 @@ def __call__( pb_resp = metadata_service.ListExecutionsResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_executions(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = metadata_service.ListExecutionsResponse.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.aiplatform_v1.MetadataServiceClient.list_executions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "ListExecutions", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListMetadataSchemas( @@ -5203,7 +6353,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]]] = (), ) -> metadata_service.ListMetadataSchemasResponse: r"""Call the list metadata schemas method over HTTP. @@ -5214,8 +6364,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: ~.metadata_service.ListMetadataSchemasResponse: @@ -5227,6 +6379,7 @@ def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseListMetadataSchemas._get_http_options() ) + request, metadata = self._interceptor.pre_list_metadata_schemas( request, metadata ) @@ -5239,6 +6392,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.aiplatform_v1.MetadataServiceClient.ListMetadataSchemas", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "ListMetadataSchemas", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MetadataServiceRestTransport._ListMetadataSchemas._get_response( self._host, @@ -5259,7 +6439,31 @@ def __call__( pb_resp = metadata_service.ListMetadataSchemasResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_metadata_schemas(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + metadata_service.ListMetadataSchemasResponse.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.aiplatform_v1.MetadataServiceClient.list_metadata_schemas", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "ListMetadataSchemas", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListMetadataStores( @@ -5298,7 +6502,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]]] = (), ) -> metadata_service.ListMetadataStoresResponse: r"""Call the list metadata stores method over HTTP. @@ -5309,8 +6513,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: ~.metadata_service.ListMetadataStoresResponse: @@ -5322,6 +6528,7 @@ def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseListMetadataStores._get_http_options() ) + request, metadata = self._interceptor.pre_list_metadata_stores( request, metadata ) @@ -5334,6 +6541,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.aiplatform_v1.MetadataServiceClient.ListMetadataStores", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "ListMetadataStores", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MetadataServiceRestTransport._ListMetadataStores._get_response( self._host, @@ -5354,7 +6588,31 @@ def __call__( pb_resp = metadata_service.ListMetadataStoresResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_metadata_stores(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + metadata_service.ListMetadataStoresResponse.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.aiplatform_v1.MetadataServiceClient.list_metadata_stores", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "ListMetadataStores", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _PurgeArtifacts( @@ -5393,7 +6651,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 purge artifacts method over HTTP. @@ -5404,8 +6662,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: @@ -5418,6 +6678,7 @@ def __call__( http_options = ( _BaseMetadataServiceRestTransport._BasePurgeArtifacts._get_http_options() ) + request, metadata = self._interceptor.pre_purge_artifacts(request, metadata) transcoded_request = _BaseMetadataServiceRestTransport._BasePurgeArtifacts._get_transcoded_request( http_options, request @@ -5432,6 +6693,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.aiplatform_v1.MetadataServiceClient.PurgeArtifacts", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "PurgeArtifacts", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MetadataServiceRestTransport._PurgeArtifacts._get_response( self._host, @@ -5451,7 +6739,29 @@ def __call__( # Return the response resp = operations_pb2.Operation() json_format.Parse(response.content, resp, ignore_unknown_fields=True) + resp = self._interceptor.post_purge_artifacts(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.aiplatform_v1.MetadataServiceClient.purge_artifacts", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "PurgeArtifacts", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _PurgeContexts( @@ -5490,7 +6800,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 purge contexts method over HTTP. @@ -5501,8 +6811,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: @@ -5515,6 +6827,7 @@ def __call__( http_options = ( _BaseMetadataServiceRestTransport._BasePurgeContexts._get_http_options() ) + request, metadata = self._interceptor.pre_purge_contexts(request, metadata) transcoded_request = _BaseMetadataServiceRestTransport._BasePurgeContexts._get_transcoded_request( http_options, request @@ -5529,6 +6842,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.aiplatform_v1.MetadataServiceClient.PurgeContexts", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "PurgeContexts", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MetadataServiceRestTransport._PurgeContexts._get_response( self._host, @@ -5548,7 +6888,29 @@ def __call__( # Return the response resp = operations_pb2.Operation() json_format.Parse(response.content, resp, ignore_unknown_fields=True) + resp = self._interceptor.post_purge_contexts(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.aiplatform_v1.MetadataServiceClient.purge_contexts", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "PurgeContexts", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _PurgeExecutions( @@ -5587,7 +6949,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 purge executions method over HTTP. @@ -5598,8 +6960,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: @@ -5612,6 +6976,7 @@ def __call__( http_options = ( _BaseMetadataServiceRestTransport._BasePurgeExecutions._get_http_options() ) + request, metadata = self._interceptor.pre_purge_executions( request, metadata ) @@ -5628,6 +6993,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.aiplatform_v1.MetadataServiceClient.PurgeExecutions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "PurgeExecutions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MetadataServiceRestTransport._PurgeExecutions._get_response( self._host, @@ -5647,7 +7039,29 @@ def __call__( # Return the response resp = operations_pb2.Operation() json_format.Parse(response.content, resp, ignore_unknown_fields=True) + resp = self._interceptor.post_purge_executions(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.aiplatform_v1.MetadataServiceClient.purge_executions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "PurgeExecutions", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _QueryArtifactLineageSubgraph( @@ -5686,7 +7100,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]]] = (), ) -> lineage_subgraph.LineageSubgraph: r"""Call the query artifact lineage subgraph method over HTTP. @@ -5698,8 +7112,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: ~.lineage_subgraph.LineageSubgraph: @@ -5712,6 +7128,7 @@ def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseQueryArtifactLineageSubgraph._get_http_options() ) + request, metadata = self._interceptor.pre_query_artifact_lineage_subgraph( request, metadata ) @@ -5724,6 +7141,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.aiplatform_v1.MetadataServiceClient.QueryArtifactLineageSubgraph", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "QueryArtifactLineageSubgraph", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MetadataServiceRestTransport._QueryArtifactLineageSubgraph._get_response( self._host, @@ -5744,7 +7188,31 @@ def __call__( pb_resp = lineage_subgraph.LineageSubgraph.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_query_artifact_lineage_subgraph(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = lineage_subgraph.LineageSubgraph.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.aiplatform_v1.MetadataServiceClient.query_artifact_lineage_subgraph", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "QueryArtifactLineageSubgraph", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _QueryContextLineageSubgraph( @@ -5783,7 +7251,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]]] = (), ) -> lineage_subgraph.LineageSubgraph: r"""Call the query context lineage subgraph method over HTTP. @@ -5795,8 +7263,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: ~.lineage_subgraph.LineageSubgraph: @@ -5809,6 +7279,7 @@ def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseQueryContextLineageSubgraph._get_http_options() ) + request, metadata = self._interceptor.pre_query_context_lineage_subgraph( request, metadata ) @@ -5821,6 +7292,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.aiplatform_v1.MetadataServiceClient.QueryContextLineageSubgraph", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "QueryContextLineageSubgraph", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( MetadataServiceRestTransport._QueryContextLineageSubgraph._get_response( @@ -5843,7 +7341,31 @@ def __call__( pb_resp = lineage_subgraph.LineageSubgraph.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_query_context_lineage_subgraph(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = lineage_subgraph.LineageSubgraph.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.aiplatform_v1.MetadataServiceClient.query_context_lineage_subgraph", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "QueryContextLineageSubgraph", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _QueryExecutionInputsAndOutputs( @@ -5882,7 +7404,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]]] = (), ) -> lineage_subgraph.LineageSubgraph: r"""Call the query execution inputs and outputs method over HTTP. @@ -5894,8 +7416,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: ~.lineage_subgraph.LineageSubgraph: @@ -5908,6 +7432,7 @@ def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseQueryExecutionInputsAndOutputs._get_http_options() ) + ( request, metadata, @@ -5923,6 +7448,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.aiplatform_v1.MetadataServiceClient.QueryExecutionInputsAndOutputs", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "QueryExecutionInputsAndOutputs", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MetadataServiceRestTransport._QueryExecutionInputsAndOutputs._get_response( self._host, @@ -5943,7 +7495,31 @@ def __call__( pb_resp = lineage_subgraph.LineageSubgraph.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_query_execution_inputs_and_outputs(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = lineage_subgraph.LineageSubgraph.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.aiplatform_v1.MetadataServiceClient.query_execution_inputs_and_outputs", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "QueryExecutionInputsAndOutputs", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _RemoveContextChildren( @@ -5983,7 +7559,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]]] = (), ) -> metadata_service.RemoveContextChildrenResponse: r"""Call the remove context children method over HTTP. @@ -5994,8 +7570,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: ~.metadata_service.RemoveContextChildrenResponse: @@ -6007,6 +7585,7 @@ def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseRemoveContextChildren._get_http_options() ) + request, metadata = self._interceptor.pre_remove_context_children( request, metadata ) @@ -6023,6 +7602,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.aiplatform_v1.MetadataServiceClient.RemoveContextChildren", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "RemoveContextChildren", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( MetadataServiceRestTransport._RemoveContextChildren._get_response( @@ -6046,7 +7652,31 @@ def __call__( pb_resp = metadata_service.RemoveContextChildrenResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_remove_context_children(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + metadata_service.RemoveContextChildrenResponse.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.aiplatform_v1.MetadataServiceClient.remove_context_children", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "RemoveContextChildren", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _UpdateArtifact( @@ -6085,7 +7715,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]]] = (), ) -> gca_artifact.Artifact: r"""Call the update artifact method over HTTP. @@ -6096,8 +7726,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: ~.gca_artifact.Artifact: @@ -6107,6 +7739,7 @@ def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseUpdateArtifact._get_http_options() ) + request, metadata = self._interceptor.pre_update_artifact(request, metadata) transcoded_request = _BaseMetadataServiceRestTransport._BaseUpdateArtifact._get_transcoded_request( http_options, request @@ -6121,6 +7754,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.aiplatform_v1.MetadataServiceClient.UpdateArtifact", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "UpdateArtifact", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MetadataServiceRestTransport._UpdateArtifact._get_response( self._host, @@ -6142,7 +7802,29 @@ def __call__( pb_resp = gca_artifact.Artifact.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_update_artifact(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gca_artifact.Artifact.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.aiplatform_v1.MetadataServiceClient.update_artifact", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "UpdateArtifact", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _UpdateContext( @@ -6181,7 +7863,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]]] = (), ) -> gca_context.Context: r"""Call the update context method over HTTP. @@ -6192,8 +7874,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: ~.gca_context.Context: @@ -6203,6 +7887,7 @@ def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseUpdateContext._get_http_options() ) + request, metadata = self._interceptor.pre_update_context(request, metadata) transcoded_request = _BaseMetadataServiceRestTransport._BaseUpdateContext._get_transcoded_request( http_options, request @@ -6217,6 +7902,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.aiplatform_v1.MetadataServiceClient.UpdateContext", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "UpdateContext", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MetadataServiceRestTransport._UpdateContext._get_response( self._host, @@ -6238,7 +7950,29 @@ def __call__( pb_resp = gca_context.Context.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_update_context(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gca_context.Context.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.aiplatform_v1.MetadataServiceClient.update_context", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "UpdateContext", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _UpdateExecution( @@ -6277,7 +8011,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]]] = (), ) -> gca_execution.Execution: r"""Call the update execution method over HTTP. @@ -6288,8 +8022,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: ~.gca_execution.Execution: @@ -6299,6 +8035,7 @@ def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseUpdateExecution._get_http_options() ) + request, metadata = self._interceptor.pre_update_execution( request, metadata ) @@ -6315,6 +8052,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.aiplatform_v1.MetadataServiceClient.UpdateExecution", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "UpdateExecution", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MetadataServiceRestTransport._UpdateExecution._get_response( self._host, @@ -6336,7 +8100,29 @@ def __call__( pb_resp = gca_execution.Execution.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_update_execution(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gca_execution.Execution.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.aiplatform_v1.MetadataServiceClient.update_execution", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "UpdateExecution", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp @property @@ -6679,7 +8465,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]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -6690,8 +8476,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: locations_pb2.Location: Response from GetLocation method. @@ -6700,6 +8488,7 @@ def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = self._interceptor.pre_get_location(request, metadata) transcoded_request = _BaseMetadataServiceRestTransport._BaseGetLocation._get_transcoded_request( http_options, request @@ -6710,6 +8499,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.aiplatform_v1.MetadataServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MetadataServiceRestTransport._GetLocation._get_response( self._host, @@ -6729,6 +8545,27 @@ def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_location(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.aiplatform_v1.MetadataServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -6770,7 +8607,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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -6781,8 +8618,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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -6791,6 +8630,7 @@ def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = self._interceptor.pre_list_locations(request, metadata) transcoded_request = _BaseMetadataServiceRestTransport._BaseListLocations._get_transcoded_request( http_options, request @@ -6801,6 +8641,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.aiplatform_v1.MetadataServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MetadataServiceRestTransport._ListLocations._get_response( self._host, @@ -6820,6 +8687,27 @@ def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_list_locations(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.aiplatform_v1.MetadataServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -6861,7 +8749,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]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -6872,8 +8760,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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -6882,6 +8772,7 @@ def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_get_iam_policy(request, metadata) transcoded_request = _BaseMetadataServiceRestTransport._BaseGetIamPolicy._get_transcoded_request( http_options, request @@ -6892,6 +8783,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.aiplatform_v1.MetadataServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MetadataServiceRestTransport._GetIamPolicy._get_response( self._host, @@ -6911,6 +8829,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_iam_policy(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.aiplatform_v1.MetadataServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -6953,7 +8892,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]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -6964,8 +8903,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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -6974,6 +8915,7 @@ def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_set_iam_policy(request, metadata) transcoded_request = _BaseMetadataServiceRestTransport._BaseSetIamPolicy._get_transcoded_request( http_options, request @@ -6988,6 +8930,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.aiplatform_v1.MetadataServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MetadataServiceRestTransport._SetIamPolicy._get_response( self._host, @@ -7008,6 +8977,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_set_iam_policy(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.aiplatform_v1.MetadataServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -7050,7 +9040,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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -7061,8 +9051,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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -7071,6 +9063,7 @@ def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -7083,6 +9076,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.aiplatform_v1.MetadataServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MetadataServiceRestTransport._TestIamPermissions._get_response( self._host, @@ -7102,6 +9122,27 @@ def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_test_iam_permissions(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.aiplatform_v1.MetadataServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -7143,7 +9184,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 cancel operation method over HTTP. @@ -7154,13 +9195,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 = ( _BaseMetadataServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = self._interceptor.pre_cancel_operation( request, metadata ) @@ -7173,6 +9217,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.aiplatform_v1.MetadataServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MetadataServiceRestTransport._CancelOperation._get_response( self._host, @@ -7229,7 +9300,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. @@ -7240,13 +9311,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 = ( _BaseMetadataServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = self._interceptor.pre_delete_operation( request, metadata ) @@ -7259,6 +9333,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.aiplatform_v1.MetadataServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MetadataServiceRestTransport._DeleteOperation._get_response( self._host, @@ -7315,7 +9416,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. @@ -7326,8 +9427,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. @@ -7336,6 +9439,7 @@ def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = self._interceptor.pre_get_operation(request, metadata) transcoded_request = _BaseMetadataServiceRestTransport._BaseGetOperation._get_transcoded_request( http_options, request @@ -7346,6 +9450,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.aiplatform_v1.MetadataServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MetadataServiceRestTransport._GetOperation._get_response( self._host, @@ -7365,6 +9496,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.aiplatform_v1.MetadataServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -7406,7 +9558,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. @@ -7417,8 +9569,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. @@ -7427,6 +9581,7 @@ def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = self._interceptor.pre_list_operations(request, metadata) transcoded_request = _BaseMetadataServiceRestTransport._BaseListOperations._get_transcoded_request( http_options, request @@ -7437,6 +9592,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.aiplatform_v1.MetadataServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MetadataServiceRestTransport._ListOperations._get_response( self._host, @@ -7456,6 +9638,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.aiplatform_v1.MetadataServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -7497,7 +9700,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 wait operation method over HTTP. @@ -7508,8 +9711,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 WaitOperation method. @@ -7518,6 +9723,7 @@ def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = self._interceptor.pre_wait_operation(request, metadata) transcoded_request = _BaseMetadataServiceRestTransport._BaseWaitOperation._get_transcoded_request( http_options, request @@ -7528,6 +9734,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.aiplatform_v1.MetadataServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MetadataServiceRestTransport._WaitOperation._get_response( self._host, @@ -7547,6 +9780,27 @@ def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = self._interceptor.post_wait_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.aiplatform_v1.MetadataServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1/services/metadata_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1/services/metadata_service/transports/rest_asyncio.py index b1567f80c0..c4cd370ad3 100644 --- a/google/cloud/aiplatform_v1/services/metadata_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1/services/metadata_service/transports/rest_asyncio.py @@ -68,6 +68,18 @@ from .base import DEFAULT_CLIENT_INFO as BASE_DEFAULT_CLIENT_INFO + +import logging + +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__) + try: OptionalRetry = Union[retries.AsyncRetry, gapic_v1.method._MethodDefault, None] except AttributeError: # pragma: NO COVER @@ -360,10 +372,10 @@ async def post_update_execution(self, response): async def pre_add_context_artifacts_and_executions( self, request: metadata_service.AddContextArtifactsAndExecutionsRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ metadata_service.AddContextArtifactsAndExecutionsRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for add_context_artifacts_and_executions @@ -386,8 +398,11 @@ async def post_add_context_artifacts_and_executions( async def pre_add_context_children( self, request: metadata_service.AddContextChildrenRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[metadata_service.AddContextChildrenRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + metadata_service.AddContextChildrenRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for add_context_children Override in a subclass to manipulate the request or metadata @@ -409,8 +424,11 @@ async def post_add_context_children( async def pre_add_execution_events( self, request: metadata_service.AddExecutionEventsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[metadata_service.AddExecutionEventsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + metadata_service.AddExecutionEventsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for add_execution_events Override in a subclass to manipulate the request or metadata @@ -432,8 +450,10 @@ async def post_add_execution_events( async def pre_create_artifact( self, request: metadata_service.CreateArtifactRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[metadata_service.CreateArtifactRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + metadata_service.CreateArtifactRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for create_artifact Override in a subclass to manipulate the request or metadata @@ -455,8 +475,10 @@ async def post_create_artifact( async def pre_create_context( self, request: metadata_service.CreateContextRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[metadata_service.CreateContextRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + metadata_service.CreateContextRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for create_context Override in a subclass to manipulate the request or metadata @@ -478,8 +500,10 @@ async def post_create_context( async def pre_create_execution( self, request: metadata_service.CreateExecutionRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[metadata_service.CreateExecutionRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + metadata_service.CreateExecutionRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for create_execution Override in a subclass to manipulate the request or metadata @@ -501,8 +525,11 @@ async def post_create_execution( async def pre_create_metadata_schema( self, request: metadata_service.CreateMetadataSchemaRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[metadata_service.CreateMetadataSchemaRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + metadata_service.CreateMetadataSchemaRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for create_metadata_schema Override in a subclass to manipulate the request or metadata @@ -524,8 +551,11 @@ async def post_create_metadata_schema( async def pre_create_metadata_store( self, request: metadata_service.CreateMetadataStoreRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[metadata_service.CreateMetadataStoreRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + metadata_service.CreateMetadataStoreRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for create_metadata_store Override in a subclass to manipulate the request or metadata @@ -547,8 +577,10 @@ async def post_create_metadata_store( async def pre_delete_artifact( self, request: metadata_service.DeleteArtifactRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[metadata_service.DeleteArtifactRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + metadata_service.DeleteArtifactRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for delete_artifact Override in a subclass to manipulate the request or metadata @@ -570,8 +602,10 @@ async def post_delete_artifact( async def pre_delete_context( self, request: metadata_service.DeleteContextRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[metadata_service.DeleteContextRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + metadata_service.DeleteContextRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for delete_context Override in a subclass to manipulate the request or metadata @@ -593,8 +627,10 @@ async def post_delete_context( async def pre_delete_execution( self, request: metadata_service.DeleteExecutionRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[metadata_service.DeleteExecutionRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + metadata_service.DeleteExecutionRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for delete_execution Override in a subclass to manipulate the request or metadata @@ -616,8 +652,11 @@ async def post_delete_execution( async def pre_delete_metadata_store( self, request: metadata_service.DeleteMetadataStoreRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[metadata_service.DeleteMetadataStoreRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + metadata_service.DeleteMetadataStoreRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for delete_metadata_store Override in a subclass to manipulate the request or metadata @@ -639,8 +678,10 @@ async def post_delete_metadata_store( async def pre_get_artifact( self, request: metadata_service.GetArtifactRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[metadata_service.GetArtifactRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + metadata_service.GetArtifactRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_artifact Override in a subclass to manipulate the request or metadata @@ -660,8 +701,10 @@ async def post_get_artifact(self, response: artifact.Artifact) -> artifact.Artif async def pre_get_context( self, request: metadata_service.GetContextRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[metadata_service.GetContextRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + metadata_service.GetContextRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_context Override in a subclass to manipulate the request or metadata @@ -681,8 +724,10 @@ async def post_get_context(self, response: context.Context) -> context.Context: async def pre_get_execution( self, request: metadata_service.GetExecutionRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[metadata_service.GetExecutionRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + metadata_service.GetExecutionRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_execution Override in a subclass to manipulate the request or metadata @@ -704,8 +749,11 @@ async def post_get_execution( async def pre_get_metadata_schema( self, request: metadata_service.GetMetadataSchemaRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[metadata_service.GetMetadataSchemaRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + metadata_service.GetMetadataSchemaRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for get_metadata_schema Override in a subclass to manipulate the request or metadata @@ -727,8 +775,11 @@ async def post_get_metadata_schema( async def pre_get_metadata_store( self, request: metadata_service.GetMetadataStoreRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[metadata_service.GetMetadataStoreRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + metadata_service.GetMetadataStoreRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for get_metadata_store Override in a subclass to manipulate the request or metadata @@ -750,8 +801,10 @@ async def post_get_metadata_store( async def pre_list_artifacts( self, request: metadata_service.ListArtifactsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[metadata_service.ListArtifactsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + metadata_service.ListArtifactsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_artifacts Override in a subclass to manipulate the request or metadata @@ -773,8 +826,10 @@ async def post_list_artifacts( async def pre_list_contexts( self, request: metadata_service.ListContextsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[metadata_service.ListContextsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + metadata_service.ListContextsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_contexts Override in a subclass to manipulate the request or metadata @@ -796,8 +851,10 @@ async def post_list_contexts( async def pre_list_executions( self, request: metadata_service.ListExecutionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[metadata_service.ListExecutionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + metadata_service.ListExecutionsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_executions Override in a subclass to manipulate the request or metadata @@ -819,8 +876,11 @@ async def post_list_executions( async def pre_list_metadata_schemas( self, request: metadata_service.ListMetadataSchemasRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[metadata_service.ListMetadataSchemasRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + metadata_service.ListMetadataSchemasRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for list_metadata_schemas Override in a subclass to manipulate the request or metadata @@ -842,8 +902,11 @@ async def post_list_metadata_schemas( async def pre_list_metadata_stores( self, request: metadata_service.ListMetadataStoresRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[metadata_service.ListMetadataStoresRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + metadata_service.ListMetadataStoresRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for list_metadata_stores Override in a subclass to manipulate the request or metadata @@ -865,8 +928,10 @@ async def post_list_metadata_stores( async def pre_purge_artifacts( self, request: metadata_service.PurgeArtifactsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[metadata_service.PurgeArtifactsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + metadata_service.PurgeArtifactsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for purge_artifacts Override in a subclass to manipulate the request or metadata @@ -888,8 +953,10 @@ async def post_purge_artifacts( async def pre_purge_contexts( self, request: metadata_service.PurgeContextsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[metadata_service.PurgeContextsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + metadata_service.PurgeContextsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for purge_contexts Override in a subclass to manipulate the request or metadata @@ -911,8 +978,10 @@ async def post_purge_contexts( async def pre_purge_executions( self, request: metadata_service.PurgeExecutionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[metadata_service.PurgeExecutionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + metadata_service.PurgeExecutionsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for purge_executions Override in a subclass to manipulate the request or metadata @@ -934,9 +1003,10 @@ async def post_purge_executions( async def pre_query_artifact_lineage_subgraph( self, request: metadata_service.QueryArtifactLineageSubgraphRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - metadata_service.QueryArtifactLineageSubgraphRequest, Sequence[Tuple[str, str]] + metadata_service.QueryArtifactLineageSubgraphRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for query_artifact_lineage_subgraph @@ -959,9 +1029,10 @@ async def post_query_artifact_lineage_subgraph( async def pre_query_context_lineage_subgraph( self, request: metadata_service.QueryContextLineageSubgraphRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - metadata_service.QueryContextLineageSubgraphRequest, Sequence[Tuple[str, str]] + metadata_service.QueryContextLineageSubgraphRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for query_context_lineage_subgraph @@ -984,10 +1055,10 @@ async def post_query_context_lineage_subgraph( async def pre_query_execution_inputs_and_outputs( self, request: metadata_service.QueryExecutionInputsAndOutputsRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ metadata_service.QueryExecutionInputsAndOutputsRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for query_execution_inputs_and_outputs @@ -1010,9 +1081,10 @@ async def post_query_execution_inputs_and_outputs( async def pre_remove_context_children( self, request: metadata_service.RemoveContextChildrenRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - metadata_service.RemoveContextChildrenRequest, Sequence[Tuple[str, str]] + metadata_service.RemoveContextChildrenRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for remove_context_children @@ -1035,8 +1107,10 @@ async def post_remove_context_children( async def pre_update_artifact( self, request: metadata_service.UpdateArtifactRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[metadata_service.UpdateArtifactRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + metadata_service.UpdateArtifactRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for update_artifact Override in a subclass to manipulate the request or metadata @@ -1058,8 +1132,10 @@ async def post_update_artifact( async def pre_update_context( self, request: metadata_service.UpdateContextRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[metadata_service.UpdateContextRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + metadata_service.UpdateContextRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for update_context Override in a subclass to manipulate the request or metadata @@ -1081,8 +1157,10 @@ async def post_update_context( async def pre_update_execution( self, request: metadata_service.UpdateExecutionRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[metadata_service.UpdateExecutionRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + metadata_service.UpdateExecutionRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for update_execution Override in a subclass to manipulate the request or metadata @@ -1104,8 +1182,10 @@ async def post_update_execution( async def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -1127,8 +1207,10 @@ async def post_get_location( async def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -1150,8 +1232,10 @@ async def post_list_locations( async def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -1173,8 +1257,10 @@ async def post_get_iam_policy( async def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -1196,8 +1282,11 @@ async def post_set_iam_policy( async def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -1219,8 +1308,10 @@ async def post_test_iam_permissions( async def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -1240,8 +1331,10 @@ async def post_cancel_operation(self, response: None) -> None: async 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 @@ -1261,8 +1354,10 @@ async def post_delete_operation(self, response: None) -> None: async 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 @@ -1284,8 +1379,10 @@ async def post_get_operation( async 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 @@ -1307,8 +1404,10 @@ async def post_list_operations( async def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -1651,7 +1750,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> metadata_service.AddContextArtifactsAndExecutionsResponse: r"""Call the add context artifacts and executions method over HTTP. @@ -1663,8 +1762,10 @@ async def __call__( 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: ~.metadata_service.AddContextArtifactsAndExecutionsResponse: @@ -1676,6 +1777,7 @@ async def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseAddContextArtifactsAndExecutions._get_http_options() ) + ( request, metadata, @@ -1695,6 +1797,33 @@ async 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.aiplatform_v1.MetadataServiceClient.AddContextArtifactsAndExecutions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "AddContextArtifactsAndExecutions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncMetadataServiceRestTransport._AddContextArtifactsAndExecutions._get_response( self._host, @@ -1725,6 +1854,30 @@ async def __call__( resp = await self._interceptor.post_add_context_artifacts_and_executions( resp ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = metadata_service.AddContextArtifactsAndExecutionsResponse.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.MetadataServiceAsyncClient.add_context_artifacts_and_executions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "AddContextArtifactsAndExecutions", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _AddContextChildren( @@ -1764,7 +1917,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> metadata_service.AddContextChildrenResponse: r"""Call the add context children method over HTTP. @@ -1775,8 +1928,10 @@ async def __call__( 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: ~.metadata_service.AddContextChildrenResponse: @@ -1788,6 +1943,7 @@ async def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseAddContextChildren._get_http_options() ) + request, metadata = await self._interceptor.pre_add_context_children( request, metadata ) @@ -1804,6 +1960,33 @@ async 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.aiplatform_v1.MetadataServiceClient.AddContextChildren", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "AddContextChildren", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncMetadataServiceRestTransport._AddContextChildren._get_response( self._host, @@ -1832,6 +2015,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_add_context_children(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + metadata_service.AddContextChildrenResponse.to_json(response) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.MetadataServiceAsyncClient.add_context_children", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "AddContextChildren", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _AddExecutionEvents( @@ -1871,7 +2078,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> metadata_service.AddExecutionEventsResponse: r"""Call the add execution events method over HTTP. @@ -1882,8 +2089,10 @@ async def __call__( 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: ~.metadata_service.AddExecutionEventsResponse: @@ -1895,6 +2104,7 @@ async def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseAddExecutionEvents._get_http_options() ) + request, metadata = await self._interceptor.pre_add_execution_events( request, metadata ) @@ -1911,6 +2121,33 @@ async 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.aiplatform_v1.MetadataServiceClient.AddExecutionEvents", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "AddExecutionEvents", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncMetadataServiceRestTransport._AddExecutionEvents._get_response( self._host, @@ -1939,6 +2176,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_add_execution_events(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + metadata_service.AddExecutionEventsResponse.to_json(response) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.MetadataServiceAsyncClient.add_execution_events", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "AddExecutionEvents", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _CreateArtifact( @@ -1978,7 +2239,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> gca_artifact.Artifact: r"""Call the create artifact method over HTTP. @@ -1989,8 +2250,10 @@ async def __call__( 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: ~.gca_artifact.Artifact: @@ -2000,6 +2263,7 @@ async def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseCreateArtifact._get_http_options() ) + request, metadata = await self._interceptor.pre_create_artifact( request, metadata ) @@ -2016,6 +2280,33 @@ async 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.aiplatform_v1.MetadataServiceClient.CreateArtifact", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "CreateArtifact", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncMetadataServiceRestTransport._CreateArtifact._get_response( @@ -2046,6 +2337,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_create_artifact(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gca_artifact.Artifact.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.MetadataServiceAsyncClient.create_artifact", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "CreateArtifact", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _CreateContext( @@ -2085,7 +2398,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> gca_context.Context: r"""Call the create context method over HTTP. @@ -2096,8 +2409,10 @@ async def __call__( 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: ~.gca_context.Context: @@ -2107,6 +2422,7 @@ async def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseCreateContext._get_http_options() ) + request, metadata = await self._interceptor.pre_create_context( request, metadata ) @@ -2123,6 +2439,33 @@ async 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.aiplatform_v1.MetadataServiceClient.CreateContext", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "CreateContext", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncMetadataServiceRestTransport._CreateContext._get_response( @@ -2153,6 +2496,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_create_context(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gca_context.Context.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.MetadataServiceAsyncClient.create_context", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "CreateContext", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _CreateExecution( @@ -2192,7 +2557,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> gca_execution.Execution: r"""Call the create execution method over HTTP. @@ -2203,8 +2568,10 @@ async def __call__( 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: ~.gca_execution.Execution: @@ -2214,6 +2581,7 @@ async def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseCreateExecution._get_http_options() ) + request, metadata = await self._interceptor.pre_create_execution( request, metadata ) @@ -2230,6 +2598,33 @@ async 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.aiplatform_v1.MetadataServiceClient.CreateExecution", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "CreateExecution", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncMetadataServiceRestTransport._CreateExecution._get_response( @@ -2260,6 +2655,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_create_execution(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gca_execution.Execution.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.MetadataServiceAsyncClient.create_execution", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "CreateExecution", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _CreateMetadataSchema( @@ -2299,7 +2716,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> gca_metadata_schema.MetadataSchema: r"""Call the create metadata schema method over HTTP. @@ -2310,8 +2727,10 @@ async def __call__( 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: ~.gca_metadata_schema.MetadataSchema: @@ -2321,6 +2740,7 @@ async def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseCreateMetadataSchema._get_http_options() ) + request, metadata = await self._interceptor.pre_create_metadata_schema( request, metadata ) @@ -2337,6 +2757,33 @@ async 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.aiplatform_v1.MetadataServiceClient.CreateMetadataSchema", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "CreateMetadataSchema", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncMetadataServiceRestTransport._CreateMetadataSchema._get_response( self._host, @@ -2365,6 +2812,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_create_metadata_schema(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gca_metadata_schema.MetadataSchema.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.MetadataServiceAsyncClient.create_metadata_schema", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "CreateMetadataSchema", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _CreateMetadataStore( @@ -2404,7 +2875,7 @@ async 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 metadata store method over HTTP. @@ -2415,8 +2886,10 @@ async def __call__( 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: @@ -2429,6 +2902,7 @@ async def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseCreateMetadataStore._get_http_options() ) + request, metadata = await self._interceptor.pre_create_metadata_store( request, metadata ) @@ -2445,6 +2919,33 @@ async 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.aiplatform_v1.MetadataServiceClient.CreateMetadataStore", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "CreateMetadataStore", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncMetadataServiceRestTransport._CreateMetadataStore._get_response( self._host, @@ -2473,6 +2974,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_create_metadata_store(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.MetadataServiceAsyncClient.create_metadata_store", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "CreateMetadataStore", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _DeleteArtifact( @@ -2511,7 +3034,7 @@ async 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 artifact method over HTTP. @@ -2522,8 +3045,10 @@ async def __call__( 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: @@ -2536,6 +3061,7 @@ async def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseDeleteArtifact._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_artifact( request, metadata ) @@ -2548,6 +3074,33 @@ async 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.aiplatform_v1.MetadataServiceClient.DeleteArtifact", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "DeleteArtifact", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncMetadataServiceRestTransport._DeleteArtifact._get_response( @@ -2577,6 +3130,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_delete_artifact(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.MetadataServiceAsyncClient.delete_artifact", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "DeleteArtifact", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _DeleteContext( @@ -2615,7 +3190,7 @@ async 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 context method over HTTP. @@ -2626,8 +3201,10 @@ async def __call__( 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: @@ -2640,6 +3217,7 @@ async def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseDeleteContext._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_context( request, metadata ) @@ -2652,6 +3230,33 @@ async 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.aiplatform_v1.MetadataServiceClient.DeleteContext", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "DeleteContext", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncMetadataServiceRestTransport._DeleteContext._get_response( @@ -2681,6 +3286,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_delete_context(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.MetadataServiceAsyncClient.delete_context", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "DeleteContext", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _DeleteExecution( @@ -2719,7 +3346,7 @@ async 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 execution method over HTTP. @@ -2730,8 +3357,10 @@ async def __call__( 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: @@ -2744,6 +3373,7 @@ async def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseDeleteExecution._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_execution( request, metadata ) @@ -2756,6 +3386,33 @@ async 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.aiplatform_v1.MetadataServiceClient.DeleteExecution", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "DeleteExecution", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncMetadataServiceRestTransport._DeleteExecution._get_response( @@ -2785,6 +3442,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_delete_execution(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.MetadataServiceAsyncClient.delete_execution", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "DeleteExecution", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _DeleteMetadataStore( @@ -2823,7 +3502,7 @@ async 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 metadata store method over HTTP. @@ -2834,8 +3513,10 @@ async def __call__( 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: @@ -2848,6 +3529,7 @@ async def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseDeleteMetadataStore._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_metadata_store( request, metadata ) @@ -2860,6 +3542,33 @@ async 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.aiplatform_v1.MetadataServiceClient.DeleteMetadataStore", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "DeleteMetadataStore", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncMetadataServiceRestTransport._DeleteMetadataStore._get_response( self._host, @@ -2887,6 +3596,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_delete_metadata_store(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.MetadataServiceAsyncClient.delete_metadata_store", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "DeleteMetadataStore", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _GetArtifact( @@ -2924,7 +3655,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> artifact.Artifact: r"""Call the get artifact method over HTTP. @@ -2935,8 +3666,10 @@ async def __call__( 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: ~.artifact.Artifact: @@ -2946,6 +3679,7 @@ async def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseGetArtifact._get_http_options() ) + request, metadata = await self._interceptor.pre_get_artifact( request, metadata ) @@ -2958,6 +3692,33 @@ async 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.aiplatform_v1.MetadataServiceClient.GetArtifact", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "GetArtifact", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncMetadataServiceRestTransport._GetArtifact._get_response( @@ -2987,6 +3748,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_get_artifact(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = artifact.Artifact.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.MetadataServiceAsyncClient.get_artifact", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "GetArtifact", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _GetContext( @@ -3024,7 +3807,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> context.Context: r"""Call the get context method over HTTP. @@ -3035,8 +3818,10 @@ async def __call__( 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: ~.context.Context: @@ -3046,6 +3831,7 @@ async def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseGetContext._get_http_options() ) + request, metadata = await self._interceptor.pre_get_context( request, metadata ) @@ -3058,6 +3844,33 @@ async 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.aiplatform_v1.MetadataServiceClient.GetContext", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "GetContext", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncMetadataServiceRestTransport._GetContext._get_response( @@ -3087,6 +3900,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_get_context(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = context.Context.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.MetadataServiceAsyncClient.get_context", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "GetContext", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _GetExecution( @@ -3125,7 +3960,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> execution.Execution: r"""Call the get execution method over HTTP. @@ -3136,8 +3971,10 @@ async def __call__( 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: ~.execution.Execution: @@ -3147,6 +3984,7 @@ async def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseGetExecution._get_http_options() ) + request, metadata = await self._interceptor.pre_get_execution( request, metadata ) @@ -3159,6 +3997,33 @@ async 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.aiplatform_v1.MetadataServiceClient.GetExecution", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "GetExecution", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncMetadataServiceRestTransport._GetExecution._get_response( @@ -3188,6 +4053,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_get_execution(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = execution.Execution.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.MetadataServiceAsyncClient.get_execution", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "GetExecution", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _GetMetadataSchema( @@ -3226,7 +4113,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> metadata_schema.MetadataSchema: r"""Call the get metadata schema method over HTTP. @@ -3237,8 +4124,10 @@ async def __call__( 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: ~.metadata_schema.MetadataSchema: @@ -3248,6 +4137,7 @@ async def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseGetMetadataSchema._get_http_options() ) + request, metadata = await self._interceptor.pre_get_metadata_schema( request, metadata ) @@ -3260,6 +4150,33 @@ async 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.aiplatform_v1.MetadataServiceClient.GetMetadataSchema", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "GetMetadataSchema", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncMetadataServiceRestTransport._GetMetadataSchema._get_response( self._host, @@ -3287,6 +4204,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_get_metadata_schema(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = metadata_schema.MetadataSchema.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.MetadataServiceAsyncClient.get_metadata_schema", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "GetMetadataSchema", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _GetMetadataStore( @@ -3325,7 +4264,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> metadata_store.MetadataStore: r"""Call the get metadata store method over HTTP. @@ -3336,8 +4275,10 @@ async def __call__( 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: ~.metadata_store.MetadataStore: @@ -3350,6 +4291,7 @@ async def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseGetMetadataStore._get_http_options() ) + request, metadata = await self._interceptor.pre_get_metadata_store( request, metadata ) @@ -3362,6 +4304,33 @@ async 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.aiplatform_v1.MetadataServiceClient.GetMetadataStore", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "GetMetadataStore", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncMetadataServiceRestTransport._GetMetadataStore._get_response( @@ -3391,6 +4360,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_get_metadata_store(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = metadata_store.MetadataStore.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.MetadataServiceAsyncClient.get_metadata_store", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "GetMetadataStore", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ListArtifacts( @@ -3429,7 +4420,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> metadata_service.ListArtifactsResponse: r"""Call the list artifacts method over HTTP. @@ -3440,8 +4431,10 @@ async def __call__( 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: ~.metadata_service.ListArtifactsResponse: @@ -3453,6 +4446,7 @@ async def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseListArtifacts._get_http_options() ) + request, metadata = await self._interceptor.pre_list_artifacts( request, metadata ) @@ -3465,6 +4459,33 @@ async 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.aiplatform_v1.MetadataServiceClient.ListArtifacts", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "ListArtifacts", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncMetadataServiceRestTransport._ListArtifacts._get_response( @@ -3494,6 +4515,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_list_artifacts(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = metadata_service.ListArtifactsResponse.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.MetadataServiceAsyncClient.list_artifacts", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "ListArtifacts", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ListContexts( @@ -3532,7 +4577,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> metadata_service.ListContextsResponse: r"""Call the list contexts method over HTTP. @@ -3543,8 +4588,10 @@ async def __call__( 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: ~.metadata_service.ListContextsResponse: @@ -3556,6 +4603,7 @@ async def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseListContexts._get_http_options() ) + request, metadata = await self._interceptor.pre_list_contexts( request, metadata ) @@ -3568,6 +4616,33 @@ async 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.aiplatform_v1.MetadataServiceClient.ListContexts", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "ListContexts", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncMetadataServiceRestTransport._ListContexts._get_response( @@ -3597,6 +4672,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_list_contexts(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = metadata_service.ListContextsResponse.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.MetadataServiceAsyncClient.list_contexts", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "ListContexts", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ListExecutions( @@ -3635,7 +4734,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> metadata_service.ListExecutionsResponse: r"""Call the list executions method over HTTP. @@ -3646,8 +4745,10 @@ async def __call__( 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: ~.metadata_service.ListExecutionsResponse: @@ -3659,6 +4760,7 @@ async def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseListExecutions._get_http_options() ) + request, metadata = await self._interceptor.pre_list_executions( request, metadata ) @@ -3671,6 +4773,33 @@ async 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.aiplatform_v1.MetadataServiceClient.ListExecutions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "ListExecutions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncMetadataServiceRestTransport._ListExecutions._get_response( @@ -3700,6 +4829,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_list_executions(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = metadata_service.ListExecutionsResponse.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.MetadataServiceAsyncClient.list_executions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "ListExecutions", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ListMetadataSchemas( @@ -3738,7 +4891,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> metadata_service.ListMetadataSchemasResponse: r"""Call the list metadata schemas method over HTTP. @@ -3749,8 +4902,10 @@ async def __call__( 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: ~.metadata_service.ListMetadataSchemasResponse: @@ -3762,6 +4917,7 @@ async def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseListMetadataSchemas._get_http_options() ) + request, metadata = await self._interceptor.pre_list_metadata_schemas( request, metadata ) @@ -3774,6 +4930,33 @@ async 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.aiplatform_v1.MetadataServiceClient.ListMetadataSchemas", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "ListMetadataSchemas", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncMetadataServiceRestTransport._ListMetadataSchemas._get_response( self._host, @@ -3801,6 +4984,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_list_metadata_schemas(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + metadata_service.ListMetadataSchemasResponse.to_json(response) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.MetadataServiceAsyncClient.list_metadata_schemas", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "ListMetadataSchemas", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ListMetadataStores( @@ -3839,7 +5046,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> metadata_service.ListMetadataStoresResponse: r"""Call the list metadata stores method over HTTP. @@ -3850,8 +5057,10 @@ async def __call__( 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: ~.metadata_service.ListMetadataStoresResponse: @@ -3863,6 +5072,7 @@ async def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseListMetadataStores._get_http_options() ) + request, metadata = await self._interceptor.pre_list_metadata_stores( request, metadata ) @@ -3875,6 +5085,33 @@ async 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.aiplatform_v1.MetadataServiceClient.ListMetadataStores", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "ListMetadataStores", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncMetadataServiceRestTransport._ListMetadataStores._get_response( self._host, @@ -3902,6 +5139,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_list_metadata_stores(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + metadata_service.ListMetadataStoresResponse.to_json(response) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.MetadataServiceAsyncClient.list_metadata_stores", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "ListMetadataStores", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _PurgeArtifacts( @@ -3941,7 +5202,7 @@ async 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 purge artifacts method over HTTP. @@ -3952,8 +5213,10 @@ async def __call__( 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: @@ -3966,6 +5229,7 @@ async def __call__( http_options = ( _BaseMetadataServiceRestTransport._BasePurgeArtifacts._get_http_options() ) + request, metadata = await self._interceptor.pre_purge_artifacts( request, metadata ) @@ -3982,6 +5246,33 @@ async 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.aiplatform_v1.MetadataServiceClient.PurgeArtifacts", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "PurgeArtifacts", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncMetadataServiceRestTransport._PurgeArtifacts._get_response( @@ -4012,6 +5303,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_purge_artifacts(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.MetadataServiceAsyncClient.purge_artifacts", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "PurgeArtifacts", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _PurgeContexts( @@ -4051,7 +5364,7 @@ async 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 purge contexts method over HTTP. @@ -4062,8 +5375,10 @@ async def __call__( 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: @@ -4076,6 +5391,7 @@ async def __call__( http_options = ( _BaseMetadataServiceRestTransport._BasePurgeContexts._get_http_options() ) + request, metadata = await self._interceptor.pre_purge_contexts( request, metadata ) @@ -4092,6 +5408,33 @@ async 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.aiplatform_v1.MetadataServiceClient.PurgeContexts", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "PurgeContexts", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncMetadataServiceRestTransport._PurgeContexts._get_response( @@ -4122,6 +5465,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_purge_contexts(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.MetadataServiceAsyncClient.purge_contexts", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "PurgeContexts", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _PurgeExecutions( @@ -4161,7 +5526,7 @@ async 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 purge executions method over HTTP. @@ -4172,8 +5537,10 @@ async def __call__( 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: @@ -4186,6 +5553,7 @@ async def __call__( http_options = ( _BaseMetadataServiceRestTransport._BasePurgeExecutions._get_http_options() ) + request, metadata = await self._interceptor.pre_purge_executions( request, metadata ) @@ -4202,6 +5570,33 @@ async 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.aiplatform_v1.MetadataServiceClient.PurgeExecutions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "PurgeExecutions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncMetadataServiceRestTransport._PurgeExecutions._get_response( @@ -4232,6 +5627,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_purge_executions(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.MetadataServiceAsyncClient.purge_executions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "PurgeExecutions", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _QueryArtifactLineageSubgraph( @@ -4272,7 +5689,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> lineage_subgraph.LineageSubgraph: r"""Call the query artifact lineage subgraph method over HTTP. @@ -4284,8 +5701,10 @@ async def __call__( 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: ~.lineage_subgraph.LineageSubgraph: @@ -4298,6 +5717,7 @@ async def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseQueryArtifactLineageSubgraph._get_http_options() ) + ( request, metadata, @@ -4313,6 +5733,33 @@ async 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.aiplatform_v1.MetadataServiceClient.QueryArtifactLineageSubgraph", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "QueryArtifactLineageSubgraph", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncMetadataServiceRestTransport._QueryArtifactLineageSubgraph._get_response( self._host, @@ -4340,6 +5787,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_query_artifact_lineage_subgraph(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = lineage_subgraph.LineageSubgraph.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.MetadataServiceAsyncClient.query_artifact_lineage_subgraph", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "QueryArtifactLineageSubgraph", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _QueryContextLineageSubgraph( @@ -4378,7 +5849,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> lineage_subgraph.LineageSubgraph: r"""Call the query context lineage subgraph method over HTTP. @@ -4390,8 +5861,10 @@ async def __call__( 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: ~.lineage_subgraph.LineageSubgraph: @@ -4404,6 +5877,7 @@ async def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseQueryContextLineageSubgraph._get_http_options() ) + ( request, metadata, @@ -4419,6 +5893,33 @@ async 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.aiplatform_v1.MetadataServiceClient.QueryContextLineageSubgraph", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "QueryContextLineageSubgraph", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncMetadataServiceRestTransport._QueryContextLineageSubgraph._get_response( self._host, @@ -4446,6 +5947,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_query_context_lineage_subgraph(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = lineage_subgraph.LineageSubgraph.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.MetadataServiceAsyncClient.query_context_lineage_subgraph", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "QueryContextLineageSubgraph", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _QueryExecutionInputsAndOutputs( @@ -4486,7 +6011,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> lineage_subgraph.LineageSubgraph: r"""Call the query execution inputs and outputs method over HTTP. @@ -4498,8 +6023,10 @@ async def __call__( 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: ~.lineage_subgraph.LineageSubgraph: @@ -4512,6 +6039,7 @@ async def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseQueryExecutionInputsAndOutputs._get_http_options() ) + ( request, metadata, @@ -4527,6 +6055,33 @@ async 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.aiplatform_v1.MetadataServiceClient.QueryExecutionInputsAndOutputs", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "QueryExecutionInputsAndOutputs", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncMetadataServiceRestTransport._QueryExecutionInputsAndOutputs._get_response( self._host, @@ -4554,6 +6109,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_query_execution_inputs_and_outputs(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = lineage_subgraph.LineageSubgraph.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.MetadataServiceAsyncClient.query_execution_inputs_and_outputs", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "QueryExecutionInputsAndOutputs", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _RemoveContextChildren( @@ -4593,7 +6172,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> metadata_service.RemoveContextChildrenResponse: r"""Call the remove context children method over HTTP. @@ -4604,8 +6183,10 @@ async def __call__( 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: ~.metadata_service.RemoveContextChildrenResponse: @@ -4617,6 +6198,7 @@ async def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseRemoveContextChildren._get_http_options() ) + request, metadata = await self._interceptor.pre_remove_context_children( request, metadata ) @@ -4633,6 +6215,33 @@ async 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.aiplatform_v1.MetadataServiceClient.RemoveContextChildren", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "RemoveContextChildren", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncMetadataServiceRestTransport._RemoveContextChildren._get_response( self._host, @@ -4661,6 +6270,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_remove_context_children(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + metadata_service.RemoveContextChildrenResponse.to_json(response) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.MetadataServiceAsyncClient.remove_context_children", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "RemoveContextChildren", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _UpdateArtifact( @@ -4700,7 +6333,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> gca_artifact.Artifact: r"""Call the update artifact method over HTTP. @@ -4711,8 +6344,10 @@ async def __call__( 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: ~.gca_artifact.Artifact: @@ -4722,6 +6357,7 @@ async def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseUpdateArtifact._get_http_options() ) + request, metadata = await self._interceptor.pre_update_artifact( request, metadata ) @@ -4738,6 +6374,33 @@ async 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.aiplatform_v1.MetadataServiceClient.UpdateArtifact", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "UpdateArtifact", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncMetadataServiceRestTransport._UpdateArtifact._get_response( @@ -4768,6 +6431,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_update_artifact(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gca_artifact.Artifact.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.MetadataServiceAsyncClient.update_artifact", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "UpdateArtifact", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _UpdateContext( @@ -4807,7 +6492,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> gca_context.Context: r"""Call the update context method over HTTP. @@ -4818,8 +6503,10 @@ async def __call__( 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: ~.gca_context.Context: @@ -4829,6 +6516,7 @@ async def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseUpdateContext._get_http_options() ) + request, metadata = await self._interceptor.pre_update_context( request, metadata ) @@ -4845,6 +6533,33 @@ async 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.aiplatform_v1.MetadataServiceClient.UpdateContext", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "UpdateContext", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncMetadataServiceRestTransport._UpdateContext._get_response( @@ -4875,6 +6590,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_update_context(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gca_context.Context.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.MetadataServiceAsyncClient.update_context", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "UpdateContext", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _UpdateExecution( @@ -4914,7 +6651,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> gca_execution.Execution: r"""Call the update execution method over HTTP. @@ -4925,8 +6662,10 @@ async def __call__( 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: ~.gca_execution.Execution: @@ -4936,6 +6675,7 @@ async def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseUpdateExecution._get_http_options() ) + request, metadata = await self._interceptor.pre_update_execution( request, metadata ) @@ -4952,6 +6692,33 @@ async 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.aiplatform_v1.MetadataServiceClient.UpdateExecution", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "UpdateExecution", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncMetadataServiceRestTransport._UpdateExecution._get_response( @@ -4982,6 +6749,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_update_execution(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gca_execution.Execution.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.MetadataServiceAsyncClient.update_execution", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "UpdateExecution", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp @property @@ -7137,7 +8926,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -7148,8 +8937,10 @@ async def __call__( 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: locations_pb2.Location: Response from GetLocation method. @@ -7158,6 +8949,7 @@ async def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_location( request, metadata ) @@ -7170,6 +8962,33 @@ async 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.aiplatform_v1.MetadataServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncMetadataServiceRestTransport._GetLocation._get_response( @@ -7197,6 +9016,27 @@ async def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_location(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.aiplatform_v1.MetadataServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -7239,7 +9079,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -7250,8 +9090,10 @@ async def __call__( 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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -7260,6 +9102,7 @@ async def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_locations( request, metadata ) @@ -7272,6 +9115,33 @@ async 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.aiplatform_v1.MetadataServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncMetadataServiceRestTransport._ListLocations._get_response( @@ -7299,6 +9169,27 @@ async def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_list_locations(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.aiplatform_v1.MetadataServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -7341,7 +9232,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -7352,8 +9243,10 @@ async def __call__( 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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -7362,6 +9255,7 @@ async def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_get_iam_policy( request, metadata ) @@ -7374,6 +9268,33 @@ async 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.aiplatform_v1.MetadataServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncMetadataServiceRestTransport._GetIamPolicy._get_response( @@ -7401,6 +9322,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_iam_policy(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.aiplatform_v1.MetadataServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -7444,7 +9386,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -7455,8 +9397,10 @@ async def __call__( 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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -7465,6 +9409,7 @@ async def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_set_iam_policy( request, metadata ) @@ -7481,6 +9426,33 @@ async 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.aiplatform_v1.MetadataServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncMetadataServiceRestTransport._SetIamPolicy._get_response( @@ -7509,6 +9481,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_set_iam_policy(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.aiplatform_v1.MetadataServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -7551,7 +9544,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -7562,8 +9555,10 @@ async def __call__( 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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -7572,6 +9567,7 @@ async def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = await self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -7584,6 +9580,33 @@ async 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.aiplatform_v1.MetadataServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncMetadataServiceRestTransport._TestIamPermissions._get_response( self._host, @@ -7609,6 +9632,27 @@ async def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_test_iam_permissions(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.aiplatform_v1.MetadataServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -7651,7 +9695,7 @@ async 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 cancel operation method over HTTP. @@ -7662,13 +9706,16 @@ async def __call__( 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`. """ http_options = ( _BaseMetadataServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_cancel_operation( request, metadata ) @@ -7681,6 +9728,33 @@ async 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.aiplatform_v1.MetadataServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncMetadataServiceRestTransport._CancelOperation._get_response( @@ -7746,7 +9820,7 @@ async 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. @@ -7757,13 +9831,16 @@ async def __call__( 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`. """ http_options = ( _BaseMetadataServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_operation( request, metadata ) @@ -7776,6 +9853,33 @@ async 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.aiplatform_v1.MetadataServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncMetadataServiceRestTransport._DeleteOperation._get_response( @@ -7841,7 +9945,7 @@ async 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. @@ -7852,8 +9956,10 @@ async def __call__( 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: Response from GetOperation method. @@ -7862,6 +9968,7 @@ async def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_operation( request, metadata ) @@ -7874,6 +9981,33 @@ async 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.aiplatform_v1.MetadataServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncMetadataServiceRestTransport._GetOperation._get_response( @@ -7901,6 +10035,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1.MetadataServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -7943,7 +10098,7 @@ async 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. @@ -7954,8 +10109,10 @@ async def __call__( 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 from ListOperations method. @@ -7964,6 +10121,7 @@ async def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_operations( request, metadata ) @@ -7976,6 +10134,33 @@ async 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.aiplatform_v1.MetadataServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncMetadataServiceRestTransport._ListOperations._get_response( @@ -8003,6 +10188,27 @@ async def __call__( resp = operations_pb2.ListOperationsResponse() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1.MetadataServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -8045,7 +10251,7 @@ async 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 wait operation method over HTTP. @@ -8056,8 +10262,10 @@ async def __call__( 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: Response from WaitOperation method. @@ -8066,6 +10274,7 @@ async def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_wait_operation( request, metadata ) @@ -8078,6 +10287,33 @@ async 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.aiplatform_v1.MetadataServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncMetadataServiceRestTransport._WaitOperation._get_response( @@ -8105,6 +10341,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_wait_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.aiplatform_v1.MetadataServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MetadataService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1/services/migration_service/async_client.py b/google/cloud/aiplatform_v1/services/migration_service/async_client.py index 06025f4aa8..c6b459a6e6 100644 --- a/google/cloud/aiplatform_v1/services/migration_service/async_client.py +++ b/google/cloud/aiplatform_v1/services/migration_service/async_client.py @@ -13,6 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging as std_logging from collections import OrderedDict import re from typing import ( @@ -56,6 +57,15 @@ from .transports.grpc_asyncio import MigrationServiceGrpcAsyncIOTransport from .client import MigrationServiceClient +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 MigrationServiceAsyncClient: """A service that migrates resources from automl.googleapis.com, @@ -279,6 +289,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.aiplatform_v1.MigrationServiceAsyncClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MigrationService", + "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.aiplatform.v1.MigrationService", + "credentialsType": None, + }, + ) + async def search_migratable_resources( self, request: Optional[ @@ -288,7 +320,7 @@ async def search_migratable_resources( 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.SearchMigratableResourcesAsyncPager: r"""Searches all of the resources in automl.googleapis.com, datalabeling.googleapis.com and @@ -339,8 +371,10 @@ async def sample_search_migratable_resources(): 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.aiplatform_v1.services.migration_service.pagers.SearchMigratableResourcesAsyncPager: @@ -420,7 +454,7 @@ async def batch_migrate_resources( ] = 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"""Batch migrates resources from ml.googleapis.com, automl.googleapis.com, and datalabeling.googleapis.com @@ -487,8 +521,10 @@ async def sample_batch_migrate_resources(): 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: @@ -560,7 +596,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. @@ -571,8 +607,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. @@ -613,7 +651,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. @@ -624,8 +662,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. @@ -666,7 +706,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. @@ -682,8 +722,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 """ @@ -720,7 +762,7 @@ async def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -735,8 +777,10 @@ async def cancel_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 """ @@ -773,7 +817,7 @@ async def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -790,8 +834,10 @@ async def wait_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. @@ -832,7 +878,7 @@ async def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -845,8 +891,10 @@ async def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -951,7 +999,7 @@ async def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -965,8 +1013,10 @@ async def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -1071,7 +1121,7 @@ async def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -1086,8 +1136,10 @@ async def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -1131,7 +1183,7 @@ async def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -1142,8 +1194,10 @@ async def get_location( 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: ~.location_pb2.Location: Location object. @@ -1184,7 +1238,7 @@ async def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -1195,8 +1249,10 @@ async def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1/services/migration_service/client.py b/google/cloud/aiplatform_v1/services/migration_service/client.py index 0df476b7cd..6db106351e 100644 --- a/google/cloud/aiplatform_v1/services/migration_service/client.py +++ b/google/cloud/aiplatform_v1/services/migration_service/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 ( @@ -48,6 +49,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.cloud.aiplatform_v1.services.migration_service import pagers @@ -230,23 +240,18 @@ def parse_annotated_dataset_path(path: str) -> Dict[str, str]: @staticmethod def dataset_path( project: str, - location: str, dataset: str, ) -> str: """Returns a fully-qualified dataset string.""" - return "projects/{project}/locations/{location}/datasets/{dataset}".format( + return "projects/{project}/datasets/{dataset}".format( project=project, - location=location, dataset=dataset, ) @staticmethod def parse_dataset_path(path: str) -> Dict[str, str]: """Parses a dataset path into its component segments.""" - m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)/datasets/(?P.+?)$", - path, - ) + m = re.match(r"^projects/(?P.+?)/datasets/(?P.+?)$", path) return m.groupdict() if m else {} @staticmethod @@ -274,18 +279,23 @@ def parse_dataset_path(path: str) -> Dict[str, str]: @staticmethod def dataset_path( project: str, + location: str, dataset: str, ) -> str: """Returns a fully-qualified dataset string.""" - return "projects/{project}/datasets/{dataset}".format( + return "projects/{project}/locations/{location}/datasets/{dataset}".format( project=project, + location=location, dataset=dataset, ) @staticmethod def parse_dataset_path(path: str) -> Dict[str, str]: """Parses a dataset path into its component segments.""" - m = re.match(r"^projects/(?P.+?)/datasets/(?P.+?)$", path) + m = re.match( + r"^projects/(?P.+?)/locations/(?P.+?)/datasets/(?P.+?)$", + path, + ) return m.groupdict() if m else {} @staticmethod @@ -729,6 +739,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( @@ -820,6 +834,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.aiplatform_v1.MigrationServiceClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MigrationService", + "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.aiplatform.v1.MigrationService", + "credentialsType": None, + }, + ) + def search_migratable_resources( self, request: Optional[ @@ -829,7 +866,7 @@ def search_migratable_resources( 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.SearchMigratableResourcesPager: r"""Searches all of the resources in automl.googleapis.com, datalabeling.googleapis.com and @@ -880,8 +917,10 @@ def sample_search_migratable_resources(): 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.aiplatform_v1.services.migration_service.pagers.SearchMigratableResourcesPager: @@ -960,7 +999,7 @@ def batch_migrate_resources( ] = 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"""Batch migrates resources from ml.googleapis.com, automl.googleapis.com, and datalabeling.googleapis.com @@ -1027,8 +1066,10 @@ def sample_batch_migrate_resources(): 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: @@ -1110,7 +1151,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. @@ -1121,8 +1162,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. @@ -1163,7 +1206,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. @@ -1174,8 +1217,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. @@ -1216,7 +1261,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. @@ -1232,8 +1277,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 """ @@ -1270,7 +1317,7 @@ def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -1285,8 +1332,10 @@ def cancel_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 """ @@ -1323,7 +1372,7 @@ def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -1340,8 +1389,10 @@ def wait_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. @@ -1382,7 +1433,7 @@ def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -1395,8 +1446,10 @@ def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -1501,7 +1554,7 @@ def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -1515,8 +1568,10 @@ def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -1621,7 +1676,7 @@ def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -1636,8 +1691,10 @@ def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -1679,7 +1736,7 @@ def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -1690,8 +1747,10 @@ def get_location( 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: ~.location_pb2.Location: Location object. @@ -1732,7 +1791,7 @@ def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -1743,8 +1802,10 @@ def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1/services/migration_service/pagers.py b/google/cloud/aiplatform_v1/services/migration_service/pagers.py index b66546b7ca..3737cd8381 100644 --- a/google/cloud/aiplatform_v1/services/migration_service/pagers.py +++ b/google/cloud/aiplatform_v1/services/migration_service/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 = migration_service.SearchMigratableResourcesRequest(request) @@ -143,7 +145,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. @@ -157,8 +159,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 = migration_service.SearchMigratableResourcesRequest(request) diff --git a/google/cloud/aiplatform_v1/services/migration_service/transports/grpc.py b/google/cloud/aiplatform_v1/services/migration_service/transports/grpc.py index 4efeffa7f4..7dfc259610 100644 --- a/google/cloud/aiplatform_v1/services/migration_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1/services/migration_service/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 import warnings from typing import Callable, Dict, Optional, Sequence, Tuple, Union @@ -22,8 +25,11 @@ import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from google.cloud.aiplatform_v1.types import migration_service from google.cloud.location import locations_pb2 # type: ignore @@ -32,6 +38,81 @@ from google.longrunning import operations_pb2 # type: ignore from .base import MigrationServiceTransport, DEFAULT_CLIENT_INFO +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.aiplatform.v1.MigrationService", + "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.aiplatform.v1.MigrationService", + "rpcName": client_call_details.method, + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class MigrationServiceGrpcTransport(MigrationServiceTransport): """gRPC backend transport for MigrationService. @@ -187,7 +268,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 @@ -251,7 +337,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 @@ -281,7 +369,9 @@ def search_migratable_resources( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "search_migratable_resources" not in self._stubs: - self._stubs["search_migratable_resources"] = self.grpc_channel.unary_unary( + self._stubs[ + "search_migratable_resources" + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.MigrationService/SearchMigratableResources", request_serializer=migration_service.SearchMigratableResourcesRequest.serialize, response_deserializer=migration_service.SearchMigratableResourcesResponse.deserialize, @@ -311,7 +401,7 @@ def batch_migrate_resources( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "batch_migrate_resources" not in self._stubs: - self._stubs["batch_migrate_resources"] = self.grpc_channel.unary_unary( + self._stubs["batch_migrate_resources"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.MigrationService/BatchMigrateResources", request_serializer=migration_service.BatchMigrateResourcesRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -319,7 +409,7 @@ def batch_migrate_resources( return self._stubs["batch_migrate_resources"] def close(self): - self.grpc_channel.close() + self._logged_channel.close() @property def delete_operation( @@ -331,7 +421,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, @@ -348,7 +438,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -365,7 +455,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -382,7 +472,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, @@ -401,7 +491,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, @@ -420,7 +510,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -437,7 +527,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -462,7 +552,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -488,7 +578,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -517,7 +607,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1/services/migration_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1/services/migration_service/transports/grpc_asyncio.py index b51c2c6f79..add8ee65c1 100644 --- a/google/cloud/aiplatform_v1/services/migration_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1/services/migration_service/transports/grpc_asyncio.py @@ -14,6 +14,9 @@ # limitations under the License. # import inspect +import json +import pickle +import logging as std_logging import warnings from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union @@ -24,8 +27,11 @@ from google.api_core import operations_v1 from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from grpc.experimental import aio # type: ignore from google.cloud.aiplatform_v1.types import migration_service @@ -36,6 +42,82 @@ from .base import MigrationServiceTransport, DEFAULT_CLIENT_INFO from .grpc import MigrationServiceGrpcTransport +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.aiplatform.v1.MigrationService", + "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.aiplatform.v1.MigrationService", + "rpcName": str(client_call_details.method), + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class MigrationServiceGrpcAsyncIOTransport(MigrationServiceTransport): """gRPC AsyncIO backend transport for MigrationService. @@ -234,10 +316,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 @@ -260,7 +345,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. @@ -291,7 +376,9 @@ def search_migratable_resources( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "search_migratable_resources" not in self._stubs: - self._stubs["search_migratable_resources"] = self.grpc_channel.unary_unary( + self._stubs[ + "search_migratable_resources" + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.MigrationService/SearchMigratableResources", request_serializer=migration_service.SearchMigratableResourcesRequest.serialize, response_deserializer=migration_service.SearchMigratableResourcesResponse.deserialize, @@ -322,7 +409,7 @@ def batch_migrate_resources( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "batch_migrate_resources" not in self._stubs: - self._stubs["batch_migrate_resources"] = self.grpc_channel.unary_unary( + self._stubs["batch_migrate_resources"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.MigrationService/BatchMigrateResources", request_serializer=migration_service.BatchMigrateResourcesRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -400,7 +487,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: @@ -416,7 +503,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, @@ -433,7 +520,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -450,7 +537,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -467,7 +554,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, @@ -486,7 +573,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, @@ -505,7 +592,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -522,7 +609,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -547,7 +634,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -573,7 +660,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -602,7 +689,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1/services/migration_service/transports/rest.py b/google/cloud/aiplatform_v1/services/migration_service/transports/rest.py index 15076fdebc..9693e07d92 100644 --- a/google/cloud/aiplatform_v1/services/migration_service/transports/rest.py +++ b/google/cloud/aiplatform_v1/services/migration_service/transports/rest.py @@ -13,9 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging +import json # type: ignore from google.auth.transport.requests import AuthorizedSession # type: ignore -import json # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.api_core import exceptions as core_exceptions from google.api_core import retry as retries @@ -47,6 +48,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, @@ -95,9 +104,10 @@ def post_search_migratable_resources(self, response): def pre_batch_migrate_resources( self, request: migration_service.BatchMigrateResourcesRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - migration_service.BatchMigrateResourcesRequest, Sequence[Tuple[str, str]] + migration_service.BatchMigrateResourcesRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for batch_migrate_resources @@ -120,9 +130,10 @@ def post_batch_migrate_resources( def pre_search_migratable_resources( self, request: migration_service.SearchMigratableResourcesRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - migration_service.SearchMigratableResourcesRequest, Sequence[Tuple[str, str]] + migration_service.SearchMigratableResourcesRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for search_migratable_resources @@ -145,8 +156,10 @@ def post_search_migratable_resources( def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -168,8 +181,10 @@ def post_get_location( def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -191,8 +206,10 @@ def post_list_locations( def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -212,8 +229,10 @@ def post_get_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -233,8 +252,11 @@ def post_set_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -256,8 +278,10 @@ def post_test_iam_permissions( def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -277,8 +301,10 @@ def post_cancel_operation(self, response: None) -> None: 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 @@ -298,8 +324,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 @@ -321,8 +349,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 @@ -344,8 +374,10 @@ def post_list_operations( def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -2368,7 +2400,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 batch migrate resources method over HTTP. @@ -2379,8 +2411,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: @@ -2393,6 +2427,7 @@ def __call__( http_options = ( _BaseMigrationServiceRestTransport._BaseBatchMigrateResources._get_http_options() ) + request, metadata = self._interceptor.pre_batch_migrate_resources( request, metadata ) @@ -2409,6 +2444,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.aiplatform_v1.MigrationServiceClient.BatchMigrateResources", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MigrationService", + "rpcName": "BatchMigrateResources", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( MigrationServiceRestTransport._BatchMigrateResources._get_response( @@ -2430,7 +2492,29 @@ def __call__( # Return the response resp = operations_pb2.Operation() json_format.Parse(response.content, resp, ignore_unknown_fields=True) + resp = self._interceptor.post_batch_migrate_resources(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.aiplatform_v1.MigrationServiceClient.batch_migrate_resources", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MigrationService", + "rpcName": "BatchMigrateResources", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _SearchMigratableResources( @@ -2470,7 +2554,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]]] = (), ) -> migration_service.SearchMigratableResourcesResponse: r"""Call the search migratable resources method over HTTP. @@ -2482,8 +2566,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: ~.migration_service.SearchMigratableResourcesResponse: @@ -2495,6 +2581,7 @@ def __call__( http_options = ( _BaseMigrationServiceRestTransport._BaseSearchMigratableResources._get_http_options() ) + request, metadata = self._interceptor.pre_search_migratable_resources( request, metadata ) @@ -2511,6 +2598,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.aiplatform_v1.MigrationServiceClient.SearchMigratableResources", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MigrationService", + "rpcName": "SearchMigratableResources", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( MigrationServiceRestTransport._SearchMigratableResources._get_response( @@ -2534,7 +2648,33 @@ def __call__( pb_resp = migration_service.SearchMigratableResourcesResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_search_migratable_resources(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + migration_service.SearchMigratableResourcesResponse.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.aiplatform_v1.MigrationServiceClient.search_migratable_resources", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MigrationService", + "rpcName": "SearchMigratableResources", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp @property @@ -2597,7 +2737,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]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -2608,8 +2748,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: locations_pb2.Location: Response from GetLocation method. @@ -2618,6 +2760,7 @@ def __call__( http_options = ( _BaseMigrationServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = self._interceptor.pre_get_location(request, metadata) transcoded_request = _BaseMigrationServiceRestTransport._BaseGetLocation._get_transcoded_request( http_options, request @@ -2628,6 +2771,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.aiplatform_v1.MigrationServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MigrationService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MigrationServiceRestTransport._GetLocation._get_response( self._host, @@ -2647,6 +2817,27 @@ def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_location(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.aiplatform_v1.MigrationServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MigrationService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -2688,7 +2879,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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -2699,8 +2890,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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -2709,6 +2902,7 @@ def __call__( http_options = ( _BaseMigrationServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = self._interceptor.pre_list_locations(request, metadata) transcoded_request = _BaseMigrationServiceRestTransport._BaseListLocations._get_transcoded_request( http_options, request @@ -2719,6 +2913,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.aiplatform_v1.MigrationServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MigrationService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MigrationServiceRestTransport._ListLocations._get_response( self._host, @@ -2738,6 +2959,27 @@ def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_list_locations(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.aiplatform_v1.MigrationServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MigrationService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -2779,7 +3021,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]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -2790,8 +3032,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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -2800,6 +3044,7 @@ def __call__( http_options = ( _BaseMigrationServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_get_iam_policy(request, metadata) transcoded_request = _BaseMigrationServiceRestTransport._BaseGetIamPolicy._get_transcoded_request( http_options, request @@ -2810,6 +3055,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.aiplatform_v1.MigrationServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MigrationService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MigrationServiceRestTransport._GetIamPolicy._get_response( self._host, @@ -2829,6 +3101,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_iam_policy(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.aiplatform_v1.MigrationServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MigrationService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -2871,7 +3164,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]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -2882,8 +3175,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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -2892,6 +3187,7 @@ def __call__( http_options = ( _BaseMigrationServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_set_iam_policy(request, metadata) transcoded_request = _BaseMigrationServiceRestTransport._BaseSetIamPolicy._get_transcoded_request( http_options, request @@ -2906,6 +3202,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.aiplatform_v1.MigrationServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MigrationService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MigrationServiceRestTransport._SetIamPolicy._get_response( self._host, @@ -2926,6 +3249,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_set_iam_policy(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.aiplatform_v1.MigrationServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MigrationService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -2968,7 +3312,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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -2979,8 +3323,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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -2989,6 +3335,7 @@ def __call__( http_options = ( _BaseMigrationServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -3001,6 +3348,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.aiplatform_v1.MigrationServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MigrationService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MigrationServiceRestTransport._TestIamPermissions._get_response( self._host, @@ -3020,6 +3394,27 @@ def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_test_iam_permissions(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.aiplatform_v1.MigrationServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MigrationService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3062,7 +3457,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 cancel operation method over HTTP. @@ -3073,13 +3468,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 = ( _BaseMigrationServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = self._interceptor.pre_cancel_operation( request, metadata ) @@ -3092,6 +3490,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.aiplatform_v1.MigrationServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MigrationService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MigrationServiceRestTransport._CancelOperation._get_response( self._host, @@ -3149,7 +3574,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. @@ -3160,13 +3585,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 = ( _BaseMigrationServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = self._interceptor.pre_delete_operation( request, metadata ) @@ -3179,6 +3607,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.aiplatform_v1.MigrationServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MigrationService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MigrationServiceRestTransport._DeleteOperation._get_response( self._host, @@ -3235,7 +3690,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. @@ -3246,8 +3701,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. @@ -3256,6 +3713,7 @@ def __call__( http_options = ( _BaseMigrationServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = self._interceptor.pre_get_operation(request, metadata) transcoded_request = _BaseMigrationServiceRestTransport._BaseGetOperation._get_transcoded_request( http_options, request @@ -3266,6 +3724,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.aiplatform_v1.MigrationServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MigrationService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MigrationServiceRestTransport._GetOperation._get_response( self._host, @@ -3285,6 +3770,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.aiplatform_v1.MigrationServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MigrationService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3326,7 +3832,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. @@ -3337,8 +3843,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. @@ -3347,6 +3855,7 @@ def __call__( http_options = ( _BaseMigrationServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = self._interceptor.pre_list_operations(request, metadata) transcoded_request = _BaseMigrationServiceRestTransport._BaseListOperations._get_transcoded_request( http_options, request @@ -3357,6 +3866,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.aiplatform_v1.MigrationServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MigrationService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MigrationServiceRestTransport._ListOperations._get_response( self._host, @@ -3376,6 +3912,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.aiplatform_v1.MigrationServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MigrationService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3417,7 +3974,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 wait operation method over HTTP. @@ -3428,8 +3985,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 WaitOperation method. @@ -3438,6 +3997,7 @@ def __call__( http_options = ( _BaseMigrationServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = self._interceptor.pre_wait_operation(request, metadata) transcoded_request = _BaseMigrationServiceRestTransport._BaseWaitOperation._get_transcoded_request( http_options, request @@ -3448,6 +4008,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.aiplatform_v1.MigrationServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MigrationService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MigrationServiceRestTransport._WaitOperation._get_response( self._host, @@ -3467,6 +4054,27 @@ def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = self._interceptor.post_wait_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.aiplatform_v1.MigrationServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MigrationService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1/services/migration_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1/services/migration_service/transports/rest_asyncio.py index bb9d576a89..70c052fa7e 100644 --- a/google/cloud/aiplatform_v1/services/migration_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1/services/migration_service/transports/rest_asyncio.py @@ -58,6 +58,18 @@ from .base import DEFAULT_CLIENT_INFO as BASE_DEFAULT_CLIENT_INFO + +import logging + +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__) + try: OptionalRetry = Union[retries.AsyncRetry, gapic_v1.method._MethodDefault, None] except AttributeError: # pragma: NO COVER @@ -110,9 +122,10 @@ async def post_search_migratable_resources(self, response): async def pre_batch_migrate_resources( self, request: migration_service.BatchMigrateResourcesRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - migration_service.BatchMigrateResourcesRequest, Sequence[Tuple[str, str]] + migration_service.BatchMigrateResourcesRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for batch_migrate_resources @@ -135,9 +148,10 @@ async def post_batch_migrate_resources( async def pre_search_migratable_resources( self, request: migration_service.SearchMigratableResourcesRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - migration_service.SearchMigratableResourcesRequest, Sequence[Tuple[str, str]] + migration_service.SearchMigratableResourcesRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for search_migratable_resources @@ -160,8 +174,10 @@ async def post_search_migratable_resources( async def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -183,8 +199,10 @@ async def post_get_location( async def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -206,8 +224,10 @@ async def post_list_locations( async def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -229,8 +249,10 @@ async def post_get_iam_policy( async def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -252,8 +274,11 @@ async def post_set_iam_policy( async def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -275,8 +300,10 @@ async def post_test_iam_permissions( async def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -296,8 +323,10 @@ async def post_cancel_operation(self, response: None) -> None: async 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 @@ -317,8 +346,10 @@ async def post_delete_operation(self, response: None) -> None: async 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 @@ -340,8 +371,10 @@ async def post_get_operation( async 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 @@ -363,8 +396,10 @@ async def post_list_operations( async def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -556,7 +591,7 @@ async 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 batch migrate resources method over HTTP. @@ -567,8 +602,10 @@ async def __call__( 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: @@ -581,6 +618,7 @@ async def __call__( http_options = ( _BaseMigrationServiceRestTransport._BaseBatchMigrateResources._get_http_options() ) + request, metadata = await self._interceptor.pre_batch_migrate_resources( request, metadata ) @@ -597,6 +635,33 @@ async 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.aiplatform_v1.MigrationServiceClient.BatchMigrateResources", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MigrationService", + "rpcName": "BatchMigrateResources", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncMigrationServiceRestTransport._BatchMigrateResources._get_response( self._host, @@ -625,6 +690,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_batch_migrate_resources(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.MigrationServiceAsyncClient.batch_migrate_resources", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MigrationService", + "rpcName": "BatchMigrateResources", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _SearchMigratableResources( @@ -664,7 +751,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> migration_service.SearchMigratableResourcesResponse: r"""Call the search migratable resources method over HTTP. @@ -676,8 +763,10 @@ async def __call__( 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: ~.migration_service.SearchMigratableResourcesResponse: @@ -689,6 +778,7 @@ async def __call__( http_options = ( _BaseMigrationServiceRestTransport._BaseSearchMigratableResources._get_http_options() ) + request, metadata = await self._interceptor.pre_search_migratable_resources( request, metadata ) @@ -705,6 +795,33 @@ async 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.aiplatform_v1.MigrationServiceClient.SearchMigratableResources", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MigrationService", + "rpcName": "SearchMigratableResources", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncMigrationServiceRestTransport._SearchMigratableResources._get_response( self._host, @@ -733,6 +850,32 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_search_migratable_resources(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + migration_service.SearchMigratableResourcesResponse.to_json( + response + ) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.MigrationServiceAsyncClient.search_migratable_resources", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MigrationService", + "rpcName": "SearchMigratableResources", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp @property @@ -2669,7 +2812,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -2680,8 +2823,10 @@ async def __call__( 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: locations_pb2.Location: Response from GetLocation method. @@ -2690,6 +2835,7 @@ async def __call__( http_options = ( _BaseMigrationServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_location( request, metadata ) @@ -2702,6 +2848,33 @@ async 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.aiplatform_v1.MigrationServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MigrationService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncMigrationServiceRestTransport._GetLocation._get_response( @@ -2729,6 +2902,27 @@ async def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_location(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.aiplatform_v1.MigrationServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MigrationService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -2771,7 +2965,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -2782,8 +2976,10 @@ async def __call__( 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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -2792,6 +2988,7 @@ async def __call__( http_options = ( _BaseMigrationServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_locations( request, metadata ) @@ -2804,6 +3001,33 @@ async 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.aiplatform_v1.MigrationServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MigrationService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncMigrationServiceRestTransport._ListLocations._get_response( @@ -2831,6 +3055,27 @@ async def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_list_locations(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.aiplatform_v1.MigrationServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MigrationService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -2873,7 +3118,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -2884,8 +3129,10 @@ async def __call__( 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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -2894,6 +3141,7 @@ async def __call__( http_options = ( _BaseMigrationServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_get_iam_policy( request, metadata ) @@ -2906,6 +3154,33 @@ async 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.aiplatform_v1.MigrationServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MigrationService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncMigrationServiceRestTransport._GetIamPolicy._get_response( @@ -2933,6 +3208,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_iam_policy(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.aiplatform_v1.MigrationServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MigrationService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -2976,7 +3272,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -2987,8 +3283,10 @@ async def __call__( 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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -2997,6 +3295,7 @@ async def __call__( http_options = ( _BaseMigrationServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_set_iam_policy( request, metadata ) @@ -3013,6 +3312,33 @@ async 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.aiplatform_v1.MigrationServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MigrationService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncMigrationServiceRestTransport._SetIamPolicy._get_response( @@ -3041,6 +3367,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_set_iam_policy(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.aiplatform_v1.MigrationServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MigrationService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3083,7 +3430,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -3094,8 +3441,10 @@ async def __call__( 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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -3104,6 +3453,7 @@ async def __call__( http_options = ( _BaseMigrationServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = await self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -3116,6 +3466,33 @@ async 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.aiplatform_v1.MigrationServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MigrationService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncMigrationServiceRestTransport._TestIamPermissions._get_response( self._host, @@ -3141,6 +3518,27 @@ async def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_test_iam_permissions(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.aiplatform_v1.MigrationServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MigrationService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3183,7 +3581,7 @@ async 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 cancel operation method over HTTP. @@ -3194,13 +3592,16 @@ async def __call__( 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`. """ http_options = ( _BaseMigrationServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_cancel_operation( request, metadata ) @@ -3213,6 +3614,33 @@ async 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.aiplatform_v1.MigrationServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MigrationService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncMigrationServiceRestTransport._CancelOperation._get_response( @@ -3278,7 +3706,7 @@ async 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. @@ -3289,13 +3717,16 @@ async def __call__( 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`. """ http_options = ( _BaseMigrationServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_operation( request, metadata ) @@ -3308,6 +3739,33 @@ async 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.aiplatform_v1.MigrationServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MigrationService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncMigrationServiceRestTransport._DeleteOperation._get_response( @@ -3373,7 +3831,7 @@ async 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. @@ -3384,8 +3842,10 @@ async def __call__( 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: Response from GetOperation method. @@ -3394,6 +3854,7 @@ async def __call__( http_options = ( _BaseMigrationServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_operation( request, metadata ) @@ -3406,6 +3867,33 @@ async 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.aiplatform_v1.MigrationServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MigrationService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncMigrationServiceRestTransport._GetOperation._get_response( @@ -3433,6 +3921,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1.MigrationServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MigrationService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3475,7 +3984,7 @@ async 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. @@ -3486,8 +3995,10 @@ async def __call__( 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 from ListOperations method. @@ -3496,6 +4007,7 @@ async def __call__( http_options = ( _BaseMigrationServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_operations( request, metadata ) @@ -3508,6 +4020,33 @@ async 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.aiplatform_v1.MigrationServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MigrationService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncMigrationServiceRestTransport._ListOperations._get_response( @@ -3535,6 +4074,27 @@ async def __call__( resp = operations_pb2.ListOperationsResponse() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1.MigrationServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MigrationService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3577,7 +4137,7 @@ async 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 wait operation method over HTTP. @@ -3588,8 +4148,10 @@ async def __call__( 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: Response from WaitOperation method. @@ -3598,6 +4160,7 @@ async def __call__( http_options = ( _BaseMigrationServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_wait_operation( request, metadata ) @@ -3610,6 +4173,33 @@ async 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.aiplatform_v1.MigrationServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MigrationService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncMigrationServiceRestTransport._WaitOperation._get_response( @@ -3637,6 +4227,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_wait_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.aiplatform_v1.MigrationServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.MigrationService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1/services/model_garden_service/async_client.py b/google/cloud/aiplatform_v1/services/model_garden_service/async_client.py index a5df35e9a3..3c6b7fce79 100644 --- a/google/cloud/aiplatform_v1/services/model_garden_service/async_client.py +++ b/google/cloud/aiplatform_v1/services/model_garden_service/async_client.py @@ -13,6 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging as std_logging from collections import OrderedDict import re from typing import ( @@ -54,6 +55,15 @@ from .transports.grpc_asyncio import ModelGardenServiceGrpcAsyncIOTransport from .client import ModelGardenServiceClient +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 ModelGardenServiceAsyncClient: """The interface of Model Garden Service.""" @@ -269,6 +279,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.aiplatform_v1.ModelGardenServiceAsyncClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelGardenService", + "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.aiplatform.v1.ModelGardenService", + "credentialsType": None, + }, + ) + async def get_publisher_model( self, request: Optional[ @@ -278,7 +310,7 @@ async def get_publisher_model( 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]]] = (), ) -> publisher_model.PublisherModel: r"""Gets a Model Garden publisher model. @@ -323,8 +355,10 @@ async def sample_get_publisher_model(): 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.aiplatform_v1.types.PublisherModel: @@ -382,7 +416,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. @@ -393,8 +427,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. @@ -435,7 +471,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. @@ -446,8 +482,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. @@ -488,7 +526,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. @@ -504,8 +542,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 """ @@ -542,7 +582,7 @@ async def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -557,8 +597,10 @@ async def cancel_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 """ @@ -595,7 +637,7 @@ async def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -612,8 +654,10 @@ async def wait_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. @@ -654,7 +698,7 @@ async def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -667,8 +711,10 @@ async def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -773,7 +819,7 @@ async def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -787,8 +833,10 @@ async def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -893,7 +941,7 @@ async def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -908,8 +956,10 @@ async def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -953,7 +1003,7 @@ async def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -964,8 +1014,10 @@ async def get_location( 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: ~.location_pb2.Location: Location object. @@ -1006,7 +1058,7 @@ async def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -1017,8 +1069,10 @@ async def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1/services/model_garden_service/client.py b/google/cloud/aiplatform_v1/services/model_garden_service/client.py index 7d323fea41..317dfae228 100644 --- a/google/cloud/aiplatform_v1/services/model_garden_service/client.py +++ b/google/cloud/aiplatform_v1/services/model_garden_service/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 ( @@ -48,6 +49,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.cloud.aiplatform_v1.types import model from google.cloud.aiplatform_v1.types import model_garden_service from google.cloud.aiplatform_v1.types import publisher_model @@ -617,6 +627,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( @@ -708,6 +722,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.aiplatform_v1.ModelGardenServiceClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelGardenService", + "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.aiplatform.v1.ModelGardenService", + "credentialsType": None, + }, + ) + def get_publisher_model( self, request: Optional[ @@ -717,7 +754,7 @@ def get_publisher_model( 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]]] = (), ) -> publisher_model.PublisherModel: r"""Gets a Model Garden publisher model. @@ -762,8 +799,10 @@ def sample_get_publisher_model(): 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.aiplatform_v1.types.PublisherModel: @@ -831,7 +870,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. @@ -842,8 +881,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. @@ -884,7 +925,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. @@ -895,8 +936,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. @@ -937,7 +980,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. @@ -953,8 +996,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 """ @@ -991,7 +1036,7 @@ def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -1006,8 +1051,10 @@ def cancel_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 """ @@ -1044,7 +1091,7 @@ def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -1061,8 +1108,10 @@ def wait_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. @@ -1103,7 +1152,7 @@ def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -1116,8 +1165,10 @@ def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -1222,7 +1273,7 @@ def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -1236,8 +1287,10 @@ def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -1342,7 +1395,7 @@ def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -1357,8 +1410,10 @@ def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -1400,7 +1455,7 @@ def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -1411,8 +1466,10 @@ def get_location( 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: ~.location_pb2.Location: Location object. @@ -1453,7 +1510,7 @@ def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -1464,8 +1521,10 @@ def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1/services/model_garden_service/transports/grpc.py b/google/cloud/aiplatform_v1/services/model_garden_service/transports/grpc.py index 89b84625e6..e73731d19b 100644 --- a/google/cloud/aiplatform_v1/services/model_garden_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1/services/model_garden_service/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 import warnings from typing import Callable, Dict, Optional, Sequence, Tuple, Union @@ -21,8 +24,11 @@ import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from google.cloud.aiplatform_v1.types import model_garden_service from google.cloud.aiplatform_v1.types import publisher_model @@ -32,6 +38,81 @@ from google.longrunning import operations_pb2 # type: ignore from .base import ModelGardenServiceTransport, DEFAULT_CLIENT_INFO +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.aiplatform.v1.ModelGardenService", + "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.aiplatform.v1.ModelGardenService", + "rpcName": client_call_details.method, + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class ModelGardenServiceGrpcTransport(ModelGardenServiceTransport): """gRPC backend transport for ModelGardenService. @@ -185,7 +266,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 @@ -261,7 +347,7 @@ def get_publisher_model( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_publisher_model" not in self._stubs: - self._stubs["get_publisher_model"] = self.grpc_channel.unary_unary( + self._stubs["get_publisher_model"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.ModelGardenService/GetPublisherModel", request_serializer=model_garden_service.GetPublisherModelRequest.serialize, response_deserializer=publisher_model.PublisherModel.deserialize, @@ -269,7 +355,7 @@ def get_publisher_model( return self._stubs["get_publisher_model"] def close(self): - self.grpc_channel.close() + self._logged_channel.close() @property def delete_operation( @@ -281,7 +367,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, @@ -298,7 +384,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -315,7 +401,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -332,7 +418,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, @@ -351,7 +437,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, @@ -370,7 +456,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -387,7 +473,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -412,7 +498,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -438,7 +524,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -467,7 +553,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1/services/model_garden_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1/services/model_garden_service/transports/grpc_asyncio.py index 8175537df3..63dfffdc48 100644 --- a/google/cloud/aiplatform_v1/services/model_garden_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1/services/model_garden_service/transports/grpc_asyncio.py @@ -14,6 +14,9 @@ # limitations under the License. # import inspect +import json +import pickle +import logging as std_logging import warnings from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union @@ -23,8 +26,11 @@ from google.api_core import retry_async as retries from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from grpc.experimental import aio # type: ignore from google.cloud.aiplatform_v1.types import model_garden_service @@ -36,6 +42,82 @@ from .base import ModelGardenServiceTransport, DEFAULT_CLIENT_INFO from .grpc import ModelGardenServiceGrpcTransport +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.aiplatform.v1.ModelGardenService", + "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.aiplatform.v1.ModelGardenService", + "rpcName": str(client_call_details.method), + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class ModelGardenServiceGrpcAsyncIOTransport(ModelGardenServiceTransport): """gRPC AsyncIO backend transport for ModelGardenService. @@ -232,10 +314,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 @@ -270,7 +355,7 @@ def get_publisher_model( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_publisher_model" not in self._stubs: - self._stubs["get_publisher_model"] = self.grpc_channel.unary_unary( + self._stubs["get_publisher_model"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.ModelGardenService/GetPublisherModel", request_serializer=model_garden_service.GetPublisherModelRequest.serialize, response_deserializer=publisher_model.PublisherModel.deserialize, @@ -343,7 +428,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: @@ -359,7 +444,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, @@ -376,7 +461,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -393,7 +478,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -410,7 +495,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, @@ -429,7 +514,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, @@ -448,7 +533,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -465,7 +550,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -490,7 +575,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -516,7 +601,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -545,7 +630,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1/services/model_garden_service/transports/rest.py b/google/cloud/aiplatform_v1/services/model_garden_service/transports/rest.py index bdf8376d09..3043dba7ca 100644 --- a/google/cloud/aiplatform_v1/services/model_garden_service/transports/rest.py +++ b/google/cloud/aiplatform_v1/services/model_garden_service/transports/rest.py @@ -13,9 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging +import json # type: ignore from google.auth.transport.requests import AuthorizedSession # type: ignore -import json # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.api_core import exceptions as core_exceptions from google.api_core import retry as retries @@ -47,6 +48,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, @@ -87,9 +96,10 @@ def post_get_publisher_model(self, response): def pre_get_publisher_model( self, request: model_garden_service.GetPublisherModelRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - model_garden_service.GetPublisherModelRequest, Sequence[Tuple[str, str]] + model_garden_service.GetPublisherModelRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for get_publisher_model @@ -112,8 +122,10 @@ def post_get_publisher_model( def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -135,8 +147,10 @@ def post_get_location( def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -158,8 +172,10 @@ def post_list_locations( def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -179,8 +195,10 @@ def post_get_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -200,8 +218,11 @@ def post_set_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -223,8 +244,10 @@ def post_test_iam_permissions( def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -244,8 +267,10 @@ def post_cancel_operation(self, response: None) -> None: 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 @@ -265,8 +290,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 @@ -288,8 +315,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 @@ -311,8 +340,10 @@ def post_list_operations( def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -454,7 +485,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]]] = (), ) -> publisher_model.PublisherModel: r"""Call the get publisher model method over HTTP. @@ -465,8 +496,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: ~.publisher_model.PublisherModel: @@ -476,6 +509,7 @@ def __call__( http_options = ( _BaseModelGardenServiceRestTransport._BaseGetPublisherModel._get_http_options() ) + request, metadata = self._interceptor.pre_get_publisher_model( request, metadata ) @@ -488,6 +522,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.aiplatform_v1.ModelGardenServiceClient.GetPublisherModel", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelGardenService", + "rpcName": "GetPublisherModel", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ModelGardenServiceRestTransport._GetPublisherModel._get_response( self._host, @@ -508,7 +569,29 @@ def __call__( pb_resp = publisher_model.PublisherModel.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_publisher_model(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = publisher_model.PublisherModel.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.aiplatform_v1.ModelGardenServiceClient.get_publisher_model", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelGardenService", + "rpcName": "GetPublisherModel", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp @property @@ -561,7 +644,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]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -572,8 +655,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: locations_pb2.Location: Response from GetLocation method. @@ -582,6 +667,7 @@ def __call__( http_options = ( _BaseModelGardenServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = self._interceptor.pre_get_location(request, metadata) transcoded_request = _BaseModelGardenServiceRestTransport._BaseGetLocation._get_transcoded_request( http_options, request @@ -592,6 +678,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.aiplatform_v1.ModelGardenServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelGardenService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ModelGardenServiceRestTransport._GetLocation._get_response( self._host, @@ -611,6 +724,27 @@ def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_location(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.aiplatform_v1.ModelGardenServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelGardenService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -653,7 +787,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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -664,8 +798,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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -674,6 +810,7 @@ def __call__( http_options = ( _BaseModelGardenServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = self._interceptor.pre_list_locations(request, metadata) transcoded_request = _BaseModelGardenServiceRestTransport._BaseListLocations._get_transcoded_request( http_options, request @@ -684,6 +821,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.aiplatform_v1.ModelGardenServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelGardenService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ModelGardenServiceRestTransport._ListLocations._get_response( self._host, @@ -703,6 +867,27 @@ def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_list_locations(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.aiplatform_v1.ModelGardenServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelGardenService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -745,7 +930,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]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -756,8 +941,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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -766,6 +953,7 @@ def __call__( http_options = ( _BaseModelGardenServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_get_iam_policy(request, metadata) transcoded_request = _BaseModelGardenServiceRestTransport._BaseGetIamPolicy._get_transcoded_request( http_options, request @@ -776,6 +964,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.aiplatform_v1.ModelGardenServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelGardenService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ModelGardenServiceRestTransport._GetIamPolicy._get_response( self._host, @@ -795,6 +1010,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_iam_policy(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.aiplatform_v1.ModelGardenServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelGardenService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -838,7 +1074,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]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -849,8 +1085,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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -859,6 +1097,7 @@ def __call__( http_options = ( _BaseModelGardenServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_set_iam_policy(request, metadata) transcoded_request = _BaseModelGardenServiceRestTransport._BaseSetIamPolicy._get_transcoded_request( http_options, request @@ -873,6 +1112,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.aiplatform_v1.ModelGardenServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelGardenService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ModelGardenServiceRestTransport._SetIamPolicy._get_response( self._host, @@ -893,6 +1159,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_set_iam_policy(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.aiplatform_v1.ModelGardenServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelGardenService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -935,7 +1222,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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -946,8 +1233,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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -956,6 +1245,7 @@ def __call__( http_options = ( _BaseModelGardenServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -968,6 +1258,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.aiplatform_v1.ModelGardenServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelGardenService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( ModelGardenServiceRestTransport._TestIamPermissions._get_response( @@ -989,6 +1306,27 @@ def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_test_iam_permissions(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.aiplatform_v1.ModelGardenServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelGardenService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1031,7 +1369,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 cancel operation method over HTTP. @@ -1042,13 +1380,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 = ( _BaseModelGardenServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = self._interceptor.pre_cancel_operation( request, metadata ) @@ -1061,6 +1402,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.aiplatform_v1.ModelGardenServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelGardenService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ModelGardenServiceRestTransport._CancelOperation._get_response( self._host, @@ -1118,7 +1486,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. @@ -1129,13 +1497,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 = ( _BaseModelGardenServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = self._interceptor.pre_delete_operation( request, metadata ) @@ -1148,6 +1519,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.aiplatform_v1.ModelGardenServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelGardenService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ModelGardenServiceRestTransport._DeleteOperation._get_response( self._host, @@ -1205,7 +1603,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. @@ -1216,8 +1614,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. @@ -1226,6 +1626,7 @@ def __call__( http_options = ( _BaseModelGardenServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = self._interceptor.pre_get_operation(request, metadata) transcoded_request = _BaseModelGardenServiceRestTransport._BaseGetOperation._get_transcoded_request( http_options, request @@ -1236,6 +1637,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.aiplatform_v1.ModelGardenServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelGardenService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ModelGardenServiceRestTransport._GetOperation._get_response( self._host, @@ -1255,6 +1683,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.aiplatform_v1.ModelGardenServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelGardenService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1297,7 +1746,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. @@ -1308,8 +1757,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. @@ -1318,6 +1769,7 @@ def __call__( http_options = ( _BaseModelGardenServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = self._interceptor.pre_list_operations(request, metadata) transcoded_request = _BaseModelGardenServiceRestTransport._BaseListOperations._get_transcoded_request( http_options, request @@ -1328,6 +1780,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.aiplatform_v1.ModelGardenServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelGardenService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ModelGardenServiceRestTransport._ListOperations._get_response( self._host, @@ -1347,6 +1826,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.aiplatform_v1.ModelGardenServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelGardenService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1389,7 +1889,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 wait operation method over HTTP. @@ -1400,8 +1900,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 WaitOperation method. @@ -1410,6 +1912,7 @@ def __call__( http_options = ( _BaseModelGardenServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = self._interceptor.pre_wait_operation(request, metadata) transcoded_request = _BaseModelGardenServiceRestTransport._BaseWaitOperation._get_transcoded_request( http_options, request @@ -1420,6 +1923,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.aiplatform_v1.ModelGardenServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelGardenService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ModelGardenServiceRestTransport._WaitOperation._get_response( self._host, @@ -1439,6 +1969,27 @@ def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = self._interceptor.post_wait_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.aiplatform_v1.ModelGardenServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelGardenService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1/services/model_garden_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1/services/model_garden_service/transports/rest_asyncio.py index 141b87457a..2104caf6f4 100644 --- a/google/cloud/aiplatform_v1/services/model_garden_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1/services/model_garden_service/transports/rest_asyncio.py @@ -57,6 +57,18 @@ from .base import DEFAULT_CLIENT_INFO as BASE_DEFAULT_CLIENT_INFO + +import logging + +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__) + try: OptionalRetry = Union[retries.AsyncRetry, gapic_v1.method._MethodDefault, None] except AttributeError: # pragma: NO COVER @@ -101,9 +113,10 @@ async def post_get_publisher_model(self, response): async def pre_get_publisher_model( self, request: model_garden_service.GetPublisherModelRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - model_garden_service.GetPublisherModelRequest, Sequence[Tuple[str, str]] + model_garden_service.GetPublisherModelRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for get_publisher_model @@ -126,8 +139,10 @@ async def post_get_publisher_model( async def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -149,8 +164,10 @@ async def post_get_location( async def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -172,8 +189,10 @@ async def post_list_locations( async def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -195,8 +214,10 @@ async def post_get_iam_policy( async def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -218,8 +239,11 @@ async def post_set_iam_policy( async def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -241,8 +265,10 @@ async def post_test_iam_permissions( async def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -262,8 +288,10 @@ async def post_cancel_operation(self, response: None) -> None: async 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 @@ -283,8 +311,10 @@ async def post_delete_operation(self, response: None) -> None: async 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 @@ -306,8 +336,10 @@ async def post_get_operation( async 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 @@ -329,8 +361,10 @@ async def post_list_operations( async def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -512,7 +546,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> publisher_model.PublisherModel: r"""Call the get publisher model method over HTTP. @@ -523,8 +557,10 @@ async def __call__( 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: ~.publisher_model.PublisherModel: @@ -534,6 +570,7 @@ async def __call__( http_options = ( _BaseModelGardenServiceRestTransport._BaseGetPublisherModel._get_http_options() ) + request, metadata = await self._interceptor.pre_get_publisher_model( request, metadata ) @@ -546,6 +583,33 @@ async 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.aiplatform_v1.ModelGardenServiceClient.GetPublisherModel", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelGardenService", + "rpcName": "GetPublisherModel", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncModelGardenServiceRestTransport._GetPublisherModel._get_response( self._host, @@ -573,6 +637,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_get_publisher_model(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = publisher_model.PublisherModel.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.ModelGardenServiceAsyncClient.get_publisher_model", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelGardenService", + "rpcName": "GetPublisherModel", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp @property @@ -623,7 +709,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -634,8 +720,10 @@ async def __call__( 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: locations_pb2.Location: Response from GetLocation method. @@ -644,6 +732,7 @@ async def __call__( http_options = ( _BaseModelGardenServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_location( request, metadata ) @@ -656,6 +745,33 @@ async 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.aiplatform_v1.ModelGardenServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelGardenService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncModelGardenServiceRestTransport._GetLocation._get_response( @@ -683,6 +799,27 @@ async def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_location(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.aiplatform_v1.ModelGardenServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelGardenService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -725,7 +862,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -736,8 +873,10 @@ async def __call__( 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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -746,6 +885,7 @@ async def __call__( http_options = ( _BaseModelGardenServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_locations( request, metadata ) @@ -758,6 +898,33 @@ async 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.aiplatform_v1.ModelGardenServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelGardenService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncModelGardenServiceRestTransport._ListLocations._get_response( @@ -785,6 +952,27 @@ async def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_list_locations(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.aiplatform_v1.ModelGardenServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelGardenService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -827,7 +1015,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -838,8 +1026,10 @@ async def __call__( 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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -848,6 +1038,7 @@ async def __call__( http_options = ( _BaseModelGardenServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_get_iam_policy( request, metadata ) @@ -860,6 +1051,33 @@ async 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.aiplatform_v1.ModelGardenServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelGardenService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncModelGardenServiceRestTransport._GetIamPolicy._get_response( @@ -887,6 +1105,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_iam_policy(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.aiplatform_v1.ModelGardenServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelGardenService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -930,7 +1169,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -941,8 +1180,10 @@ async def __call__( 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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -951,6 +1192,7 @@ async def __call__( http_options = ( _BaseModelGardenServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_set_iam_policy( request, metadata ) @@ -967,6 +1209,33 @@ async 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.aiplatform_v1.ModelGardenServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelGardenService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncModelGardenServiceRestTransport._SetIamPolicy._get_response( @@ -995,6 +1264,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_set_iam_policy(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.aiplatform_v1.ModelGardenServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelGardenService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1037,7 +1327,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -1048,8 +1338,10 @@ async def __call__( 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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -1058,6 +1350,7 @@ async def __call__( http_options = ( _BaseModelGardenServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = await self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -1070,6 +1363,33 @@ async 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.aiplatform_v1.ModelGardenServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelGardenService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncModelGardenServiceRestTransport._TestIamPermissions._get_response( self._host, @@ -1095,6 +1415,27 @@ async def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_test_iam_permissions(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.aiplatform_v1.ModelGardenServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelGardenService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1137,7 +1478,7 @@ async 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 cancel operation method over HTTP. @@ -1148,13 +1489,16 @@ async def __call__( 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`. """ http_options = ( _BaseModelGardenServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_cancel_operation( request, metadata ) @@ -1167,6 +1511,33 @@ async 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.aiplatform_v1.ModelGardenServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelGardenService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncModelGardenServiceRestTransport._CancelOperation._get_response( self._host, @@ -1230,7 +1601,7 @@ async 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. @@ -1241,13 +1612,16 @@ async def __call__( 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`. """ http_options = ( _BaseModelGardenServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_operation( request, metadata ) @@ -1260,6 +1634,33 @@ async 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.aiplatform_v1.ModelGardenServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelGardenService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncModelGardenServiceRestTransport._DeleteOperation._get_response( self._host, @@ -1323,7 +1724,7 @@ async 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. @@ -1334,8 +1735,10 @@ async def __call__( 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: Response from GetOperation method. @@ -1344,6 +1747,7 @@ async def __call__( http_options = ( _BaseModelGardenServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_operation( request, metadata ) @@ -1356,6 +1760,33 @@ async 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.aiplatform_v1.ModelGardenServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelGardenService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncModelGardenServiceRestTransport._GetOperation._get_response( @@ -1383,6 +1814,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1.ModelGardenServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelGardenService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1425,7 +1877,7 @@ async 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. @@ -1436,8 +1888,10 @@ async def __call__( 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 from ListOperations method. @@ -1446,6 +1900,7 @@ async def __call__( http_options = ( _BaseModelGardenServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_operations( request, metadata ) @@ -1458,6 +1913,33 @@ async 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.aiplatform_v1.ModelGardenServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelGardenService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncModelGardenServiceRestTransport._ListOperations._get_response( self._host, @@ -1483,6 +1965,27 @@ async def __call__( resp = operations_pb2.ListOperationsResponse() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1.ModelGardenServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelGardenService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1525,7 +2028,7 @@ async 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 wait operation method over HTTP. @@ -1536,8 +2039,10 @@ async def __call__( 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: Response from WaitOperation method. @@ -1546,6 +2051,7 @@ async def __call__( http_options = ( _BaseModelGardenServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_wait_operation( request, metadata ) @@ -1558,6 +2064,33 @@ async 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.aiplatform_v1.ModelGardenServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelGardenService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncModelGardenServiceRestTransport._WaitOperation._get_response( @@ -1585,6 +2118,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_wait_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.aiplatform_v1.ModelGardenServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelGardenService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1/services/model_service/async_client.py b/google/cloud/aiplatform_v1/services/model_service/async_client.py index d85487f1c7..44f08473ef 100644 --- a/google/cloud/aiplatform_v1/services/model_service/async_client.py +++ b/google/cloud/aiplatform_v1/services/model_service/async_client.py @@ -13,6 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging as std_logging from collections import OrderedDict import re from typing import ( @@ -69,6 +70,15 @@ from .transports.grpc_asyncio import ModelServiceGrpcAsyncIOTransport from .client import ModelServiceClient +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 ModelServiceAsyncClient: """A service for managing Vertex AI's machine learning Models.""" @@ -288,6 +298,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.aiplatform_v1.ModelServiceAsyncClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelService", + "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.aiplatform.v1.ModelService", + "credentialsType": None, + }, + ) + async def upload_model( self, request: Optional[Union[model_service.UploadModelRequest, dict]] = None, @@ -296,7 +328,7 @@ async def upload_model( model: Optional[gca_model.Model] = 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"""Uploads a Model artifact into Vertex AI. @@ -354,8 +386,10 @@ async def sample_upload_model(): 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: @@ -429,7 +463,7 @@ async def get_model( 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]]] = (), ) -> model.Model: r"""Gets a Model. @@ -484,8 +518,10 @@ async def sample_get_model(): 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.aiplatform_v1.types.Model: @@ -544,7 +580,7 @@ async def list_models( 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.ListModelsAsyncPager: r"""Lists Models in a Location. @@ -590,8 +626,10 @@ async def sample_list_models(): 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.aiplatform_v1.services.model_service.pagers.ListModelsAsyncPager: @@ -666,7 +704,7 @@ async def list_model_versions( 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]]] = (), ) -> pagers.ListModelVersionsAsyncPager: r"""Lists versions of the specified model. @@ -711,8 +749,10 @@ async def sample_list_model_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.aiplatform_v1.services.model_service.pagers.ListModelVersionsAsyncPager: @@ -788,7 +828,7 @@ async def update_model( 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]]] = (), ) -> gca_model.Model: r"""Updates a Model. @@ -864,8 +904,10 @@ async def sample_update_model(): 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.aiplatform_v1.types.Model: @@ -930,7 +972,7 @@ async def update_explanation_dataset( model: 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"""Incrementally update the dataset used for an examples model. @@ -980,8 +1022,10 @@ async def sample_update_explanation_dataset(): 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: @@ -1053,7 +1097,7 @@ async def delete_model( 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"""Deletes a Model. @@ -1109,8 +1153,10 @@ async def sample_delete_model(): 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: @@ -1189,7 +1235,7 @@ async def delete_model_version( 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"""Deletes a Model version. @@ -1247,8 +1293,10 @@ async def sample_delete_model_version(): 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: @@ -1328,7 +1376,7 @@ async def merge_version_aliases( version_aliases: Optional[MutableSequence[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]]] = (), ) -> model.Model: r"""Merges a set of aliases for a Model version. @@ -1396,8 +1444,10 @@ async def sample_merge_version_aliases(): 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.aiplatform_v1.types.Model: @@ -1459,7 +1509,7 @@ async def export_model( output_config: Optional[model_service.ExportModelRequest.OutputConfig] = 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"""Exports a trained, exportable Model to a location specified by the user. A Model is considered to be exportable if it has at @@ -1521,8 +1571,10 @@ async def sample_export_model(): 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: @@ -1597,7 +1649,7 @@ async def copy_model( source_model: 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"""Copies an already existing Vertex AI Model into the specified Location. The source Model must exist in the same Project. When @@ -1661,8 +1713,10 @@ async def sample_copy_model(): 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: @@ -1739,7 +1793,7 @@ async def import_model_evaluation( model_evaluation: Optional[gca_model_evaluation.ModelEvaluation] = 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]]] = (), ) -> gca_model_evaluation.ModelEvaluation: r"""Imports an externally generated ModelEvaluation. @@ -1790,8 +1844,10 @@ async def sample_import_model_evaluation(): 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.aiplatform_v1.types.ModelEvaluation: @@ -1861,7 +1917,7 @@ async def batch_import_model_evaluation_slices( ] = 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]]] = (), ) -> model_service.BatchImportModelEvaluationSlicesResponse: r"""Imports a list of externally generated ModelEvaluationSlice. @@ -1914,8 +1970,10 @@ async def sample_batch_import_model_evaluation_slices(): 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.aiplatform_v1.types.BatchImportModelEvaluationSlicesResponse: @@ -1985,7 +2043,7 @@ async def batch_import_evaluated_annotations( ] = 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]]] = (), ) -> model_service.BatchImportEvaluatedAnnotationsResponse: r"""Imports a list of externally generated EvaluatedAnnotations. @@ -2038,8 +2096,10 @@ async def sample_batch_import_evaluated_annotations(): 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.aiplatform_v1.types.BatchImportEvaluatedAnnotationsResponse: @@ -2104,7 +2164,7 @@ async def get_model_evaluation( 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]]] = (), ) -> model_evaluation.ModelEvaluation: r"""Gets a ModelEvaluation. @@ -2149,8 +2209,10 @@ async def sample_get_model_evaluation(): 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.aiplatform_v1.types.ModelEvaluation: @@ -2215,7 +2277,7 @@ async def list_model_evaluations( 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.ListModelEvaluationsAsyncPager: r"""Lists ModelEvaluations in a Model. @@ -2261,8 +2323,10 @@ async def sample_list_model_evaluations(): 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.aiplatform_v1.services.model_service.pagers.ListModelEvaluationsAsyncPager: @@ -2339,7 +2403,7 @@ async def get_model_evaluation_slice( 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]]] = (), ) -> model_evaluation_slice.ModelEvaluationSlice: r"""Gets a ModelEvaluationSlice. @@ -2384,8 +2448,10 @@ async def sample_get_model_evaluation_slice(): 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.aiplatform_v1.types.ModelEvaluationSlice: @@ -2450,7 +2516,7 @@ async def list_model_evaluation_slices( 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.ListModelEvaluationSlicesAsyncPager: r"""Lists ModelEvaluationSlices in a ModelEvaluation. @@ -2496,8 +2562,10 @@ async def sample_list_model_evaluation_slices(): 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.aiplatform_v1.services.model_service.pagers.ListModelEvaluationSlicesAsyncPager: @@ -2571,7 +2639,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. @@ -2582,8 +2650,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. @@ -2624,7 +2694,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. @@ -2635,8 +2705,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. @@ -2677,7 +2749,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. @@ -2693,8 +2765,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 """ @@ -2731,7 +2805,7 @@ async def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -2746,8 +2820,10 @@ async def cancel_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 """ @@ -2784,7 +2860,7 @@ async def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -2801,8 +2877,10 @@ async def wait_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. @@ -2843,7 +2921,7 @@ async def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -2856,8 +2934,10 @@ async def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -2962,7 +3042,7 @@ async def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -2976,8 +3056,10 @@ async def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -3082,7 +3164,7 @@ async def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -3097,8 +3179,10 @@ async def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -3142,7 +3226,7 @@ async def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -3153,8 +3237,10 @@ async def get_location( 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: ~.location_pb2.Location: Location object. @@ -3195,7 +3281,7 @@ async def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -3206,8 +3292,10 @@ async def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1/services/model_service/client.py b/google/cloud/aiplatform_v1/services/model_service/client.py index 745b56310c..e77f13eb48 100644 --- a/google/cloud/aiplatform_v1/services/model_service/client.py +++ b/google/cloud/aiplatform_v1/services/model_service/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 ( @@ -48,6 +49,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 as gac_operation # type: ignore from google.api_core import operation_async # type: ignore from google.cloud.aiplatform_v1.services.model_service import pagers @@ -725,6 +735,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( @@ -812,6 +826,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.aiplatform_v1.ModelServiceClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelService", + "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.aiplatform.v1.ModelService", + "credentialsType": None, + }, + ) + def upload_model( self, request: Optional[Union[model_service.UploadModelRequest, dict]] = None, @@ -820,7 +857,7 @@ def upload_model( model: Optional[gca_model.Model] = 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]]] = (), ) -> gac_operation.Operation: r"""Uploads a Model artifact into Vertex AI. @@ -878,8 +915,10 @@ def sample_upload_model(): 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: @@ -950,7 +989,7 @@ def get_model( 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]]] = (), ) -> model.Model: r"""Gets a Model. @@ -1005,8 +1044,10 @@ def sample_get_model(): 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.aiplatform_v1.types.Model: @@ -1062,7 +1103,7 @@ def list_models( 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.ListModelsPager: r"""Lists Models in a Location. @@ -1108,8 +1149,10 @@ def sample_list_models(): 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.aiplatform_v1.services.model_service.pagers.ListModelsPager: @@ -1181,7 +1224,7 @@ def list_model_versions( 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]]] = (), ) -> pagers.ListModelVersionsPager: r"""Lists versions of the specified model. @@ -1226,8 +1269,10 @@ def sample_list_model_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.aiplatform_v1.services.model_service.pagers.ListModelVersionsPager: @@ -1300,7 +1345,7 @@ def update_model( 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]]] = (), ) -> gca_model.Model: r"""Updates a Model. @@ -1376,8 +1421,10 @@ def sample_update_model(): 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.aiplatform_v1.types.Model: @@ -1439,7 +1486,7 @@ def update_explanation_dataset( model: 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]]] = (), ) -> gac_operation.Operation: r"""Incrementally update the dataset used for an examples model. @@ -1489,8 +1536,10 @@ def sample_update_explanation_dataset(): 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: @@ -1561,7 +1610,7 @@ def delete_model( 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]]] = (), ) -> gac_operation.Operation: r"""Deletes a Model. @@ -1617,8 +1666,10 @@ def sample_delete_model(): 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: @@ -1694,7 +1745,7 @@ def delete_model_version( 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]]] = (), ) -> gac_operation.Operation: r"""Deletes a Model version. @@ -1752,8 +1803,10 @@ def sample_delete_model_version(): 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: @@ -1830,7 +1883,7 @@ def merge_version_aliases( version_aliases: Optional[MutableSequence[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]]] = (), ) -> model.Model: r"""Merges a set of aliases for a Model version. @@ -1898,8 +1951,10 @@ def sample_merge_version_aliases(): 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.aiplatform_v1.types.Model: @@ -1958,7 +2013,7 @@ def export_model( output_config: Optional[model_service.ExportModelRequest.OutputConfig] = 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]]] = (), ) -> gac_operation.Operation: r"""Exports a trained, exportable Model to a location specified by the user. A Model is considered to be exportable if it has at @@ -2020,8 +2075,10 @@ def sample_export_model(): 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: @@ -2093,7 +2150,7 @@ def copy_model( source_model: 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]]] = (), ) -> gac_operation.Operation: r"""Copies an already existing Vertex AI Model into the specified Location. The source Model must exist in the same Project. When @@ -2157,8 +2214,10 @@ def sample_copy_model(): 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: @@ -2232,7 +2291,7 @@ def import_model_evaluation( model_evaluation: Optional[gca_model_evaluation.ModelEvaluation] = 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]]] = (), ) -> gca_model_evaluation.ModelEvaluation: r"""Imports an externally generated ModelEvaluation. @@ -2283,8 +2342,10 @@ def sample_import_model_evaluation(): 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.aiplatform_v1.types.ModelEvaluation: @@ -2351,7 +2412,7 @@ def batch_import_model_evaluation_slices( ] = 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]]] = (), ) -> model_service.BatchImportModelEvaluationSlicesResponse: r"""Imports a list of externally generated ModelEvaluationSlice. @@ -2404,8 +2465,10 @@ def sample_batch_import_model_evaluation_slices(): 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.aiplatform_v1.types.BatchImportModelEvaluationSlicesResponse: @@ -2474,7 +2537,7 @@ def batch_import_evaluated_annotations( ] = 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]]] = (), ) -> model_service.BatchImportEvaluatedAnnotationsResponse: r"""Imports a list of externally generated EvaluatedAnnotations. @@ -2527,8 +2590,10 @@ def sample_batch_import_evaluated_annotations(): 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.aiplatform_v1.types.BatchImportEvaluatedAnnotationsResponse: @@ -2592,7 +2657,7 @@ def get_model_evaluation( 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]]] = (), ) -> model_evaluation.ModelEvaluation: r"""Gets a ModelEvaluation. @@ -2637,8 +2702,10 @@ def sample_get_model_evaluation(): 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.aiplatform_v1.types.ModelEvaluation: @@ -2700,7 +2767,7 @@ def list_model_evaluations( 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.ListModelEvaluationsPager: r"""Lists ModelEvaluations in a Model. @@ -2746,8 +2813,10 @@ def sample_list_model_evaluations(): 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.aiplatform_v1.services.model_service.pagers.ListModelEvaluationsPager: @@ -2821,7 +2890,7 @@ def get_model_evaluation_slice( 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]]] = (), ) -> model_evaluation_slice.ModelEvaluationSlice: r"""Gets a ModelEvaluationSlice. @@ -2866,8 +2935,10 @@ def sample_get_model_evaluation_slice(): 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.aiplatform_v1.types.ModelEvaluationSlice: @@ -2931,7 +3002,7 @@ def list_model_evaluation_slices( 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.ListModelEvaluationSlicesPager: r"""Lists ModelEvaluationSlices in a ModelEvaluation. @@ -2977,8 +3048,10 @@ def sample_list_model_evaluation_slices(): 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.aiplatform_v1.services.model_service.pagers.ListModelEvaluationSlicesPager: @@ -3064,7 +3137,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. @@ -3075,8 +3148,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. @@ -3117,7 +3192,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. @@ -3128,8 +3203,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. @@ -3170,7 +3247,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. @@ -3186,8 +3263,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 """ @@ -3224,7 +3303,7 @@ def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -3239,8 +3318,10 @@ def cancel_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 """ @@ -3277,7 +3358,7 @@ def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -3294,8 +3375,10 @@ def wait_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. @@ -3336,7 +3419,7 @@ def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -3349,8 +3432,10 @@ def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -3455,7 +3540,7 @@ def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -3469,8 +3554,10 @@ def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -3575,7 +3662,7 @@ def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -3590,8 +3677,10 @@ def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -3633,7 +3722,7 @@ def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -3644,8 +3733,10 @@ def get_location( 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: ~.location_pb2.Location: Location object. @@ -3686,7 +3777,7 @@ def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -3697,8 +3788,10 @@ def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1/services/model_service/pagers.py b/google/cloud/aiplatform_v1/services/model_service/pagers.py index bcbb42ce5a..03d454f889 100644 --- a/google/cloud/aiplatform_v1/services/model_service/pagers.py +++ b/google/cloud/aiplatform_v1/services/model_service/pagers.py @@ -69,7 +69,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. @@ -83,8 +83,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 = model_service.ListModelsRequest(request) @@ -143,7 +145,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. @@ -157,8 +159,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 = model_service.ListModelsRequest(request) @@ -221,7 +225,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. @@ -235,8 +239,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 = model_service.ListModelVersionsRequest(request) @@ -295,7 +301,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. @@ -309,8 +315,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 = model_service.ListModelVersionsRequest(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 = model_service.ListModelEvaluationsRequest(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 = model_service.ListModelEvaluationsRequest(request) @@ -525,7 +537,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. @@ -539,8 +551,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 = model_service.ListModelEvaluationSlicesRequest(request) @@ -601,7 +615,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. @@ -615,8 +629,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 = model_service.ListModelEvaluationSlicesRequest(request) diff --git a/google/cloud/aiplatform_v1/services/model_service/transports/grpc.py b/google/cloud/aiplatform_v1/services/model_service/transports/grpc.py index cb0882d675..9a31d4c9c9 100644 --- a/google/cloud/aiplatform_v1/services/model_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1/services/model_service/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 import warnings from typing import Callable, Dict, Optional, Sequence, Tuple, Union @@ -22,8 +25,11 @@ import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from google.cloud.aiplatform_v1.types import model from google.cloud.aiplatform_v1.types import model as gca_model @@ -37,6 +43,81 @@ from google.longrunning import operations_pb2 # type: ignore from .base import ModelServiceTransport, DEFAULT_CLIENT_INFO +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.aiplatform.v1.ModelService", + "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.aiplatform.v1.ModelService", + "rpcName": client_call_details.method, + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class ModelServiceGrpcTransport(ModelServiceTransport): """gRPC backend transport for ModelService. @@ -191,7 +272,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 @@ -255,7 +341,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 @@ -279,7 +367,7 @@ def upload_model( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "upload_model" not in self._stubs: - self._stubs["upload_model"] = self.grpc_channel.unary_unary( + self._stubs["upload_model"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.ModelService/UploadModel", request_serializer=model_service.UploadModelRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -303,7 +391,7 @@ def get_model(self) -> Callable[[model_service.GetModelRequest], model.Model]: # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_model" not in self._stubs: - self._stubs["get_model"] = self.grpc_channel.unary_unary( + self._stubs["get_model"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.ModelService/GetModel", request_serializer=model_service.GetModelRequest.serialize, response_deserializer=model.Model.deserialize, @@ -329,7 +417,7 @@ def list_models( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_models" not in self._stubs: - self._stubs["list_models"] = self.grpc_channel.unary_unary( + self._stubs["list_models"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.ModelService/ListModels", request_serializer=model_service.ListModelsRequest.serialize, response_deserializer=model_service.ListModelsResponse.deserialize, @@ -358,7 +446,7 @@ def list_model_versions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_model_versions" not in self._stubs: - self._stubs["list_model_versions"] = self.grpc_channel.unary_unary( + self._stubs["list_model_versions"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.ModelService/ListModelVersions", request_serializer=model_service.ListModelVersionsRequest.serialize, response_deserializer=model_service.ListModelVersionsResponse.deserialize, @@ -384,7 +472,7 @@ def update_model( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_model" not in self._stubs: - self._stubs["update_model"] = self.grpc_channel.unary_unary( + self._stubs["update_model"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.ModelService/UpdateModel", request_serializer=model_service.UpdateModelRequest.serialize, response_deserializer=gca_model.Model.deserialize, @@ -413,7 +501,9 @@ def update_explanation_dataset( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_explanation_dataset" not in self._stubs: - self._stubs["update_explanation_dataset"] = self.grpc_channel.unary_unary( + self._stubs[ + "update_explanation_dataset" + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.ModelService/UpdateExplanationDataset", request_serializer=model_service.UpdateExplanationDatasetRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -446,7 +536,7 @@ def delete_model( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_model" not in self._stubs: - self._stubs["delete_model"] = self.grpc_channel.unary_unary( + self._stubs["delete_model"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.ModelService/DeleteModel", request_serializer=model_service.DeleteModelRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -479,7 +569,7 @@ def delete_model_version( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_model_version" not in self._stubs: - self._stubs["delete_model_version"] = self.grpc_channel.unary_unary( + self._stubs["delete_model_version"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.ModelService/DeleteModelVersion", request_serializer=model_service.DeleteModelVersionRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -505,7 +595,7 @@ def merge_version_aliases( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "merge_version_aliases" not in self._stubs: - self._stubs["merge_version_aliases"] = self.grpc_channel.unary_unary( + self._stubs["merge_version_aliases"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.ModelService/MergeVersionAliases", request_serializer=model_service.MergeVersionAliasesRequest.serialize, response_deserializer=model.Model.deserialize, @@ -534,7 +624,7 @@ def export_model( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "export_model" not in self._stubs: - self._stubs["export_model"] = self.grpc_channel.unary_unary( + self._stubs["export_model"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.ModelService/ExportModel", request_serializer=model_service.ExportModelRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -565,7 +655,7 @@ def copy_model( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "copy_model" not in self._stubs: - self._stubs["copy_model"] = self.grpc_channel.unary_unary( + self._stubs["copy_model"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.ModelService/CopyModel", request_serializer=model_service.CopyModelRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -594,7 +684,7 @@ def import_model_evaluation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "import_model_evaluation" not in self._stubs: - self._stubs["import_model_evaluation"] = self.grpc_channel.unary_unary( + self._stubs["import_model_evaluation"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.ModelService/ImportModelEvaluation", request_serializer=model_service.ImportModelEvaluationRequest.serialize, response_deserializer=gca_model_evaluation.ModelEvaluation.deserialize, @@ -627,7 +717,7 @@ def batch_import_model_evaluation_slices( if "batch_import_model_evaluation_slices" not in self._stubs: self._stubs[ "batch_import_model_evaluation_slices" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.ModelService/BatchImportModelEvaluationSlices", request_serializer=model_service.BatchImportModelEvaluationSlicesRequest.serialize, response_deserializer=model_service.BatchImportModelEvaluationSlicesResponse.deserialize, @@ -660,7 +750,7 @@ def batch_import_evaluated_annotations( if "batch_import_evaluated_annotations" not in self._stubs: self._stubs[ "batch_import_evaluated_annotations" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.ModelService/BatchImportEvaluatedAnnotations", request_serializer=model_service.BatchImportEvaluatedAnnotationsRequest.serialize, response_deserializer=model_service.BatchImportEvaluatedAnnotationsResponse.deserialize, @@ -688,7 +778,7 @@ def get_model_evaluation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_model_evaluation" not in self._stubs: - self._stubs["get_model_evaluation"] = self.grpc_channel.unary_unary( + self._stubs["get_model_evaluation"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.ModelService/GetModelEvaluation", request_serializer=model_service.GetModelEvaluationRequest.serialize, response_deserializer=model_evaluation.ModelEvaluation.deserialize, @@ -717,7 +807,7 @@ def list_model_evaluations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_model_evaluations" not in self._stubs: - self._stubs["list_model_evaluations"] = self.grpc_channel.unary_unary( + self._stubs["list_model_evaluations"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.ModelService/ListModelEvaluations", request_serializer=model_service.ListModelEvaluationsRequest.serialize, response_deserializer=model_service.ListModelEvaluationsResponse.deserialize, @@ -746,7 +836,9 @@ def get_model_evaluation_slice( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_model_evaluation_slice" not in self._stubs: - self._stubs["get_model_evaluation_slice"] = self.grpc_channel.unary_unary( + self._stubs[ + "get_model_evaluation_slice" + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.ModelService/GetModelEvaluationSlice", request_serializer=model_service.GetModelEvaluationSliceRequest.serialize, response_deserializer=model_evaluation_slice.ModelEvaluationSlice.deserialize, @@ -775,7 +867,9 @@ def list_model_evaluation_slices( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_model_evaluation_slices" not in self._stubs: - self._stubs["list_model_evaluation_slices"] = self.grpc_channel.unary_unary( + self._stubs[ + "list_model_evaluation_slices" + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.ModelService/ListModelEvaluationSlices", request_serializer=model_service.ListModelEvaluationSlicesRequest.serialize, response_deserializer=model_service.ListModelEvaluationSlicesResponse.deserialize, @@ -783,7 +877,7 @@ def list_model_evaluation_slices( return self._stubs["list_model_evaluation_slices"] def close(self): - self.grpc_channel.close() + self._logged_channel.close() @property def delete_operation( @@ -795,7 +889,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, @@ -812,7 +906,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -829,7 +923,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -846,7 +940,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, @@ -865,7 +959,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, @@ -884,7 +978,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -901,7 +995,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -926,7 +1020,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -952,7 +1046,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -981,7 +1075,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1/services/model_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1/services/model_service/transports/grpc_asyncio.py index cf80dc997b..51cbbcc959 100644 --- a/google/cloud/aiplatform_v1/services/model_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1/services/model_service/transports/grpc_asyncio.py @@ -14,6 +14,9 @@ # limitations under the License. # import inspect +import json +import pickle +import logging as std_logging import warnings from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union @@ -24,8 +27,11 @@ from google.api_core import operations_v1 from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from grpc.experimental import aio # type: ignore from google.cloud.aiplatform_v1.types import model @@ -41,6 +47,82 @@ from .base import ModelServiceTransport, DEFAULT_CLIENT_INFO from .grpc import ModelServiceGrpcTransport +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.aiplatform.v1.ModelService", + "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.aiplatform.v1.ModelService", + "rpcName": str(client_call_details.method), + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class ModelServiceGrpcAsyncIOTransport(ModelServiceTransport): """gRPC AsyncIO backend transport for ModelService. @@ -238,10 +320,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 @@ -264,7 +349,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. @@ -291,7 +376,7 @@ def upload_model( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "upload_model" not in self._stubs: - self._stubs["upload_model"] = self.grpc_channel.unary_unary( + self._stubs["upload_model"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.ModelService/UploadModel", request_serializer=model_service.UploadModelRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -317,7 +402,7 @@ def get_model( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_model" not in self._stubs: - self._stubs["get_model"] = self.grpc_channel.unary_unary( + self._stubs["get_model"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.ModelService/GetModel", request_serializer=model_service.GetModelRequest.serialize, response_deserializer=model.Model.deserialize, @@ -345,7 +430,7 @@ def list_models( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_models" not in self._stubs: - self._stubs["list_models"] = self.grpc_channel.unary_unary( + self._stubs["list_models"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.ModelService/ListModels", request_serializer=model_service.ListModelsRequest.serialize, response_deserializer=model_service.ListModelsResponse.deserialize, @@ -374,7 +459,7 @@ def list_model_versions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_model_versions" not in self._stubs: - self._stubs["list_model_versions"] = self.grpc_channel.unary_unary( + self._stubs["list_model_versions"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.ModelService/ListModelVersions", request_serializer=model_service.ListModelVersionsRequest.serialize, response_deserializer=model_service.ListModelVersionsResponse.deserialize, @@ -400,7 +485,7 @@ def update_model( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_model" not in self._stubs: - self._stubs["update_model"] = self.grpc_channel.unary_unary( + self._stubs["update_model"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.ModelService/UpdateModel", request_serializer=model_service.UpdateModelRequest.serialize, response_deserializer=gca_model.Model.deserialize, @@ -430,7 +515,9 @@ def update_explanation_dataset( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_explanation_dataset" not in self._stubs: - self._stubs["update_explanation_dataset"] = self.grpc_channel.unary_unary( + self._stubs[ + "update_explanation_dataset" + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.ModelService/UpdateExplanationDataset", request_serializer=model_service.UpdateExplanationDatasetRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -465,7 +552,7 @@ def delete_model( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_model" not in self._stubs: - self._stubs["delete_model"] = self.grpc_channel.unary_unary( + self._stubs["delete_model"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.ModelService/DeleteModel", request_serializer=model_service.DeleteModelRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -500,7 +587,7 @@ def delete_model_version( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_model_version" not in self._stubs: - self._stubs["delete_model_version"] = self.grpc_channel.unary_unary( + self._stubs["delete_model_version"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.ModelService/DeleteModelVersion", request_serializer=model_service.DeleteModelVersionRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -526,7 +613,7 @@ def merge_version_aliases( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "merge_version_aliases" not in self._stubs: - self._stubs["merge_version_aliases"] = self.grpc_channel.unary_unary( + self._stubs["merge_version_aliases"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.ModelService/MergeVersionAliases", request_serializer=model_service.MergeVersionAliasesRequest.serialize, response_deserializer=model.Model.deserialize, @@ -557,7 +644,7 @@ def export_model( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "export_model" not in self._stubs: - self._stubs["export_model"] = self.grpc_channel.unary_unary( + self._stubs["export_model"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.ModelService/ExportModel", request_serializer=model_service.ExportModelRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -590,7 +677,7 @@ def copy_model( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "copy_model" not in self._stubs: - self._stubs["copy_model"] = self.grpc_channel.unary_unary( + self._stubs["copy_model"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.ModelService/CopyModel", request_serializer=model_service.CopyModelRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -619,7 +706,7 @@ def import_model_evaluation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "import_model_evaluation" not in self._stubs: - self._stubs["import_model_evaluation"] = self.grpc_channel.unary_unary( + self._stubs["import_model_evaluation"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.ModelService/ImportModelEvaluation", request_serializer=model_service.ImportModelEvaluationRequest.serialize, response_deserializer=gca_model_evaluation.ModelEvaluation.deserialize, @@ -652,7 +739,7 @@ def batch_import_model_evaluation_slices( if "batch_import_model_evaluation_slices" not in self._stubs: self._stubs[ "batch_import_model_evaluation_slices" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.ModelService/BatchImportModelEvaluationSlices", request_serializer=model_service.BatchImportModelEvaluationSlicesRequest.serialize, response_deserializer=model_service.BatchImportModelEvaluationSlicesResponse.deserialize, @@ -685,7 +772,7 @@ def batch_import_evaluated_annotations( if "batch_import_evaluated_annotations" not in self._stubs: self._stubs[ "batch_import_evaluated_annotations" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.ModelService/BatchImportEvaluatedAnnotations", request_serializer=model_service.BatchImportEvaluatedAnnotationsRequest.serialize, response_deserializer=model_service.BatchImportEvaluatedAnnotationsResponse.deserialize, @@ -714,7 +801,7 @@ def get_model_evaluation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_model_evaluation" not in self._stubs: - self._stubs["get_model_evaluation"] = self.grpc_channel.unary_unary( + self._stubs["get_model_evaluation"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.ModelService/GetModelEvaluation", request_serializer=model_service.GetModelEvaluationRequest.serialize, response_deserializer=model_evaluation.ModelEvaluation.deserialize, @@ -743,7 +830,7 @@ def list_model_evaluations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_model_evaluations" not in self._stubs: - self._stubs["list_model_evaluations"] = self.grpc_channel.unary_unary( + self._stubs["list_model_evaluations"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.ModelService/ListModelEvaluations", request_serializer=model_service.ListModelEvaluationsRequest.serialize, response_deserializer=model_service.ListModelEvaluationsResponse.deserialize, @@ -772,7 +859,9 @@ def get_model_evaluation_slice( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_model_evaluation_slice" not in self._stubs: - self._stubs["get_model_evaluation_slice"] = self.grpc_channel.unary_unary( + self._stubs[ + "get_model_evaluation_slice" + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.ModelService/GetModelEvaluationSlice", request_serializer=model_service.GetModelEvaluationSliceRequest.serialize, response_deserializer=model_evaluation_slice.ModelEvaluationSlice.deserialize, @@ -801,7 +890,9 @@ def list_model_evaluation_slices( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_model_evaluation_slices" not in self._stubs: - self._stubs["list_model_evaluation_slices"] = self.grpc_channel.unary_unary( + self._stubs[ + "list_model_evaluation_slices" + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.ModelService/ListModelEvaluationSlices", request_serializer=model_service.ListModelEvaluationSlicesRequest.serialize, response_deserializer=model_service.ListModelEvaluationSlicesResponse.deserialize, @@ -959,7 +1050,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: @@ -975,7 +1066,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, @@ -992,7 +1083,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -1009,7 +1100,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -1026,7 +1117,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, @@ -1045,7 +1136,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, @@ -1064,7 +1155,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -1081,7 +1172,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -1106,7 +1197,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -1132,7 +1223,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -1161,7 +1252,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1/services/model_service/transports/rest.py b/google/cloud/aiplatform_v1/services/model_service/transports/rest.py index c5895e4cf3..9a6ee9e8e1 100644 --- a/google/cloud/aiplatform_v1/services/model_service/transports/rest.py +++ b/google/cloud/aiplatform_v1/services/model_service/transports/rest.py @@ -13,9 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging +import json # type: ignore from google.auth.transport.requests import AuthorizedSession # type: ignore -import json # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.api_core import exceptions as core_exceptions from google.api_core import retry as retries @@ -52,6 +53,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, @@ -228,9 +237,10 @@ def post_upload_model(self, response): def pre_batch_import_evaluated_annotations( self, request: model_service.BatchImportEvaluatedAnnotationsRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - model_service.BatchImportEvaluatedAnnotationsRequest, Sequence[Tuple[str, str]] + model_service.BatchImportEvaluatedAnnotationsRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for batch_import_evaluated_annotations @@ -253,9 +263,10 @@ def post_batch_import_evaluated_annotations( def pre_batch_import_model_evaluation_slices( self, request: model_service.BatchImportModelEvaluationSlicesRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - model_service.BatchImportModelEvaluationSlicesRequest, Sequence[Tuple[str, str]] + model_service.BatchImportModelEvaluationSlicesRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for batch_import_model_evaluation_slices @@ -278,8 +289,8 @@ def post_batch_import_model_evaluation_slices( def pre_copy_model( self, request: model_service.CopyModelRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[model_service.CopyModelRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[model_service.CopyModelRequest, Sequence[Tuple[str, Union[str, bytes]]]]: """Pre-rpc interceptor for copy_model Override in a subclass to manipulate the request or metadata @@ -301,8 +312,10 @@ def post_copy_model( def pre_delete_model( self, request: model_service.DeleteModelRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[model_service.DeleteModelRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + model_service.DeleteModelRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for delete_model Override in a subclass to manipulate the request or metadata @@ -324,8 +337,10 @@ def post_delete_model( def pre_delete_model_version( self, request: model_service.DeleteModelVersionRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[model_service.DeleteModelVersionRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + model_service.DeleteModelVersionRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for delete_model_version Override in a subclass to manipulate the request or metadata @@ -347,8 +362,10 @@ def post_delete_model_version( def pre_export_model( self, request: model_service.ExportModelRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[model_service.ExportModelRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + model_service.ExportModelRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for export_model Override in a subclass to manipulate the request or metadata @@ -370,8 +387,8 @@ def post_export_model( def pre_get_model( self, request: model_service.GetModelRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[model_service.GetModelRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[model_service.GetModelRequest, Sequence[Tuple[str, Union[str, bytes]]]]: """Pre-rpc interceptor for get_model Override in a subclass to manipulate the request or metadata @@ -391,8 +408,10 @@ def post_get_model(self, response: model.Model) -> model.Model: def pre_get_model_evaluation( self, request: model_service.GetModelEvaluationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[model_service.GetModelEvaluationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + model_service.GetModelEvaluationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_model_evaluation Override in a subclass to manipulate the request or metadata @@ -414,8 +433,11 @@ def post_get_model_evaluation( def pre_get_model_evaluation_slice( self, request: model_service.GetModelEvaluationSliceRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[model_service.GetModelEvaluationSliceRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + model_service.GetModelEvaluationSliceRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for get_model_evaluation_slice Override in a subclass to manipulate the request or metadata @@ -437,8 +459,11 @@ def post_get_model_evaluation_slice( def pre_import_model_evaluation( self, request: model_service.ImportModelEvaluationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[model_service.ImportModelEvaluationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + model_service.ImportModelEvaluationRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for import_model_evaluation Override in a subclass to manipulate the request or metadata @@ -460,8 +485,11 @@ def post_import_model_evaluation( def pre_list_model_evaluations( self, request: model_service.ListModelEvaluationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[model_service.ListModelEvaluationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + model_service.ListModelEvaluationsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for list_model_evaluations Override in a subclass to manipulate the request or metadata @@ -483,9 +511,10 @@ def post_list_model_evaluations( def pre_list_model_evaluation_slices( self, request: model_service.ListModelEvaluationSlicesRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - model_service.ListModelEvaluationSlicesRequest, Sequence[Tuple[str, str]] + model_service.ListModelEvaluationSlicesRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for list_model_evaluation_slices @@ -508,8 +537,10 @@ def post_list_model_evaluation_slices( def pre_list_models( self, request: model_service.ListModelsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[model_service.ListModelsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + model_service.ListModelsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_models Override in a subclass to manipulate the request or metadata @@ -531,8 +562,10 @@ def post_list_models( def pre_list_model_versions( self, request: model_service.ListModelVersionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[model_service.ListModelVersionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + model_service.ListModelVersionsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_model_versions Override in a subclass to manipulate the request or metadata @@ -554,8 +587,11 @@ def post_list_model_versions( def pre_merge_version_aliases( self, request: model_service.MergeVersionAliasesRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[model_service.MergeVersionAliasesRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + model_service.MergeVersionAliasesRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for merge_version_aliases Override in a subclass to manipulate the request or metadata @@ -575,9 +611,10 @@ def post_merge_version_aliases(self, response: model.Model) -> model.Model: def pre_update_explanation_dataset( self, request: model_service.UpdateExplanationDatasetRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - model_service.UpdateExplanationDatasetRequest, Sequence[Tuple[str, str]] + model_service.UpdateExplanationDatasetRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for update_explanation_dataset @@ -600,8 +637,10 @@ def post_update_explanation_dataset( def pre_update_model( self, request: model_service.UpdateModelRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[model_service.UpdateModelRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + model_service.UpdateModelRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for update_model Override in a subclass to manipulate the request or metadata @@ -621,8 +660,10 @@ def post_update_model(self, response: gca_model.Model) -> gca_model.Model: def pre_upload_model( self, request: model_service.UploadModelRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[model_service.UploadModelRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + model_service.UploadModelRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for upload_model Override in a subclass to manipulate the request or metadata @@ -644,8 +685,10 @@ def post_upload_model( def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -667,8 +710,10 @@ def post_get_location( def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -690,8 +735,10 @@ def post_list_locations( def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -711,8 +758,10 @@ def post_get_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -732,8 +781,11 @@ def post_set_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -755,8 +807,10 @@ def post_test_iam_permissions( def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -776,8 +830,10 @@ def post_cancel_operation(self, response: None) -> None: 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 @@ -797,8 +853,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 @@ -820,8 +878,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 @@ -843,8 +903,10 @@ def post_list_operations( def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -2866,7 +2928,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]]] = (), ) -> model_service.BatchImportEvaluatedAnnotationsResponse: r"""Call the batch import evaluated annotations method over HTTP. @@ -2878,8 +2940,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: ~.model_service.BatchImportEvaluatedAnnotationsResponse: @@ -2891,6 +2955,7 @@ def __call__( http_options = ( _BaseModelServiceRestTransport._BaseBatchImportEvaluatedAnnotations._get_http_options() ) + ( request, metadata, @@ -2910,6 +2975,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.aiplatform_v1.ModelServiceClient.BatchImportEvaluatedAnnotations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelService", + "rpcName": "BatchImportEvaluatedAnnotations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ModelServiceRestTransport._BatchImportEvaluatedAnnotations._get_response( self._host, @@ -2931,7 +3023,33 @@ def __call__( pb_resp = model_service.BatchImportEvaluatedAnnotationsResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_batch_import_evaluated_annotations(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + model_service.BatchImportEvaluatedAnnotationsResponse.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.aiplatform_v1.ModelServiceClient.batch_import_evaluated_annotations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelService", + "rpcName": "BatchImportEvaluatedAnnotations", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _BatchImportModelEvaluationSlices( @@ -2971,7 +3089,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]]] = (), ) -> model_service.BatchImportModelEvaluationSlicesResponse: r"""Call the batch import model evaluation slices method over HTTP. @@ -2983,8 +3101,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: ~.model_service.BatchImportModelEvaluationSlicesResponse: @@ -2996,6 +3116,7 @@ def __call__( http_options = ( _BaseModelServiceRestTransport._BaseBatchImportModelEvaluationSlices._get_http_options() ) + ( request, metadata, @@ -3015,6 +3136,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.aiplatform_v1.ModelServiceClient.BatchImportModelEvaluationSlices", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelService", + "rpcName": "BatchImportModelEvaluationSlices", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ModelServiceRestTransport._BatchImportModelEvaluationSlices._get_response( self._host, @@ -3036,7 +3184,33 @@ def __call__( pb_resp = model_service.BatchImportModelEvaluationSlicesResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_batch_import_model_evaluation_slices(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + model_service.BatchImportModelEvaluationSlicesResponse.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.aiplatform_v1.ModelServiceClient.batch_import_model_evaluation_slices", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelService", + "rpcName": "BatchImportModelEvaluationSlices", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _CopyModel( @@ -3075,7 +3249,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 copy model method over HTTP. @@ -3086,8 +3260,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: @@ -3100,6 +3276,7 @@ def __call__( http_options = ( _BaseModelServiceRestTransport._BaseCopyModel._get_http_options() ) + request, metadata = self._interceptor.pre_copy_model(request, metadata) transcoded_request = ( _BaseModelServiceRestTransport._BaseCopyModel._get_transcoded_request( @@ -3118,6 +3295,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.aiplatform_v1.ModelServiceClient.CopyModel", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelService", + "rpcName": "CopyModel", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ModelServiceRestTransport._CopyModel._get_response( self._host, @@ -3137,7 +3341,29 @@ def __call__( # Return the response resp = operations_pb2.Operation() json_format.Parse(response.content, resp, ignore_unknown_fields=True) + resp = self._interceptor.post_copy_model(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.aiplatform_v1.ModelServiceClient.copy_model", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelService", + "rpcName": "CopyModel", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _DeleteModel( @@ -3175,7 +3401,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 model method over HTTP. @@ -3186,8 +3412,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: @@ -3200,6 +3428,7 @@ def __call__( http_options = ( _BaseModelServiceRestTransport._BaseDeleteModel._get_http_options() ) + request, metadata = self._interceptor.pre_delete_model(request, metadata) transcoded_request = ( _BaseModelServiceRestTransport._BaseDeleteModel._get_transcoded_request( @@ -3214,6 +3443,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.aiplatform_v1.ModelServiceClient.DeleteModel", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelService", + "rpcName": "DeleteModel", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ModelServiceRestTransport._DeleteModel._get_response( self._host, @@ -3232,7 +3488,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_model(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.aiplatform_v1.ModelServiceClient.delete_model", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelService", + "rpcName": "DeleteModel", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _DeleteModelVersion( @@ -3270,7 +3548,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 model version method over HTTP. @@ -3281,8 +3559,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: @@ -3295,6 +3575,7 @@ def __call__( http_options = ( _BaseModelServiceRestTransport._BaseDeleteModelVersion._get_http_options() ) + request, metadata = self._interceptor.pre_delete_model_version( request, metadata ) @@ -3307,6 +3588,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.aiplatform_v1.ModelServiceClient.DeleteModelVersion", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelService", + "rpcName": "DeleteModelVersion", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ModelServiceRestTransport._DeleteModelVersion._get_response( self._host, @@ -3325,7 +3633,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_model_version(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.aiplatform_v1.ModelServiceClient.delete_model_version", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelService", + "rpcName": "DeleteModelVersion", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ExportModel( @@ -3364,7 +3694,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 export model method over HTTP. @@ -3375,8 +3705,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: @@ -3389,6 +3721,7 @@ def __call__( http_options = ( _BaseModelServiceRestTransport._BaseExportModel._get_http_options() ) + request, metadata = self._interceptor.pre_export_model(request, metadata) transcoded_request = ( _BaseModelServiceRestTransport._BaseExportModel._get_transcoded_request( @@ -3409,6 +3742,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.aiplatform_v1.ModelServiceClient.ExportModel", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelService", + "rpcName": "ExportModel", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ModelServiceRestTransport._ExportModel._get_response( self._host, @@ -3428,7 +3788,29 @@ def __call__( # Return the response resp = operations_pb2.Operation() json_format.Parse(response.content, resp, ignore_unknown_fields=True) + resp = self._interceptor.post_export_model(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.aiplatform_v1.ModelServiceClient.export_model", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelService", + "rpcName": "ExportModel", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _GetModel(_BaseModelServiceRestTransport._BaseGetModel, ModelServiceRestStub): @@ -3464,7 +3846,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]]] = (), ) -> model.Model: r"""Call the get model method over HTTP. @@ -3475,8 +3857,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: ~.model.Model: @@ -3486,6 +3870,7 @@ def __call__( http_options = ( _BaseModelServiceRestTransport._BaseGetModel._get_http_options() ) + request, metadata = self._interceptor.pre_get_model(request, metadata) transcoded_request = ( _BaseModelServiceRestTransport._BaseGetModel._get_transcoded_request( @@ -3500,6 +3885,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 = 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.aiplatform_v1.ModelServiceClient.GetModel", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelService", + "rpcName": "GetModel", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ModelServiceRestTransport._GetModel._get_response( self._host, @@ -3520,7 +3932,29 @@ def __call__( pb_resp = model.Model.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_model(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = model.Model.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.aiplatform_v1.ModelServiceClient.get_model", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelService", + "rpcName": "GetModel", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _GetModelEvaluation( @@ -3558,7 +3992,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]]] = (), ) -> model_evaluation.ModelEvaluation: r"""Call the get model evaluation method over HTTP. @@ -3569,8 +4003,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: ~.model_evaluation.ModelEvaluation: @@ -3584,6 +4020,7 @@ def __call__( http_options = ( _BaseModelServiceRestTransport._BaseGetModelEvaluation._get_http_options() ) + request, metadata = self._interceptor.pre_get_model_evaluation( request, metadata ) @@ -3596,6 +4033,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.aiplatform_v1.ModelServiceClient.GetModelEvaluation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelService", + "rpcName": "GetModelEvaluation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ModelServiceRestTransport._GetModelEvaluation._get_response( self._host, @@ -3616,7 +4080,31 @@ def __call__( pb_resp = model_evaluation.ModelEvaluation.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_model_evaluation(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = model_evaluation.ModelEvaluation.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.aiplatform_v1.ModelServiceClient.get_model_evaluation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelService", + "rpcName": "GetModelEvaluation", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _GetModelEvaluationSlice( @@ -3655,7 +4143,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]]] = (), ) -> model_evaluation_slice.ModelEvaluationSlice: r"""Call the get model evaluation slice method over HTTP. @@ -3667,8 +4155,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: ~.model_evaluation_slice.ModelEvaluationSlice: @@ -3682,6 +4172,7 @@ def __call__( http_options = ( _BaseModelServiceRestTransport._BaseGetModelEvaluationSlice._get_http_options() ) + request, metadata = self._interceptor.pre_get_model_evaluation_slice( request, metadata ) @@ -3694,6 +4185,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.aiplatform_v1.ModelServiceClient.GetModelEvaluationSlice", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelService", + "rpcName": "GetModelEvaluationSlice", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ModelServiceRestTransport._GetModelEvaluationSlice._get_response( self._host, @@ -3714,7 +4232,31 @@ def __call__( pb_resp = model_evaluation_slice.ModelEvaluationSlice.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_model_evaluation_slice(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + model_evaluation_slice.ModelEvaluationSlice.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.aiplatform_v1.ModelServiceClient.get_model_evaluation_slice", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelService", + "rpcName": "GetModelEvaluationSlice", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ImportModelEvaluation( @@ -3753,7 +4295,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]]] = (), ) -> gca_model_evaluation.ModelEvaluation: r"""Call the import model evaluation method over HTTP. @@ -3764,8 +4306,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: ~.gca_model_evaluation.ModelEvaluation: @@ -3779,6 +4323,7 @@ def __call__( http_options = ( _BaseModelServiceRestTransport._BaseImportModelEvaluation._get_http_options() ) + request, metadata = self._interceptor.pre_import_model_evaluation( request, metadata ) @@ -3795,6 +4340,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.aiplatform_v1.ModelServiceClient.ImportModelEvaluation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelService", + "rpcName": "ImportModelEvaluation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ModelServiceRestTransport._ImportModelEvaluation._get_response( self._host, @@ -3816,7 +4388,31 @@ def __call__( pb_resp = gca_model_evaluation.ModelEvaluation.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_import_model_evaluation(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gca_model_evaluation.ModelEvaluation.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.aiplatform_v1.ModelServiceClient.import_model_evaluation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelService", + "rpcName": "ImportModelEvaluation", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListModelEvaluations( @@ -3854,7 +4450,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]]] = (), ) -> model_service.ListModelEvaluationsResponse: r"""Call the list model evaluations method over HTTP. @@ -3865,8 +4461,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: ~.model_service.ListModelEvaluationsResponse: @@ -3878,6 +4476,7 @@ def __call__( http_options = ( _BaseModelServiceRestTransport._BaseListModelEvaluations._get_http_options() ) + request, metadata = self._interceptor.pre_list_model_evaluations( request, metadata ) @@ -3890,6 +4489,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.aiplatform_v1.ModelServiceClient.ListModelEvaluations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelService", + "rpcName": "ListModelEvaluations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ModelServiceRestTransport._ListModelEvaluations._get_response( self._host, @@ -3910,7 +4536,31 @@ def __call__( pb_resp = model_service.ListModelEvaluationsResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_model_evaluations(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + model_service.ListModelEvaluationsResponse.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.aiplatform_v1.ModelServiceClient.list_model_evaluations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelService", + "rpcName": "ListModelEvaluations", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListModelEvaluationSlices( @@ -3949,7 +4599,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]]] = (), ) -> model_service.ListModelEvaluationSlicesResponse: r"""Call the list model evaluation slices method over HTTP. @@ -3961,8 +4611,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: ~.model_service.ListModelEvaluationSlicesResponse: @@ -3974,6 +4626,7 @@ def __call__( http_options = ( _BaseModelServiceRestTransport._BaseListModelEvaluationSlices._get_http_options() ) + request, metadata = self._interceptor.pre_list_model_evaluation_slices( request, metadata ) @@ -3986,6 +4639,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.aiplatform_v1.ModelServiceClient.ListModelEvaluationSlices", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelService", + "rpcName": "ListModelEvaluationSlices", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( ModelServiceRestTransport._ListModelEvaluationSlices._get_response( @@ -4008,7 +4688,33 @@ def __call__( pb_resp = model_service.ListModelEvaluationSlicesResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_model_evaluation_slices(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + model_service.ListModelEvaluationSlicesResponse.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.aiplatform_v1.ModelServiceClient.list_model_evaluation_slices", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelService", + "rpcName": "ListModelEvaluationSlices", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListModels( @@ -4046,7 +4752,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]]] = (), ) -> model_service.ListModelsResponse: r"""Call the list models method over HTTP. @@ -4057,8 +4763,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: ~.model_service.ListModelsResponse: @@ -4070,6 +4778,7 @@ def __call__( http_options = ( _BaseModelServiceRestTransport._BaseListModels._get_http_options() ) + request, metadata = self._interceptor.pre_list_models(request, metadata) transcoded_request = ( _BaseModelServiceRestTransport._BaseListModels._get_transcoded_request( @@ -4084,6 +4793,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 = 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.aiplatform_v1.ModelServiceClient.ListModels", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelService", + "rpcName": "ListModels", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ModelServiceRestTransport._ListModels._get_response( self._host, @@ -4104,7 +4840,31 @@ def __call__( pb_resp = model_service.ListModelsResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_models(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = model_service.ListModelsResponse.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.aiplatform_v1.ModelServiceClient.list_models", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelService", + "rpcName": "ListModels", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListModelVersions( @@ -4142,7 +4902,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]]] = (), ) -> model_service.ListModelVersionsResponse: r"""Call the list model versions method over HTTP. @@ -4153,8 +4913,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: ~.model_service.ListModelVersionsResponse: @@ -4166,6 +4928,7 @@ def __call__( http_options = ( _BaseModelServiceRestTransport._BaseListModelVersions._get_http_options() ) + request, metadata = self._interceptor.pre_list_model_versions( request, metadata ) @@ -4178,6 +4941,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.aiplatform_v1.ModelServiceClient.ListModelVersions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelService", + "rpcName": "ListModelVersions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ModelServiceRestTransport._ListModelVersions._get_response( self._host, @@ -4198,7 +4988,31 @@ def __call__( pb_resp = model_service.ListModelVersionsResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_model_versions(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = model_service.ListModelVersionsResponse.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.aiplatform_v1.ModelServiceClient.list_model_versions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelService", + "rpcName": "ListModelVersions", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _MergeVersionAliases( @@ -4237,7 +5051,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]]] = (), ) -> model.Model: r"""Call the merge version aliases method over HTTP. @@ -4248,8 +5062,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: ~.model.Model: @@ -4259,6 +5075,7 @@ def __call__( http_options = ( _BaseModelServiceRestTransport._BaseMergeVersionAliases._get_http_options() ) + request, metadata = self._interceptor.pre_merge_version_aliases( request, metadata ) @@ -4275,6 +5092,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.aiplatform_v1.ModelServiceClient.MergeVersionAliases", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelService", + "rpcName": "MergeVersionAliases", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ModelServiceRestTransport._MergeVersionAliases._get_response( self._host, @@ -4296,7 +5140,29 @@ def __call__( pb_resp = model.Model.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_merge_version_aliases(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = model.Model.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.aiplatform_v1.ModelServiceClient.merge_version_aliases", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelService", + "rpcName": "MergeVersionAliases", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _UpdateExplanationDataset( @@ -4336,7 +5202,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 explanation dataset method over HTTP. @@ -4348,8 +5214,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: @@ -4362,6 +5230,7 @@ def __call__( http_options = ( _BaseModelServiceRestTransport._BaseUpdateExplanationDataset._get_http_options() ) + request, metadata = self._interceptor.pre_update_explanation_dataset( request, metadata ) @@ -4378,6 +5247,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.aiplatform_v1.ModelServiceClient.UpdateExplanationDataset", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelService", + "rpcName": "UpdateExplanationDataset", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( ModelServiceRestTransport._UpdateExplanationDataset._get_response( @@ -4399,7 +5295,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_explanation_dataset(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.aiplatform_v1.ModelServiceClient.update_explanation_dataset", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelService", + "rpcName": "UpdateExplanationDataset", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _UpdateModel( @@ -4438,7 +5356,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]]] = (), ) -> gca_model.Model: r"""Call the update model method over HTTP. @@ -4449,8 +5367,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: ~.gca_model.Model: @@ -4460,6 +5380,7 @@ def __call__( http_options = ( _BaseModelServiceRestTransport._BaseUpdateModel._get_http_options() ) + request, metadata = self._interceptor.pre_update_model(request, metadata) transcoded_request = ( _BaseModelServiceRestTransport._BaseUpdateModel._get_transcoded_request( @@ -4480,6 +5401,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 = 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.aiplatform_v1.ModelServiceClient.UpdateModel", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelService", + "rpcName": "UpdateModel", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ModelServiceRestTransport._UpdateModel._get_response( self._host, @@ -4501,7 +5449,29 @@ def __call__( pb_resp = gca_model.Model.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_update_model(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gca_model.Model.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.aiplatform_v1.ModelServiceClient.update_model", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelService", + "rpcName": "UpdateModel", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _UploadModel( @@ -4540,7 +5510,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 upload model method over HTTP. @@ -4551,8 +5521,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: @@ -4565,6 +5537,7 @@ def __call__( http_options = ( _BaseModelServiceRestTransport._BaseUploadModel._get_http_options() ) + request, metadata = self._interceptor.pre_upload_model(request, metadata) transcoded_request = ( _BaseModelServiceRestTransport._BaseUploadModel._get_transcoded_request( @@ -4585,6 +5558,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.aiplatform_v1.ModelServiceClient.UploadModel", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelService", + "rpcName": "UploadModel", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ModelServiceRestTransport._UploadModel._get_response( self._host, @@ -4604,7 +5604,29 @@ def __call__( # Return the response resp = operations_pb2.Operation() json_format.Parse(response.content, resp, ignore_unknown_fields=True) + resp = self._interceptor.post_upload_model(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.aiplatform_v1.ModelServiceClient.upload_model", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelService", + "rpcName": "UploadModel", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp @property @@ -4813,7 +5835,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]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -4824,8 +5846,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: locations_pb2.Location: Response from GetLocation method. @@ -4834,6 +5858,7 @@ def __call__( http_options = ( _BaseModelServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = self._interceptor.pre_get_location(request, metadata) transcoded_request = ( _BaseModelServiceRestTransport._BaseGetLocation._get_transcoded_request( @@ -4848,6 +5873,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.aiplatform_v1.ModelServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ModelServiceRestTransport._GetLocation._get_response( self._host, @@ -4867,6 +5919,27 @@ def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_location(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.aiplatform_v1.ModelServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4908,7 +5981,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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -4919,8 +5992,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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -4929,6 +6004,7 @@ def __call__( http_options = ( _BaseModelServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = self._interceptor.pre_list_locations(request, metadata) transcoded_request = _BaseModelServiceRestTransport._BaseListLocations._get_transcoded_request( http_options, request @@ -4939,6 +6015,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.aiplatform_v1.ModelServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ModelServiceRestTransport._ListLocations._get_response( self._host, @@ -4958,6 +6061,27 @@ def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_list_locations(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.aiplatform_v1.ModelServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4999,7 +6123,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]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -5010,8 +6134,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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -5020,6 +6146,7 @@ def __call__( http_options = ( _BaseModelServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_get_iam_policy(request, metadata) transcoded_request = _BaseModelServiceRestTransport._BaseGetIamPolicy._get_transcoded_request( http_options, request @@ -5032,6 +6159,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.aiplatform_v1.ModelServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ModelServiceRestTransport._GetIamPolicy._get_response( self._host, @@ -5051,6 +6205,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_iam_policy(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.aiplatform_v1.ModelServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5093,7 +6268,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]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -5104,8 +6279,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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -5114,6 +6291,7 @@ def __call__( http_options = ( _BaseModelServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_set_iam_policy(request, metadata) transcoded_request = _BaseModelServiceRestTransport._BaseSetIamPolicy._get_transcoded_request( http_options, request @@ -5132,6 +6310,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.aiplatform_v1.ModelServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ModelServiceRestTransport._SetIamPolicy._get_response( self._host, @@ -5152,6 +6357,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_set_iam_policy(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.aiplatform_v1.ModelServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5193,7 +6419,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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -5204,8 +6430,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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -5214,6 +6442,7 @@ def __call__( http_options = ( _BaseModelServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -5226,6 +6455,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.aiplatform_v1.ModelServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ModelServiceRestTransport._TestIamPermissions._get_response( self._host, @@ -5245,6 +6501,27 @@ def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_test_iam_permissions(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.aiplatform_v1.ModelServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5286,7 +6563,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 cancel operation method over HTTP. @@ -5297,13 +6574,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 = ( _BaseModelServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = self._interceptor.pre_cancel_operation( request, metadata ) @@ -5316,6 +6596,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.aiplatform_v1.ModelServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ModelServiceRestTransport._CancelOperation._get_response( self._host, @@ -5372,7 +6679,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. @@ -5383,13 +6690,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 = ( _BaseModelServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = self._interceptor.pre_delete_operation( request, metadata ) @@ -5402,6 +6712,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.aiplatform_v1.ModelServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ModelServiceRestTransport._DeleteOperation._get_response( self._host, @@ -5458,7 +6795,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. @@ -5469,8 +6806,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. @@ -5479,6 +6818,7 @@ def __call__( http_options = ( _BaseModelServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = self._interceptor.pre_get_operation(request, metadata) transcoded_request = _BaseModelServiceRestTransport._BaseGetOperation._get_transcoded_request( http_options, request @@ -5491,6 +6831,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.aiplatform_v1.ModelServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ModelServiceRestTransport._GetOperation._get_response( self._host, @@ -5510,6 +6877,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.aiplatform_v1.ModelServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5551,7 +6939,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. @@ -5562,8 +6950,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. @@ -5572,6 +6962,7 @@ def __call__( http_options = ( _BaseModelServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = self._interceptor.pre_list_operations(request, metadata) transcoded_request = _BaseModelServiceRestTransport._BaseListOperations._get_transcoded_request( http_options, request @@ -5582,6 +6973,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.aiplatform_v1.ModelServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ModelServiceRestTransport._ListOperations._get_response( self._host, @@ -5601,6 +7019,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.aiplatform_v1.ModelServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5642,7 +7081,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 wait operation method over HTTP. @@ -5653,8 +7092,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 WaitOperation method. @@ -5663,6 +7104,7 @@ def __call__( http_options = ( _BaseModelServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = self._interceptor.pre_wait_operation(request, metadata) transcoded_request = _BaseModelServiceRestTransport._BaseWaitOperation._get_transcoded_request( http_options, request @@ -5673,6 +7115,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.aiplatform_v1.ModelServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ModelServiceRestTransport._WaitOperation._get_response( self._host, @@ -5692,6 +7161,27 @@ def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = self._interceptor.post_wait_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.aiplatform_v1.ModelServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1/services/model_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1/services/model_service/transports/rest_asyncio.py index 969b00e0ab..a7fd2f169c 100644 --- a/google/cloud/aiplatform_v1/services/model_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1/services/model_service/transports/rest_asyncio.py @@ -63,6 +63,18 @@ from .base import DEFAULT_CLIENT_INFO as BASE_DEFAULT_CLIENT_INFO + +import logging + +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__) + try: OptionalRetry = Union[retries.AsyncRetry, gapic_v1.method._MethodDefault, None] except AttributeError: # pragma: NO COVER @@ -243,9 +255,10 @@ async def post_upload_model(self, response): async def pre_batch_import_evaluated_annotations( self, request: model_service.BatchImportEvaluatedAnnotationsRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - model_service.BatchImportEvaluatedAnnotationsRequest, Sequence[Tuple[str, str]] + model_service.BatchImportEvaluatedAnnotationsRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for batch_import_evaluated_annotations @@ -268,9 +281,10 @@ async def post_batch_import_evaluated_annotations( async def pre_batch_import_model_evaluation_slices( self, request: model_service.BatchImportModelEvaluationSlicesRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - model_service.BatchImportModelEvaluationSlicesRequest, Sequence[Tuple[str, str]] + model_service.BatchImportModelEvaluationSlicesRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for batch_import_model_evaluation_slices @@ -293,8 +307,8 @@ async def post_batch_import_model_evaluation_slices( async def pre_copy_model( self, request: model_service.CopyModelRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[model_service.CopyModelRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[model_service.CopyModelRequest, Sequence[Tuple[str, Union[str, bytes]]]]: """Pre-rpc interceptor for copy_model Override in a subclass to manipulate the request or metadata @@ -316,8 +330,10 @@ async def post_copy_model( async def pre_delete_model( self, request: model_service.DeleteModelRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[model_service.DeleteModelRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + model_service.DeleteModelRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for delete_model Override in a subclass to manipulate the request or metadata @@ -339,8 +355,10 @@ async def post_delete_model( async def pre_delete_model_version( self, request: model_service.DeleteModelVersionRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[model_service.DeleteModelVersionRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + model_service.DeleteModelVersionRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for delete_model_version Override in a subclass to manipulate the request or metadata @@ -362,8 +380,10 @@ async def post_delete_model_version( async def pre_export_model( self, request: model_service.ExportModelRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[model_service.ExportModelRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + model_service.ExportModelRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for export_model Override in a subclass to manipulate the request or metadata @@ -385,8 +405,8 @@ async def post_export_model( async def pre_get_model( self, request: model_service.GetModelRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[model_service.GetModelRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[model_service.GetModelRequest, Sequence[Tuple[str, Union[str, bytes]]]]: """Pre-rpc interceptor for get_model Override in a subclass to manipulate the request or metadata @@ -406,8 +426,10 @@ async def post_get_model(self, response: model.Model) -> model.Model: async def pre_get_model_evaluation( self, request: model_service.GetModelEvaluationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[model_service.GetModelEvaluationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + model_service.GetModelEvaluationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_model_evaluation Override in a subclass to manipulate the request or metadata @@ -429,8 +451,11 @@ async def post_get_model_evaluation( async def pre_get_model_evaluation_slice( self, request: model_service.GetModelEvaluationSliceRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[model_service.GetModelEvaluationSliceRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + model_service.GetModelEvaluationSliceRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for get_model_evaluation_slice Override in a subclass to manipulate the request or metadata @@ -452,8 +477,11 @@ async def post_get_model_evaluation_slice( async def pre_import_model_evaluation( self, request: model_service.ImportModelEvaluationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[model_service.ImportModelEvaluationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + model_service.ImportModelEvaluationRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for import_model_evaluation Override in a subclass to manipulate the request or metadata @@ -475,8 +503,11 @@ async def post_import_model_evaluation( async def pre_list_model_evaluations( self, request: model_service.ListModelEvaluationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[model_service.ListModelEvaluationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + model_service.ListModelEvaluationsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for list_model_evaluations Override in a subclass to manipulate the request or metadata @@ -498,9 +529,10 @@ async def post_list_model_evaluations( async def pre_list_model_evaluation_slices( self, request: model_service.ListModelEvaluationSlicesRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - model_service.ListModelEvaluationSlicesRequest, Sequence[Tuple[str, str]] + model_service.ListModelEvaluationSlicesRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for list_model_evaluation_slices @@ -523,8 +555,10 @@ async def post_list_model_evaluation_slices( async def pre_list_models( self, request: model_service.ListModelsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[model_service.ListModelsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + model_service.ListModelsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_models Override in a subclass to manipulate the request or metadata @@ -546,8 +580,10 @@ async def post_list_models( async def pre_list_model_versions( self, request: model_service.ListModelVersionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[model_service.ListModelVersionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + model_service.ListModelVersionsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_model_versions Override in a subclass to manipulate the request or metadata @@ -569,8 +605,11 @@ async def post_list_model_versions( async def pre_merge_version_aliases( self, request: model_service.MergeVersionAliasesRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[model_service.MergeVersionAliasesRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + model_service.MergeVersionAliasesRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for merge_version_aliases Override in a subclass to manipulate the request or metadata @@ -590,9 +629,10 @@ async def post_merge_version_aliases(self, response: model.Model) -> model.Model async def pre_update_explanation_dataset( self, request: model_service.UpdateExplanationDatasetRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - model_service.UpdateExplanationDatasetRequest, Sequence[Tuple[str, str]] + model_service.UpdateExplanationDatasetRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for update_explanation_dataset @@ -615,8 +655,10 @@ async def post_update_explanation_dataset( async def pre_update_model( self, request: model_service.UpdateModelRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[model_service.UpdateModelRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + model_service.UpdateModelRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for update_model Override in a subclass to manipulate the request or metadata @@ -636,8 +678,10 @@ async def post_update_model(self, response: gca_model.Model) -> gca_model.Model: async def pre_upload_model( self, request: model_service.UploadModelRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[model_service.UploadModelRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + model_service.UploadModelRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for upload_model Override in a subclass to manipulate the request or metadata @@ -659,8 +703,10 @@ async def post_upload_model( async def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -682,8 +728,10 @@ async def post_get_location( async def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -705,8 +753,10 @@ async def post_list_locations( async def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -728,8 +778,10 @@ async def post_get_iam_policy( async def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -751,8 +803,11 @@ async def post_set_iam_policy( async def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -774,8 +829,10 @@ async def post_test_iam_permissions( async def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -795,8 +852,10 @@ async def post_cancel_operation(self, response: None) -> None: async 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 @@ -816,8 +875,10 @@ async def post_delete_operation(self, response: None) -> None: async 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 @@ -839,8 +900,10 @@ async def post_get_operation( async 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 @@ -862,8 +925,10 @@ async def post_list_operations( async def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -1136,7 +1201,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> model_service.BatchImportEvaluatedAnnotationsResponse: r"""Call the batch import evaluated annotations method over HTTP. @@ -1148,8 +1213,10 @@ async def __call__( 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: ~.model_service.BatchImportEvaluatedAnnotationsResponse: @@ -1161,6 +1228,7 @@ async def __call__( http_options = ( _BaseModelServiceRestTransport._BaseBatchImportEvaluatedAnnotations._get_http_options() ) + ( request, metadata, @@ -1180,6 +1248,33 @@ async 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.aiplatform_v1.ModelServiceClient.BatchImportEvaluatedAnnotations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelService", + "rpcName": "BatchImportEvaluatedAnnotations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncModelServiceRestTransport._BatchImportEvaluatedAnnotations._get_response( self._host, @@ -1208,6 +1303,32 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_batch_import_evaluated_annotations(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + model_service.BatchImportEvaluatedAnnotationsResponse.to_json( + response + ) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.ModelServiceAsyncClient.batch_import_evaluated_annotations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelService", + "rpcName": "BatchImportEvaluatedAnnotations", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _BatchImportModelEvaluationSlices( @@ -1249,7 +1370,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> model_service.BatchImportModelEvaluationSlicesResponse: r"""Call the batch import model evaluation slices method over HTTP. @@ -1261,8 +1382,10 @@ async def __call__( 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: ~.model_service.BatchImportModelEvaluationSlicesResponse: @@ -1274,6 +1397,7 @@ async def __call__( http_options = ( _BaseModelServiceRestTransport._BaseBatchImportModelEvaluationSlices._get_http_options() ) + ( request, metadata, @@ -1293,6 +1417,33 @@ async 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.aiplatform_v1.ModelServiceClient.BatchImportModelEvaluationSlices", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelService", + "rpcName": "BatchImportModelEvaluationSlices", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncModelServiceRestTransport._BatchImportModelEvaluationSlices._get_response( self._host, @@ -1323,6 +1474,32 @@ async def __call__( resp = await self._interceptor.post_batch_import_model_evaluation_slices( resp ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + model_service.BatchImportModelEvaluationSlicesResponse.to_json( + response + ) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.ModelServiceAsyncClient.batch_import_model_evaluation_slices", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelService", + "rpcName": "BatchImportModelEvaluationSlices", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _CopyModel( @@ -1361,7 +1538,7 @@ async 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 copy model method over HTTP. @@ -1372,8 +1549,10 @@ async def __call__( 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: @@ -1386,6 +1565,7 @@ async def __call__( http_options = ( _BaseModelServiceRestTransport._BaseCopyModel._get_http_options() ) + request, metadata = await self._interceptor.pre_copy_model( request, metadata ) @@ -1406,6 +1586,33 @@ async 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.aiplatform_v1.ModelServiceClient.CopyModel", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelService", + "rpcName": "CopyModel", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncModelServiceRestTransport._CopyModel._get_response( self._host, @@ -1434,6 +1641,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_copy_model(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.ModelServiceAsyncClient.copy_model", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelService", + "rpcName": "CopyModel", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _DeleteModel( @@ -1471,7 +1700,7 @@ async 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 model method over HTTP. @@ -1482,8 +1711,10 @@ async def __call__( 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: @@ -1496,6 +1727,7 @@ async def __call__( http_options = ( _BaseModelServiceRestTransport._BaseDeleteModel._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_model( request, metadata ) @@ -1512,6 +1744,33 @@ async 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.aiplatform_v1.ModelServiceClient.DeleteModel", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelService", + "rpcName": "DeleteModel", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncModelServiceRestTransport._DeleteModel._get_response( self._host, @@ -1539,6 +1798,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_delete_model(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.ModelServiceAsyncClient.delete_model", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelService", + "rpcName": "DeleteModel", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _DeleteModelVersion( @@ -1577,7 +1858,7 @@ async 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 model version method over HTTP. @@ -1588,8 +1869,10 @@ async def __call__( 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: @@ -1602,6 +1885,7 @@ async def __call__( http_options = ( _BaseModelServiceRestTransport._BaseDeleteModelVersion._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_model_version( request, metadata ) @@ -1614,6 +1898,33 @@ async 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.aiplatform_v1.ModelServiceClient.DeleteModelVersion", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelService", + "rpcName": "DeleteModelVersion", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncModelServiceRestTransport._DeleteModelVersion._get_response( @@ -1643,6 +1954,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_delete_model_version(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.ModelServiceAsyncClient.delete_model_version", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelService", + "rpcName": "DeleteModelVersion", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ExportModel( @@ -1681,7 +2014,7 @@ async 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 export model method over HTTP. @@ -1692,8 +2025,10 @@ async def __call__( 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: @@ -1706,6 +2041,7 @@ async def __call__( http_options = ( _BaseModelServiceRestTransport._BaseExportModel._get_http_options() ) + request, metadata = await self._interceptor.pre_export_model( request, metadata ) @@ -1728,6 +2064,33 @@ async 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.aiplatform_v1.ModelServiceClient.ExportModel", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelService", + "rpcName": "ExportModel", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncModelServiceRestTransport._ExportModel._get_response( self._host, @@ -1756,6 +2119,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_export_model(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.ModelServiceAsyncClient.export_model", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelService", + "rpcName": "ExportModel", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _GetModel( @@ -1793,7 +2178,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> model.Model: r"""Call the get model method over HTTP. @@ -1804,8 +2189,10 @@ async def __call__( 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: ~.model.Model: @@ -1815,6 +2202,7 @@ async def __call__( http_options = ( _BaseModelServiceRestTransport._BaseGetModel._get_http_options() ) + request, metadata = await self._interceptor.pre_get_model(request, metadata) transcoded_request = ( _BaseModelServiceRestTransport._BaseGetModel._get_transcoded_request( @@ -1829,6 +2217,33 @@ async 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 = 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.aiplatform_v1.ModelServiceClient.GetModel", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelService", + "rpcName": "GetModel", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncModelServiceRestTransport._GetModel._get_response( self._host, @@ -1856,6 +2271,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_get_model(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = model.Model.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.ModelServiceAsyncClient.get_model", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelService", + "rpcName": "GetModel", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _GetModelEvaluation( @@ -1894,7 +2331,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> model_evaluation.ModelEvaluation: r"""Call the get model evaluation method over HTTP. @@ -1905,8 +2342,10 @@ async def __call__( 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: ~.model_evaluation.ModelEvaluation: @@ -1920,6 +2359,7 @@ async def __call__( http_options = ( _BaseModelServiceRestTransport._BaseGetModelEvaluation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_model_evaluation( request, metadata ) @@ -1932,6 +2372,33 @@ async 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.aiplatform_v1.ModelServiceClient.GetModelEvaluation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelService", + "rpcName": "GetModelEvaluation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncModelServiceRestTransport._GetModelEvaluation._get_response( @@ -1961,6 +2428,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_get_model_evaluation(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = model_evaluation.ModelEvaluation.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.ModelServiceAsyncClient.get_model_evaluation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelService", + "rpcName": "GetModelEvaluation", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _GetModelEvaluationSlice( @@ -1999,7 +2490,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> model_evaluation_slice.ModelEvaluationSlice: r"""Call the get model evaluation slice method over HTTP. @@ -2011,8 +2502,10 @@ async def __call__( 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: ~.model_evaluation_slice.ModelEvaluationSlice: @@ -2026,6 +2519,7 @@ async def __call__( http_options = ( _BaseModelServiceRestTransport._BaseGetModelEvaluationSlice._get_http_options() ) + request, metadata = await self._interceptor.pre_get_model_evaluation_slice( request, metadata ) @@ -2038,6 +2532,33 @@ async 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.aiplatform_v1.ModelServiceClient.GetModelEvaluationSlice", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelService", + "rpcName": "GetModelEvaluationSlice", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncModelServiceRestTransport._GetModelEvaluationSlice._get_response( self._host, @@ -2065,6 +2586,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_get_model_evaluation_slice(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + model_evaluation_slice.ModelEvaluationSlice.to_json(response) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.ModelServiceAsyncClient.get_model_evaluation_slice", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelService", + "rpcName": "GetModelEvaluationSlice", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ImportModelEvaluation( @@ -2104,7 +2649,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> gca_model_evaluation.ModelEvaluation: r"""Call the import model evaluation method over HTTP. @@ -2115,8 +2660,10 @@ async def __call__( 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: ~.gca_model_evaluation.ModelEvaluation: @@ -2130,6 +2677,7 @@ async def __call__( http_options = ( _BaseModelServiceRestTransport._BaseImportModelEvaluation._get_http_options() ) + request, metadata = await self._interceptor.pre_import_model_evaluation( request, metadata ) @@ -2146,6 +2694,33 @@ async 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.aiplatform_v1.ModelServiceClient.ImportModelEvaluation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelService", + "rpcName": "ImportModelEvaluation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncModelServiceRestTransport._ImportModelEvaluation._get_response( self._host, @@ -2174,6 +2749,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_import_model_evaluation(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gca_model_evaluation.ModelEvaluation.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.ModelServiceAsyncClient.import_model_evaluation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelService", + "rpcName": "ImportModelEvaluation", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ListModelEvaluations( @@ -2212,7 +2811,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> model_service.ListModelEvaluationsResponse: r"""Call the list model evaluations method over HTTP. @@ -2223,8 +2822,10 @@ async def __call__( 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: ~.model_service.ListModelEvaluationsResponse: @@ -2236,6 +2837,7 @@ async def __call__( http_options = ( _BaseModelServiceRestTransport._BaseListModelEvaluations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_model_evaluations( request, metadata ) @@ -2248,6 +2850,33 @@ async 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.aiplatform_v1.ModelServiceClient.ListModelEvaluations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelService", + "rpcName": "ListModelEvaluations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncModelServiceRestTransport._ListModelEvaluations._get_response( self._host, @@ -2275,6 +2904,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_list_model_evaluations(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + model_service.ListModelEvaluationsResponse.to_json(response) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.ModelServiceAsyncClient.list_model_evaluations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelService", + "rpcName": "ListModelEvaluations", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ListModelEvaluationSlices( @@ -2313,7 +2966,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> model_service.ListModelEvaluationSlicesResponse: r"""Call the list model evaluation slices method over HTTP. @@ -2325,8 +2978,10 @@ async def __call__( 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: ~.model_service.ListModelEvaluationSlicesResponse: @@ -2338,6 +2993,7 @@ async def __call__( http_options = ( _BaseModelServiceRestTransport._BaseListModelEvaluationSlices._get_http_options() ) + ( request, metadata, @@ -2353,6 +3009,33 @@ async 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.aiplatform_v1.ModelServiceClient.ListModelEvaluationSlices", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelService", + "rpcName": "ListModelEvaluationSlices", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncModelServiceRestTransport._ListModelEvaluationSlices._get_response( self._host, @@ -2380,6 +3063,32 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_list_model_evaluation_slices(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + model_service.ListModelEvaluationSlicesResponse.to_json( + response + ) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.ModelServiceAsyncClient.list_model_evaluation_slices", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelService", + "rpcName": "ListModelEvaluationSlices", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ListModels( @@ -2417,7 +3126,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> model_service.ListModelsResponse: r"""Call the list models method over HTTP. @@ -2428,8 +3137,10 @@ async def __call__( 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: ~.model_service.ListModelsResponse: @@ -2441,6 +3152,7 @@ async def __call__( http_options = ( _BaseModelServiceRestTransport._BaseListModels._get_http_options() ) + request, metadata = await self._interceptor.pre_list_models( request, metadata ) @@ -2457,6 +3169,33 @@ async 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 = 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.aiplatform_v1.ModelServiceClient.ListModels", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelService", + "rpcName": "ListModels", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncModelServiceRestTransport._ListModels._get_response( self._host, @@ -2484,6 +3223,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_list_models(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = model_service.ListModelsResponse.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.ModelServiceAsyncClient.list_models", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelService", + "rpcName": "ListModels", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ListModelVersions( @@ -2521,7 +3284,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> model_service.ListModelVersionsResponse: r"""Call the list model versions method over HTTP. @@ -2532,8 +3295,10 @@ async def __call__( 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: ~.model_service.ListModelVersionsResponse: @@ -2545,6 +3310,7 @@ async def __call__( http_options = ( _BaseModelServiceRestTransport._BaseListModelVersions._get_http_options() ) + request, metadata = await self._interceptor.pre_list_model_versions( request, metadata ) @@ -2557,6 +3323,33 @@ async 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.aiplatform_v1.ModelServiceClient.ListModelVersions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelService", + "rpcName": "ListModelVersions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncModelServiceRestTransport._ListModelVersions._get_response( @@ -2586,6 +3379,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_list_model_versions(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = model_service.ListModelVersionsResponse.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.ModelServiceAsyncClient.list_model_versions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelService", + "rpcName": "ListModelVersions", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _MergeVersionAliases( @@ -2625,7 +3442,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> model.Model: r"""Call the merge version aliases method over HTTP. @@ -2636,8 +3453,10 @@ async def __call__( 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: ~.model.Model: @@ -2647,6 +3466,7 @@ async def __call__( http_options = ( _BaseModelServiceRestTransport._BaseMergeVersionAliases._get_http_options() ) + request, metadata = await self._interceptor.pre_merge_version_aliases( request, metadata ) @@ -2663,6 +3483,33 @@ async 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.aiplatform_v1.ModelServiceClient.MergeVersionAliases", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelService", + "rpcName": "MergeVersionAliases", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncModelServiceRestTransport._MergeVersionAliases._get_response( @@ -2693,6 +3540,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_merge_version_aliases(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = model.Model.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.ModelServiceAsyncClient.merge_version_aliases", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelService", + "rpcName": "MergeVersionAliases", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _UpdateExplanationDataset( @@ -2732,7 +3601,7 @@ async 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 explanation dataset method over HTTP. @@ -2744,8 +3613,10 @@ async def __call__( 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: @@ -2758,6 +3629,7 @@ async def __call__( http_options = ( _BaseModelServiceRestTransport._BaseUpdateExplanationDataset._get_http_options() ) + request, metadata = await self._interceptor.pre_update_explanation_dataset( request, metadata ) @@ -2774,6 +3646,33 @@ async 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.aiplatform_v1.ModelServiceClient.UpdateExplanationDataset", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelService", + "rpcName": "UpdateExplanationDataset", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncModelServiceRestTransport._UpdateExplanationDataset._get_response( self._host, @@ -2802,6 +3701,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_update_explanation_dataset(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.ModelServiceAsyncClient.update_explanation_dataset", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelService", + "rpcName": "UpdateExplanationDataset", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _UpdateModel( @@ -2840,7 +3761,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> gca_model.Model: r"""Call the update model method over HTTP. @@ -2851,8 +3772,10 @@ async def __call__( 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: ~.gca_model.Model: @@ -2862,6 +3785,7 @@ async def __call__( http_options = ( _BaseModelServiceRestTransport._BaseUpdateModel._get_http_options() ) + request, metadata = await self._interceptor.pre_update_model( request, metadata ) @@ -2884,6 +3808,33 @@ async 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 = 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.aiplatform_v1.ModelServiceClient.UpdateModel", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelService", + "rpcName": "UpdateModel", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncModelServiceRestTransport._UpdateModel._get_response( self._host, @@ -2912,6 +3863,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_update_model(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gca_model.Model.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.ModelServiceAsyncClient.update_model", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelService", + "rpcName": "UpdateModel", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _UploadModel( @@ -2950,7 +3923,7 @@ async 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 upload model method over HTTP. @@ -2961,8 +3934,10 @@ async def __call__( 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: @@ -2975,6 +3950,7 @@ async def __call__( http_options = ( _BaseModelServiceRestTransport._BaseUploadModel._get_http_options() ) + request, metadata = await self._interceptor.pre_upload_model( request, metadata ) @@ -2997,6 +3973,33 @@ async 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.aiplatform_v1.ModelServiceClient.UploadModel", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelService", + "rpcName": "UploadModel", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncModelServiceRestTransport._UploadModel._get_response( self._host, @@ -3025,6 +4028,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_upload_model(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.ModelServiceAsyncClient.upload_model", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelService", + "rpcName": "UploadModel", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp @property @@ -5074,7 +6099,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -5085,8 +6110,10 @@ async def __call__( 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: locations_pb2.Location: Response from GetLocation method. @@ -5095,6 +6122,7 @@ async def __call__( http_options = ( _BaseModelServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_location( request, metadata ) @@ -5111,6 +6139,33 @@ async 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.aiplatform_v1.ModelServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncModelServiceRestTransport._GetLocation._get_response( self._host, @@ -5136,6 +6191,27 @@ async def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_location(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.aiplatform_v1.ModelServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5177,7 +6253,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -5188,8 +6264,10 @@ async def __call__( 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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -5198,6 +6276,7 @@ async def __call__( http_options = ( _BaseModelServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_locations( request, metadata ) @@ -5210,6 +6289,33 @@ async 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.aiplatform_v1.ModelServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncModelServiceRestTransport._ListLocations._get_response( @@ -5237,6 +6343,27 @@ async def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_list_locations(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.aiplatform_v1.ModelServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5278,7 +6405,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -5289,8 +6416,10 @@ async def __call__( 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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -5299,6 +6428,7 @@ async def __call__( http_options = ( _BaseModelServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_get_iam_policy( request, metadata ) @@ -5313,6 +6443,33 @@ async 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.aiplatform_v1.ModelServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncModelServiceRestTransport._GetIamPolicy._get_response( self._host, @@ -5338,6 +6495,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_iam_policy(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.aiplatform_v1.ModelServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5380,7 +6558,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -5391,8 +6569,10 @@ async def __call__( 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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -5401,6 +6581,7 @@ async def __call__( http_options = ( _BaseModelServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_set_iam_policy( request, metadata ) @@ -5421,6 +6602,33 @@ async 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.aiplatform_v1.ModelServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncModelServiceRestTransport._SetIamPolicy._get_response( self._host, @@ -5447,6 +6655,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_set_iam_policy(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.aiplatform_v1.ModelServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5489,7 +6718,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -5500,8 +6729,10 @@ async def __call__( 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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -5510,6 +6741,7 @@ async def __call__( http_options = ( _BaseModelServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = await self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -5522,6 +6754,33 @@ async 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.aiplatform_v1.ModelServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncModelServiceRestTransport._TestIamPermissions._get_response( @@ -5549,6 +6808,27 @@ async def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_test_iam_permissions(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.aiplatform_v1.ModelServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5590,7 +6870,7 @@ async 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 cancel operation method over HTTP. @@ -5601,13 +6881,16 @@ async def __call__( 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`. """ http_options = ( _BaseModelServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_cancel_operation( request, metadata ) @@ -5620,6 +6903,33 @@ async 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.aiplatform_v1.ModelServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncModelServiceRestTransport._CancelOperation._get_response( @@ -5684,7 +6994,7 @@ async 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. @@ -5695,13 +7005,16 @@ async def __call__( 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`. """ http_options = ( _BaseModelServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_operation( request, metadata ) @@ -5714,6 +7027,33 @@ async 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.aiplatform_v1.ModelServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncModelServiceRestTransport._DeleteOperation._get_response( @@ -5778,7 +7118,7 @@ async 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. @@ -5789,8 +7129,10 @@ async def __call__( 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: Response from GetOperation method. @@ -5799,6 +7141,7 @@ async def __call__( http_options = ( _BaseModelServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_operation( request, metadata ) @@ -5813,6 +7156,33 @@ async 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.aiplatform_v1.ModelServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncModelServiceRestTransport._GetOperation._get_response( self._host, @@ -5838,6 +7208,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1.ModelServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5879,7 +7270,7 @@ async 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. @@ -5890,8 +7281,10 @@ async def __call__( 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 from ListOperations method. @@ -5900,6 +7293,7 @@ async def __call__( http_options = ( _BaseModelServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_operations( request, metadata ) @@ -5912,6 +7306,33 @@ async 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.aiplatform_v1.ModelServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncModelServiceRestTransport._ListOperations._get_response( @@ -5939,6 +7360,27 @@ async def __call__( resp = operations_pb2.ListOperationsResponse() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1.ModelServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5980,7 +7422,7 @@ async 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 wait operation method over HTTP. @@ -5991,8 +7433,10 @@ async def __call__( 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: Response from WaitOperation method. @@ -6001,6 +7445,7 @@ async def __call__( http_options = ( _BaseModelServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_wait_operation( request, metadata ) @@ -6013,6 +7458,33 @@ async 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.aiplatform_v1.ModelServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncModelServiceRestTransport._WaitOperation._get_response( @@ -6040,6 +7512,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_wait_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.aiplatform_v1.ModelServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ModelService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1/services/notebook_service/async_client.py b/google/cloud/aiplatform_v1/services/notebook_service/async_client.py index 77da30efcf..646941b048 100644 --- a/google/cloud/aiplatform_v1/services/notebook_service/async_client.py +++ b/google/cloud/aiplatform_v1/services/notebook_service/async_client.py @@ -13,6 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging as std_logging from collections import OrderedDict import re from typing import ( @@ -74,6 +75,15 @@ from .transports.grpc_asyncio import NotebookServiceGrpcAsyncIOTransport from .client import NotebookServiceClient +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 NotebookServiceAsyncClient: """The interface for Vertex Notebook service (a.k.a. Colab on @@ -305,6 +315,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.aiplatform_v1.NotebookServiceAsyncClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1.NotebookService", + "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.aiplatform.v1.NotebookService", + "credentialsType": None, + }, + ) + async def create_notebook_runtime_template( self, request: Optional[ @@ -318,7 +350,7 @@ async def create_notebook_runtime_template( notebook_runtime_template_id: 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"""Creates a NotebookRuntimeTemplate. @@ -385,8 +417,10 @@ async def sample_create_notebook_runtime_template(): 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: @@ -469,7 +503,7 @@ async def get_notebook_runtime_template( 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]]] = (), ) -> notebook_runtime.NotebookRuntimeTemplate: r"""Gets a NotebookRuntimeTemplate. @@ -514,8 +548,10 @@ async def sample_get_notebook_runtime_template(): 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.aiplatform_v1.types.NotebookRuntimeTemplate: @@ -581,7 +617,7 @@ async def list_notebook_runtime_templates( 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.ListNotebookRuntimeTemplatesAsyncPager: r"""Lists NotebookRuntimeTemplates in a Location. @@ -627,8 +663,10 @@ async def sample_list_notebook_runtime_templates(): 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.aiplatform_v1.services.notebook_service.pagers.ListNotebookRuntimeTemplatesAsyncPager: @@ -707,7 +745,7 @@ async def delete_notebook_runtime_template( 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"""Deletes a NotebookRuntimeTemplate. @@ -756,8 +794,10 @@ async def sample_delete_notebook_runtime_template(): 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: @@ -843,7 +883,7 @@ async def update_notebook_runtime_template( 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]]] = (), ) -> notebook_runtime.NotebookRuntimeTemplate: r"""Updates a NotebookRuntimeTemplate. @@ -902,8 +942,10 @@ async def sample_update_notebook_runtime_template(): 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.aiplatform_v1.types.NotebookRuntimeTemplate: @@ -983,7 +1025,7 @@ async def assign_notebook_runtime( notebook_runtime_id: 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"""Assigns a NotebookRuntime to a user for a particular Notebook file. This method will either returns an @@ -1065,8 +1107,10 @@ async def sample_assign_notebook_runtime(): 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: @@ -1148,7 +1192,7 @@ async def get_notebook_runtime( 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]]] = (), ) -> notebook_runtime.NotebookRuntime: r"""Gets a NotebookRuntime. @@ -1197,8 +1241,10 @@ async def sample_get_notebook_runtime(): 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.aiplatform_v1.types.NotebookRuntime: @@ -1263,7 +1309,7 @@ async def list_notebook_runtimes( 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.ListNotebookRuntimesAsyncPager: r"""Lists NotebookRuntimes in a Location. @@ -1309,8 +1355,10 @@ async def sample_list_notebook_runtimes(): 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.aiplatform_v1.services.notebook_service.pagers.ListNotebookRuntimesAsyncPager: @@ -1387,7 +1435,7 @@ async def delete_notebook_runtime( 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"""Deletes a NotebookRuntime. @@ -1440,8 +1488,10 @@ async def sample_delete_notebook_runtime(): 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: @@ -1522,7 +1572,7 @@ async def upgrade_notebook_runtime( 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"""Upgrades a NotebookRuntime. @@ -1575,8 +1625,10 @@ async def sample_upgrade_notebook_runtime(): 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: @@ -1649,7 +1701,7 @@ async def start_notebook_runtime( 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"""Starts a NotebookRuntime. @@ -1702,8 +1754,10 @@ async def sample_start_notebook_runtime(): 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: @@ -1776,7 +1830,7 @@ async def stop_notebook_runtime( 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"""Stops a NotebookRuntime. @@ -1829,8 +1883,10 @@ async def sample_stop_notebook_runtime(): 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: @@ -1907,7 +1963,7 @@ async def create_notebook_execution_job( notebook_execution_job_id: 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"""Creates a NotebookExecutionJob. @@ -1976,8 +2032,10 @@ async def sample_create_notebook_execution_job(): 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: @@ -2058,7 +2116,7 @@ async def get_notebook_execution_job( 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]]] = (), ) -> notebook_execution_job.NotebookExecutionJob: r"""Gets a NotebookExecutionJob. @@ -2102,8 +2160,10 @@ async def sample_get_notebook_execution_job(): 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.aiplatform_v1.types.NotebookExecutionJob: @@ -2166,7 +2226,7 @@ async def list_notebook_execution_jobs( 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.ListNotebookExecutionJobsAsyncPager: r"""Lists NotebookExecutionJobs in a Location. @@ -2212,8 +2272,10 @@ async def sample_list_notebook_execution_jobs(): 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.aiplatform_v1.services.notebook_service.pagers.ListNotebookExecutionJobsAsyncPager: @@ -2290,7 +2352,7 @@ async def delete_notebook_execution_job( 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"""Deletes a NotebookExecutionJob. @@ -2339,8 +2401,10 @@ async def sample_delete_notebook_execution_job(): 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: @@ -2418,7 +2482,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. @@ -2429,8 +2493,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. @@ -2471,7 +2537,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. @@ -2482,8 +2548,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. @@ -2524,7 +2592,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. @@ -2540,8 +2608,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 """ @@ -2578,7 +2648,7 @@ async def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -2593,8 +2663,10 @@ async def cancel_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 """ @@ -2631,7 +2703,7 @@ async def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -2648,8 +2720,10 @@ async def wait_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. @@ -2690,7 +2764,7 @@ async def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -2703,8 +2777,10 @@ async def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -2809,7 +2885,7 @@ async def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -2823,8 +2899,10 @@ async def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -2929,7 +3007,7 @@ async def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -2944,8 +3022,10 @@ async def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -2989,7 +3069,7 @@ async def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -3000,8 +3080,10 @@ async def get_location( 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: ~.location_pb2.Location: Location object. @@ -3042,7 +3124,7 @@ async def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -3053,8 +3135,10 @@ async def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1/services/notebook_service/client.py b/google/cloud/aiplatform_v1/services/notebook_service/client.py index db678b55d6..32e26cd961 100644 --- a/google/cloud/aiplatform_v1/services/notebook_service/client.py +++ b/google/cloud/aiplatform_v1/services/notebook_service/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 ( @@ -48,6 +49,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 as gac_operation # type: ignore from google.api_core import operation_async # type: ignore from google.cloud.aiplatform_v1.services.notebook_service import pagers @@ -749,6 +759,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( @@ -839,6 +853,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.aiplatform_v1.NotebookServiceClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1.NotebookService", + "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.aiplatform.v1.NotebookService", + "credentialsType": None, + }, + ) + def create_notebook_runtime_template( self, request: Optional[ @@ -852,7 +889,7 @@ def create_notebook_runtime_template( notebook_runtime_template_id: 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]]] = (), ) -> gac_operation.Operation: r"""Creates a NotebookRuntimeTemplate. @@ -919,8 +956,10 @@ def sample_create_notebook_runtime_template(): 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: @@ -1002,7 +1041,7 @@ def get_notebook_runtime_template( 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]]] = (), ) -> notebook_runtime.NotebookRuntimeTemplate: r"""Gets a NotebookRuntimeTemplate. @@ -1047,8 +1086,10 @@ def sample_get_notebook_runtime_template(): 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.aiplatform_v1.types.NotebookRuntimeTemplate: @@ -1113,7 +1154,7 @@ def list_notebook_runtime_templates( 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.ListNotebookRuntimeTemplatesPager: r"""Lists NotebookRuntimeTemplates in a Location. @@ -1159,8 +1200,10 @@ def sample_list_notebook_runtime_templates(): 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.aiplatform_v1.services.notebook_service.pagers.ListNotebookRuntimeTemplatesPager: @@ -1238,7 +1281,7 @@ def delete_notebook_runtime_template( 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]]] = (), ) -> gac_operation.Operation: r"""Deletes a NotebookRuntimeTemplate. @@ -1287,8 +1330,10 @@ def sample_delete_notebook_runtime_template(): 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: @@ -1373,7 +1418,7 @@ def update_notebook_runtime_template( 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]]] = (), ) -> notebook_runtime.NotebookRuntimeTemplate: r"""Updates a NotebookRuntimeTemplate. @@ -1432,8 +1477,10 @@ def sample_update_notebook_runtime_template(): 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.aiplatform_v1.types.NotebookRuntimeTemplate: @@ -1512,7 +1559,7 @@ def assign_notebook_runtime( notebook_runtime_id: 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]]] = (), ) -> gac_operation.Operation: r"""Assigns a NotebookRuntime to a user for a particular Notebook file. This method will either returns an @@ -1594,8 +1641,10 @@ def sample_assign_notebook_runtime(): 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: @@ -1674,7 +1723,7 @@ def get_notebook_runtime( 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]]] = (), ) -> notebook_runtime.NotebookRuntime: r"""Gets a NotebookRuntime. @@ -1723,8 +1772,10 @@ def sample_get_notebook_runtime(): 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.aiplatform_v1.types.NotebookRuntime: @@ -1786,7 +1837,7 @@ def list_notebook_runtimes( 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.ListNotebookRuntimesPager: r"""Lists NotebookRuntimes in a Location. @@ -1832,8 +1883,10 @@ def sample_list_notebook_runtimes(): 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.aiplatform_v1.services.notebook_service.pagers.ListNotebookRuntimesPager: @@ -1907,7 +1960,7 @@ def delete_notebook_runtime( 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]]] = (), ) -> gac_operation.Operation: r"""Deletes a NotebookRuntime. @@ -1960,8 +2013,10 @@ def sample_delete_notebook_runtime(): 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: @@ -2039,7 +2094,7 @@ def upgrade_notebook_runtime( 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]]] = (), ) -> gac_operation.Operation: r"""Upgrades a NotebookRuntime. @@ -2092,8 +2147,10 @@ def sample_upgrade_notebook_runtime(): 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: @@ -2163,7 +2220,7 @@ def start_notebook_runtime( 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]]] = (), ) -> gac_operation.Operation: r"""Starts a NotebookRuntime. @@ -2216,8 +2273,10 @@ def sample_start_notebook_runtime(): 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: @@ -2287,7 +2346,7 @@ def stop_notebook_runtime( 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]]] = (), ) -> gac_operation.Operation: r"""Stops a NotebookRuntime. @@ -2340,8 +2399,10 @@ def sample_stop_notebook_runtime(): 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: @@ -2415,7 +2476,7 @@ def create_notebook_execution_job( notebook_execution_job_id: 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]]] = (), ) -> gac_operation.Operation: r"""Creates a NotebookExecutionJob. @@ -2484,8 +2545,10 @@ def sample_create_notebook_execution_job(): 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: @@ -2565,7 +2628,7 @@ def get_notebook_execution_job( 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]]] = (), ) -> notebook_execution_job.NotebookExecutionJob: r"""Gets a NotebookExecutionJob. @@ -2609,8 +2672,10 @@ def sample_get_notebook_execution_job(): 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.aiplatform_v1.types.NotebookExecutionJob: @@ -2672,7 +2737,7 @@ def list_notebook_execution_jobs( 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.ListNotebookExecutionJobsPager: r"""Lists NotebookExecutionJobs in a Location. @@ -2718,8 +2783,10 @@ def sample_list_notebook_execution_jobs(): 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.aiplatform_v1.services.notebook_service.pagers.ListNotebookExecutionJobsPager: @@ -2795,7 +2862,7 @@ def delete_notebook_execution_job( 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]]] = (), ) -> gac_operation.Operation: r"""Deletes a NotebookExecutionJob. @@ -2844,8 +2911,10 @@ def sample_delete_notebook_execution_job(): 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: @@ -2935,7 +3004,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. @@ -2946,8 +3015,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. @@ -2988,7 +3059,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. @@ -2999,8 +3070,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. @@ -3041,7 +3114,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. @@ -3057,8 +3130,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 """ @@ -3095,7 +3170,7 @@ def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -3110,8 +3185,10 @@ def cancel_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 """ @@ -3148,7 +3225,7 @@ def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -3165,8 +3242,10 @@ def wait_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. @@ -3207,7 +3286,7 @@ def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -3220,8 +3299,10 @@ def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -3326,7 +3407,7 @@ def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -3340,8 +3421,10 @@ def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -3446,7 +3529,7 @@ def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -3461,8 +3544,10 @@ def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -3504,7 +3589,7 @@ def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -3515,8 +3600,10 @@ def get_location( 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: ~.location_pb2.Location: Location object. @@ -3557,7 +3644,7 @@ def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -3568,8 +3655,10 @@ def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1/services/notebook_service/pagers.py b/google/cloud/aiplatform_v1/services/notebook_service/pagers.py index 95ad25bf9c..58c5af8144 100644 --- a/google/cloud/aiplatform_v1/services/notebook_service/pagers.py +++ b/google/cloud/aiplatform_v1/services/notebook_service/pagers.py @@ -68,7 +68,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. @@ -82,8 +82,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 = notebook_service.ListNotebookRuntimeTemplatesRequest(request) @@ -144,7 +146,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. @@ -158,8 +160,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 = notebook_service.ListNotebookRuntimeTemplatesRequest(request) @@ -224,7 +228,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. @@ -238,8 +242,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 = notebook_service.ListNotebookRuntimesRequest(request) @@ -298,7 +304,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. @@ -312,8 +318,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 = notebook_service.ListNotebookRuntimesRequest(request) @@ -378,7 +386,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. @@ -392,8 +400,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 = notebook_service.ListNotebookExecutionJobsRequest(request) @@ -454,7 +464,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. @@ -468,8 +478,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 = notebook_service.ListNotebookExecutionJobsRequest(request) diff --git a/google/cloud/aiplatform_v1/services/notebook_service/transports/grpc.py b/google/cloud/aiplatform_v1/services/notebook_service/transports/grpc.py index f6ce6a0aa9..af558126f4 100644 --- a/google/cloud/aiplatform_v1/services/notebook_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1/services/notebook_service/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 import warnings from typing import Callable, Dict, Optional, Sequence, Tuple, Union @@ -22,8 +25,11 @@ import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from google.cloud.aiplatform_v1.types import notebook_execution_job from google.cloud.aiplatform_v1.types import notebook_runtime @@ -34,6 +40,81 @@ from google.longrunning import operations_pb2 # type: ignore from .base import NotebookServiceTransport, DEFAULT_CLIENT_INFO +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.aiplatform.v1.NotebookService", + "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.aiplatform.v1.NotebookService", + "rpcName": client_call_details.method, + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class NotebookServiceGrpcTransport(NotebookServiceTransport): """gRPC backend transport for NotebookService. @@ -189,7 +270,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 @@ -253,7 +339,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 @@ -283,7 +371,7 @@ def create_notebook_runtime_template( if "create_notebook_runtime_template" not in self._stubs: self._stubs[ "create_notebook_runtime_template" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.NotebookService/CreateNotebookRuntimeTemplate", request_serializer=notebook_service.CreateNotebookRuntimeTemplateRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -314,7 +402,7 @@ def get_notebook_runtime_template( if "get_notebook_runtime_template" not in self._stubs: self._stubs[ "get_notebook_runtime_template" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.NotebookService/GetNotebookRuntimeTemplate", request_serializer=notebook_service.GetNotebookRuntimeTemplateRequest.serialize, response_deserializer=notebook_runtime.NotebookRuntimeTemplate.deserialize, @@ -346,7 +434,7 @@ def list_notebook_runtime_templates( if "list_notebook_runtime_templates" not in self._stubs: self._stubs[ "list_notebook_runtime_templates" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.NotebookService/ListNotebookRuntimeTemplates", request_serializer=notebook_service.ListNotebookRuntimeTemplatesRequest.serialize, response_deserializer=notebook_service.ListNotebookRuntimeTemplatesResponse.deserialize, @@ -378,7 +466,7 @@ def delete_notebook_runtime_template( if "delete_notebook_runtime_template" not in self._stubs: self._stubs[ "delete_notebook_runtime_template" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.NotebookService/DeleteNotebookRuntimeTemplate", request_serializer=notebook_service.DeleteNotebookRuntimeTemplateRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -410,7 +498,7 @@ def update_notebook_runtime_template( if "update_notebook_runtime_template" not in self._stubs: self._stubs[ "update_notebook_runtime_template" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.NotebookService/UpdateNotebookRuntimeTemplate", request_serializer=notebook_service.UpdateNotebookRuntimeTemplateRequest.serialize, response_deserializer=notebook_runtime.NotebookRuntimeTemplate.deserialize, @@ -440,7 +528,7 @@ def assign_notebook_runtime( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "assign_notebook_runtime" not in self._stubs: - self._stubs["assign_notebook_runtime"] = self.grpc_channel.unary_unary( + self._stubs["assign_notebook_runtime"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.NotebookService/AssignNotebookRuntime", request_serializer=notebook_service.AssignNotebookRuntimeRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -468,7 +556,7 @@ def get_notebook_runtime( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_notebook_runtime" not in self._stubs: - self._stubs["get_notebook_runtime"] = self.grpc_channel.unary_unary( + self._stubs["get_notebook_runtime"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.NotebookService/GetNotebookRuntime", request_serializer=notebook_service.GetNotebookRuntimeRequest.serialize, response_deserializer=notebook_runtime.NotebookRuntime.deserialize, @@ -497,7 +585,7 @@ def list_notebook_runtimes( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_notebook_runtimes" not in self._stubs: - self._stubs["list_notebook_runtimes"] = self.grpc_channel.unary_unary( + self._stubs["list_notebook_runtimes"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.NotebookService/ListNotebookRuntimes", request_serializer=notebook_service.ListNotebookRuntimesRequest.serialize, response_deserializer=notebook_service.ListNotebookRuntimesResponse.deserialize, @@ -525,7 +613,7 @@ def delete_notebook_runtime( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_notebook_runtime" not in self._stubs: - self._stubs["delete_notebook_runtime"] = self.grpc_channel.unary_unary( + self._stubs["delete_notebook_runtime"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.NotebookService/DeleteNotebookRuntime", request_serializer=notebook_service.DeleteNotebookRuntimeRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -553,7 +641,7 @@ def upgrade_notebook_runtime( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "upgrade_notebook_runtime" not in self._stubs: - self._stubs["upgrade_notebook_runtime"] = self.grpc_channel.unary_unary( + self._stubs["upgrade_notebook_runtime"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.NotebookService/UpgradeNotebookRuntime", request_serializer=notebook_service.UpgradeNotebookRuntimeRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -581,7 +669,7 @@ def start_notebook_runtime( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "start_notebook_runtime" not in self._stubs: - self._stubs["start_notebook_runtime"] = self.grpc_channel.unary_unary( + self._stubs["start_notebook_runtime"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.NotebookService/StartNotebookRuntime", request_serializer=notebook_service.StartNotebookRuntimeRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -609,7 +697,7 @@ def stop_notebook_runtime( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "stop_notebook_runtime" not in self._stubs: - self._stubs["stop_notebook_runtime"] = self.grpc_channel.unary_unary( + self._stubs["stop_notebook_runtime"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.NotebookService/StopNotebookRuntime", request_serializer=notebook_service.StopNotebookRuntimeRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -639,7 +727,7 @@ def create_notebook_execution_job( if "create_notebook_execution_job" not in self._stubs: self._stubs[ "create_notebook_execution_job" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.NotebookService/CreateNotebookExecutionJob", request_serializer=notebook_service.CreateNotebookExecutionJobRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -668,7 +756,9 @@ def get_notebook_execution_job( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_notebook_execution_job" not in self._stubs: - self._stubs["get_notebook_execution_job"] = self.grpc_channel.unary_unary( + self._stubs[ + "get_notebook_execution_job" + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.NotebookService/GetNotebookExecutionJob", request_serializer=notebook_service.GetNotebookExecutionJobRequest.serialize, response_deserializer=notebook_execution_job.NotebookExecutionJob.deserialize, @@ -697,7 +787,9 @@ def list_notebook_execution_jobs( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_notebook_execution_jobs" not in self._stubs: - self._stubs["list_notebook_execution_jobs"] = self.grpc_channel.unary_unary( + self._stubs[ + "list_notebook_execution_jobs" + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.NotebookService/ListNotebookExecutionJobs", request_serializer=notebook_service.ListNotebookExecutionJobsRequest.serialize, response_deserializer=notebook_service.ListNotebookExecutionJobsResponse.deserialize, @@ -727,7 +819,7 @@ def delete_notebook_execution_job( if "delete_notebook_execution_job" not in self._stubs: self._stubs[ "delete_notebook_execution_job" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.NotebookService/DeleteNotebookExecutionJob", request_serializer=notebook_service.DeleteNotebookExecutionJobRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -735,7 +827,7 @@ def delete_notebook_execution_job( return self._stubs["delete_notebook_execution_job"] def close(self): - self.grpc_channel.close() + self._logged_channel.close() @property def delete_operation( @@ -747,7 +839,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, @@ -764,7 +856,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -781,7 +873,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -798,7 +890,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, @@ -817,7 +909,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, @@ -836,7 +928,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -853,7 +945,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -878,7 +970,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -904,7 +996,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -933,7 +1025,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1/services/notebook_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1/services/notebook_service/transports/grpc_asyncio.py index 1687d33d5e..e6c232e5fa 100644 --- a/google/cloud/aiplatform_v1/services/notebook_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1/services/notebook_service/transports/grpc_asyncio.py @@ -14,6 +14,9 @@ # limitations under the License. # import inspect +import json +import pickle +import logging as std_logging import warnings from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union @@ -24,8 +27,11 @@ from google.api_core import operations_v1 from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from grpc.experimental import aio # type: ignore from google.cloud.aiplatform_v1.types import notebook_execution_job @@ -38,6 +44,82 @@ from .base import NotebookServiceTransport, DEFAULT_CLIENT_INFO from .grpc import NotebookServiceGrpcTransport +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.aiplatform.v1.NotebookService", + "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.aiplatform.v1.NotebookService", + "rpcName": str(client_call_details.method), + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class NotebookServiceGrpcAsyncIOTransport(NotebookServiceTransport): """gRPC AsyncIO backend transport for NotebookService. @@ -236,10 +318,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 @@ -262,7 +347,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. @@ -293,7 +378,7 @@ def create_notebook_runtime_template( if "create_notebook_runtime_template" not in self._stubs: self._stubs[ "create_notebook_runtime_template" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.NotebookService/CreateNotebookRuntimeTemplate", request_serializer=notebook_service.CreateNotebookRuntimeTemplateRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -324,7 +409,7 @@ def get_notebook_runtime_template( if "get_notebook_runtime_template" not in self._stubs: self._stubs[ "get_notebook_runtime_template" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.NotebookService/GetNotebookRuntimeTemplate", request_serializer=notebook_service.GetNotebookRuntimeTemplateRequest.serialize, response_deserializer=notebook_runtime.NotebookRuntimeTemplate.deserialize, @@ -356,7 +441,7 @@ def list_notebook_runtime_templates( if "list_notebook_runtime_templates" not in self._stubs: self._stubs[ "list_notebook_runtime_templates" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.NotebookService/ListNotebookRuntimeTemplates", request_serializer=notebook_service.ListNotebookRuntimeTemplatesRequest.serialize, response_deserializer=notebook_service.ListNotebookRuntimeTemplatesResponse.deserialize, @@ -388,7 +473,7 @@ def delete_notebook_runtime_template( if "delete_notebook_runtime_template" not in self._stubs: self._stubs[ "delete_notebook_runtime_template" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.NotebookService/DeleteNotebookRuntimeTemplate", request_serializer=notebook_service.DeleteNotebookRuntimeTemplateRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -420,7 +505,7 @@ def update_notebook_runtime_template( if "update_notebook_runtime_template" not in self._stubs: self._stubs[ "update_notebook_runtime_template" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.NotebookService/UpdateNotebookRuntimeTemplate", request_serializer=notebook_service.UpdateNotebookRuntimeTemplateRequest.serialize, response_deserializer=notebook_runtime.NotebookRuntimeTemplate.deserialize, @@ -451,7 +536,7 @@ def assign_notebook_runtime( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "assign_notebook_runtime" not in self._stubs: - self._stubs["assign_notebook_runtime"] = self.grpc_channel.unary_unary( + self._stubs["assign_notebook_runtime"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.NotebookService/AssignNotebookRuntime", request_serializer=notebook_service.AssignNotebookRuntimeRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -480,7 +565,7 @@ def get_notebook_runtime( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_notebook_runtime" not in self._stubs: - self._stubs["get_notebook_runtime"] = self.grpc_channel.unary_unary( + self._stubs["get_notebook_runtime"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.NotebookService/GetNotebookRuntime", request_serializer=notebook_service.GetNotebookRuntimeRequest.serialize, response_deserializer=notebook_runtime.NotebookRuntime.deserialize, @@ -509,7 +594,7 @@ def list_notebook_runtimes( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_notebook_runtimes" not in self._stubs: - self._stubs["list_notebook_runtimes"] = self.grpc_channel.unary_unary( + self._stubs["list_notebook_runtimes"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.NotebookService/ListNotebookRuntimes", request_serializer=notebook_service.ListNotebookRuntimesRequest.serialize, response_deserializer=notebook_service.ListNotebookRuntimesResponse.deserialize, @@ -538,7 +623,7 @@ def delete_notebook_runtime( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_notebook_runtime" not in self._stubs: - self._stubs["delete_notebook_runtime"] = self.grpc_channel.unary_unary( + self._stubs["delete_notebook_runtime"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.NotebookService/DeleteNotebookRuntime", request_serializer=notebook_service.DeleteNotebookRuntimeRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -567,7 +652,7 @@ def upgrade_notebook_runtime( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "upgrade_notebook_runtime" not in self._stubs: - self._stubs["upgrade_notebook_runtime"] = self.grpc_channel.unary_unary( + self._stubs["upgrade_notebook_runtime"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.NotebookService/UpgradeNotebookRuntime", request_serializer=notebook_service.UpgradeNotebookRuntimeRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -596,7 +681,7 @@ def start_notebook_runtime( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "start_notebook_runtime" not in self._stubs: - self._stubs["start_notebook_runtime"] = self.grpc_channel.unary_unary( + self._stubs["start_notebook_runtime"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.NotebookService/StartNotebookRuntime", request_serializer=notebook_service.StartNotebookRuntimeRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -625,7 +710,7 @@ def stop_notebook_runtime( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "stop_notebook_runtime" not in self._stubs: - self._stubs["stop_notebook_runtime"] = self.grpc_channel.unary_unary( + self._stubs["stop_notebook_runtime"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.NotebookService/StopNotebookRuntime", request_serializer=notebook_service.StopNotebookRuntimeRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -656,7 +741,7 @@ def create_notebook_execution_job( if "create_notebook_execution_job" not in self._stubs: self._stubs[ "create_notebook_execution_job" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.NotebookService/CreateNotebookExecutionJob", request_serializer=notebook_service.CreateNotebookExecutionJobRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -685,7 +770,9 @@ def get_notebook_execution_job( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_notebook_execution_job" not in self._stubs: - self._stubs["get_notebook_execution_job"] = self.grpc_channel.unary_unary( + self._stubs[ + "get_notebook_execution_job" + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.NotebookService/GetNotebookExecutionJob", request_serializer=notebook_service.GetNotebookExecutionJobRequest.serialize, response_deserializer=notebook_execution_job.NotebookExecutionJob.deserialize, @@ -714,7 +801,9 @@ def list_notebook_execution_jobs( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_notebook_execution_jobs" not in self._stubs: - self._stubs["list_notebook_execution_jobs"] = self.grpc_channel.unary_unary( + self._stubs[ + "list_notebook_execution_jobs" + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.NotebookService/ListNotebookExecutionJobs", request_serializer=notebook_service.ListNotebookExecutionJobsRequest.serialize, response_deserializer=notebook_service.ListNotebookExecutionJobsResponse.deserialize, @@ -745,7 +834,7 @@ def delete_notebook_execution_job( if "delete_notebook_execution_job" not in self._stubs: self._stubs[ "delete_notebook_execution_job" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.NotebookService/DeleteNotebookExecutionJob", request_serializer=notebook_service.DeleteNotebookExecutionJobRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -893,7 +982,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: @@ -909,7 +998,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, @@ -926,7 +1015,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -943,7 +1032,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -960,7 +1049,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, @@ -979,7 +1068,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, @@ -998,7 +1087,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -1015,7 +1104,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -1040,7 +1129,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -1066,7 +1155,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -1095,7 +1184,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1/services/notebook_service/transports/rest.py b/google/cloud/aiplatform_v1/services/notebook_service/transports/rest.py index 64df08560b..4fcbed978f 100644 --- a/google/cloud/aiplatform_v1/services/notebook_service/transports/rest.py +++ b/google/cloud/aiplatform_v1/services/notebook_service/transports/rest.py @@ -13,9 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging +import json # type: ignore from google.auth.transport.requests import AuthorizedSession # type: ignore -import json # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.api_core import exceptions as core_exceptions from google.api_core import retry as retries @@ -49,6 +50,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, @@ -209,9 +218,10 @@ def post_upgrade_notebook_runtime(self, response): def pre_assign_notebook_runtime( self, request: notebook_service.AssignNotebookRuntimeRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - notebook_service.AssignNotebookRuntimeRequest, Sequence[Tuple[str, str]] + notebook_service.AssignNotebookRuntimeRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for assign_notebook_runtime @@ -234,9 +244,10 @@ def post_assign_notebook_runtime( def pre_create_notebook_execution_job( self, request: notebook_service.CreateNotebookExecutionJobRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - notebook_service.CreateNotebookExecutionJobRequest, Sequence[Tuple[str, str]] + notebook_service.CreateNotebookExecutionJobRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for create_notebook_execution_job @@ -259,9 +270,10 @@ def post_create_notebook_execution_job( def pre_create_notebook_runtime_template( self, request: notebook_service.CreateNotebookRuntimeTemplateRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - notebook_service.CreateNotebookRuntimeTemplateRequest, Sequence[Tuple[str, str]] + notebook_service.CreateNotebookRuntimeTemplateRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for create_notebook_runtime_template @@ -284,9 +296,10 @@ def post_create_notebook_runtime_template( def pre_delete_notebook_execution_job( self, request: notebook_service.DeleteNotebookExecutionJobRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - notebook_service.DeleteNotebookExecutionJobRequest, Sequence[Tuple[str, str]] + notebook_service.DeleteNotebookExecutionJobRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for delete_notebook_execution_job @@ -309,9 +322,10 @@ def post_delete_notebook_execution_job( def pre_delete_notebook_runtime( self, request: notebook_service.DeleteNotebookRuntimeRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - notebook_service.DeleteNotebookRuntimeRequest, Sequence[Tuple[str, str]] + notebook_service.DeleteNotebookRuntimeRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for delete_notebook_runtime @@ -334,9 +348,10 @@ def post_delete_notebook_runtime( def pre_delete_notebook_runtime_template( self, request: notebook_service.DeleteNotebookRuntimeTemplateRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - notebook_service.DeleteNotebookRuntimeTemplateRequest, Sequence[Tuple[str, str]] + notebook_service.DeleteNotebookRuntimeTemplateRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for delete_notebook_runtime_template @@ -359,9 +374,10 @@ def post_delete_notebook_runtime_template( def pre_get_notebook_execution_job( self, request: notebook_service.GetNotebookExecutionJobRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - notebook_service.GetNotebookExecutionJobRequest, Sequence[Tuple[str, str]] + notebook_service.GetNotebookExecutionJobRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for get_notebook_execution_job @@ -384,8 +400,11 @@ def post_get_notebook_execution_job( def pre_get_notebook_runtime( self, request: notebook_service.GetNotebookRuntimeRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[notebook_service.GetNotebookRuntimeRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + notebook_service.GetNotebookRuntimeRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for get_notebook_runtime Override in a subclass to manipulate the request or metadata @@ -407,9 +426,10 @@ def post_get_notebook_runtime( def pre_get_notebook_runtime_template( self, request: notebook_service.GetNotebookRuntimeTemplateRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - notebook_service.GetNotebookRuntimeTemplateRequest, Sequence[Tuple[str, str]] + notebook_service.GetNotebookRuntimeTemplateRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for get_notebook_runtime_template @@ -432,9 +452,10 @@ def post_get_notebook_runtime_template( def pre_list_notebook_execution_jobs( self, request: notebook_service.ListNotebookExecutionJobsRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - notebook_service.ListNotebookExecutionJobsRequest, Sequence[Tuple[str, str]] + notebook_service.ListNotebookExecutionJobsRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for list_notebook_execution_jobs @@ -457,8 +478,11 @@ def post_list_notebook_execution_jobs( def pre_list_notebook_runtimes( self, request: notebook_service.ListNotebookRuntimesRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[notebook_service.ListNotebookRuntimesRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + notebook_service.ListNotebookRuntimesRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for list_notebook_runtimes Override in a subclass to manipulate the request or metadata @@ -480,9 +504,10 @@ def post_list_notebook_runtimes( def pre_list_notebook_runtime_templates( self, request: notebook_service.ListNotebookRuntimeTemplatesRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - notebook_service.ListNotebookRuntimeTemplatesRequest, Sequence[Tuple[str, str]] + notebook_service.ListNotebookRuntimeTemplatesRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for list_notebook_runtime_templates @@ -505,8 +530,11 @@ def post_list_notebook_runtime_templates( def pre_start_notebook_runtime( self, request: notebook_service.StartNotebookRuntimeRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[notebook_service.StartNotebookRuntimeRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + notebook_service.StartNotebookRuntimeRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for start_notebook_runtime Override in a subclass to manipulate the request or metadata @@ -528,8 +556,11 @@ def post_start_notebook_runtime( def pre_stop_notebook_runtime( self, request: notebook_service.StopNotebookRuntimeRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[notebook_service.StopNotebookRuntimeRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + notebook_service.StopNotebookRuntimeRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for stop_notebook_runtime Override in a subclass to manipulate the request or metadata @@ -551,9 +582,10 @@ def post_stop_notebook_runtime( def pre_update_notebook_runtime_template( self, request: notebook_service.UpdateNotebookRuntimeTemplateRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - notebook_service.UpdateNotebookRuntimeTemplateRequest, Sequence[Tuple[str, str]] + notebook_service.UpdateNotebookRuntimeTemplateRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for update_notebook_runtime_template @@ -576,9 +608,10 @@ def post_update_notebook_runtime_template( def pre_upgrade_notebook_runtime( self, request: notebook_service.UpgradeNotebookRuntimeRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - notebook_service.UpgradeNotebookRuntimeRequest, Sequence[Tuple[str, str]] + notebook_service.UpgradeNotebookRuntimeRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for upgrade_notebook_runtime @@ -601,8 +634,10 @@ def post_upgrade_notebook_runtime( def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -624,8 +659,10 @@ def post_get_location( def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -647,8 +684,10 @@ def post_list_locations( def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -668,8 +707,10 @@ def post_get_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -689,8 +730,11 @@ def post_set_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -712,8 +756,10 @@ def post_test_iam_permissions( def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -733,8 +779,10 @@ def post_cancel_operation(self, response: None) -> None: 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 @@ -754,8 +802,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 @@ -777,8 +827,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 @@ -800,8 +852,10 @@ def post_list_operations( def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -2824,7 +2878,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 assign notebook runtime method over HTTP. @@ -2835,8 +2889,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: @@ -2849,6 +2905,7 @@ def __call__( http_options = ( _BaseNotebookServiceRestTransport._BaseAssignNotebookRuntime._get_http_options() ) + request, metadata = self._interceptor.pre_assign_notebook_runtime( request, metadata ) @@ -2865,6 +2922,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.aiplatform_v1.NotebookServiceClient.AssignNotebookRuntime", + extra={ + "serviceName": "google.cloud.aiplatform.v1.NotebookService", + "rpcName": "AssignNotebookRuntime", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( NotebookServiceRestTransport._AssignNotebookRuntime._get_response( @@ -2886,7 +2970,29 @@ def __call__( # Return the response resp = operations_pb2.Operation() json_format.Parse(response.content, resp, ignore_unknown_fields=True) + resp = self._interceptor.post_assign_notebook_runtime(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.aiplatform_v1.NotebookServiceClient.assign_notebook_runtime", + extra={ + "serviceName": "google.cloud.aiplatform.v1.NotebookService", + "rpcName": "AssignNotebookRuntime", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _CreateNotebookExecutionJob( @@ -2926,7 +3032,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 notebook execution job method over HTTP. @@ -2938,8 +3044,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: @@ -2952,6 +3060,7 @@ def __call__( http_options = ( _BaseNotebookServiceRestTransport._BaseCreateNotebookExecutionJob._get_http_options() ) + request, metadata = self._interceptor.pre_create_notebook_execution_job( request, metadata ) @@ -2968,6 +3077,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.aiplatform_v1.NotebookServiceClient.CreateNotebookExecutionJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1.NotebookService", + "rpcName": "CreateNotebookExecutionJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( NotebookServiceRestTransport._CreateNotebookExecutionJob._get_response( @@ -2989,7 +3125,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_notebook_execution_job(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.aiplatform_v1.NotebookServiceClient.create_notebook_execution_job", + extra={ + "serviceName": "google.cloud.aiplatform.v1.NotebookService", + "rpcName": "CreateNotebookExecutionJob", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _CreateNotebookRuntimeTemplate( @@ -3029,7 +3187,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 notebook runtime template method over HTTP. @@ -3041,8 +3199,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: @@ -3055,6 +3215,7 @@ def __call__( http_options = ( _BaseNotebookServiceRestTransport._BaseCreateNotebookRuntimeTemplate._get_http_options() ) + request, metadata = self._interceptor.pre_create_notebook_runtime_template( request, metadata ) @@ -3071,6 +3232,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.aiplatform_v1.NotebookServiceClient.CreateNotebookRuntimeTemplate", + extra={ + "serviceName": "google.cloud.aiplatform.v1.NotebookService", + "rpcName": "CreateNotebookRuntimeTemplate", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = NotebookServiceRestTransport._CreateNotebookRuntimeTemplate._get_response( self._host, @@ -3090,7 +3278,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_notebook_runtime_template(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.aiplatform_v1.NotebookServiceClient.create_notebook_runtime_template", + extra={ + "serviceName": "google.cloud.aiplatform.v1.NotebookService", + "rpcName": "CreateNotebookRuntimeTemplate", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _DeleteNotebookExecutionJob( @@ -3129,7 +3339,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 notebook execution job method over HTTP. @@ -3141,8 +3351,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: @@ -3155,6 +3367,7 @@ def __call__( http_options = ( _BaseNotebookServiceRestTransport._BaseDeleteNotebookExecutionJob._get_http_options() ) + request, metadata = self._interceptor.pre_delete_notebook_execution_job( request, metadata ) @@ -3167,6 +3380,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.aiplatform_v1.NotebookServiceClient.DeleteNotebookExecutionJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1.NotebookService", + "rpcName": "DeleteNotebookExecutionJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( NotebookServiceRestTransport._DeleteNotebookExecutionJob._get_response( @@ -3187,7 +3427,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_notebook_execution_job(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.aiplatform_v1.NotebookServiceClient.delete_notebook_execution_job", + extra={ + "serviceName": "google.cloud.aiplatform.v1.NotebookService", + "rpcName": "DeleteNotebookExecutionJob", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _DeleteNotebookRuntime( @@ -3226,7 +3488,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 notebook runtime method over HTTP. @@ -3237,8 +3499,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: @@ -3251,6 +3515,7 @@ def __call__( http_options = ( _BaseNotebookServiceRestTransport._BaseDeleteNotebookRuntime._get_http_options() ) + request, metadata = self._interceptor.pre_delete_notebook_runtime( request, metadata ) @@ -3263,6 +3528,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.aiplatform_v1.NotebookServiceClient.DeleteNotebookRuntime", + extra={ + "serviceName": "google.cloud.aiplatform.v1.NotebookService", + "rpcName": "DeleteNotebookRuntime", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( NotebookServiceRestTransport._DeleteNotebookRuntime._get_response( @@ -3283,7 +3575,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_notebook_runtime(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.aiplatform_v1.NotebookServiceClient.delete_notebook_runtime", + extra={ + "serviceName": "google.cloud.aiplatform.v1.NotebookService", + "rpcName": "DeleteNotebookRuntime", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _DeleteNotebookRuntimeTemplate( @@ -3322,7 +3636,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 notebook runtime template method over HTTP. @@ -3334,8 +3648,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: @@ -3348,6 +3664,7 @@ def __call__( http_options = ( _BaseNotebookServiceRestTransport._BaseDeleteNotebookRuntimeTemplate._get_http_options() ) + request, metadata = self._interceptor.pre_delete_notebook_runtime_template( request, metadata ) @@ -3360,6 +3677,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.aiplatform_v1.NotebookServiceClient.DeleteNotebookRuntimeTemplate", + extra={ + "serviceName": "google.cloud.aiplatform.v1.NotebookService", + "rpcName": "DeleteNotebookRuntimeTemplate", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = NotebookServiceRestTransport._DeleteNotebookRuntimeTemplate._get_response( self._host, @@ -3378,7 +3722,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_notebook_runtime_template(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.aiplatform_v1.NotebookServiceClient.delete_notebook_runtime_template", + extra={ + "serviceName": "google.cloud.aiplatform.v1.NotebookService", + "rpcName": "DeleteNotebookRuntimeTemplate", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _GetNotebookExecutionJob( @@ -3417,7 +3783,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]]] = (), ) -> notebook_execution_job.NotebookExecutionJob: r"""Call the get notebook execution job method over HTTP. @@ -3429,8 +3795,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: ~.notebook_execution_job.NotebookExecutionJob: @@ -3442,6 +3810,7 @@ def __call__( http_options = ( _BaseNotebookServiceRestTransport._BaseGetNotebookExecutionJob._get_http_options() ) + request, metadata = self._interceptor.pre_get_notebook_execution_job( request, metadata ) @@ -3454,6 +3823,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.aiplatform_v1.NotebookServiceClient.GetNotebookExecutionJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1.NotebookService", + "rpcName": "GetNotebookExecutionJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( NotebookServiceRestTransport._GetNotebookExecutionJob._get_response( @@ -3476,7 +3872,31 @@ def __call__( pb_resp = notebook_execution_job.NotebookExecutionJob.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_notebook_execution_job(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + notebook_execution_job.NotebookExecutionJob.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.aiplatform_v1.NotebookServiceClient.get_notebook_execution_job", + extra={ + "serviceName": "google.cloud.aiplatform.v1.NotebookService", + "rpcName": "GetNotebookExecutionJob", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _GetNotebookRuntime( @@ -3515,7 +3935,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]]] = (), ) -> notebook_runtime.NotebookRuntime: r"""Call the get notebook runtime method over HTTP. @@ -3526,8 +3946,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: ~.notebook_runtime.NotebookRuntime: @@ -3541,6 +3963,7 @@ def __call__( http_options = ( _BaseNotebookServiceRestTransport._BaseGetNotebookRuntime._get_http_options() ) + request, metadata = self._interceptor.pre_get_notebook_runtime( request, metadata ) @@ -3553,6 +3976,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.aiplatform_v1.NotebookServiceClient.GetNotebookRuntime", + extra={ + "serviceName": "google.cloud.aiplatform.v1.NotebookService", + "rpcName": "GetNotebookRuntime", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = NotebookServiceRestTransport._GetNotebookRuntime._get_response( self._host, @@ -3573,7 +4023,31 @@ def __call__( pb_resp = notebook_runtime.NotebookRuntime.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_notebook_runtime(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = notebook_runtime.NotebookRuntime.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.aiplatform_v1.NotebookServiceClient.get_notebook_runtime", + extra={ + "serviceName": "google.cloud.aiplatform.v1.NotebookService", + "rpcName": "GetNotebookRuntime", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _GetNotebookRuntimeTemplate( @@ -3612,7 +4086,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]]] = (), ) -> notebook_runtime.NotebookRuntimeTemplate: r"""Call the get notebook runtime template method over HTTP. @@ -3624,8 +4098,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: ~.notebook_runtime.NotebookRuntimeTemplate: @@ -3640,6 +4116,7 @@ def __call__( http_options = ( _BaseNotebookServiceRestTransport._BaseGetNotebookRuntimeTemplate._get_http_options() ) + request, metadata = self._interceptor.pre_get_notebook_runtime_template( request, metadata ) @@ -3652,6 +4129,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.aiplatform_v1.NotebookServiceClient.GetNotebookRuntimeTemplate", + extra={ + "serviceName": "google.cloud.aiplatform.v1.NotebookService", + "rpcName": "GetNotebookRuntimeTemplate", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( NotebookServiceRestTransport._GetNotebookRuntimeTemplate._get_response( @@ -3674,7 +4178,31 @@ def __call__( pb_resp = notebook_runtime.NotebookRuntimeTemplate.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_notebook_runtime_template(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = notebook_runtime.NotebookRuntimeTemplate.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.aiplatform_v1.NotebookServiceClient.get_notebook_runtime_template", + extra={ + "serviceName": "google.cloud.aiplatform.v1.NotebookService", + "rpcName": "GetNotebookRuntimeTemplate", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListNotebookExecutionJobs( @@ -3713,7 +4241,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]]] = (), ) -> notebook_service.ListNotebookExecutionJobsResponse: r"""Call the list notebook execution jobs method over HTTP. @@ -3725,8 +4253,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: ~.notebook_service.ListNotebookExecutionJobsResponse: @@ -3738,6 +4268,7 @@ def __call__( http_options = ( _BaseNotebookServiceRestTransport._BaseListNotebookExecutionJobs._get_http_options() ) + request, metadata = self._interceptor.pre_list_notebook_execution_jobs( request, metadata ) @@ -3750,6 +4281,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.aiplatform_v1.NotebookServiceClient.ListNotebookExecutionJobs", + extra={ + "serviceName": "google.cloud.aiplatform.v1.NotebookService", + "rpcName": "ListNotebookExecutionJobs", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( NotebookServiceRestTransport._ListNotebookExecutionJobs._get_response( @@ -3772,7 +4330,33 @@ def __call__( pb_resp = notebook_service.ListNotebookExecutionJobsResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_notebook_execution_jobs(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + notebook_service.ListNotebookExecutionJobsResponse.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.aiplatform_v1.NotebookServiceClient.list_notebook_execution_jobs", + extra={ + "serviceName": "google.cloud.aiplatform.v1.NotebookService", + "rpcName": "ListNotebookExecutionJobs", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListNotebookRuntimes( @@ -3811,7 +4395,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]]] = (), ) -> notebook_service.ListNotebookRuntimesResponse: r"""Call the list notebook runtimes method over HTTP. @@ -3822,8 +4406,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: ~.notebook_service.ListNotebookRuntimesResponse: @@ -3835,6 +4421,7 @@ def __call__( http_options = ( _BaseNotebookServiceRestTransport._BaseListNotebookRuntimes._get_http_options() ) + request, metadata = self._interceptor.pre_list_notebook_runtimes( request, metadata ) @@ -3847,6 +4434,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.aiplatform_v1.NotebookServiceClient.ListNotebookRuntimes", + extra={ + "serviceName": "google.cloud.aiplatform.v1.NotebookService", + "rpcName": "ListNotebookRuntimes", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = NotebookServiceRestTransport._ListNotebookRuntimes._get_response( self._host, @@ -3867,7 +4481,31 @@ def __call__( pb_resp = notebook_service.ListNotebookRuntimesResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_notebook_runtimes(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + notebook_service.ListNotebookRuntimesResponse.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.aiplatform_v1.NotebookServiceClient.list_notebook_runtimes", + extra={ + "serviceName": "google.cloud.aiplatform.v1.NotebookService", + "rpcName": "ListNotebookRuntimes", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListNotebookRuntimeTemplates( @@ -3906,7 +4544,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]]] = (), ) -> notebook_service.ListNotebookRuntimeTemplatesResponse: r"""Call the list notebook runtime templates method over HTTP. @@ -3918,8 +4556,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: ~.notebook_service.ListNotebookRuntimeTemplatesResponse: @@ -3931,6 +4571,7 @@ def __call__( http_options = ( _BaseNotebookServiceRestTransport._BaseListNotebookRuntimeTemplates._get_http_options() ) + request, metadata = self._interceptor.pre_list_notebook_runtime_templates( request, metadata ) @@ -3943,6 +4584,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.aiplatform_v1.NotebookServiceClient.ListNotebookRuntimeTemplates", + extra={ + "serviceName": "google.cloud.aiplatform.v1.NotebookService", + "rpcName": "ListNotebookRuntimeTemplates", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = NotebookServiceRestTransport._ListNotebookRuntimeTemplates._get_response( self._host, @@ -3963,7 +4631,33 @@ def __call__( pb_resp = notebook_service.ListNotebookRuntimeTemplatesResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_notebook_runtime_templates(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + notebook_service.ListNotebookRuntimeTemplatesResponse.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.aiplatform_v1.NotebookServiceClient.list_notebook_runtime_templates", + extra={ + "serviceName": "google.cloud.aiplatform.v1.NotebookService", + "rpcName": "ListNotebookRuntimeTemplates", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _StartNotebookRuntime( @@ -4003,7 +4697,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 start notebook runtime method over HTTP. @@ -4014,8 +4708,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: @@ -4028,6 +4724,7 @@ def __call__( http_options = ( _BaseNotebookServiceRestTransport._BaseStartNotebookRuntime._get_http_options() ) + request, metadata = self._interceptor.pre_start_notebook_runtime( request, metadata ) @@ -4044,6 +4741,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.aiplatform_v1.NotebookServiceClient.StartNotebookRuntime", + extra={ + "serviceName": "google.cloud.aiplatform.v1.NotebookService", + "rpcName": "StartNotebookRuntime", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = NotebookServiceRestTransport._StartNotebookRuntime._get_response( self._host, @@ -4063,7 +4787,29 @@ def __call__( # Return the response resp = operations_pb2.Operation() json_format.Parse(response.content, resp, ignore_unknown_fields=True) + resp = self._interceptor.post_start_notebook_runtime(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.aiplatform_v1.NotebookServiceClient.start_notebook_runtime", + extra={ + "serviceName": "google.cloud.aiplatform.v1.NotebookService", + "rpcName": "StartNotebookRuntime", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _StopNotebookRuntime( @@ -4103,7 +4849,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 stop notebook runtime method over HTTP. @@ -4114,8 +4860,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: @@ -4128,6 +4876,7 @@ def __call__( http_options = ( _BaseNotebookServiceRestTransport._BaseStopNotebookRuntime._get_http_options() ) + request, metadata = self._interceptor.pre_stop_notebook_runtime( request, metadata ) @@ -4144,6 +4893,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.aiplatform_v1.NotebookServiceClient.StopNotebookRuntime", + extra={ + "serviceName": "google.cloud.aiplatform.v1.NotebookService", + "rpcName": "StopNotebookRuntime", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = NotebookServiceRestTransport._StopNotebookRuntime._get_response( self._host, @@ -4163,7 +4939,29 @@ def __call__( # Return the response resp = operations_pb2.Operation() json_format.Parse(response.content, resp, ignore_unknown_fields=True) + resp = self._interceptor.post_stop_notebook_runtime(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.aiplatform_v1.NotebookServiceClient.stop_notebook_runtime", + extra={ + "serviceName": "google.cloud.aiplatform.v1.NotebookService", + "rpcName": "StopNotebookRuntime", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _UpdateNotebookRuntimeTemplate( @@ -4203,7 +5001,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]]] = (), ) -> notebook_runtime.NotebookRuntimeTemplate: r"""Call the update notebook runtime template method over HTTP. @@ -4215,8 +5013,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: ~.notebook_runtime.NotebookRuntimeTemplate: @@ -4231,6 +5031,7 @@ def __call__( http_options = ( _BaseNotebookServiceRestTransport._BaseUpdateNotebookRuntimeTemplate._get_http_options() ) + request, metadata = self._interceptor.pre_update_notebook_runtime_template( request, metadata ) @@ -4247,6 +5048,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.aiplatform_v1.NotebookServiceClient.UpdateNotebookRuntimeTemplate", + extra={ + "serviceName": "google.cloud.aiplatform.v1.NotebookService", + "rpcName": "UpdateNotebookRuntimeTemplate", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = NotebookServiceRestTransport._UpdateNotebookRuntimeTemplate._get_response( self._host, @@ -4268,7 +5096,31 @@ def __call__( pb_resp = notebook_runtime.NotebookRuntimeTemplate.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_update_notebook_runtime_template(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = notebook_runtime.NotebookRuntimeTemplate.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.aiplatform_v1.NotebookServiceClient.update_notebook_runtime_template", + extra={ + "serviceName": "google.cloud.aiplatform.v1.NotebookService", + "rpcName": "UpdateNotebookRuntimeTemplate", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _UpgradeNotebookRuntime( @@ -4308,7 +5160,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 upgrade notebook runtime method over HTTP. @@ -4319,8 +5171,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: @@ -4333,6 +5187,7 @@ def __call__( http_options = ( _BaseNotebookServiceRestTransport._BaseUpgradeNotebookRuntime._get_http_options() ) + request, metadata = self._interceptor.pre_upgrade_notebook_runtime( request, metadata ) @@ -4349,6 +5204,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.aiplatform_v1.NotebookServiceClient.UpgradeNotebookRuntime", + extra={ + "serviceName": "google.cloud.aiplatform.v1.NotebookService", + "rpcName": "UpgradeNotebookRuntime", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( NotebookServiceRestTransport._UpgradeNotebookRuntime._get_response( @@ -4370,7 +5252,29 @@ def __call__( # Return the response resp = operations_pb2.Operation() json_format.Parse(response.content, resp, ignore_unknown_fields=True) + resp = self._interceptor.post_upgrade_notebook_runtime(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.aiplatform_v1.NotebookServiceClient.upgrade_notebook_runtime", + extra={ + "serviceName": "google.cloud.aiplatform.v1.NotebookService", + "rpcName": "UpgradeNotebookRuntime", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp @property @@ -4580,7 +5484,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]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -4591,8 +5495,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: locations_pb2.Location: Response from GetLocation method. @@ -4601,6 +5507,7 @@ def __call__( http_options = ( _BaseNotebookServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = self._interceptor.pre_get_location(request, metadata) transcoded_request = _BaseNotebookServiceRestTransport._BaseGetLocation._get_transcoded_request( http_options, request @@ -4611,6 +5518,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.aiplatform_v1.NotebookServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.NotebookService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = NotebookServiceRestTransport._GetLocation._get_response( self._host, @@ -4630,6 +5564,27 @@ def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_location(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.aiplatform_v1.NotebookServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.NotebookService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4671,7 +5626,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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -4682,8 +5637,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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -4692,6 +5649,7 @@ def __call__( http_options = ( _BaseNotebookServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = self._interceptor.pre_list_locations(request, metadata) transcoded_request = _BaseNotebookServiceRestTransport._BaseListLocations._get_transcoded_request( http_options, request @@ -4702,6 +5660,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.aiplatform_v1.NotebookServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.NotebookService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = NotebookServiceRestTransport._ListLocations._get_response( self._host, @@ -4721,6 +5706,27 @@ def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_list_locations(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.aiplatform_v1.NotebookServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.NotebookService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4762,7 +5768,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]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -4773,8 +5779,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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -4783,6 +5791,7 @@ def __call__( http_options = ( _BaseNotebookServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_get_iam_policy(request, metadata) transcoded_request = _BaseNotebookServiceRestTransport._BaseGetIamPolicy._get_transcoded_request( http_options, request @@ -4793,6 +5802,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.aiplatform_v1.NotebookServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.NotebookService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = NotebookServiceRestTransport._GetIamPolicy._get_response( self._host, @@ -4812,6 +5848,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_iam_policy(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.aiplatform_v1.NotebookServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.NotebookService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4854,7 +5911,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]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -4865,8 +5922,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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -4875,6 +5934,7 @@ def __call__( http_options = ( _BaseNotebookServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_set_iam_policy(request, metadata) transcoded_request = _BaseNotebookServiceRestTransport._BaseSetIamPolicy._get_transcoded_request( http_options, request @@ -4889,6 +5949,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.aiplatform_v1.NotebookServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.NotebookService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = NotebookServiceRestTransport._SetIamPolicy._get_response( self._host, @@ -4909,6 +5996,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_set_iam_policy(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.aiplatform_v1.NotebookServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.NotebookService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4951,7 +6059,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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -4962,8 +6070,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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -4972,6 +6082,7 @@ def __call__( http_options = ( _BaseNotebookServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -4984,6 +6095,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.aiplatform_v1.NotebookServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.NotebookService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = NotebookServiceRestTransport._TestIamPermissions._get_response( self._host, @@ -5003,6 +6141,27 @@ def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_test_iam_permissions(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.aiplatform_v1.NotebookServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.NotebookService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5044,7 +6203,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 cancel operation method over HTTP. @@ -5055,13 +6214,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 = ( _BaseNotebookServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = self._interceptor.pre_cancel_operation( request, metadata ) @@ -5074,6 +6236,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.aiplatform_v1.NotebookServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.NotebookService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = NotebookServiceRestTransport._CancelOperation._get_response( self._host, @@ -5130,7 +6319,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. @@ -5141,13 +6330,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 = ( _BaseNotebookServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = self._interceptor.pre_delete_operation( request, metadata ) @@ -5160,6 +6352,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.aiplatform_v1.NotebookServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.NotebookService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = NotebookServiceRestTransport._DeleteOperation._get_response( self._host, @@ -5216,7 +6435,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. @@ -5227,8 +6446,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. @@ -5237,6 +6458,7 @@ def __call__( http_options = ( _BaseNotebookServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = self._interceptor.pre_get_operation(request, metadata) transcoded_request = _BaseNotebookServiceRestTransport._BaseGetOperation._get_transcoded_request( http_options, request @@ -5247,6 +6469,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.aiplatform_v1.NotebookServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.NotebookService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = NotebookServiceRestTransport._GetOperation._get_response( self._host, @@ -5266,6 +6515,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.aiplatform_v1.NotebookServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.NotebookService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5307,7 +6577,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. @@ -5318,8 +6588,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. @@ -5328,6 +6600,7 @@ def __call__( http_options = ( _BaseNotebookServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = self._interceptor.pre_list_operations(request, metadata) transcoded_request = _BaseNotebookServiceRestTransport._BaseListOperations._get_transcoded_request( http_options, request @@ -5338,6 +6611,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.aiplatform_v1.NotebookServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.NotebookService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = NotebookServiceRestTransport._ListOperations._get_response( self._host, @@ -5357,6 +6657,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.aiplatform_v1.NotebookServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.NotebookService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5398,7 +6719,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 wait operation method over HTTP. @@ -5409,8 +6730,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 WaitOperation method. @@ -5419,6 +6742,7 @@ def __call__( http_options = ( _BaseNotebookServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = self._interceptor.pre_wait_operation(request, metadata) transcoded_request = _BaseNotebookServiceRestTransport._BaseWaitOperation._get_transcoded_request( http_options, request @@ -5429,6 +6753,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.aiplatform_v1.NotebookServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.NotebookService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = NotebookServiceRestTransport._WaitOperation._get_response( self._host, @@ -5448,6 +6799,27 @@ def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = self._interceptor.post_wait_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.aiplatform_v1.NotebookServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.NotebookService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1/services/notebook_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1/services/notebook_service/transports/rest_asyncio.py index 4e3c28bf88..bb38b8a807 100644 --- a/google/cloud/aiplatform_v1/services/notebook_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1/services/notebook_service/transports/rest_asyncio.py @@ -60,6 +60,18 @@ from .base import DEFAULT_CLIENT_INFO as BASE_DEFAULT_CLIENT_INFO + +import logging + +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__) + try: OptionalRetry = Union[retries.AsyncRetry, gapic_v1.method._MethodDefault, None] except AttributeError: # pragma: NO COVER @@ -224,9 +236,10 @@ async def post_upgrade_notebook_runtime(self, response): async def pre_assign_notebook_runtime( self, request: notebook_service.AssignNotebookRuntimeRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - notebook_service.AssignNotebookRuntimeRequest, Sequence[Tuple[str, str]] + notebook_service.AssignNotebookRuntimeRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for assign_notebook_runtime @@ -249,9 +262,10 @@ async def post_assign_notebook_runtime( async def pre_create_notebook_execution_job( self, request: notebook_service.CreateNotebookExecutionJobRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - notebook_service.CreateNotebookExecutionJobRequest, Sequence[Tuple[str, str]] + notebook_service.CreateNotebookExecutionJobRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for create_notebook_execution_job @@ -274,9 +288,10 @@ async def post_create_notebook_execution_job( async def pre_create_notebook_runtime_template( self, request: notebook_service.CreateNotebookRuntimeTemplateRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - notebook_service.CreateNotebookRuntimeTemplateRequest, Sequence[Tuple[str, str]] + notebook_service.CreateNotebookRuntimeTemplateRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for create_notebook_runtime_template @@ -299,9 +314,10 @@ async def post_create_notebook_runtime_template( async def pre_delete_notebook_execution_job( self, request: notebook_service.DeleteNotebookExecutionJobRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - notebook_service.DeleteNotebookExecutionJobRequest, Sequence[Tuple[str, str]] + notebook_service.DeleteNotebookExecutionJobRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for delete_notebook_execution_job @@ -324,9 +340,10 @@ async def post_delete_notebook_execution_job( async def pre_delete_notebook_runtime( self, request: notebook_service.DeleteNotebookRuntimeRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - notebook_service.DeleteNotebookRuntimeRequest, Sequence[Tuple[str, str]] + notebook_service.DeleteNotebookRuntimeRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for delete_notebook_runtime @@ -349,9 +366,10 @@ async def post_delete_notebook_runtime( async def pre_delete_notebook_runtime_template( self, request: notebook_service.DeleteNotebookRuntimeTemplateRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - notebook_service.DeleteNotebookRuntimeTemplateRequest, Sequence[Tuple[str, str]] + notebook_service.DeleteNotebookRuntimeTemplateRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for delete_notebook_runtime_template @@ -374,9 +392,10 @@ async def post_delete_notebook_runtime_template( async def pre_get_notebook_execution_job( self, request: notebook_service.GetNotebookExecutionJobRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - notebook_service.GetNotebookExecutionJobRequest, Sequence[Tuple[str, str]] + notebook_service.GetNotebookExecutionJobRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for get_notebook_execution_job @@ -399,8 +418,11 @@ async def post_get_notebook_execution_job( async def pre_get_notebook_runtime( self, request: notebook_service.GetNotebookRuntimeRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[notebook_service.GetNotebookRuntimeRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + notebook_service.GetNotebookRuntimeRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for get_notebook_runtime Override in a subclass to manipulate the request or metadata @@ -422,9 +444,10 @@ async def post_get_notebook_runtime( async def pre_get_notebook_runtime_template( self, request: notebook_service.GetNotebookRuntimeTemplateRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - notebook_service.GetNotebookRuntimeTemplateRequest, Sequence[Tuple[str, str]] + notebook_service.GetNotebookRuntimeTemplateRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for get_notebook_runtime_template @@ -447,9 +470,10 @@ async def post_get_notebook_runtime_template( async def pre_list_notebook_execution_jobs( self, request: notebook_service.ListNotebookExecutionJobsRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - notebook_service.ListNotebookExecutionJobsRequest, Sequence[Tuple[str, str]] + notebook_service.ListNotebookExecutionJobsRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for list_notebook_execution_jobs @@ -472,8 +496,11 @@ async def post_list_notebook_execution_jobs( async def pre_list_notebook_runtimes( self, request: notebook_service.ListNotebookRuntimesRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[notebook_service.ListNotebookRuntimesRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + notebook_service.ListNotebookRuntimesRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for list_notebook_runtimes Override in a subclass to manipulate the request or metadata @@ -495,9 +522,10 @@ async def post_list_notebook_runtimes( async def pre_list_notebook_runtime_templates( self, request: notebook_service.ListNotebookRuntimeTemplatesRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - notebook_service.ListNotebookRuntimeTemplatesRequest, Sequence[Tuple[str, str]] + notebook_service.ListNotebookRuntimeTemplatesRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for list_notebook_runtime_templates @@ -520,8 +548,11 @@ async def post_list_notebook_runtime_templates( async def pre_start_notebook_runtime( self, request: notebook_service.StartNotebookRuntimeRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[notebook_service.StartNotebookRuntimeRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + notebook_service.StartNotebookRuntimeRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for start_notebook_runtime Override in a subclass to manipulate the request or metadata @@ -543,8 +574,11 @@ async def post_start_notebook_runtime( async def pre_stop_notebook_runtime( self, request: notebook_service.StopNotebookRuntimeRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[notebook_service.StopNotebookRuntimeRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + notebook_service.StopNotebookRuntimeRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for stop_notebook_runtime Override in a subclass to manipulate the request or metadata @@ -566,9 +600,10 @@ async def post_stop_notebook_runtime( async def pre_update_notebook_runtime_template( self, request: notebook_service.UpdateNotebookRuntimeTemplateRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - notebook_service.UpdateNotebookRuntimeTemplateRequest, Sequence[Tuple[str, str]] + notebook_service.UpdateNotebookRuntimeTemplateRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for update_notebook_runtime_template @@ -591,9 +626,10 @@ async def post_update_notebook_runtime_template( async def pre_upgrade_notebook_runtime( self, request: notebook_service.UpgradeNotebookRuntimeRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - notebook_service.UpgradeNotebookRuntimeRequest, Sequence[Tuple[str, str]] + notebook_service.UpgradeNotebookRuntimeRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for upgrade_notebook_runtime @@ -616,8 +652,10 @@ async def post_upgrade_notebook_runtime( async def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -639,8 +677,10 @@ async def post_get_location( async def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -662,8 +702,10 @@ async def post_list_locations( async def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -685,8 +727,10 @@ async def post_get_iam_policy( async def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -708,8 +752,11 @@ async def post_set_iam_policy( async def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -731,8 +778,10 @@ async def post_test_iam_permissions( async def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -752,8 +801,10 @@ async def post_cancel_operation(self, response: None) -> None: async 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 @@ -773,8 +824,10 @@ async def post_delete_operation(self, response: None) -> None: async 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 @@ -796,8 +849,10 @@ async def post_get_operation( async 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 @@ -819,8 +874,10 @@ async def post_list_operations( async def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -1082,7 +1139,7 @@ async 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 assign notebook runtime method over HTTP. @@ -1093,8 +1150,10 @@ async def __call__( 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: @@ -1107,6 +1166,7 @@ async def __call__( http_options = ( _BaseNotebookServiceRestTransport._BaseAssignNotebookRuntime._get_http_options() ) + request, metadata = await self._interceptor.pre_assign_notebook_runtime( request, metadata ) @@ -1123,6 +1183,33 @@ async 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.aiplatform_v1.NotebookServiceClient.AssignNotebookRuntime", + extra={ + "serviceName": "google.cloud.aiplatform.v1.NotebookService", + "rpcName": "AssignNotebookRuntime", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncNotebookServiceRestTransport._AssignNotebookRuntime._get_response( self._host, @@ -1151,6 +1238,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_assign_notebook_runtime(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.NotebookServiceAsyncClient.assign_notebook_runtime", + extra={ + "serviceName": "google.cloud.aiplatform.v1.NotebookService", + "rpcName": "AssignNotebookRuntime", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _CreateNotebookExecutionJob( @@ -1190,7 +1299,7 @@ async 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 notebook execution job method over HTTP. @@ -1202,8 +1311,10 @@ async def __call__( 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: @@ -1216,6 +1327,7 @@ async def __call__( http_options = ( _BaseNotebookServiceRestTransport._BaseCreateNotebookExecutionJob._get_http_options() ) + ( request, metadata, @@ -1235,6 +1347,33 @@ async 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.aiplatform_v1.NotebookServiceClient.CreateNotebookExecutionJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1.NotebookService", + "rpcName": "CreateNotebookExecutionJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncNotebookServiceRestTransport._CreateNotebookExecutionJob._get_response( self._host, @@ -1263,6 +1402,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_create_notebook_execution_job(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.NotebookServiceAsyncClient.create_notebook_execution_job", + extra={ + "serviceName": "google.cloud.aiplatform.v1.NotebookService", + "rpcName": "CreateNotebookExecutionJob", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _CreateNotebookRuntimeTemplate( @@ -1304,7 +1465,7 @@ async 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 notebook runtime template method over HTTP. @@ -1316,8 +1477,10 @@ async def __call__( 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: @@ -1330,6 +1493,7 @@ async def __call__( http_options = ( _BaseNotebookServiceRestTransport._BaseCreateNotebookRuntimeTemplate._get_http_options() ) + ( request, metadata, @@ -1349,6 +1513,33 @@ async 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.aiplatform_v1.NotebookServiceClient.CreateNotebookRuntimeTemplate", + extra={ + "serviceName": "google.cloud.aiplatform.v1.NotebookService", + "rpcName": "CreateNotebookRuntimeTemplate", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncNotebookServiceRestTransport._CreateNotebookRuntimeTemplate._get_response( self._host, @@ -1377,6 +1568,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_create_notebook_runtime_template(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.NotebookServiceAsyncClient.create_notebook_runtime_template", + extra={ + "serviceName": "google.cloud.aiplatform.v1.NotebookService", + "rpcName": "CreateNotebookRuntimeTemplate", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _DeleteNotebookExecutionJob( @@ -1415,7 +1628,7 @@ async 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 notebook execution job method over HTTP. @@ -1427,8 +1640,10 @@ async def __call__( 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: @@ -1441,6 +1656,7 @@ async def __call__( http_options = ( _BaseNotebookServiceRestTransport._BaseDeleteNotebookExecutionJob._get_http_options() ) + ( request, metadata, @@ -1456,6 +1672,33 @@ async 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.aiplatform_v1.NotebookServiceClient.DeleteNotebookExecutionJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1.NotebookService", + "rpcName": "DeleteNotebookExecutionJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncNotebookServiceRestTransport._DeleteNotebookExecutionJob._get_response( self._host, @@ -1483,6 +1726,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_delete_notebook_execution_job(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.NotebookServiceAsyncClient.delete_notebook_execution_job", + extra={ + "serviceName": "google.cloud.aiplatform.v1.NotebookService", + "rpcName": "DeleteNotebookExecutionJob", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _DeleteNotebookRuntime( @@ -1521,7 +1786,7 @@ async 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 notebook runtime method over HTTP. @@ -1532,8 +1797,10 @@ async def __call__( 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: @@ -1546,6 +1813,7 @@ async def __call__( http_options = ( _BaseNotebookServiceRestTransport._BaseDeleteNotebookRuntime._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_notebook_runtime( request, metadata ) @@ -1558,6 +1826,33 @@ async 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.aiplatform_v1.NotebookServiceClient.DeleteNotebookRuntime", + extra={ + "serviceName": "google.cloud.aiplatform.v1.NotebookService", + "rpcName": "DeleteNotebookRuntime", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncNotebookServiceRestTransport._DeleteNotebookRuntime._get_response( self._host, @@ -1585,6 +1880,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_delete_notebook_runtime(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.NotebookServiceAsyncClient.delete_notebook_runtime", + extra={ + "serviceName": "google.cloud.aiplatform.v1.NotebookService", + "rpcName": "DeleteNotebookRuntime", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _DeleteNotebookRuntimeTemplate( @@ -1625,7 +1942,7 @@ async 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 notebook runtime template method over HTTP. @@ -1637,8 +1954,10 @@ async def __call__( 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: @@ -1651,6 +1970,7 @@ async def __call__( http_options = ( _BaseNotebookServiceRestTransport._BaseDeleteNotebookRuntimeTemplate._get_http_options() ) + ( request, metadata, @@ -1666,6 +1986,33 @@ async 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.aiplatform_v1.NotebookServiceClient.DeleteNotebookRuntimeTemplate", + extra={ + "serviceName": "google.cloud.aiplatform.v1.NotebookService", + "rpcName": "DeleteNotebookRuntimeTemplate", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncNotebookServiceRestTransport._DeleteNotebookRuntimeTemplate._get_response( self._host, @@ -1693,6 +2040,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_delete_notebook_runtime_template(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.NotebookServiceAsyncClient.delete_notebook_runtime_template", + extra={ + "serviceName": "google.cloud.aiplatform.v1.NotebookService", + "rpcName": "DeleteNotebookRuntimeTemplate", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _GetNotebookExecutionJob( @@ -1731,7 +2100,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> notebook_execution_job.NotebookExecutionJob: r"""Call the get notebook execution job method over HTTP. @@ -1743,8 +2112,10 @@ async def __call__( 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: ~.notebook_execution_job.NotebookExecutionJob: @@ -1756,6 +2127,7 @@ async def __call__( http_options = ( _BaseNotebookServiceRestTransport._BaseGetNotebookExecutionJob._get_http_options() ) + request, metadata = await self._interceptor.pre_get_notebook_execution_job( request, metadata ) @@ -1768,6 +2140,33 @@ async 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.aiplatform_v1.NotebookServiceClient.GetNotebookExecutionJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1.NotebookService", + "rpcName": "GetNotebookExecutionJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncNotebookServiceRestTransport._GetNotebookExecutionJob._get_response( self._host, @@ -1795,6 +2194,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_get_notebook_execution_job(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + notebook_execution_job.NotebookExecutionJob.to_json(response) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.NotebookServiceAsyncClient.get_notebook_execution_job", + extra={ + "serviceName": "google.cloud.aiplatform.v1.NotebookService", + "rpcName": "GetNotebookExecutionJob", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _GetNotebookRuntime( @@ -1833,7 +2256,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> notebook_runtime.NotebookRuntime: r"""Call the get notebook runtime method over HTTP. @@ -1844,8 +2267,10 @@ async def __call__( 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: ~.notebook_runtime.NotebookRuntime: @@ -1859,6 +2284,7 @@ async def __call__( http_options = ( _BaseNotebookServiceRestTransport._BaseGetNotebookRuntime._get_http_options() ) + request, metadata = await self._interceptor.pre_get_notebook_runtime( request, metadata ) @@ -1871,6 +2297,33 @@ async 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.aiplatform_v1.NotebookServiceClient.GetNotebookRuntime", + extra={ + "serviceName": "google.cloud.aiplatform.v1.NotebookService", + "rpcName": "GetNotebookRuntime", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncNotebookServiceRestTransport._GetNotebookRuntime._get_response( self._host, @@ -1898,6 +2351,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_get_notebook_runtime(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = notebook_runtime.NotebookRuntime.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.NotebookServiceAsyncClient.get_notebook_runtime", + extra={ + "serviceName": "google.cloud.aiplatform.v1.NotebookService", + "rpcName": "GetNotebookRuntime", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _GetNotebookRuntimeTemplate( @@ -1936,7 +2413,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> notebook_runtime.NotebookRuntimeTemplate: r"""Call the get notebook runtime template method over HTTP. @@ -1948,8 +2425,10 @@ async def __call__( 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: ~.notebook_runtime.NotebookRuntimeTemplate: @@ -1964,6 +2443,7 @@ async def __call__( http_options = ( _BaseNotebookServiceRestTransport._BaseGetNotebookRuntimeTemplate._get_http_options() ) + ( request, metadata, @@ -1979,6 +2459,33 @@ async 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.aiplatform_v1.NotebookServiceClient.GetNotebookRuntimeTemplate", + extra={ + "serviceName": "google.cloud.aiplatform.v1.NotebookService", + "rpcName": "GetNotebookRuntimeTemplate", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncNotebookServiceRestTransport._GetNotebookRuntimeTemplate._get_response( self._host, @@ -2006,6 +2513,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_get_notebook_runtime_template(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = notebook_runtime.NotebookRuntimeTemplate.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.NotebookServiceAsyncClient.get_notebook_runtime_template", + extra={ + "serviceName": "google.cloud.aiplatform.v1.NotebookService", + "rpcName": "GetNotebookRuntimeTemplate", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ListNotebookExecutionJobs( @@ -2044,7 +2575,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> notebook_service.ListNotebookExecutionJobsResponse: r"""Call the list notebook execution jobs method over HTTP. @@ -2056,8 +2587,10 @@ async def __call__( 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: ~.notebook_service.ListNotebookExecutionJobsResponse: @@ -2069,6 +2602,7 @@ async def __call__( http_options = ( _BaseNotebookServiceRestTransport._BaseListNotebookExecutionJobs._get_http_options() ) + ( request, metadata, @@ -2084,6 +2618,33 @@ async 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.aiplatform_v1.NotebookServiceClient.ListNotebookExecutionJobs", + extra={ + "serviceName": "google.cloud.aiplatform.v1.NotebookService", + "rpcName": "ListNotebookExecutionJobs", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncNotebookServiceRestTransport._ListNotebookExecutionJobs._get_response( self._host, @@ -2111,6 +2672,32 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_list_notebook_execution_jobs(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + notebook_service.ListNotebookExecutionJobsResponse.to_json( + response + ) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.NotebookServiceAsyncClient.list_notebook_execution_jobs", + extra={ + "serviceName": "google.cloud.aiplatform.v1.NotebookService", + "rpcName": "ListNotebookExecutionJobs", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ListNotebookRuntimes( @@ -2149,7 +2736,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> notebook_service.ListNotebookRuntimesResponse: r"""Call the list notebook runtimes method over HTTP. @@ -2160,8 +2747,10 @@ async def __call__( 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: ~.notebook_service.ListNotebookRuntimesResponse: @@ -2173,6 +2762,7 @@ async def __call__( http_options = ( _BaseNotebookServiceRestTransport._BaseListNotebookRuntimes._get_http_options() ) + request, metadata = await self._interceptor.pre_list_notebook_runtimes( request, metadata ) @@ -2185,6 +2775,33 @@ async 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.aiplatform_v1.NotebookServiceClient.ListNotebookRuntimes", + extra={ + "serviceName": "google.cloud.aiplatform.v1.NotebookService", + "rpcName": "ListNotebookRuntimes", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncNotebookServiceRestTransport._ListNotebookRuntimes._get_response( self._host, @@ -2212,6 +2829,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_list_notebook_runtimes(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + notebook_service.ListNotebookRuntimesResponse.to_json(response) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.NotebookServiceAsyncClient.list_notebook_runtimes", + extra={ + "serviceName": "google.cloud.aiplatform.v1.NotebookService", + "rpcName": "ListNotebookRuntimes", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ListNotebookRuntimeTemplates( @@ -2252,7 +2893,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> notebook_service.ListNotebookRuntimeTemplatesResponse: r"""Call the list notebook runtime templates method over HTTP. @@ -2264,8 +2905,10 @@ async def __call__( 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: ~.notebook_service.ListNotebookRuntimeTemplatesResponse: @@ -2277,6 +2920,7 @@ async def __call__( http_options = ( _BaseNotebookServiceRestTransport._BaseListNotebookRuntimeTemplates._get_http_options() ) + ( request, metadata, @@ -2292,6 +2936,33 @@ async 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.aiplatform_v1.NotebookServiceClient.ListNotebookRuntimeTemplates", + extra={ + "serviceName": "google.cloud.aiplatform.v1.NotebookService", + "rpcName": "ListNotebookRuntimeTemplates", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncNotebookServiceRestTransport._ListNotebookRuntimeTemplates._get_response( self._host, @@ -2319,6 +2990,32 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_list_notebook_runtime_templates(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + notebook_service.ListNotebookRuntimeTemplatesResponse.to_json( + response + ) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.NotebookServiceAsyncClient.list_notebook_runtime_templates", + extra={ + "serviceName": "google.cloud.aiplatform.v1.NotebookService", + "rpcName": "ListNotebookRuntimeTemplates", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _StartNotebookRuntime( @@ -2358,7 +3055,7 @@ async 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 start notebook runtime method over HTTP. @@ -2369,8 +3066,10 @@ async def __call__( 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: @@ -2383,6 +3082,7 @@ async def __call__( http_options = ( _BaseNotebookServiceRestTransport._BaseStartNotebookRuntime._get_http_options() ) + request, metadata = await self._interceptor.pre_start_notebook_runtime( request, metadata ) @@ -2399,6 +3099,33 @@ async 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.aiplatform_v1.NotebookServiceClient.StartNotebookRuntime", + extra={ + "serviceName": "google.cloud.aiplatform.v1.NotebookService", + "rpcName": "StartNotebookRuntime", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncNotebookServiceRestTransport._StartNotebookRuntime._get_response( self._host, @@ -2427,6 +3154,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_start_notebook_runtime(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.NotebookServiceAsyncClient.start_notebook_runtime", + extra={ + "serviceName": "google.cloud.aiplatform.v1.NotebookService", + "rpcName": "StartNotebookRuntime", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _StopNotebookRuntime( @@ -2466,7 +3215,7 @@ async 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 stop notebook runtime method over HTTP. @@ -2477,8 +3226,10 @@ async def __call__( 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: @@ -2491,6 +3242,7 @@ async def __call__( http_options = ( _BaseNotebookServiceRestTransport._BaseStopNotebookRuntime._get_http_options() ) + request, metadata = await self._interceptor.pre_stop_notebook_runtime( request, metadata ) @@ -2507,6 +3259,33 @@ async 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.aiplatform_v1.NotebookServiceClient.StopNotebookRuntime", + extra={ + "serviceName": "google.cloud.aiplatform.v1.NotebookService", + "rpcName": "StopNotebookRuntime", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncNotebookServiceRestTransport._StopNotebookRuntime._get_response( self._host, @@ -2535,6 +3314,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_stop_notebook_runtime(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.NotebookServiceAsyncClient.stop_notebook_runtime", + extra={ + "serviceName": "google.cloud.aiplatform.v1.NotebookService", + "rpcName": "StopNotebookRuntime", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _UpdateNotebookRuntimeTemplate( @@ -2576,7 +3377,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> notebook_runtime.NotebookRuntimeTemplate: r"""Call the update notebook runtime template method over HTTP. @@ -2588,8 +3389,10 @@ async def __call__( 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: ~.notebook_runtime.NotebookRuntimeTemplate: @@ -2604,6 +3407,7 @@ async def __call__( http_options = ( _BaseNotebookServiceRestTransport._BaseUpdateNotebookRuntimeTemplate._get_http_options() ) + ( request, metadata, @@ -2623,6 +3427,33 @@ async 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.aiplatform_v1.NotebookServiceClient.UpdateNotebookRuntimeTemplate", + extra={ + "serviceName": "google.cloud.aiplatform.v1.NotebookService", + "rpcName": "UpdateNotebookRuntimeTemplate", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncNotebookServiceRestTransport._UpdateNotebookRuntimeTemplate._get_response( self._host, @@ -2651,6 +3482,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_update_notebook_runtime_template(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = notebook_runtime.NotebookRuntimeTemplate.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.NotebookServiceAsyncClient.update_notebook_runtime_template", + extra={ + "serviceName": "google.cloud.aiplatform.v1.NotebookService", + "rpcName": "UpdateNotebookRuntimeTemplate", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _UpgradeNotebookRuntime( @@ -2690,7 +3545,7 @@ async 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 upgrade notebook runtime method over HTTP. @@ -2701,8 +3556,10 @@ async def __call__( 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: @@ -2715,6 +3572,7 @@ async def __call__( http_options = ( _BaseNotebookServiceRestTransport._BaseUpgradeNotebookRuntime._get_http_options() ) + request, metadata = await self._interceptor.pre_upgrade_notebook_runtime( request, metadata ) @@ -2731,6 +3589,33 @@ async 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.aiplatform_v1.NotebookServiceClient.UpgradeNotebookRuntime", + extra={ + "serviceName": "google.cloud.aiplatform.v1.NotebookService", + "rpcName": "UpgradeNotebookRuntime", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncNotebookServiceRestTransport._UpgradeNotebookRuntime._get_response( self._host, @@ -2759,6 +3644,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_upgrade_notebook_runtime(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.NotebookServiceAsyncClient.upgrade_notebook_runtime", + extra={ + "serviceName": "google.cloud.aiplatform.v1.NotebookService", + "rpcName": "UpgradeNotebookRuntime", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp @property @@ -4813,7 +5720,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -4824,8 +5731,10 @@ async def __call__( 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: locations_pb2.Location: Response from GetLocation method. @@ -4834,6 +5743,7 @@ async def __call__( http_options = ( _BaseNotebookServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_location( request, metadata ) @@ -4846,6 +5756,33 @@ async 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.aiplatform_v1.NotebookServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.NotebookService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncNotebookServiceRestTransport._GetLocation._get_response( @@ -4873,6 +5810,27 @@ async def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_location(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.aiplatform_v1.NotebookServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.NotebookService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4915,7 +5873,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -4926,8 +5884,10 @@ async def __call__( 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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -4936,6 +5896,7 @@ async def __call__( http_options = ( _BaseNotebookServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_locations( request, metadata ) @@ -4948,6 +5909,33 @@ async 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.aiplatform_v1.NotebookServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.NotebookService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncNotebookServiceRestTransport._ListLocations._get_response( @@ -4975,6 +5963,27 @@ async def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_list_locations(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.aiplatform_v1.NotebookServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.NotebookService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5017,7 +6026,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -5028,8 +6037,10 @@ async def __call__( 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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -5038,6 +6049,7 @@ async def __call__( http_options = ( _BaseNotebookServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_get_iam_policy( request, metadata ) @@ -5050,6 +6062,33 @@ async 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.aiplatform_v1.NotebookServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.NotebookService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncNotebookServiceRestTransport._GetIamPolicy._get_response( @@ -5077,6 +6116,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_iam_policy(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.aiplatform_v1.NotebookServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.NotebookService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5120,7 +6180,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -5131,8 +6191,10 @@ async def __call__( 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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -5141,6 +6203,7 @@ async def __call__( http_options = ( _BaseNotebookServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_set_iam_policy( request, metadata ) @@ -5157,6 +6220,33 @@ async 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.aiplatform_v1.NotebookServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.NotebookService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncNotebookServiceRestTransport._SetIamPolicy._get_response( @@ -5185,6 +6275,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_set_iam_policy(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.aiplatform_v1.NotebookServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.NotebookService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5227,7 +6338,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -5238,8 +6349,10 @@ async def __call__( 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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -5248,6 +6361,7 @@ async def __call__( http_options = ( _BaseNotebookServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = await self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -5260,6 +6374,33 @@ async 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.aiplatform_v1.NotebookServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.NotebookService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncNotebookServiceRestTransport._TestIamPermissions._get_response( self._host, @@ -5285,6 +6426,27 @@ async def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_test_iam_permissions(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.aiplatform_v1.NotebookServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.NotebookService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5327,7 +6489,7 @@ async 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 cancel operation method over HTTP. @@ -5338,13 +6500,16 @@ async def __call__( 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`. """ http_options = ( _BaseNotebookServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_cancel_operation( request, metadata ) @@ -5357,6 +6522,33 @@ async 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.aiplatform_v1.NotebookServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.NotebookService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncNotebookServiceRestTransport._CancelOperation._get_response( @@ -5422,7 +6614,7 @@ async 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. @@ -5433,13 +6625,16 @@ async def __call__( 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`. """ http_options = ( _BaseNotebookServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_operation( request, metadata ) @@ -5452,6 +6647,33 @@ async 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.aiplatform_v1.NotebookServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.NotebookService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncNotebookServiceRestTransport._DeleteOperation._get_response( @@ -5517,7 +6739,7 @@ async 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. @@ -5528,8 +6750,10 @@ async def __call__( 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: Response from GetOperation method. @@ -5538,6 +6762,7 @@ async def __call__( http_options = ( _BaseNotebookServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_operation( request, metadata ) @@ -5550,6 +6775,33 @@ async 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.aiplatform_v1.NotebookServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.NotebookService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncNotebookServiceRestTransport._GetOperation._get_response( @@ -5577,6 +6829,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1.NotebookServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.NotebookService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5619,7 +6892,7 @@ async 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. @@ -5630,8 +6903,10 @@ async def __call__( 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 from ListOperations method. @@ -5640,6 +6915,7 @@ async def __call__( http_options = ( _BaseNotebookServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_operations( request, metadata ) @@ -5652,6 +6928,33 @@ async 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.aiplatform_v1.NotebookServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.NotebookService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncNotebookServiceRestTransport._ListOperations._get_response( @@ -5679,6 +6982,27 @@ async def __call__( resp = operations_pb2.ListOperationsResponse() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1.NotebookServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.NotebookService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5721,7 +7045,7 @@ async 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 wait operation method over HTTP. @@ -5732,8 +7056,10 @@ async def __call__( 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: Response from WaitOperation method. @@ -5742,6 +7068,7 @@ async def __call__( http_options = ( _BaseNotebookServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_wait_operation( request, metadata ) @@ -5754,6 +7081,33 @@ async 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.aiplatform_v1.NotebookServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.NotebookService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncNotebookServiceRestTransport._WaitOperation._get_response( @@ -5781,6 +7135,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_wait_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.aiplatform_v1.NotebookServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.NotebookService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1/services/persistent_resource_service/async_client.py b/google/cloud/aiplatform_v1/services/persistent_resource_service/async_client.py index cb5a4cea25..a2d7234f0f 100644 --- a/google/cloud/aiplatform_v1/services/persistent_resource_service/async_client.py +++ b/google/cloud/aiplatform_v1/services/persistent_resource_service/async_client.py @@ -13,6 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging as std_logging from collections import OrderedDict import re from typing import ( @@ -65,6 +66,15 @@ from .transports.grpc_asyncio import PersistentResourceServiceGrpcAsyncIOTransport from .client import PersistentResourceServiceClient +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 PersistentResourceServiceAsyncClient: """A service for managing Vertex AI's machine learning @@ -296,6 +306,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.aiplatform_v1.PersistentResourceServiceAsyncClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PersistentResourceService", + "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.aiplatform.v1.PersistentResourceService", + "credentialsType": None, + }, + ) + async def create_persistent_resource( self, request: Optional[ @@ -309,7 +341,7 @@ async def create_persistent_resource( persistent_resource_id: 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"""Creates a PersistentResource. @@ -377,8 +409,10 @@ async def sample_create_persistent_resource(): 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: @@ -463,7 +497,7 @@ async def get_persistent_resource( 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]]] = (), ) -> persistent_resource.PersistentResource: r"""Gets a PersistentResource. @@ -508,8 +542,10 @@ async def sample_get_persistent_resource(): 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.aiplatform_v1.types.PersistentResource: @@ -577,7 +613,7 @@ async def list_persistent_resources( 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.ListPersistentResourcesAsyncPager: r"""Lists PersistentResources in a Location. @@ -623,8 +659,10 @@ async def sample_list_persistent_resources(): 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.aiplatform_v1.services.persistent_resource_service.pagers.ListPersistentResourcesAsyncPager: @@ -705,7 +743,7 @@ async def delete_persistent_resource( 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"""Deletes a PersistentResource. @@ -754,8 +792,10 @@ async def sample_delete_persistent_resource(): 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: @@ -843,7 +883,7 @@ async def update_persistent_resource( 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"""Updates a PersistentResource. @@ -901,8 +941,10 @@ async def sample_update_persistent_resource(): 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: @@ -985,7 +1027,7 @@ async def reboot_persistent_resource( 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"""Reboots a PersistentResource. @@ -1034,8 +1076,10 @@ async def sample_reboot_persistent_resource(): 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: @@ -1111,7 +1155,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. @@ -1122,8 +1166,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. @@ -1164,7 +1210,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. @@ -1175,8 +1221,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. @@ -1217,7 +1265,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. @@ -1233,8 +1281,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 """ @@ -1271,7 +1321,7 @@ async def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -1286,8 +1336,10 @@ async def cancel_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 """ @@ -1324,7 +1376,7 @@ async def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -1341,8 +1393,10 @@ async def wait_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. @@ -1383,7 +1437,7 @@ async def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -1396,8 +1450,10 @@ async def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -1502,7 +1558,7 @@ async def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -1516,8 +1572,10 @@ async def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -1622,7 +1680,7 @@ async def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -1637,8 +1695,10 @@ async def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -1682,7 +1742,7 @@ async def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -1693,8 +1753,10 @@ async def get_location( 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: ~.location_pb2.Location: Location object. @@ -1735,7 +1797,7 @@ async def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -1746,8 +1808,10 @@ async def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1/services/persistent_resource_service/client.py b/google/cloud/aiplatform_v1/services/persistent_resource_service/client.py index f4c89ad5e3..ab694c7173 100644 --- a/google/cloud/aiplatform_v1/services/persistent_resource_service/client.py +++ b/google/cloud/aiplatform_v1/services/persistent_resource_service/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 ( @@ -48,6 +49,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 as gac_operation # type: ignore from google.api_core import operation_async # type: ignore from google.cloud.aiplatform_v1.services.persistent_resource_service import pagers @@ -660,6 +670,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( @@ -751,6 +765,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.aiplatform_v1.PersistentResourceServiceClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PersistentResourceService", + "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.aiplatform.v1.PersistentResourceService", + "credentialsType": None, + }, + ) + def create_persistent_resource( self, request: Optional[ @@ -764,7 +801,7 @@ def create_persistent_resource( persistent_resource_id: 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]]] = (), ) -> gac_operation.Operation: r"""Creates a PersistentResource. @@ -832,8 +869,10 @@ def sample_create_persistent_resource(): 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: @@ -917,7 +956,7 @@ def get_persistent_resource( 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]]] = (), ) -> persistent_resource.PersistentResource: r"""Gets a PersistentResource. @@ -962,8 +1001,10 @@ def sample_get_persistent_resource(): 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.aiplatform_v1.types.PersistentResource: @@ -1028,7 +1069,7 @@ def list_persistent_resources( 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.ListPersistentResourcesPager: r"""Lists PersistentResources in a Location. @@ -1074,8 +1115,10 @@ def sample_list_persistent_resources(): 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.aiplatform_v1.services.persistent_resource_service.pagers.ListPersistentResourcesPager: @@ -1155,7 +1198,7 @@ def delete_persistent_resource( 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]]] = (), ) -> gac_operation.Operation: r"""Deletes a PersistentResource. @@ -1204,8 +1247,10 @@ def sample_delete_persistent_resource(): 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: @@ -1292,7 +1337,7 @@ def update_persistent_resource( 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]]] = (), ) -> gac_operation.Operation: r"""Updates a PersistentResource. @@ -1350,8 +1395,10 @@ def sample_update_persistent_resource(): 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: @@ -1433,7 +1480,7 @@ def reboot_persistent_resource( 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]]] = (), ) -> gac_operation.Operation: r"""Reboots a PersistentResource. @@ -1482,8 +1529,10 @@ def sample_reboot_persistent_resource(): 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: @@ -1571,7 +1620,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. @@ -1582,8 +1631,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. @@ -1624,7 +1675,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. @@ -1635,8 +1686,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. @@ -1677,7 +1730,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. @@ -1693,8 +1746,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 """ @@ -1731,7 +1786,7 @@ def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -1746,8 +1801,10 @@ def cancel_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 """ @@ -1784,7 +1841,7 @@ def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -1801,8 +1858,10 @@ def wait_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. @@ -1843,7 +1902,7 @@ def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -1856,8 +1915,10 @@ def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -1962,7 +2023,7 @@ def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -1976,8 +2037,10 @@ def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -2082,7 +2145,7 @@ def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -2097,8 +2160,10 @@ def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -2140,7 +2205,7 @@ def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -2151,8 +2216,10 @@ def get_location( 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: ~.location_pb2.Location: Location object. @@ -2193,7 +2260,7 @@ def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -2204,8 +2271,10 @@ def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1/services/persistent_resource_service/pagers.py b/google/cloud/aiplatform_v1/services/persistent_resource_service/pagers.py index ca9a084315..40738ac29c 100644 --- a/google/cloud/aiplatform_v1/services/persistent_resource_service/pagers.py +++ b/google/cloud/aiplatform_v1/services/persistent_resource_service/pagers.py @@ -69,7 +69,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. @@ -83,8 +83,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 = persistent_resource_service.ListPersistentResourcesRequest( @@ -149,7 +151,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. @@ -163,8 +165,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 = persistent_resource_service.ListPersistentResourcesRequest( diff --git a/google/cloud/aiplatform_v1/services/persistent_resource_service/transports/grpc.py b/google/cloud/aiplatform_v1/services/persistent_resource_service/transports/grpc.py index 4bdeafd807..59cfc26fd0 100644 --- a/google/cloud/aiplatform_v1/services/persistent_resource_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1/services/persistent_resource_service/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 import warnings from typing import Callable, Dict, Optional, Sequence, Tuple, Union @@ -22,8 +25,11 @@ import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from google.cloud.aiplatform_v1.types import persistent_resource from google.cloud.aiplatform_v1.types import persistent_resource_service @@ -33,6 +39,81 @@ from google.longrunning import operations_pb2 # type: ignore from .base import PersistentResourceServiceTransport, DEFAULT_CLIENT_INFO +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.aiplatform.v1.PersistentResourceService", + "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.aiplatform.v1.PersistentResourceService", + "rpcName": client_call_details.method, + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class PersistentResourceServiceGrpcTransport(PersistentResourceServiceTransport): """gRPC backend transport for PersistentResourceService. @@ -188,7 +269,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 @@ -252,7 +338,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 @@ -279,7 +367,9 @@ def create_persistent_resource( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_persistent_resource" not in self._stubs: - self._stubs["create_persistent_resource"] = self.grpc_channel.unary_unary( + self._stubs[ + "create_persistent_resource" + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.PersistentResourceService/CreatePersistentResource", request_serializer=persistent_resource_service.CreatePersistentResourceRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -308,7 +398,7 @@ def get_persistent_resource( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_persistent_resource" not in self._stubs: - self._stubs["get_persistent_resource"] = self.grpc_channel.unary_unary( + self._stubs["get_persistent_resource"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.PersistentResourceService/GetPersistentResource", request_serializer=persistent_resource_service.GetPersistentResourceRequest.serialize, response_deserializer=persistent_resource.PersistentResource.deserialize, @@ -337,7 +427,7 @@ def list_persistent_resources( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_persistent_resources" not in self._stubs: - self._stubs["list_persistent_resources"] = self.grpc_channel.unary_unary( + self._stubs["list_persistent_resources"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.PersistentResourceService/ListPersistentResources", request_serializer=persistent_resource_service.ListPersistentResourcesRequest.serialize, response_deserializer=persistent_resource_service.ListPersistentResourcesResponse.deserialize, @@ -366,7 +456,9 @@ def delete_persistent_resource( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_persistent_resource" not in self._stubs: - self._stubs["delete_persistent_resource"] = self.grpc_channel.unary_unary( + self._stubs[ + "delete_persistent_resource" + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.PersistentResourceService/DeletePersistentResource", request_serializer=persistent_resource_service.DeletePersistentResourceRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -395,7 +487,9 @@ def update_persistent_resource( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_persistent_resource" not in self._stubs: - self._stubs["update_persistent_resource"] = self.grpc_channel.unary_unary( + self._stubs[ + "update_persistent_resource" + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.PersistentResourceService/UpdatePersistentResource", request_serializer=persistent_resource_service.UpdatePersistentResourceRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -424,7 +518,9 @@ def reboot_persistent_resource( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "reboot_persistent_resource" not in self._stubs: - self._stubs["reboot_persistent_resource"] = self.grpc_channel.unary_unary( + self._stubs[ + "reboot_persistent_resource" + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.PersistentResourceService/RebootPersistentResource", request_serializer=persistent_resource_service.RebootPersistentResourceRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -432,7 +528,7 @@ def reboot_persistent_resource( return self._stubs["reboot_persistent_resource"] def close(self): - self.grpc_channel.close() + self._logged_channel.close() @property def delete_operation( @@ -444,7 +540,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, @@ -461,7 +557,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -478,7 +574,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -495,7 +591,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, @@ -514,7 +610,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, @@ -533,7 +629,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -550,7 +646,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -575,7 +671,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -601,7 +697,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -630,7 +726,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1/services/persistent_resource_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1/services/persistent_resource_service/transports/grpc_asyncio.py index 333fd2a5bf..1bcf559377 100644 --- a/google/cloud/aiplatform_v1/services/persistent_resource_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1/services/persistent_resource_service/transports/grpc_asyncio.py @@ -14,6 +14,9 @@ # limitations under the License. # import inspect +import json +import pickle +import logging as std_logging import warnings from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union @@ -24,8 +27,11 @@ from google.api_core import operations_v1 from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from grpc.experimental import aio # type: ignore from google.cloud.aiplatform_v1.types import persistent_resource @@ -37,6 +43,82 @@ from .base import PersistentResourceServiceTransport, DEFAULT_CLIENT_INFO from .grpc import PersistentResourceServiceGrpcTransport +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.aiplatform.v1.PersistentResourceService", + "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.aiplatform.v1.PersistentResourceService", + "rpcName": str(client_call_details.method), + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class PersistentResourceServiceGrpcAsyncIOTransport(PersistentResourceServiceTransport): """gRPC AsyncIO backend transport for PersistentResourceService. @@ -235,10 +317,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 @@ -261,7 +346,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. @@ -289,7 +374,9 @@ def create_persistent_resource( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_persistent_resource" not in self._stubs: - self._stubs["create_persistent_resource"] = self.grpc_channel.unary_unary( + self._stubs[ + "create_persistent_resource" + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.PersistentResourceService/CreatePersistentResource", request_serializer=persistent_resource_service.CreatePersistentResourceRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -318,7 +405,7 @@ def get_persistent_resource( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_persistent_resource" not in self._stubs: - self._stubs["get_persistent_resource"] = self.grpc_channel.unary_unary( + self._stubs["get_persistent_resource"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.PersistentResourceService/GetPersistentResource", request_serializer=persistent_resource_service.GetPersistentResourceRequest.serialize, response_deserializer=persistent_resource.PersistentResource.deserialize, @@ -347,7 +434,7 @@ def list_persistent_resources( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_persistent_resources" not in self._stubs: - self._stubs["list_persistent_resources"] = self.grpc_channel.unary_unary( + self._stubs["list_persistent_resources"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.PersistentResourceService/ListPersistentResources", request_serializer=persistent_resource_service.ListPersistentResourcesRequest.serialize, response_deserializer=persistent_resource_service.ListPersistentResourcesResponse.deserialize, @@ -376,7 +463,9 @@ def delete_persistent_resource( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_persistent_resource" not in self._stubs: - self._stubs["delete_persistent_resource"] = self.grpc_channel.unary_unary( + self._stubs[ + "delete_persistent_resource" + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.PersistentResourceService/DeletePersistentResource", request_serializer=persistent_resource_service.DeletePersistentResourceRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -405,7 +494,9 @@ def update_persistent_resource( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_persistent_resource" not in self._stubs: - self._stubs["update_persistent_resource"] = self.grpc_channel.unary_unary( + self._stubs[ + "update_persistent_resource" + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.PersistentResourceService/UpdatePersistentResource", request_serializer=persistent_resource_service.UpdatePersistentResourceRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -434,7 +525,9 @@ def reboot_persistent_resource( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "reboot_persistent_resource" not in self._stubs: - self._stubs["reboot_persistent_resource"] = self.grpc_channel.unary_unary( + self._stubs[ + "reboot_persistent_resource" + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.PersistentResourceService/RebootPersistentResource", request_serializer=persistent_resource_service.RebootPersistentResourceRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -532,7 +625,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: @@ -548,7 +641,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, @@ -565,7 +658,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -582,7 +675,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -599,7 +692,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, @@ -618,7 +711,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, @@ -637,7 +730,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -654,7 +747,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -679,7 +772,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -705,7 +798,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -734,7 +827,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1/services/persistent_resource_service/transports/rest.py b/google/cloud/aiplatform_v1/services/persistent_resource_service/transports/rest.py index d7944a3725..0dd633e1e3 100644 --- a/google/cloud/aiplatform_v1/services/persistent_resource_service/transports/rest.py +++ b/google/cloud/aiplatform_v1/services/persistent_resource_service/transports/rest.py @@ -13,9 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging +import json # type: ignore from google.auth.transport.requests import AuthorizedSession # type: ignore -import json # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.api_core import exceptions as core_exceptions from google.api_core import retry as retries @@ -48,6 +49,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, @@ -128,10 +137,10 @@ def post_update_persistent_resource(self, response): def pre_create_persistent_resource( self, request: persistent_resource_service.CreatePersistentResourceRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ persistent_resource_service.CreatePersistentResourceRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for create_persistent_resource @@ -154,10 +163,10 @@ def post_create_persistent_resource( def pre_delete_persistent_resource( self, request: persistent_resource_service.DeletePersistentResourceRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ persistent_resource_service.DeletePersistentResourceRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for delete_persistent_resource @@ -180,10 +189,10 @@ def post_delete_persistent_resource( def pre_get_persistent_resource( self, request: persistent_resource_service.GetPersistentResourceRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ persistent_resource_service.GetPersistentResourceRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for get_persistent_resource @@ -206,10 +215,10 @@ def post_get_persistent_resource( def pre_list_persistent_resources( self, request: persistent_resource_service.ListPersistentResourcesRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ persistent_resource_service.ListPersistentResourcesRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for list_persistent_resources @@ -232,10 +241,10 @@ def post_list_persistent_resources( def pre_reboot_persistent_resource( self, request: persistent_resource_service.RebootPersistentResourceRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ persistent_resource_service.RebootPersistentResourceRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for reboot_persistent_resource @@ -258,10 +267,10 @@ def post_reboot_persistent_resource( def pre_update_persistent_resource( self, request: persistent_resource_service.UpdatePersistentResourceRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ persistent_resource_service.UpdatePersistentResourceRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for update_persistent_resource @@ -284,8 +293,10 @@ def post_update_persistent_resource( def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -307,8 +318,10 @@ def post_get_location( def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -330,8 +343,10 @@ def post_list_locations( def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -351,8 +366,10 @@ def post_get_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -372,8 +389,11 @@ def post_set_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -395,8 +415,10 @@ def post_test_iam_permissions( def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -416,8 +438,10 @@ def post_cancel_operation(self, response: None) -> None: 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 @@ -437,8 +461,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 @@ -460,8 +486,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 @@ -483,8 +511,10 @@ def post_list_operations( def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -2511,7 +2541,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 persistent resource method over HTTP. @@ -2523,8 +2553,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: @@ -2537,6 +2569,7 @@ def __call__( http_options = ( _BasePersistentResourceServiceRestTransport._BaseCreatePersistentResource._get_http_options() ) + request, metadata = self._interceptor.pre_create_persistent_resource( request, metadata ) @@ -2553,6 +2586,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.aiplatform_v1.PersistentResourceServiceClient.CreatePersistentResource", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PersistentResourceService", + "rpcName": "CreatePersistentResource", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = PersistentResourceServiceRestTransport._CreatePersistentResource._get_response( self._host, @@ -2572,7 +2632,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_persistent_resource(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.aiplatform_v1.PersistentResourceServiceClient.create_persistent_resource", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PersistentResourceService", + "rpcName": "CreatePersistentResource", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _DeletePersistentResource( @@ -2613,7 +2695,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 persistent resource method over HTTP. @@ -2625,8 +2707,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: @@ -2639,6 +2723,7 @@ def __call__( http_options = ( _BasePersistentResourceServiceRestTransport._BaseDeletePersistentResource._get_http_options() ) + request, metadata = self._interceptor.pre_delete_persistent_resource( request, metadata ) @@ -2651,6 +2736,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.aiplatform_v1.PersistentResourceServiceClient.DeletePersistentResource", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PersistentResourceService", + "rpcName": "DeletePersistentResource", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = PersistentResourceServiceRestTransport._DeletePersistentResource._get_response( self._host, @@ -2669,7 +2781,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_persistent_resource(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.aiplatform_v1.PersistentResourceServiceClient.delete_persistent_resource", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PersistentResourceService", + "rpcName": "DeletePersistentResource", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _GetPersistentResource( @@ -2708,7 +2842,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]]] = (), ) -> persistent_resource.PersistentResource: r"""Call the get persistent resource method over HTTP. @@ -2719,8 +2853,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: ~.persistent_resource.PersistentResource: @@ -2735,6 +2871,7 @@ def __call__( http_options = ( _BasePersistentResourceServiceRestTransport._BaseGetPersistentResource._get_http_options() ) + request, metadata = self._interceptor.pre_get_persistent_resource( request, metadata ) @@ -2747,6 +2884,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.aiplatform_v1.PersistentResourceServiceClient.GetPersistentResource", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PersistentResourceService", + "rpcName": "GetPersistentResource", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = PersistentResourceServiceRestTransport._GetPersistentResource._get_response( self._host, @@ -2767,7 +2931,31 @@ def __call__( pb_resp = persistent_resource.PersistentResource.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_persistent_resource(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = persistent_resource.PersistentResource.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.aiplatform_v1.PersistentResourceServiceClient.get_persistent_resource", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PersistentResourceService", + "rpcName": "GetPersistentResource", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListPersistentResources( @@ -2808,7 +2996,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]]] = (), ) -> persistent_resource_service.ListPersistentResourcesResponse: r"""Call the list persistent resources method over HTTP. @@ -2819,8 +3007,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: ~.persistent_resource_service.ListPersistentResourcesResponse: @@ -2832,6 +3022,7 @@ def __call__( http_options = ( _BasePersistentResourceServiceRestTransport._BaseListPersistentResources._get_http_options() ) + request, metadata = self._interceptor.pre_list_persistent_resources( request, metadata ) @@ -2844,6 +3035,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.aiplatform_v1.PersistentResourceServiceClient.ListPersistentResources", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PersistentResourceService", + "rpcName": "ListPersistentResources", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = PersistentResourceServiceRestTransport._ListPersistentResources._get_response( self._host, @@ -2866,7 +3084,31 @@ def __call__( ) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_persistent_resources(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = persistent_resource_service.ListPersistentResourcesResponse.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.aiplatform_v1.PersistentResourceServiceClient.list_persistent_resources", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PersistentResourceService", + "rpcName": "ListPersistentResources", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _RebootPersistentResource( @@ -2908,7 +3150,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 reboot persistent resource method over HTTP. @@ -2920,8 +3162,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: @@ -2934,6 +3178,7 @@ def __call__( http_options = ( _BasePersistentResourceServiceRestTransport._BaseRebootPersistentResource._get_http_options() ) + request, metadata = self._interceptor.pre_reboot_persistent_resource( request, metadata ) @@ -2950,6 +3195,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.aiplatform_v1.PersistentResourceServiceClient.RebootPersistentResource", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PersistentResourceService", + "rpcName": "RebootPersistentResource", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = PersistentResourceServiceRestTransport._RebootPersistentResource._get_response( self._host, @@ -2969,7 +3241,29 @@ def __call__( # Return the response resp = operations_pb2.Operation() json_format.Parse(response.content, resp, ignore_unknown_fields=True) + resp = self._interceptor.post_reboot_persistent_resource(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.aiplatform_v1.PersistentResourceServiceClient.reboot_persistent_resource", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PersistentResourceService", + "rpcName": "RebootPersistentResource", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _UpdatePersistentResource( @@ -3011,7 +3305,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 persistent resource method over HTTP. @@ -3023,8 +3317,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: @@ -3037,6 +3333,7 @@ def __call__( http_options = ( _BasePersistentResourceServiceRestTransport._BaseUpdatePersistentResource._get_http_options() ) + request, metadata = self._interceptor.pre_update_persistent_resource( request, metadata ) @@ -3053,6 +3350,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.aiplatform_v1.PersistentResourceServiceClient.UpdatePersistentResource", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PersistentResourceService", + "rpcName": "UpdatePersistentResource", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = PersistentResourceServiceRestTransport._UpdatePersistentResource._get_response( self._host, @@ -3072,7 +3396,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_persistent_resource(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.aiplatform_v1.PersistentResourceServiceClient.update_persistent_resource", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PersistentResourceService", + "rpcName": "UpdatePersistentResource", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp @property @@ -3181,7 +3527,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]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -3192,8 +3538,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: locations_pb2.Location: Response from GetLocation method. @@ -3202,6 +3550,7 @@ def __call__( http_options = ( _BasePersistentResourceServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = self._interceptor.pre_get_location(request, metadata) transcoded_request = _BasePersistentResourceServiceRestTransport._BaseGetLocation._get_transcoded_request( http_options, request @@ -3212,6 +3561,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.aiplatform_v1.PersistentResourceServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PersistentResourceService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( PersistentResourceServiceRestTransport._GetLocation._get_response( @@ -3233,6 +3609,27 @@ def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_location(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.aiplatform_v1.PersistentResourceServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PersistentResourceService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3275,7 +3672,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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -3286,8 +3683,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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -3296,6 +3695,7 @@ def __call__( http_options = ( _BasePersistentResourceServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = self._interceptor.pre_list_locations(request, metadata) transcoded_request = _BasePersistentResourceServiceRestTransport._BaseListLocations._get_transcoded_request( http_options, request @@ -3306,6 +3706,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.aiplatform_v1.PersistentResourceServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PersistentResourceService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( PersistentResourceServiceRestTransport._ListLocations._get_response( @@ -3327,6 +3754,27 @@ def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_list_locations(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.aiplatform_v1.PersistentResourceServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PersistentResourceService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3369,7 +3817,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]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -3380,8 +3828,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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -3390,6 +3840,7 @@ def __call__( http_options = ( _BasePersistentResourceServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_get_iam_policy(request, metadata) transcoded_request = _BasePersistentResourceServiceRestTransport._BaseGetIamPolicy._get_transcoded_request( http_options, request @@ -3400,6 +3851,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.aiplatform_v1.PersistentResourceServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PersistentResourceService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( PersistentResourceServiceRestTransport._GetIamPolicy._get_response( @@ -3421,6 +3899,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_iam_policy(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.aiplatform_v1.PersistentResourceServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PersistentResourceService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3464,7 +3963,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]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -3475,8 +3974,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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -3485,6 +3986,7 @@ def __call__( http_options = ( _BasePersistentResourceServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_set_iam_policy(request, metadata) transcoded_request = _BasePersistentResourceServiceRestTransport._BaseSetIamPolicy._get_transcoded_request( http_options, request @@ -3499,6 +4001,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.aiplatform_v1.PersistentResourceServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PersistentResourceService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( PersistentResourceServiceRestTransport._SetIamPolicy._get_response( @@ -3521,6 +4050,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_set_iam_policy(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.aiplatform_v1.PersistentResourceServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PersistentResourceService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3563,7 +4113,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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -3574,8 +4124,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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -3584,6 +4136,7 @@ def __call__( http_options = ( _BasePersistentResourceServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -3596,6 +4149,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.aiplatform_v1.PersistentResourceServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PersistentResourceService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = PersistentResourceServiceRestTransport._TestIamPermissions._get_response( self._host, @@ -3615,6 +4195,27 @@ def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_test_iam_permissions(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.aiplatform_v1.PersistentResourceServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PersistentResourceService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3657,7 +4258,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 cancel operation method over HTTP. @@ -3668,13 +4269,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 = ( _BasePersistentResourceServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = self._interceptor.pre_cancel_operation( request, metadata ) @@ -3687,6 +4291,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.aiplatform_v1.PersistentResourceServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PersistentResourceService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( PersistentResourceServiceRestTransport._CancelOperation._get_response( @@ -3746,7 +4377,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. @@ -3757,13 +4388,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 = ( _BasePersistentResourceServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = self._interceptor.pre_delete_operation( request, metadata ) @@ -3776,6 +4410,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.aiplatform_v1.PersistentResourceServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PersistentResourceService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( PersistentResourceServiceRestTransport._DeleteOperation._get_response( @@ -3835,7 +4496,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. @@ -3846,8 +4507,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. @@ -3856,6 +4519,7 @@ def __call__( http_options = ( _BasePersistentResourceServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = self._interceptor.pre_get_operation(request, metadata) transcoded_request = _BasePersistentResourceServiceRestTransport._BaseGetOperation._get_transcoded_request( http_options, request @@ -3866,6 +4530,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.aiplatform_v1.PersistentResourceServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PersistentResourceService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( PersistentResourceServiceRestTransport._GetOperation._get_response( @@ -3887,6 +4578,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.aiplatform_v1.PersistentResourceServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PersistentResourceService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3929,7 +4641,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. @@ -3940,8 +4652,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. @@ -3950,6 +4664,7 @@ def __call__( http_options = ( _BasePersistentResourceServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = self._interceptor.pre_list_operations(request, metadata) transcoded_request = _BasePersistentResourceServiceRestTransport._BaseListOperations._get_transcoded_request( http_options, request @@ -3960,6 +4675,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.aiplatform_v1.PersistentResourceServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PersistentResourceService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( PersistentResourceServiceRestTransport._ListOperations._get_response( @@ -3981,6 +4723,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.aiplatform_v1.PersistentResourceServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PersistentResourceService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4023,7 +4786,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 wait operation method over HTTP. @@ -4034,8 +4797,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 WaitOperation method. @@ -4044,6 +4809,7 @@ def __call__( http_options = ( _BasePersistentResourceServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = self._interceptor.pre_wait_operation(request, metadata) transcoded_request = _BasePersistentResourceServiceRestTransport._BaseWaitOperation._get_transcoded_request( http_options, request @@ -4054,6 +4820,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.aiplatform_v1.PersistentResourceServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PersistentResourceService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( PersistentResourceServiceRestTransport._WaitOperation._get_response( @@ -4075,6 +4868,27 @@ def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = self._interceptor.post_wait_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.aiplatform_v1.PersistentResourceServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PersistentResourceService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1/services/persistent_resource_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1/services/persistent_resource_service/transports/rest_asyncio.py index 8abd586d22..2ad39d5e12 100644 --- a/google/cloud/aiplatform_v1/services/persistent_resource_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1/services/persistent_resource_service/transports/rest_asyncio.py @@ -59,6 +59,18 @@ from .base import DEFAULT_CLIENT_INFO as BASE_DEFAULT_CLIENT_INFO + +import logging + +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__) + try: OptionalRetry = Union[retries.AsyncRetry, gapic_v1.method._MethodDefault, None] except AttributeError: # pragma: NO COVER @@ -143,10 +155,10 @@ async def post_update_persistent_resource(self, response): async def pre_create_persistent_resource( self, request: persistent_resource_service.CreatePersistentResourceRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ persistent_resource_service.CreatePersistentResourceRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for create_persistent_resource @@ -169,10 +181,10 @@ async def post_create_persistent_resource( async def pre_delete_persistent_resource( self, request: persistent_resource_service.DeletePersistentResourceRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ persistent_resource_service.DeletePersistentResourceRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for delete_persistent_resource @@ -195,10 +207,10 @@ async def post_delete_persistent_resource( async def pre_get_persistent_resource( self, request: persistent_resource_service.GetPersistentResourceRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ persistent_resource_service.GetPersistentResourceRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for get_persistent_resource @@ -221,10 +233,10 @@ async def post_get_persistent_resource( async def pre_list_persistent_resources( self, request: persistent_resource_service.ListPersistentResourcesRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ persistent_resource_service.ListPersistentResourcesRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for list_persistent_resources @@ -247,10 +259,10 @@ async def post_list_persistent_resources( async def pre_reboot_persistent_resource( self, request: persistent_resource_service.RebootPersistentResourceRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ persistent_resource_service.RebootPersistentResourceRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for reboot_persistent_resource @@ -273,10 +285,10 @@ async def post_reboot_persistent_resource( async def pre_update_persistent_resource( self, request: persistent_resource_service.UpdatePersistentResourceRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ persistent_resource_service.UpdatePersistentResourceRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for update_persistent_resource @@ -299,8 +311,10 @@ async def post_update_persistent_resource( async def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -322,8 +336,10 @@ async def post_get_location( async def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -345,8 +361,10 @@ async def post_list_locations( async def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -368,8 +386,10 @@ async def post_get_iam_policy( async def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -391,8 +411,11 @@ async def post_set_iam_policy( async def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -414,8 +437,10 @@ async def post_test_iam_permissions( async def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -435,8 +460,10 @@ async def post_cancel_operation(self, response: None) -> None: async 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 @@ -456,8 +483,10 @@ async def post_delete_operation(self, response: None) -> None: async 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 @@ -479,8 +508,10 @@ async def post_get_operation( async 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 @@ -502,8 +533,10 @@ async def post_list_operations( async def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -721,7 +754,7 @@ async 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 persistent resource method over HTTP. @@ -733,8 +766,10 @@ async def __call__( 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: @@ -747,6 +782,7 @@ async def __call__( http_options = ( _BasePersistentResourceServiceRestTransport._BaseCreatePersistentResource._get_http_options() ) + request, metadata = await self._interceptor.pre_create_persistent_resource( request, metadata ) @@ -763,6 +799,33 @@ async 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.aiplatform_v1.PersistentResourceServiceClient.CreatePersistentResource", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PersistentResourceService", + "rpcName": "CreatePersistentResource", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncPersistentResourceServiceRestTransport._CreatePersistentResource._get_response( self._host, @@ -791,6 +854,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_create_persistent_resource(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.PersistentResourceServiceAsyncClient.create_persistent_resource", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PersistentResourceService", + "rpcName": "CreatePersistentResource", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _DeletePersistentResource( @@ -831,7 +916,7 @@ async 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 persistent resource method over HTTP. @@ -843,8 +928,10 @@ async def __call__( 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: @@ -857,6 +944,7 @@ async def __call__( http_options = ( _BasePersistentResourceServiceRestTransport._BaseDeletePersistentResource._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_persistent_resource( request, metadata ) @@ -869,6 +957,33 @@ async 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.aiplatform_v1.PersistentResourceServiceClient.DeletePersistentResource", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PersistentResourceService", + "rpcName": "DeletePersistentResource", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncPersistentResourceServiceRestTransport._DeletePersistentResource._get_response( self._host, @@ -896,6 +1011,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_delete_persistent_resource(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.PersistentResourceServiceAsyncClient.delete_persistent_resource", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PersistentResourceService", + "rpcName": "DeletePersistentResource", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _GetPersistentResource( @@ -936,7 +1073,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> persistent_resource.PersistentResource: r"""Call the get persistent resource method over HTTP. @@ -947,8 +1084,10 @@ async def __call__( 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: ~.persistent_resource.PersistentResource: @@ -963,6 +1102,7 @@ async def __call__( http_options = ( _BasePersistentResourceServiceRestTransport._BaseGetPersistentResource._get_http_options() ) + request, metadata = await self._interceptor.pre_get_persistent_resource( request, metadata ) @@ -975,6 +1115,33 @@ async 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.aiplatform_v1.PersistentResourceServiceClient.GetPersistentResource", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PersistentResourceService", + "rpcName": "GetPersistentResource", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncPersistentResourceServiceRestTransport._GetPersistentResource._get_response( self._host, @@ -1002,6 +1169,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_get_persistent_resource(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = persistent_resource.PersistentResource.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.PersistentResourceServiceAsyncClient.get_persistent_resource", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PersistentResourceService", + "rpcName": "GetPersistentResource", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ListPersistentResources( @@ -1042,7 +1233,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> persistent_resource_service.ListPersistentResourcesResponse: r"""Call the list persistent resources method over HTTP. @@ -1053,8 +1244,10 @@ async def __call__( 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: ~.persistent_resource_service.ListPersistentResourcesResponse: @@ -1066,6 +1259,7 @@ async def __call__( http_options = ( _BasePersistentResourceServiceRestTransport._BaseListPersistentResources._get_http_options() ) + request, metadata = await self._interceptor.pre_list_persistent_resources( request, metadata ) @@ -1078,6 +1272,33 @@ async 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.aiplatform_v1.PersistentResourceServiceClient.ListPersistentResources", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PersistentResourceService", + "rpcName": "ListPersistentResources", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncPersistentResourceServiceRestTransport._ListPersistentResources._get_response( self._host, @@ -1107,6 +1328,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_list_persistent_resources(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = persistent_resource_service.ListPersistentResourcesResponse.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.PersistentResourceServiceAsyncClient.list_persistent_resources", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PersistentResourceService", + "rpcName": "ListPersistentResources", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _RebootPersistentResource( @@ -1148,7 +1393,7 @@ async 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 reboot persistent resource method over HTTP. @@ -1160,8 +1405,10 @@ async def __call__( 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: @@ -1174,6 +1421,7 @@ async def __call__( http_options = ( _BasePersistentResourceServiceRestTransport._BaseRebootPersistentResource._get_http_options() ) + request, metadata = await self._interceptor.pre_reboot_persistent_resource( request, metadata ) @@ -1190,6 +1438,33 @@ async 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.aiplatform_v1.PersistentResourceServiceClient.RebootPersistentResource", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PersistentResourceService", + "rpcName": "RebootPersistentResource", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncPersistentResourceServiceRestTransport._RebootPersistentResource._get_response( self._host, @@ -1218,6 +1493,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_reboot_persistent_resource(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.PersistentResourceServiceAsyncClient.reboot_persistent_resource", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PersistentResourceService", + "rpcName": "RebootPersistentResource", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _UpdatePersistentResource( @@ -1259,7 +1556,7 @@ async 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 persistent resource method over HTTP. @@ -1271,8 +1568,10 @@ async def __call__( 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: @@ -1285,6 +1584,7 @@ async def __call__( http_options = ( _BasePersistentResourceServiceRestTransport._BaseUpdatePersistentResource._get_http_options() ) + request, metadata = await self._interceptor.pre_update_persistent_resource( request, metadata ) @@ -1301,6 +1601,33 @@ async 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.aiplatform_v1.PersistentResourceServiceClient.UpdatePersistentResource", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PersistentResourceService", + "rpcName": "UpdatePersistentResource", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncPersistentResourceServiceRestTransport._UpdatePersistentResource._get_response( self._host, @@ -1329,6 +1656,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_update_persistent_resource(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.PersistentResourceServiceAsyncClient.update_persistent_resource", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PersistentResourceService", + "rpcName": "UpdatePersistentResource", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp @property @@ -3302,7 +3651,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -3313,8 +3662,10 @@ async def __call__( 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: locations_pb2.Location: Response from GetLocation method. @@ -3323,6 +3674,7 @@ async def __call__( http_options = ( _BasePersistentResourceServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_location( request, metadata ) @@ -3335,6 +3687,33 @@ async 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.aiplatform_v1.PersistentResourceServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PersistentResourceService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncPersistentResourceServiceRestTransport._GetLocation._get_response( self._host, @@ -3360,6 +3739,27 @@ async def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_location(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.aiplatform_v1.PersistentResourceServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PersistentResourceService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3402,7 +3802,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -3413,8 +3813,10 @@ async def __call__( 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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -3423,6 +3825,7 @@ async def __call__( http_options = ( _BasePersistentResourceServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_locations( request, metadata ) @@ -3435,6 +3838,33 @@ async 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.aiplatform_v1.PersistentResourceServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PersistentResourceService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncPersistentResourceServiceRestTransport._ListLocations._get_response( self._host, @@ -3460,6 +3890,27 @@ async def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_list_locations(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.aiplatform_v1.PersistentResourceServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PersistentResourceService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3502,7 +3953,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -3513,8 +3964,10 @@ async def __call__( 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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -3523,6 +3976,7 @@ async def __call__( http_options = ( _BasePersistentResourceServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_get_iam_policy( request, metadata ) @@ -3535,6 +3989,33 @@ async 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.aiplatform_v1.PersistentResourceServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PersistentResourceService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncPersistentResourceServiceRestTransport._GetIamPolicy._get_response( self._host, @@ -3560,6 +4041,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_iam_policy(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.aiplatform_v1.PersistentResourceServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PersistentResourceService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3603,7 +4105,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -3614,8 +4116,10 @@ async def __call__( 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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -3624,6 +4128,7 @@ async def __call__( http_options = ( _BasePersistentResourceServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_set_iam_policy( request, metadata ) @@ -3640,6 +4145,33 @@ async 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.aiplatform_v1.PersistentResourceServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PersistentResourceService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncPersistentResourceServiceRestTransport._SetIamPolicy._get_response( self._host, @@ -3666,6 +4198,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_set_iam_policy(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.aiplatform_v1.PersistentResourceServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PersistentResourceService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3710,7 +4263,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -3721,8 +4274,10 @@ async def __call__( 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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -3731,6 +4286,7 @@ async def __call__( http_options = ( _BasePersistentResourceServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = await self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -3743,6 +4299,33 @@ async 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.aiplatform_v1.PersistentResourceServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PersistentResourceService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncPersistentResourceServiceRestTransport._TestIamPermissions._get_response( self._host, @@ -3768,6 +4351,27 @@ async def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_test_iam_permissions(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.aiplatform_v1.PersistentResourceServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PersistentResourceService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3810,7 +4414,7 @@ async 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 cancel operation method over HTTP. @@ -3821,13 +4425,16 @@ async def __call__( 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`. """ http_options = ( _BasePersistentResourceServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_cancel_operation( request, metadata ) @@ -3840,6 +4447,33 @@ async 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.aiplatform_v1.PersistentResourceServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PersistentResourceService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncPersistentResourceServiceRestTransport._CancelOperation._get_response( self._host, @@ -3903,7 +4537,7 @@ async 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. @@ -3914,13 +4548,16 @@ async def __call__( 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`. """ http_options = ( _BasePersistentResourceServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_operation( request, metadata ) @@ -3933,6 +4570,33 @@ async 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.aiplatform_v1.PersistentResourceServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PersistentResourceService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncPersistentResourceServiceRestTransport._DeleteOperation._get_response( self._host, @@ -3996,7 +4660,7 @@ async 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. @@ -4007,8 +4671,10 @@ async def __call__( 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: Response from GetOperation method. @@ -4017,6 +4683,7 @@ async def __call__( http_options = ( _BasePersistentResourceServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_operation( request, metadata ) @@ -4029,6 +4696,33 @@ async 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.aiplatform_v1.PersistentResourceServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PersistentResourceService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncPersistentResourceServiceRestTransport._GetOperation._get_response( self._host, @@ -4054,6 +4748,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1.PersistentResourceServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PersistentResourceService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4096,7 +4811,7 @@ async 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. @@ -4107,8 +4822,10 @@ async def __call__( 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 from ListOperations method. @@ -4117,6 +4834,7 @@ async def __call__( http_options = ( _BasePersistentResourceServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_operations( request, metadata ) @@ -4129,6 +4847,33 @@ async 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.aiplatform_v1.PersistentResourceServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PersistentResourceService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncPersistentResourceServiceRestTransport._ListOperations._get_response( self._host, @@ -4154,6 +4899,27 @@ async def __call__( resp = operations_pb2.ListOperationsResponse() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1.PersistentResourceServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PersistentResourceService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4196,7 +4962,7 @@ async 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 wait operation method over HTTP. @@ -4207,8 +4973,10 @@ async def __call__( 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: Response from WaitOperation method. @@ -4217,6 +4985,7 @@ async def __call__( http_options = ( _BasePersistentResourceServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_wait_operation( request, metadata ) @@ -4229,6 +4998,33 @@ async 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.aiplatform_v1.PersistentResourceServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PersistentResourceService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncPersistentResourceServiceRestTransport._WaitOperation._get_response( self._host, @@ -4254,6 +5050,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_wait_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.aiplatform_v1.PersistentResourceServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PersistentResourceService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1/services/pipeline_service/async_client.py b/google/cloud/aiplatform_v1/services/pipeline_service/async_client.py index 66aeee960e..007f2053c7 100644 --- a/google/cloud/aiplatform_v1/services/pipeline_service/async_client.py +++ b/google/cloud/aiplatform_v1/services/pipeline_service/async_client.py @@ -13,6 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging as std_logging from collections import OrderedDict import re from typing import ( @@ -67,6 +68,15 @@ from .transports.grpc_asyncio import PipelineServiceGrpcAsyncIOTransport from .client import PipelineServiceClient +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 PipelineServiceAsyncClient: """A service for creating and managing Vertex AI's pipelines. This @@ -298,6 +308,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.aiplatform_v1.PipelineServiceAsyncClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PipelineService", + "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.aiplatform.v1.PipelineService", + "credentialsType": None, + }, + ) + async def create_training_pipeline( self, request: Optional[ @@ -308,7 +340,7 @@ async def create_training_pipeline( training_pipeline: Optional[gca_training_pipeline.TrainingPipeline] = 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]]] = (), ) -> gca_training_pipeline.TrainingPipeline: r"""Creates a TrainingPipeline. A created TrainingPipeline right away will be attempted to be run. @@ -367,8 +399,10 @@ async def sample_create_training_pipeline(): 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.aiplatform_v1.types.TrainingPipeline: @@ -437,7 +471,7 @@ async def get_training_pipeline( 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]]] = (), ) -> training_pipeline.TrainingPipeline: r"""Gets a TrainingPipeline. @@ -482,8 +516,10 @@ async def sample_get_training_pipeline(): 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.aiplatform_v1.types.TrainingPipeline: @@ -550,7 +586,7 @@ async def list_training_pipelines( 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.ListTrainingPipelinesAsyncPager: r"""Lists TrainingPipelines in a Location. @@ -596,8 +632,10 @@ async def sample_list_training_pipelines(): 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.aiplatform_v1.services.pipeline_service.pagers.ListTrainingPipelinesAsyncPager: @@ -674,7 +712,7 @@ async def delete_training_pipeline( 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"""Deletes a TrainingPipeline. @@ -723,8 +761,10 @@ async def sample_delete_training_pipeline(): 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: @@ -805,7 +845,7 @@ async def cancel_training_pipeline( 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"""Cancels a TrainingPipeline. Starts asynchronous cancellation on the TrainingPipeline. The server makes a best effort to cancel @@ -859,8 +899,10 @@ async def sample_cancel_training_pipeline(): 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 @@ -916,7 +958,7 @@ async def create_pipeline_job( pipeline_job_id: 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]]] = (), ) -> gca_pipeline_job.PipelineJob: r"""Creates a PipelineJob. A PipelineJob will run immediately when created. @@ -978,8 +1020,10 @@ async def sample_create_pipeline_job(): 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.aiplatform_v1.types.PipelineJob: @@ -1044,7 +1088,7 @@ async def get_pipeline_job( 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]]] = (), ) -> pipeline_job.PipelineJob: r"""Gets a PipelineJob. @@ -1088,8 +1132,10 @@ async def sample_get_pipeline_job(): 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.aiplatform_v1.types.PipelineJob: @@ -1150,7 +1196,7 @@ async def list_pipeline_jobs( 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.ListPipelineJobsAsyncPager: r"""Lists PipelineJobs in a Location. @@ -1196,8 +1242,10 @@ async def sample_list_pipeline_jobs(): 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.aiplatform_v1.services.pipeline_service.pagers.ListPipelineJobsAsyncPager: @@ -1274,7 +1322,7 @@ async def delete_pipeline_job( 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"""Deletes a PipelineJob. @@ -1323,8 +1371,10 @@ async def sample_delete_pipeline_job(): 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: @@ -1406,7 +1456,7 @@ async def batch_delete_pipeline_jobs( names: Optional[MutableSequence[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"""Batch deletes PipelineJobs The Operation is atomic. If it fails, none of the @@ -1467,8 +1517,10 @@ async def sample_batch_delete_pipeline_jobs(): 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: @@ -1543,7 +1595,7 @@ async def cancel_pipeline_job( 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"""Cancels a PipelineJob. Starts asynchronous cancellation on the PipelineJob. The server makes a best effort to cancel the @@ -1596,8 +1648,10 @@ async def sample_cancel_pipeline_job(): 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 @@ -1652,7 +1706,7 @@ async def batch_cancel_pipeline_jobs( names: Optional[MutableSequence[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"""Batch cancel PipelineJobs. Firstly the server will check if all the jobs are in @@ -1718,8 +1772,10 @@ async def sample_batch_cancel_pipeline_jobs(): 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: @@ -1791,7 +1847,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. @@ -1802,8 +1858,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. @@ -1844,7 +1902,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. @@ -1855,8 +1913,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. @@ -1897,7 +1957,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. @@ -1913,8 +1973,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 """ @@ -1951,7 +2013,7 @@ async def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -1966,8 +2028,10 @@ async def cancel_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 """ @@ -2004,7 +2068,7 @@ async def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -2021,8 +2085,10 @@ async def wait_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. @@ -2063,7 +2129,7 @@ async def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -2076,8 +2142,10 @@ async def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -2182,7 +2250,7 @@ async def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -2196,8 +2264,10 @@ async def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -2302,7 +2372,7 @@ async def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -2317,8 +2387,10 @@ async def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -2362,7 +2434,7 @@ async def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -2373,8 +2445,10 @@ async def get_location( 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: ~.location_pb2.Location: Location object. @@ -2415,7 +2489,7 @@ async def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -2426,8 +2500,10 @@ async def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1/services/pipeline_service/client.py b/google/cloud/aiplatform_v1/services/pipeline_service/client.py index eb67e0aafc..7720e7f25a 100644 --- a/google/cloud/aiplatform_v1/services/pipeline_service/client.py +++ b/google/cloud/aiplatform_v1/services/pipeline_service/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 ( @@ -48,6 +49,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 as gac_operation # type: ignore from google.api_core import operation_async # type: ignore from google.cloud.aiplatform_v1.services.pipeline_service import pagers @@ -794,6 +804,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( @@ -884,6 +898,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.aiplatform_v1.PipelineServiceClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PipelineService", + "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.aiplatform.v1.PipelineService", + "credentialsType": None, + }, + ) + def create_training_pipeline( self, request: Optional[ @@ -894,7 +931,7 @@ def create_training_pipeline( training_pipeline: Optional[gca_training_pipeline.TrainingPipeline] = 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]]] = (), ) -> gca_training_pipeline.TrainingPipeline: r"""Creates a TrainingPipeline. A created TrainingPipeline right away will be attempted to be run. @@ -953,8 +990,10 @@ def sample_create_training_pipeline(): 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.aiplatform_v1.types.TrainingPipeline: @@ -1020,7 +1059,7 @@ def get_training_pipeline( 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]]] = (), ) -> training_pipeline.TrainingPipeline: r"""Gets a TrainingPipeline. @@ -1065,8 +1104,10 @@ def sample_get_training_pipeline(): 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.aiplatform_v1.types.TrainingPipeline: @@ -1130,7 +1171,7 @@ def list_training_pipelines( 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.ListTrainingPipelinesPager: r"""Lists TrainingPipelines in a Location. @@ -1176,8 +1217,10 @@ def sample_list_training_pipelines(): 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.aiplatform_v1.services.pipeline_service.pagers.ListTrainingPipelinesPager: @@ -1251,7 +1294,7 @@ def delete_training_pipeline( 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]]] = (), ) -> gac_operation.Operation: r"""Deletes a TrainingPipeline. @@ -1300,8 +1343,10 @@ def sample_delete_training_pipeline(): 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: @@ -1379,7 +1424,7 @@ def cancel_training_pipeline( 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"""Cancels a TrainingPipeline. Starts asynchronous cancellation on the TrainingPipeline. The server makes a best effort to cancel @@ -1433,8 +1478,10 @@ def sample_cancel_training_pipeline(): 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 @@ -1487,7 +1534,7 @@ def create_pipeline_job( pipeline_job_id: 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]]] = (), ) -> gca_pipeline_job.PipelineJob: r"""Creates a PipelineJob. A PipelineJob will run immediately when created. @@ -1549,8 +1596,10 @@ def sample_create_pipeline_job(): 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.aiplatform_v1.types.PipelineJob: @@ -1612,7 +1661,7 @@ def get_pipeline_job( 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]]] = (), ) -> pipeline_job.PipelineJob: r"""Gets a PipelineJob. @@ -1656,8 +1705,10 @@ def sample_get_pipeline_job(): 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.aiplatform_v1.types.PipelineJob: @@ -1715,7 +1766,7 @@ def list_pipeline_jobs( 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.ListPipelineJobsPager: r"""Lists PipelineJobs in a Location. @@ -1761,8 +1812,10 @@ def sample_list_pipeline_jobs(): 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.aiplatform_v1.services.pipeline_service.pagers.ListPipelineJobsPager: @@ -1836,7 +1889,7 @@ def delete_pipeline_job( 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]]] = (), ) -> gac_operation.Operation: r"""Deletes a PipelineJob. @@ -1885,8 +1938,10 @@ def sample_delete_pipeline_job(): 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: @@ -1965,7 +2020,7 @@ def batch_delete_pipeline_jobs( names: Optional[MutableSequence[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]]] = (), ) -> gac_operation.Operation: r"""Batch deletes PipelineJobs The Operation is atomic. If it fails, none of the @@ -2026,8 +2081,10 @@ def sample_batch_delete_pipeline_jobs(): 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: @@ -2101,7 +2158,7 @@ def cancel_pipeline_job( 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"""Cancels a PipelineJob. Starts asynchronous cancellation on the PipelineJob. The server makes a best effort to cancel the @@ -2154,8 +2211,10 @@ def sample_cancel_pipeline_job(): 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 @@ -2207,7 +2266,7 @@ def batch_cancel_pipeline_jobs( names: Optional[MutableSequence[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]]] = (), ) -> gac_operation.Operation: r"""Batch cancel PipelineJobs. Firstly the server will check if all the jobs are in @@ -2273,8 +2332,10 @@ def sample_batch_cancel_pipeline_jobs(): 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: @@ -2358,7 +2419,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. @@ -2369,8 +2430,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. @@ -2411,7 +2474,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. @@ -2422,8 +2485,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. @@ -2464,7 +2529,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. @@ -2480,8 +2545,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 """ @@ -2518,7 +2585,7 @@ def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -2533,8 +2600,10 @@ def cancel_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 """ @@ -2571,7 +2640,7 @@ def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -2588,8 +2657,10 @@ def wait_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. @@ -2630,7 +2701,7 @@ def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -2643,8 +2714,10 @@ def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -2749,7 +2822,7 @@ def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -2763,8 +2836,10 @@ def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -2869,7 +2944,7 @@ def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -2884,8 +2959,10 @@ def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -2927,7 +3004,7 @@ def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -2938,8 +3015,10 @@ def get_location( 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: ~.location_pb2.Location: Location object. @@ -2980,7 +3059,7 @@ def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -2991,8 +3070,10 @@ def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1/services/pipeline_service/pagers.py b/google/cloud/aiplatform_v1/services/pipeline_service/pagers.py index 08c4883bb9..bf20ba5084 100644 --- a/google/cloud/aiplatform_v1/services/pipeline_service/pagers.py +++ b/google/cloud/aiplatform_v1/services/pipeline_service/pagers.py @@ -68,7 +68,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. @@ -82,8 +82,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 = pipeline_service.ListTrainingPipelinesRequest(request) @@ -144,7 +146,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. @@ -158,8 +160,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 = pipeline_service.ListTrainingPipelinesRequest(request) @@ -224,7 +228,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. @@ -238,8 +242,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 = pipeline_service.ListPipelineJobsRequest(request) @@ -298,7 +304,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. @@ -312,8 +318,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 = pipeline_service.ListPipelineJobsRequest(request) diff --git a/google/cloud/aiplatform_v1/services/pipeline_service/transports/grpc.py b/google/cloud/aiplatform_v1/services/pipeline_service/transports/grpc.py index a2b20e66f8..8d08918c2f 100644 --- a/google/cloud/aiplatform_v1/services/pipeline_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1/services/pipeline_service/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 import warnings from typing import Callable, Dict, Optional, Sequence, Tuple, Union @@ -22,8 +25,11 @@ import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from google.cloud.aiplatform_v1.types import pipeline_job from google.cloud.aiplatform_v1.types import pipeline_job as gca_pipeline_job @@ -37,6 +43,81 @@ from google.protobuf import empty_pb2 # type: ignore from .base import PipelineServiceTransport, DEFAULT_CLIENT_INFO +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.aiplatform.v1.PipelineService", + "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.aiplatform.v1.PipelineService", + "rpcName": client_call_details.method, + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class PipelineServiceGrpcTransport(PipelineServiceTransport): """gRPC backend transport for PipelineService. @@ -194,7 +275,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 @@ -258,7 +344,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 @@ -286,7 +374,7 @@ def create_training_pipeline( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_training_pipeline" not in self._stubs: - self._stubs["create_training_pipeline"] = self.grpc_channel.unary_unary( + self._stubs["create_training_pipeline"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.PipelineService/CreateTrainingPipeline", request_serializer=pipeline_service.CreateTrainingPipelineRequest.serialize, response_deserializer=gca_training_pipeline.TrainingPipeline.deserialize, @@ -315,7 +403,7 @@ def get_training_pipeline( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_training_pipeline" not in self._stubs: - self._stubs["get_training_pipeline"] = self.grpc_channel.unary_unary( + self._stubs["get_training_pipeline"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.PipelineService/GetTrainingPipeline", request_serializer=pipeline_service.GetTrainingPipelineRequest.serialize, response_deserializer=training_pipeline.TrainingPipeline.deserialize, @@ -344,7 +432,7 @@ def list_training_pipelines( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_training_pipelines" not in self._stubs: - self._stubs["list_training_pipelines"] = self.grpc_channel.unary_unary( + self._stubs["list_training_pipelines"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.PipelineService/ListTrainingPipelines", request_serializer=pipeline_service.ListTrainingPipelinesRequest.serialize, response_deserializer=pipeline_service.ListTrainingPipelinesResponse.deserialize, @@ -372,7 +460,7 @@ def delete_training_pipeline( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_training_pipeline" not in self._stubs: - self._stubs["delete_training_pipeline"] = self.grpc_channel.unary_unary( + self._stubs["delete_training_pipeline"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.PipelineService/DeleteTrainingPipeline", request_serializer=pipeline_service.DeleteTrainingPipelineRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -410,7 +498,7 @@ def cancel_training_pipeline( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_training_pipeline" not in self._stubs: - self._stubs["cancel_training_pipeline"] = self.grpc_channel.unary_unary( + self._stubs["cancel_training_pipeline"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.PipelineService/CancelTrainingPipeline", request_serializer=pipeline_service.CancelTrainingPipelineRequest.serialize, response_deserializer=empty_pb2.Empty.FromString, @@ -439,7 +527,7 @@ def create_pipeline_job( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_pipeline_job" not in self._stubs: - self._stubs["create_pipeline_job"] = self.grpc_channel.unary_unary( + self._stubs["create_pipeline_job"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.PipelineService/CreatePipelineJob", request_serializer=pipeline_service.CreatePipelineJobRequest.serialize, response_deserializer=gca_pipeline_job.PipelineJob.deserialize, @@ -465,7 +553,7 @@ def get_pipeline_job( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_pipeline_job" not in self._stubs: - self._stubs["get_pipeline_job"] = self.grpc_channel.unary_unary( + self._stubs["get_pipeline_job"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.PipelineService/GetPipelineJob", request_serializer=pipeline_service.GetPipelineJobRequest.serialize, response_deserializer=pipeline_job.PipelineJob.deserialize, @@ -494,7 +582,7 @@ def list_pipeline_jobs( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_pipeline_jobs" not in self._stubs: - self._stubs["list_pipeline_jobs"] = self.grpc_channel.unary_unary( + self._stubs["list_pipeline_jobs"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.PipelineService/ListPipelineJobs", request_serializer=pipeline_service.ListPipelineJobsRequest.serialize, response_deserializer=pipeline_service.ListPipelineJobsResponse.deserialize, @@ -522,7 +610,7 @@ def delete_pipeline_job( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_pipeline_job" not in self._stubs: - self._stubs["delete_pipeline_job"] = self.grpc_channel.unary_unary( + self._stubs["delete_pipeline_job"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.PipelineService/DeletePipelineJob", request_serializer=pipeline_service.DeletePipelineJobRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -553,7 +641,9 @@ def batch_delete_pipeline_jobs( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "batch_delete_pipeline_jobs" not in self._stubs: - self._stubs["batch_delete_pipeline_jobs"] = self.grpc_channel.unary_unary( + self._stubs[ + "batch_delete_pipeline_jobs" + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.PipelineService/BatchDeletePipelineJobs", request_serializer=pipeline_service.BatchDeletePipelineJobsRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -591,7 +681,7 @@ def cancel_pipeline_job( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_pipeline_job" not in self._stubs: - self._stubs["cancel_pipeline_job"] = self.grpc_channel.unary_unary( + self._stubs["cancel_pipeline_job"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.PipelineService/CancelPipelineJob", request_serializer=pipeline_service.CancelPipelineJobRequest.serialize, response_deserializer=empty_pb2.Empty.FromString, @@ -627,7 +717,9 @@ def batch_cancel_pipeline_jobs( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "batch_cancel_pipeline_jobs" not in self._stubs: - self._stubs["batch_cancel_pipeline_jobs"] = self.grpc_channel.unary_unary( + self._stubs[ + "batch_cancel_pipeline_jobs" + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.PipelineService/BatchCancelPipelineJobs", request_serializer=pipeline_service.BatchCancelPipelineJobsRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -635,7 +727,7 @@ def batch_cancel_pipeline_jobs( return self._stubs["batch_cancel_pipeline_jobs"] def close(self): - self.grpc_channel.close() + self._logged_channel.close() @property def delete_operation( @@ -647,7 +739,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, @@ -664,7 +756,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -681,7 +773,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -698,7 +790,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, @@ -717,7 +809,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, @@ -736,7 +828,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -753,7 +845,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -778,7 +870,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -804,7 +896,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -833,7 +925,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1/services/pipeline_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1/services/pipeline_service/transports/grpc_asyncio.py index e6ccf43a6a..f3d7b7275a 100644 --- a/google/cloud/aiplatform_v1/services/pipeline_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1/services/pipeline_service/transports/grpc_asyncio.py @@ -14,6 +14,9 @@ # limitations under the License. # import inspect +import json +import pickle +import logging as std_logging import warnings from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union @@ -24,8 +27,11 @@ from google.api_core import operations_v1 from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from grpc.experimental import aio # type: ignore from google.cloud.aiplatform_v1.types import pipeline_job @@ -41,6 +47,82 @@ from .base import PipelineServiceTransport, DEFAULT_CLIENT_INFO from .grpc import PipelineServiceGrpcTransport +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.aiplatform.v1.PipelineService", + "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.aiplatform.v1.PipelineService", + "rpcName": str(client_call_details.method), + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class PipelineServiceGrpcAsyncIOTransport(PipelineServiceTransport): """gRPC AsyncIO backend transport for PipelineService. @@ -241,10 +323,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 @@ -267,7 +352,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. @@ -296,7 +381,7 @@ def create_training_pipeline( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_training_pipeline" not in self._stubs: - self._stubs["create_training_pipeline"] = self.grpc_channel.unary_unary( + self._stubs["create_training_pipeline"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.PipelineService/CreateTrainingPipeline", request_serializer=pipeline_service.CreateTrainingPipelineRequest.serialize, response_deserializer=gca_training_pipeline.TrainingPipeline.deserialize, @@ -325,7 +410,7 @@ def get_training_pipeline( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_training_pipeline" not in self._stubs: - self._stubs["get_training_pipeline"] = self.grpc_channel.unary_unary( + self._stubs["get_training_pipeline"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.PipelineService/GetTrainingPipeline", request_serializer=pipeline_service.GetTrainingPipelineRequest.serialize, response_deserializer=training_pipeline.TrainingPipeline.deserialize, @@ -354,7 +439,7 @@ def list_training_pipelines( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_training_pipelines" not in self._stubs: - self._stubs["list_training_pipelines"] = self.grpc_channel.unary_unary( + self._stubs["list_training_pipelines"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.PipelineService/ListTrainingPipelines", request_serializer=pipeline_service.ListTrainingPipelinesRequest.serialize, response_deserializer=pipeline_service.ListTrainingPipelinesResponse.deserialize, @@ -383,7 +468,7 @@ def delete_training_pipeline( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_training_pipeline" not in self._stubs: - self._stubs["delete_training_pipeline"] = self.grpc_channel.unary_unary( + self._stubs["delete_training_pipeline"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.PipelineService/DeleteTrainingPipeline", request_serializer=pipeline_service.DeleteTrainingPipelineRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -423,7 +508,7 @@ def cancel_training_pipeline( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_training_pipeline" not in self._stubs: - self._stubs["cancel_training_pipeline"] = self.grpc_channel.unary_unary( + self._stubs["cancel_training_pipeline"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.PipelineService/CancelTrainingPipeline", request_serializer=pipeline_service.CancelTrainingPipelineRequest.serialize, response_deserializer=empty_pb2.Empty.FromString, @@ -453,7 +538,7 @@ def create_pipeline_job( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_pipeline_job" not in self._stubs: - self._stubs["create_pipeline_job"] = self.grpc_channel.unary_unary( + self._stubs["create_pipeline_job"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.PipelineService/CreatePipelineJob", request_serializer=pipeline_service.CreatePipelineJobRequest.serialize, response_deserializer=gca_pipeline_job.PipelineJob.deserialize, @@ -481,7 +566,7 @@ def get_pipeline_job( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_pipeline_job" not in self._stubs: - self._stubs["get_pipeline_job"] = self.grpc_channel.unary_unary( + self._stubs["get_pipeline_job"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.PipelineService/GetPipelineJob", request_serializer=pipeline_service.GetPipelineJobRequest.serialize, response_deserializer=pipeline_job.PipelineJob.deserialize, @@ -510,7 +595,7 @@ def list_pipeline_jobs( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_pipeline_jobs" not in self._stubs: - self._stubs["list_pipeline_jobs"] = self.grpc_channel.unary_unary( + self._stubs["list_pipeline_jobs"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.PipelineService/ListPipelineJobs", request_serializer=pipeline_service.ListPipelineJobsRequest.serialize, response_deserializer=pipeline_service.ListPipelineJobsResponse.deserialize, @@ -538,7 +623,7 @@ def delete_pipeline_job( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_pipeline_job" not in self._stubs: - self._stubs["delete_pipeline_job"] = self.grpc_channel.unary_unary( + self._stubs["delete_pipeline_job"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.PipelineService/DeletePipelineJob", request_serializer=pipeline_service.DeletePipelineJobRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -570,7 +655,9 @@ def batch_delete_pipeline_jobs( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "batch_delete_pipeline_jobs" not in self._stubs: - self._stubs["batch_delete_pipeline_jobs"] = self.grpc_channel.unary_unary( + self._stubs[ + "batch_delete_pipeline_jobs" + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.PipelineService/BatchDeletePipelineJobs", request_serializer=pipeline_service.BatchDeletePipelineJobsRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -610,7 +697,7 @@ def cancel_pipeline_job( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_pipeline_job" not in self._stubs: - self._stubs["cancel_pipeline_job"] = self.grpc_channel.unary_unary( + self._stubs["cancel_pipeline_job"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.PipelineService/CancelPipelineJob", request_serializer=pipeline_service.CancelPipelineJobRequest.serialize, response_deserializer=empty_pb2.Empty.FromString, @@ -647,7 +734,9 @@ def batch_cancel_pipeline_jobs( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "batch_cancel_pipeline_jobs" not in self._stubs: - self._stubs["batch_cancel_pipeline_jobs"] = self.grpc_channel.unary_unary( + self._stubs[ + "batch_cancel_pipeline_jobs" + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.PipelineService/BatchCancelPipelineJobs", request_serializer=pipeline_service.BatchCancelPipelineJobsRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -775,7 +864,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: @@ -791,7 +880,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, @@ -808,7 +897,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -825,7 +914,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -842,7 +931,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, @@ -861,7 +950,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, @@ -880,7 +969,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -897,7 +986,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -922,7 +1011,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -948,7 +1037,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -977,7 +1066,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1/services/pipeline_service/transports/rest.py b/google/cloud/aiplatform_v1/services/pipeline_service/transports/rest.py index efaca1857d..9df07cc5a8 100644 --- a/google/cloud/aiplatform_v1/services/pipeline_service/transports/rest.py +++ b/google/cloud/aiplatform_v1/services/pipeline_service/transports/rest.py @@ -13,9 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging +import json # type: ignore from google.auth.transport.requests import AuthorizedSession # type: ignore -import json # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.api_core import exceptions as core_exceptions from google.api_core import retry as retries @@ -52,6 +53,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, @@ -172,9 +181,10 @@ def post_list_training_pipelines(self, response): def pre_batch_cancel_pipeline_jobs( self, request: pipeline_service.BatchCancelPipelineJobsRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - pipeline_service.BatchCancelPipelineJobsRequest, Sequence[Tuple[str, str]] + pipeline_service.BatchCancelPipelineJobsRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for batch_cancel_pipeline_jobs @@ -197,9 +207,10 @@ def post_batch_cancel_pipeline_jobs( def pre_batch_delete_pipeline_jobs( self, request: pipeline_service.BatchDeletePipelineJobsRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - pipeline_service.BatchDeletePipelineJobsRequest, Sequence[Tuple[str, str]] + pipeline_service.BatchDeletePipelineJobsRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for batch_delete_pipeline_jobs @@ -222,8 +233,11 @@ def post_batch_delete_pipeline_jobs( def pre_cancel_pipeline_job( self, request: pipeline_service.CancelPipelineJobRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[pipeline_service.CancelPipelineJobRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + pipeline_service.CancelPipelineJobRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for cancel_pipeline_job Override in a subclass to manipulate the request or metadata @@ -234,9 +248,10 @@ def pre_cancel_pipeline_job( def pre_cancel_training_pipeline( self, request: pipeline_service.CancelTrainingPipelineRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - pipeline_service.CancelTrainingPipelineRequest, Sequence[Tuple[str, str]] + pipeline_service.CancelTrainingPipelineRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for cancel_training_pipeline @@ -248,8 +263,11 @@ def pre_cancel_training_pipeline( def pre_create_pipeline_job( self, request: pipeline_service.CreatePipelineJobRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[pipeline_service.CreatePipelineJobRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + pipeline_service.CreatePipelineJobRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for create_pipeline_job Override in a subclass to manipulate the request or metadata @@ -271,9 +289,10 @@ def post_create_pipeline_job( def pre_create_training_pipeline( self, request: pipeline_service.CreateTrainingPipelineRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - pipeline_service.CreateTrainingPipelineRequest, Sequence[Tuple[str, str]] + pipeline_service.CreateTrainingPipelineRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for create_training_pipeline @@ -296,8 +315,11 @@ def post_create_training_pipeline( def pre_delete_pipeline_job( self, request: pipeline_service.DeletePipelineJobRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[pipeline_service.DeletePipelineJobRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + pipeline_service.DeletePipelineJobRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for delete_pipeline_job Override in a subclass to manipulate the request or metadata @@ -319,9 +341,10 @@ def post_delete_pipeline_job( def pre_delete_training_pipeline( self, request: pipeline_service.DeleteTrainingPipelineRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - pipeline_service.DeleteTrainingPipelineRequest, Sequence[Tuple[str, str]] + pipeline_service.DeleteTrainingPipelineRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for delete_training_pipeline @@ -344,8 +367,10 @@ def post_delete_training_pipeline( def pre_get_pipeline_job( self, request: pipeline_service.GetPipelineJobRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[pipeline_service.GetPipelineJobRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + pipeline_service.GetPipelineJobRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_pipeline_job Override in a subclass to manipulate the request or metadata @@ -367,8 +392,11 @@ def post_get_pipeline_job( def pre_get_training_pipeline( self, request: pipeline_service.GetTrainingPipelineRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[pipeline_service.GetTrainingPipelineRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + pipeline_service.GetTrainingPipelineRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for get_training_pipeline Override in a subclass to manipulate the request or metadata @@ -390,8 +418,11 @@ def post_get_training_pipeline( def pre_list_pipeline_jobs( self, request: pipeline_service.ListPipelineJobsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[pipeline_service.ListPipelineJobsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + pipeline_service.ListPipelineJobsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for list_pipeline_jobs Override in a subclass to manipulate the request or metadata @@ -413,9 +444,10 @@ def post_list_pipeline_jobs( def pre_list_training_pipelines( self, request: pipeline_service.ListTrainingPipelinesRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - pipeline_service.ListTrainingPipelinesRequest, Sequence[Tuple[str, str]] + pipeline_service.ListTrainingPipelinesRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for list_training_pipelines @@ -438,8 +470,10 @@ def post_list_training_pipelines( def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -461,8 +495,10 @@ def post_get_location( def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -484,8 +520,10 @@ def post_list_locations( def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -505,8 +543,10 @@ def post_get_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -526,8 +566,11 @@ def post_set_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -549,8 +592,10 @@ def post_test_iam_permissions( def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -570,8 +615,10 @@ def post_cancel_operation(self, response: None) -> None: 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 @@ -591,8 +638,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 @@ -614,8 +663,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 @@ -637,8 +688,10 @@ def post_list_operations( def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -2663,7 +2716,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 batch cancel pipeline jobs method over HTTP. @@ -2675,8 +2728,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: @@ -2689,6 +2744,7 @@ def __call__( http_options = ( _BasePipelineServiceRestTransport._BaseBatchCancelPipelineJobs._get_http_options() ) + request, metadata = self._interceptor.pre_batch_cancel_pipeline_jobs( request, metadata ) @@ -2705,6 +2761,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.aiplatform_v1.PipelineServiceClient.BatchCancelPipelineJobs", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PipelineService", + "rpcName": "BatchCancelPipelineJobs", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( PipelineServiceRestTransport._BatchCancelPipelineJobs._get_response( @@ -2726,7 +2809,29 @@ def __call__( # Return the response resp = operations_pb2.Operation() json_format.Parse(response.content, resp, ignore_unknown_fields=True) + resp = self._interceptor.post_batch_cancel_pipeline_jobs(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.aiplatform_v1.PipelineServiceClient.batch_cancel_pipeline_jobs", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PipelineService", + "rpcName": "BatchCancelPipelineJobs", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _BatchDeletePipelineJobs( @@ -2766,7 +2871,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 batch delete pipeline jobs method over HTTP. @@ -2778,8 +2883,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: @@ -2792,6 +2899,7 @@ def __call__( http_options = ( _BasePipelineServiceRestTransport._BaseBatchDeletePipelineJobs._get_http_options() ) + request, metadata = self._interceptor.pre_batch_delete_pipeline_jobs( request, metadata ) @@ -2808,6 +2916,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.aiplatform_v1.PipelineServiceClient.BatchDeletePipelineJobs", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PipelineService", + "rpcName": "BatchDeletePipelineJobs", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( PipelineServiceRestTransport._BatchDeletePipelineJobs._get_response( @@ -2829,7 +2964,29 @@ def __call__( # Return the response resp = operations_pb2.Operation() json_format.Parse(response.content, resp, ignore_unknown_fields=True) + resp = self._interceptor.post_batch_delete_pipeline_jobs(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.aiplatform_v1.PipelineServiceClient.batch_delete_pipeline_jobs", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PipelineService", + "rpcName": "BatchDeletePipelineJobs", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _CancelPipelineJob( @@ -2869,7 +3026,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 cancel pipeline job method over HTTP. @@ -2880,13 +3037,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 = ( _BasePipelineServiceRestTransport._BaseCancelPipelineJob._get_http_options() ) + request, metadata = self._interceptor.pre_cancel_pipeline_job( request, metadata ) @@ -2903,6 +3063,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.aiplatform_v1.PipelineServiceClient.CancelPipelineJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PipelineService", + "rpcName": "CancelPipelineJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = PipelineServiceRestTransport._CancelPipelineJob._get_response( self._host, @@ -2956,7 +3143,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 cancel training pipeline method over HTTP. @@ -2967,13 +3154,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 = ( _BasePipelineServiceRestTransport._BaseCancelTrainingPipeline._get_http_options() ) + request, metadata = self._interceptor.pre_cancel_training_pipeline( request, metadata ) @@ -2990,6 +3180,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.aiplatform_v1.PipelineServiceClient.CancelTrainingPipeline", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PipelineService", + "rpcName": "CancelTrainingPipeline", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( PipelineServiceRestTransport._CancelTrainingPipeline._get_response( @@ -3045,7 +3262,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]]] = (), ) -> gca_pipeline_job.PipelineJob: r"""Call the create pipeline job method over HTTP. @@ -3056,8 +3273,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: ~.gca_pipeline_job.PipelineJob: @@ -3069,6 +3288,7 @@ def __call__( http_options = ( _BasePipelineServiceRestTransport._BaseCreatePipelineJob._get_http_options() ) + request, metadata = self._interceptor.pre_create_pipeline_job( request, metadata ) @@ -3085,6 +3305,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.aiplatform_v1.PipelineServiceClient.CreatePipelineJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PipelineService", + "rpcName": "CreatePipelineJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = PipelineServiceRestTransport._CreatePipelineJob._get_response( self._host, @@ -3106,7 +3353,29 @@ def __call__( pb_resp = gca_pipeline_job.PipelineJob.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_create_pipeline_job(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gca_pipeline_job.PipelineJob.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.aiplatform_v1.PipelineServiceClient.create_pipeline_job", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PipelineService", + "rpcName": "CreatePipelineJob", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _CreateTrainingPipeline( @@ -3146,7 +3415,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]]] = (), ) -> gca_training_pipeline.TrainingPipeline: r"""Call the create training pipeline method over HTTP. @@ -3157,8 +3426,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: ~.gca_training_pipeline.TrainingPipeline: @@ -3174,6 +3445,7 @@ def __call__( http_options = ( _BasePipelineServiceRestTransport._BaseCreateTrainingPipeline._get_http_options() ) + request, metadata = self._interceptor.pre_create_training_pipeline( request, metadata ) @@ -3190,6 +3462,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.aiplatform_v1.PipelineServiceClient.CreateTrainingPipeline", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PipelineService", + "rpcName": "CreateTrainingPipeline", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( PipelineServiceRestTransport._CreateTrainingPipeline._get_response( @@ -3213,7 +3512,31 @@ def __call__( pb_resp = gca_training_pipeline.TrainingPipeline.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_create_training_pipeline(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gca_training_pipeline.TrainingPipeline.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.aiplatform_v1.PipelineServiceClient.create_training_pipeline", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PipelineService", + "rpcName": "CreateTrainingPipeline", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _DeletePipelineJob( @@ -3252,7 +3575,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 pipeline job method over HTTP. @@ -3263,8 +3586,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: @@ -3277,6 +3602,7 @@ def __call__( http_options = ( _BasePipelineServiceRestTransport._BaseDeletePipelineJob._get_http_options() ) + request, metadata = self._interceptor.pre_delete_pipeline_job( request, metadata ) @@ -3289,6 +3615,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.aiplatform_v1.PipelineServiceClient.DeletePipelineJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PipelineService", + "rpcName": "DeletePipelineJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = PipelineServiceRestTransport._DeletePipelineJob._get_response( self._host, @@ -3307,7 +3660,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_pipeline_job(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.aiplatform_v1.PipelineServiceClient.delete_pipeline_job", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PipelineService", + "rpcName": "DeletePipelineJob", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _DeleteTrainingPipeline( @@ -3346,7 +3721,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 training pipeline method over HTTP. @@ -3357,8 +3732,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: @@ -3371,6 +3748,7 @@ def __call__( http_options = ( _BasePipelineServiceRestTransport._BaseDeleteTrainingPipeline._get_http_options() ) + request, metadata = self._interceptor.pre_delete_training_pipeline( request, metadata ) @@ -3383,6 +3761,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.aiplatform_v1.PipelineServiceClient.DeleteTrainingPipeline", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PipelineService", + "rpcName": "DeleteTrainingPipeline", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( PipelineServiceRestTransport._DeleteTrainingPipeline._get_response( @@ -3403,7 +3808,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_training_pipeline(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.aiplatform_v1.PipelineServiceClient.delete_training_pipeline", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PipelineService", + "rpcName": "DeleteTrainingPipeline", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _GetPipelineJob( @@ -3441,7 +3868,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]]] = (), ) -> pipeline_job.PipelineJob: r"""Call the get pipeline job method over HTTP. @@ -3452,8 +3879,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: ~.pipeline_job.PipelineJob: @@ -3465,6 +3894,7 @@ def __call__( http_options = ( _BasePipelineServiceRestTransport._BaseGetPipelineJob._get_http_options() ) + request, metadata = self._interceptor.pre_get_pipeline_job( request, metadata ) @@ -3477,6 +3907,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.aiplatform_v1.PipelineServiceClient.GetPipelineJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PipelineService", + "rpcName": "GetPipelineJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = PipelineServiceRestTransport._GetPipelineJob._get_response( self._host, @@ -3497,7 +3954,29 @@ def __call__( pb_resp = pipeline_job.PipelineJob.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_pipeline_job(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = pipeline_job.PipelineJob.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.aiplatform_v1.PipelineServiceClient.get_pipeline_job", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PipelineService", + "rpcName": "GetPipelineJob", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _GetTrainingPipeline( @@ -3536,7 +4015,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]]] = (), ) -> training_pipeline.TrainingPipeline: r"""Call the get training pipeline method over HTTP. @@ -3547,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: ~.training_pipeline.TrainingPipeline: @@ -3564,6 +4045,7 @@ def __call__( http_options = ( _BasePipelineServiceRestTransport._BaseGetTrainingPipeline._get_http_options() ) + request, metadata = self._interceptor.pre_get_training_pipeline( request, metadata ) @@ -3576,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.aiplatform_v1.PipelineServiceClient.GetTrainingPipeline", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PipelineService", + "rpcName": "GetTrainingPipeline", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = PipelineServiceRestTransport._GetTrainingPipeline._get_response( self._host, @@ -3596,7 +4105,31 @@ def __call__( pb_resp = training_pipeline.TrainingPipeline.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_training_pipeline(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = training_pipeline.TrainingPipeline.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.aiplatform_v1.PipelineServiceClient.get_training_pipeline", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PipelineService", + "rpcName": "GetTrainingPipeline", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListPipelineJobs( @@ -3634,7 +4167,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]]] = (), ) -> pipeline_service.ListPipelineJobsResponse: r"""Call the list pipeline jobs method over HTTP. @@ -3645,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: ~.pipeline_service.ListPipelineJobsResponse: @@ -3658,6 +4193,7 @@ def __call__( http_options = ( _BasePipelineServiceRestTransport._BaseListPipelineJobs._get_http_options() ) + request, metadata = self._interceptor.pre_list_pipeline_jobs( request, metadata ) @@ -3670,6 +4206,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.aiplatform_v1.PipelineServiceClient.ListPipelineJobs", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PipelineService", + "rpcName": "ListPipelineJobs", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = PipelineServiceRestTransport._ListPipelineJobs._get_response( self._host, @@ -3690,7 +4253,31 @@ def __call__( pb_resp = pipeline_service.ListPipelineJobsResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_pipeline_jobs(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + pipeline_service.ListPipelineJobsResponse.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.aiplatform_v1.PipelineServiceClient.list_pipeline_jobs", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PipelineService", + "rpcName": "ListPipelineJobs", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListTrainingPipelines( @@ -3729,7 +4316,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]]] = (), ) -> pipeline_service.ListTrainingPipelinesResponse: r"""Call the list training pipelines method over HTTP. @@ -3740,8 +4327,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: ~.pipeline_service.ListTrainingPipelinesResponse: @@ -3753,6 +4342,7 @@ def __call__( http_options = ( _BasePipelineServiceRestTransport._BaseListTrainingPipelines._get_http_options() ) + request, metadata = self._interceptor.pre_list_training_pipelines( request, metadata ) @@ -3765,6 +4355,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.aiplatform_v1.PipelineServiceClient.ListTrainingPipelines", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PipelineService", + "rpcName": "ListTrainingPipelines", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( PipelineServiceRestTransport._ListTrainingPipelines._get_response( @@ -3787,7 +4404,31 @@ def __call__( pb_resp = pipeline_service.ListTrainingPipelinesResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_training_pipelines(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + pipeline_service.ListTrainingPipelinesResponse.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.aiplatform_v1.PipelineServiceClient.list_training_pipelines", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PipelineService", + "rpcName": "ListTrainingPipelines", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp @property @@ -3947,7 +4588,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]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -3958,8 +4599,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: locations_pb2.Location: Response from GetLocation method. @@ -3968,6 +4611,7 @@ def __call__( http_options = ( _BasePipelineServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = self._interceptor.pre_get_location(request, metadata) transcoded_request = _BasePipelineServiceRestTransport._BaseGetLocation._get_transcoded_request( http_options, request @@ -3978,6 +4622,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.aiplatform_v1.PipelineServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PipelineService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = PipelineServiceRestTransport._GetLocation._get_response( self._host, @@ -3997,6 +4668,27 @@ def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_location(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.aiplatform_v1.PipelineServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PipelineService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4038,7 +4730,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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -4049,8 +4741,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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -4059,6 +4753,7 @@ def __call__( http_options = ( _BasePipelineServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = self._interceptor.pre_list_locations(request, metadata) transcoded_request = _BasePipelineServiceRestTransport._BaseListLocations._get_transcoded_request( http_options, request @@ -4069,6 +4764,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.aiplatform_v1.PipelineServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PipelineService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = PipelineServiceRestTransport._ListLocations._get_response( self._host, @@ -4088,6 +4810,27 @@ def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_list_locations(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.aiplatform_v1.PipelineServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PipelineService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4129,7 +4872,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]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -4140,8 +4883,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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -4150,6 +4895,7 @@ def __call__( http_options = ( _BasePipelineServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_get_iam_policy(request, metadata) transcoded_request = _BasePipelineServiceRestTransport._BaseGetIamPolicy._get_transcoded_request( http_options, request @@ -4160,6 +4906,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.aiplatform_v1.PipelineServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PipelineService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = PipelineServiceRestTransport._GetIamPolicy._get_response( self._host, @@ -4179,6 +4952,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_iam_policy(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.aiplatform_v1.PipelineServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PipelineService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4221,7 +5015,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]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -4232,8 +5026,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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -4242,6 +5038,7 @@ def __call__( http_options = ( _BasePipelineServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_set_iam_policy(request, metadata) transcoded_request = _BasePipelineServiceRestTransport._BaseSetIamPolicy._get_transcoded_request( http_options, request @@ -4256,6 +5053,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.aiplatform_v1.PipelineServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PipelineService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = PipelineServiceRestTransport._SetIamPolicy._get_response( self._host, @@ -4276,6 +5100,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_set_iam_policy(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.aiplatform_v1.PipelineServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PipelineService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4318,7 +5163,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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -4329,8 +5174,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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -4339,6 +5186,7 @@ def __call__( http_options = ( _BasePipelineServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -4351,6 +5199,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.aiplatform_v1.PipelineServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PipelineService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = PipelineServiceRestTransport._TestIamPermissions._get_response( self._host, @@ -4370,6 +5245,27 @@ def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_test_iam_permissions(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.aiplatform_v1.PipelineServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PipelineService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4411,7 +5307,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 cancel operation method over HTTP. @@ -4422,13 +5318,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 = ( _BasePipelineServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = self._interceptor.pre_cancel_operation( request, metadata ) @@ -4441,6 +5340,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.aiplatform_v1.PipelineServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PipelineService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = PipelineServiceRestTransport._CancelOperation._get_response( self._host, @@ -4497,7 +5423,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. @@ -4508,13 +5434,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 = ( _BasePipelineServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = self._interceptor.pre_delete_operation( request, metadata ) @@ -4527,6 +5456,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.aiplatform_v1.PipelineServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PipelineService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = PipelineServiceRestTransport._DeleteOperation._get_response( self._host, @@ -4583,7 +5539,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. @@ -4594,8 +5550,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. @@ -4604,6 +5562,7 @@ def __call__( http_options = ( _BasePipelineServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = self._interceptor.pre_get_operation(request, metadata) transcoded_request = _BasePipelineServiceRestTransport._BaseGetOperation._get_transcoded_request( http_options, request @@ -4614,6 +5573,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.aiplatform_v1.PipelineServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PipelineService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = PipelineServiceRestTransport._GetOperation._get_response( self._host, @@ -4633,6 +5619,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.aiplatform_v1.PipelineServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PipelineService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4674,7 +5681,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. @@ -4685,8 +5692,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. @@ -4695,6 +5704,7 @@ def __call__( http_options = ( _BasePipelineServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = self._interceptor.pre_list_operations(request, metadata) transcoded_request = _BasePipelineServiceRestTransport._BaseListOperations._get_transcoded_request( http_options, request @@ -4705,6 +5715,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.aiplatform_v1.PipelineServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PipelineService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = PipelineServiceRestTransport._ListOperations._get_response( self._host, @@ -4724,6 +5761,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.aiplatform_v1.PipelineServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PipelineService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4765,7 +5823,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 wait operation method over HTTP. @@ -4776,8 +5834,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 WaitOperation method. @@ -4786,6 +5846,7 @@ def __call__( http_options = ( _BasePipelineServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = self._interceptor.pre_wait_operation(request, metadata) transcoded_request = _BasePipelineServiceRestTransport._BaseWaitOperation._get_transcoded_request( http_options, request @@ -4796,6 +5857,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.aiplatform_v1.PipelineServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PipelineService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = PipelineServiceRestTransport._WaitOperation._get_response( self._host, @@ -4815,6 +5903,27 @@ def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = self._interceptor.post_wait_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.aiplatform_v1.PipelineServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PipelineService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1/services/pipeline_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1/services/pipeline_service/transports/rest_asyncio.py index 405f75e5d8..e0a4673ba0 100644 --- a/google/cloud/aiplatform_v1/services/pipeline_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1/services/pipeline_service/transports/rest_asyncio.py @@ -63,6 +63,18 @@ from .base import DEFAULT_CLIENT_INFO as BASE_DEFAULT_CLIENT_INFO + +import logging + +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__) + try: OptionalRetry = Union[retries.AsyncRetry, gapic_v1.method._MethodDefault, None] except AttributeError: # pragma: NO COVER @@ -187,9 +199,10 @@ async def post_list_training_pipelines(self, response): async def pre_batch_cancel_pipeline_jobs( self, request: pipeline_service.BatchCancelPipelineJobsRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - pipeline_service.BatchCancelPipelineJobsRequest, Sequence[Tuple[str, str]] + pipeline_service.BatchCancelPipelineJobsRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for batch_cancel_pipeline_jobs @@ -212,9 +225,10 @@ async def post_batch_cancel_pipeline_jobs( async def pre_batch_delete_pipeline_jobs( self, request: pipeline_service.BatchDeletePipelineJobsRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - pipeline_service.BatchDeletePipelineJobsRequest, Sequence[Tuple[str, str]] + pipeline_service.BatchDeletePipelineJobsRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for batch_delete_pipeline_jobs @@ -237,8 +251,11 @@ async def post_batch_delete_pipeline_jobs( async def pre_cancel_pipeline_job( self, request: pipeline_service.CancelPipelineJobRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[pipeline_service.CancelPipelineJobRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + pipeline_service.CancelPipelineJobRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for cancel_pipeline_job Override in a subclass to manipulate the request or metadata @@ -249,9 +266,10 @@ async def pre_cancel_pipeline_job( async def pre_cancel_training_pipeline( self, request: pipeline_service.CancelTrainingPipelineRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - pipeline_service.CancelTrainingPipelineRequest, Sequence[Tuple[str, str]] + pipeline_service.CancelTrainingPipelineRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for cancel_training_pipeline @@ -263,8 +281,11 @@ async def pre_cancel_training_pipeline( async def pre_create_pipeline_job( self, request: pipeline_service.CreatePipelineJobRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[pipeline_service.CreatePipelineJobRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + pipeline_service.CreatePipelineJobRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for create_pipeline_job Override in a subclass to manipulate the request or metadata @@ -286,9 +307,10 @@ async def post_create_pipeline_job( async def pre_create_training_pipeline( self, request: pipeline_service.CreateTrainingPipelineRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - pipeline_service.CreateTrainingPipelineRequest, Sequence[Tuple[str, str]] + pipeline_service.CreateTrainingPipelineRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for create_training_pipeline @@ -311,8 +333,11 @@ async def post_create_training_pipeline( async def pre_delete_pipeline_job( self, request: pipeline_service.DeletePipelineJobRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[pipeline_service.DeletePipelineJobRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + pipeline_service.DeletePipelineJobRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for delete_pipeline_job Override in a subclass to manipulate the request or metadata @@ -334,9 +359,10 @@ async def post_delete_pipeline_job( async def pre_delete_training_pipeline( self, request: pipeline_service.DeleteTrainingPipelineRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - pipeline_service.DeleteTrainingPipelineRequest, Sequence[Tuple[str, str]] + pipeline_service.DeleteTrainingPipelineRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for delete_training_pipeline @@ -359,8 +385,10 @@ async def post_delete_training_pipeline( async def pre_get_pipeline_job( self, request: pipeline_service.GetPipelineJobRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[pipeline_service.GetPipelineJobRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + pipeline_service.GetPipelineJobRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_pipeline_job Override in a subclass to manipulate the request or metadata @@ -382,8 +410,11 @@ async def post_get_pipeline_job( async def pre_get_training_pipeline( self, request: pipeline_service.GetTrainingPipelineRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[pipeline_service.GetTrainingPipelineRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + pipeline_service.GetTrainingPipelineRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for get_training_pipeline Override in a subclass to manipulate the request or metadata @@ -405,8 +436,11 @@ async def post_get_training_pipeline( async def pre_list_pipeline_jobs( self, request: pipeline_service.ListPipelineJobsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[pipeline_service.ListPipelineJobsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + pipeline_service.ListPipelineJobsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for list_pipeline_jobs Override in a subclass to manipulate the request or metadata @@ -428,9 +462,10 @@ async def post_list_pipeline_jobs( async def pre_list_training_pipelines( self, request: pipeline_service.ListTrainingPipelinesRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - pipeline_service.ListTrainingPipelinesRequest, Sequence[Tuple[str, str]] + pipeline_service.ListTrainingPipelinesRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for list_training_pipelines @@ -453,8 +488,10 @@ async def post_list_training_pipelines( async def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -476,8 +513,10 @@ async def post_get_location( async def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -499,8 +538,10 @@ async def post_list_locations( async def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -522,8 +563,10 @@ async def post_get_iam_policy( async def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -545,8 +588,11 @@ async def post_set_iam_policy( async def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -568,8 +614,10 @@ async def post_test_iam_permissions( async def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -589,8 +637,10 @@ async def post_cancel_operation(self, response: None) -> None: async 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 @@ -610,8 +660,10 @@ async def post_delete_operation(self, response: None) -> None: async 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 @@ -633,8 +685,10 @@ async def post_get_operation( async 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 @@ -656,8 +710,10 @@ async def post_list_operations( async def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -901,7 +957,7 @@ async 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 batch cancel pipeline jobs method over HTTP. @@ -913,8 +969,10 @@ async def __call__( 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: @@ -927,6 +985,7 @@ async def __call__( http_options = ( _BasePipelineServiceRestTransport._BaseBatchCancelPipelineJobs._get_http_options() ) + request, metadata = await self._interceptor.pre_batch_cancel_pipeline_jobs( request, metadata ) @@ -943,6 +1002,33 @@ async 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.aiplatform_v1.PipelineServiceClient.BatchCancelPipelineJobs", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PipelineService", + "rpcName": "BatchCancelPipelineJobs", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncPipelineServiceRestTransport._BatchCancelPipelineJobs._get_response( self._host, @@ -971,6 +1057,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_batch_cancel_pipeline_jobs(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.PipelineServiceAsyncClient.batch_cancel_pipeline_jobs", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PipelineService", + "rpcName": "BatchCancelPipelineJobs", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _BatchDeletePipelineJobs( @@ -1010,7 +1118,7 @@ async 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 batch delete pipeline jobs method over HTTP. @@ -1022,8 +1130,10 @@ async def __call__( 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: @@ -1036,6 +1146,7 @@ async def __call__( http_options = ( _BasePipelineServiceRestTransport._BaseBatchDeletePipelineJobs._get_http_options() ) + request, metadata = await self._interceptor.pre_batch_delete_pipeline_jobs( request, metadata ) @@ -1052,6 +1163,33 @@ async 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.aiplatform_v1.PipelineServiceClient.BatchDeletePipelineJobs", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PipelineService", + "rpcName": "BatchDeletePipelineJobs", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncPipelineServiceRestTransport._BatchDeletePipelineJobs._get_response( self._host, @@ -1080,6 +1218,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_batch_delete_pipeline_jobs(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.PipelineServiceAsyncClient.batch_delete_pipeline_jobs", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PipelineService", + "rpcName": "BatchDeletePipelineJobs", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _CancelPipelineJob( @@ -1119,7 +1279,7 @@ async 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 cancel pipeline job method over HTTP. @@ -1130,13 +1290,16 @@ async def __call__( 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`. """ http_options = ( _BasePipelineServiceRestTransport._BaseCancelPipelineJob._get_http_options() ) + request, metadata = await self._interceptor.pre_cancel_pipeline_job( request, metadata ) @@ -1153,6 +1316,33 @@ async 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.aiplatform_v1.PipelineServiceClient.CancelPipelineJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PipelineService", + "rpcName": "CancelPipelineJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncPipelineServiceRestTransport._CancelPipelineJob._get_response( self._host, @@ -1212,7 +1402,7 @@ async 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 cancel training pipeline method over HTTP. @@ -1223,13 +1413,16 @@ async def __call__( 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`. """ http_options = ( _BasePipelineServiceRestTransport._BaseCancelTrainingPipeline._get_http_options() ) + request, metadata = await self._interceptor.pre_cancel_training_pipeline( request, metadata ) @@ -1246,6 +1439,33 @@ async 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.aiplatform_v1.PipelineServiceClient.CancelTrainingPipeline", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PipelineService", + "rpcName": "CancelTrainingPipeline", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncPipelineServiceRestTransport._CancelTrainingPipeline._get_response( self._host, @@ -1305,7 +1525,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> gca_pipeline_job.PipelineJob: r"""Call the create pipeline job method over HTTP. @@ -1316,8 +1536,10 @@ async def __call__( 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: ~.gca_pipeline_job.PipelineJob: @@ -1329,6 +1551,7 @@ async def __call__( http_options = ( _BasePipelineServiceRestTransport._BaseCreatePipelineJob._get_http_options() ) + request, metadata = await self._interceptor.pre_create_pipeline_job( request, metadata ) @@ -1345,6 +1568,33 @@ async 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.aiplatform_v1.PipelineServiceClient.CreatePipelineJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PipelineService", + "rpcName": "CreatePipelineJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncPipelineServiceRestTransport._CreatePipelineJob._get_response( self._host, @@ -1373,6 +1623,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_create_pipeline_job(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gca_pipeline_job.PipelineJob.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.PipelineServiceAsyncClient.create_pipeline_job", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PipelineService", + "rpcName": "CreatePipelineJob", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _CreateTrainingPipeline( @@ -1412,7 +1684,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> gca_training_pipeline.TrainingPipeline: r"""Call the create training pipeline method over HTTP. @@ -1423,8 +1695,10 @@ async def __call__( 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: ~.gca_training_pipeline.TrainingPipeline: @@ -1440,6 +1714,7 @@ async def __call__( http_options = ( _BasePipelineServiceRestTransport._BaseCreateTrainingPipeline._get_http_options() ) + request, metadata = await self._interceptor.pre_create_training_pipeline( request, metadata ) @@ -1456,6 +1731,33 @@ async 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.aiplatform_v1.PipelineServiceClient.CreateTrainingPipeline", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PipelineService", + "rpcName": "CreateTrainingPipeline", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncPipelineServiceRestTransport._CreateTrainingPipeline._get_response( self._host, @@ -1484,6 +1786,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_create_training_pipeline(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gca_training_pipeline.TrainingPipeline.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.PipelineServiceAsyncClient.create_training_pipeline", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PipelineService", + "rpcName": "CreateTrainingPipeline", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _DeletePipelineJob( @@ -1522,7 +1848,7 @@ async 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 pipeline job method over HTTP. @@ -1533,8 +1859,10 @@ async def __call__( 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: @@ -1547,6 +1875,7 @@ async def __call__( http_options = ( _BasePipelineServiceRestTransport._BaseDeletePipelineJob._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_pipeline_job( request, metadata ) @@ -1559,6 +1888,33 @@ async 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.aiplatform_v1.PipelineServiceClient.DeletePipelineJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PipelineService", + "rpcName": "DeletePipelineJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncPipelineServiceRestTransport._DeletePipelineJob._get_response( self._host, @@ -1586,6 +1942,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_delete_pipeline_job(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.PipelineServiceAsyncClient.delete_pipeline_job", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PipelineService", + "rpcName": "DeletePipelineJob", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _DeleteTrainingPipeline( @@ -1624,7 +2002,7 @@ async 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 training pipeline method over HTTP. @@ -1635,8 +2013,10 @@ async def __call__( 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: @@ -1649,6 +2029,7 @@ async def __call__( http_options = ( _BasePipelineServiceRestTransport._BaseDeleteTrainingPipeline._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_training_pipeline( request, metadata ) @@ -1661,6 +2042,33 @@ async 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.aiplatform_v1.PipelineServiceClient.DeleteTrainingPipeline", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PipelineService", + "rpcName": "DeleteTrainingPipeline", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncPipelineServiceRestTransport._DeleteTrainingPipeline._get_response( self._host, @@ -1688,6 +2096,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_delete_training_pipeline(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.PipelineServiceAsyncClient.delete_training_pipeline", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PipelineService", + "rpcName": "DeleteTrainingPipeline", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _GetPipelineJob( @@ -1726,7 +2156,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> pipeline_job.PipelineJob: r"""Call the get pipeline job method over HTTP. @@ -1737,8 +2167,10 @@ async def __call__( 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: ~.pipeline_job.PipelineJob: @@ -1750,6 +2182,7 @@ async def __call__( http_options = ( _BasePipelineServiceRestTransport._BaseGetPipelineJob._get_http_options() ) + request, metadata = await self._interceptor.pre_get_pipeline_job( request, metadata ) @@ -1762,6 +2195,33 @@ async 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.aiplatform_v1.PipelineServiceClient.GetPipelineJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PipelineService", + "rpcName": "GetPipelineJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncPipelineServiceRestTransport._GetPipelineJob._get_response( @@ -1791,6 +2251,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_get_pipeline_job(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = pipeline_job.PipelineJob.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.PipelineServiceAsyncClient.get_pipeline_job", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PipelineService", + "rpcName": "GetPipelineJob", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _GetTrainingPipeline( @@ -1829,7 +2311,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> training_pipeline.TrainingPipeline: r"""Call the get training pipeline method over HTTP. @@ -1840,8 +2322,10 @@ async def __call__( 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: ~.training_pipeline.TrainingPipeline: @@ -1857,6 +2341,7 @@ async def __call__( http_options = ( _BasePipelineServiceRestTransport._BaseGetTrainingPipeline._get_http_options() ) + request, metadata = await self._interceptor.pre_get_training_pipeline( request, metadata ) @@ -1869,6 +2354,33 @@ async 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.aiplatform_v1.PipelineServiceClient.GetTrainingPipeline", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PipelineService", + "rpcName": "GetTrainingPipeline", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncPipelineServiceRestTransport._GetTrainingPipeline._get_response( self._host, @@ -1896,6 +2408,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_get_training_pipeline(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = training_pipeline.TrainingPipeline.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.PipelineServiceAsyncClient.get_training_pipeline", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PipelineService", + "rpcName": "GetTrainingPipeline", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ListPipelineJobs( @@ -1934,7 +2470,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> pipeline_service.ListPipelineJobsResponse: r"""Call the list pipeline jobs method over HTTP. @@ -1945,8 +2481,10 @@ async def __call__( 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: ~.pipeline_service.ListPipelineJobsResponse: @@ -1958,6 +2496,7 @@ async def __call__( http_options = ( _BasePipelineServiceRestTransport._BaseListPipelineJobs._get_http_options() ) + request, metadata = await self._interceptor.pre_list_pipeline_jobs( request, metadata ) @@ -1970,6 +2509,33 @@ async 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.aiplatform_v1.PipelineServiceClient.ListPipelineJobs", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PipelineService", + "rpcName": "ListPipelineJobs", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncPipelineServiceRestTransport._ListPipelineJobs._get_response( @@ -1999,6 +2565,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_list_pipeline_jobs(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + pipeline_service.ListPipelineJobsResponse.to_json(response) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.PipelineServiceAsyncClient.list_pipeline_jobs", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PipelineService", + "rpcName": "ListPipelineJobs", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ListTrainingPipelines( @@ -2037,7 +2627,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> pipeline_service.ListTrainingPipelinesResponse: r"""Call the list training pipelines method over HTTP. @@ -2048,8 +2638,10 @@ async def __call__( 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: ~.pipeline_service.ListTrainingPipelinesResponse: @@ -2061,6 +2653,7 @@ async def __call__( http_options = ( _BasePipelineServiceRestTransport._BaseListTrainingPipelines._get_http_options() ) + request, metadata = await self._interceptor.pre_list_training_pipelines( request, metadata ) @@ -2073,6 +2666,33 @@ async 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.aiplatform_v1.PipelineServiceClient.ListTrainingPipelines", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PipelineService", + "rpcName": "ListTrainingPipelines", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncPipelineServiceRestTransport._ListTrainingPipelines._get_response( self._host, @@ -2100,6 +2720,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_list_training_pipelines(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + pipeline_service.ListTrainingPipelinesResponse.to_json(response) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.PipelineServiceAsyncClient.list_training_pipelines", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PipelineService", + "rpcName": "ListTrainingPipelines", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp @property @@ -4112,7 +4756,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -4123,8 +4767,10 @@ async def __call__( 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: locations_pb2.Location: Response from GetLocation method. @@ -4133,6 +4779,7 @@ async def __call__( http_options = ( _BasePipelineServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_location( request, metadata ) @@ -4145,6 +4792,33 @@ async 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.aiplatform_v1.PipelineServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PipelineService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncPipelineServiceRestTransport._GetLocation._get_response( @@ -4172,6 +4846,27 @@ async def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_location(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.aiplatform_v1.PipelineServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PipelineService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4214,7 +4909,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -4225,8 +4920,10 @@ async def __call__( 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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -4235,6 +4932,7 @@ async def __call__( http_options = ( _BasePipelineServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_locations( request, metadata ) @@ -4247,6 +4945,33 @@ async 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.aiplatform_v1.PipelineServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PipelineService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncPipelineServiceRestTransport._ListLocations._get_response( @@ -4274,6 +4999,27 @@ async def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_list_locations(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.aiplatform_v1.PipelineServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PipelineService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4316,7 +5062,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -4327,8 +5073,10 @@ async def __call__( 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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -4337,6 +5085,7 @@ async def __call__( http_options = ( _BasePipelineServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_get_iam_policy( request, metadata ) @@ -4349,6 +5098,33 @@ async 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.aiplatform_v1.PipelineServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PipelineService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncPipelineServiceRestTransport._GetIamPolicy._get_response( @@ -4376,6 +5152,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_iam_policy(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.aiplatform_v1.PipelineServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PipelineService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4419,7 +5216,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -4430,8 +5227,10 @@ async def __call__( 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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -4440,6 +5239,7 @@ async def __call__( http_options = ( _BasePipelineServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_set_iam_policy( request, metadata ) @@ -4456,6 +5256,33 @@ async 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.aiplatform_v1.PipelineServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PipelineService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncPipelineServiceRestTransport._SetIamPolicy._get_response( @@ -4484,6 +5311,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_set_iam_policy(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.aiplatform_v1.PipelineServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PipelineService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4526,7 +5374,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -4537,8 +5385,10 @@ async def __call__( 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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -4547,6 +5397,7 @@ async def __call__( http_options = ( _BasePipelineServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = await self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -4559,6 +5410,33 @@ async 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.aiplatform_v1.PipelineServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PipelineService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncPipelineServiceRestTransport._TestIamPermissions._get_response( self._host, @@ -4584,6 +5462,27 @@ async def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_test_iam_permissions(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.aiplatform_v1.PipelineServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PipelineService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4626,7 +5525,7 @@ async 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 cancel operation method over HTTP. @@ -4637,13 +5536,16 @@ async def __call__( 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`. """ http_options = ( _BasePipelineServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_cancel_operation( request, metadata ) @@ -4656,6 +5558,33 @@ async 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.aiplatform_v1.PipelineServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PipelineService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncPipelineServiceRestTransport._CancelOperation._get_response( @@ -4721,7 +5650,7 @@ async 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. @@ -4732,13 +5661,16 @@ async def __call__( 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`. """ http_options = ( _BasePipelineServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_operation( request, metadata ) @@ -4751,6 +5683,33 @@ async 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.aiplatform_v1.PipelineServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PipelineService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncPipelineServiceRestTransport._DeleteOperation._get_response( @@ -4816,7 +5775,7 @@ async 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. @@ -4827,8 +5786,10 @@ async def __call__( 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: Response from GetOperation method. @@ -4837,6 +5798,7 @@ async def __call__( http_options = ( _BasePipelineServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_operation( request, metadata ) @@ -4849,6 +5811,33 @@ async 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.aiplatform_v1.PipelineServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PipelineService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncPipelineServiceRestTransport._GetOperation._get_response( @@ -4876,6 +5865,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1.PipelineServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PipelineService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4918,7 +5928,7 @@ async 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. @@ -4929,8 +5939,10 @@ async def __call__( 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 from ListOperations method. @@ -4939,6 +5951,7 @@ async def __call__( http_options = ( _BasePipelineServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_operations( request, metadata ) @@ -4951,6 +5964,33 @@ async 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.aiplatform_v1.PipelineServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PipelineService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncPipelineServiceRestTransport._ListOperations._get_response( @@ -4978,6 +6018,27 @@ async def __call__( resp = operations_pb2.ListOperationsResponse() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1.PipelineServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PipelineService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5020,7 +6081,7 @@ async 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 wait operation method over HTTP. @@ -5031,8 +6092,10 @@ async def __call__( 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: Response from WaitOperation method. @@ -5041,6 +6104,7 @@ async def __call__( http_options = ( _BasePipelineServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_wait_operation( request, metadata ) @@ -5053,6 +6117,33 @@ async 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.aiplatform_v1.PipelineServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PipelineService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncPipelineServiceRestTransport._WaitOperation._get_response( @@ -5080,6 +6171,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_wait_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.aiplatform_v1.PipelineServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PipelineService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1/services/prediction_service/async_client.py b/google/cloud/aiplatform_v1/services/prediction_service/async_client.py index dca06568b8..2c269eb6b4 100644 --- a/google/cloud/aiplatform_v1/services/prediction_service/async_client.py +++ b/google/cloud/aiplatform_v1/services/prediction_service/async_client.py @@ -13,6 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging as std_logging from collections import OrderedDict import re from typing import ( @@ -61,6 +62,15 @@ from .transports.grpc_asyncio import PredictionServiceGrpcAsyncIOTransport from .client import PredictionServiceClient +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 PredictionServiceAsyncClient: """A service for online predictions and explanations.""" @@ -274,6 +284,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.aiplatform_v1.PredictionServiceAsyncClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PredictionService", + "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.aiplatform.v1.PredictionService", + "credentialsType": None, + }, + ) + async def predict( self, request: Optional[Union[prediction_service.PredictRequest, dict]] = None, @@ -283,7 +315,7 @@ async def predict( parameters: Optional[struct_pb2.Value] = 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]]] = (), ) -> prediction_service.PredictResponse: r"""Perform an online prediction. @@ -359,8 +391,10 @@ async def sample_predict(): 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.aiplatform_v1.types.PredictResponse: @@ -424,7 +458,7 @@ async def raw_predict( http_body: Optional[httpbody_pb2.HttpBody] = 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]]] = (), ) -> httpbody_pb2.HttpBody: r"""Perform an online prediction with an arbitrary HTTP payload. @@ -505,8 +539,10 @@ async def sample_raw_predict(): 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.httpbody_pb2.HttpBody: @@ -616,7 +652,7 @@ def stream_raw_predict( http_body: Optional[httpbody_pb2.HttpBody] = 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]]] = (), ) -> Awaitable[AsyncIterable[httpbody_pb2.HttpBody]]: r"""Perform a streaming online prediction with an arbitrary HTTP payload. @@ -670,8 +706,10 @@ async def sample_stream_raw_predict(): 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: AsyncIterable[google.api.httpbody_pb2.HttpBody]: @@ -777,7 +815,7 @@ async def direct_predict( *, 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]]] = (), ) -> prediction_service.DirectPredictResponse: r"""Perform an unary online prediction request to a gRPC model server for Vertex first-party products and @@ -816,8 +854,10 @@ async def sample_direct_predict(): 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.aiplatform_v1.types.DirectPredictResponse: @@ -865,7 +905,7 @@ async def direct_raw_predict( *, 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]]] = (), ) -> prediction_service.DirectRawPredictResponse: r"""Perform an unary online prediction request to a gRPC model server for custom containers. @@ -903,8 +943,10 @@ async def sample_direct_raw_predict(): 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.aiplatform_v1.types.DirectRawPredictResponse: @@ -952,7 +994,7 @@ def stream_direct_predict( *, 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]]] = (), ) -> Awaitable[AsyncIterable[prediction_service.StreamDirectPredictResponse]]: r"""Perform a streaming online prediction request to a gRPC model server for Vertex first-party products and @@ -1007,8 +1049,10 @@ def request_generator(): 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: AsyncIterable[google.cloud.aiplatform_v1.types.StreamDirectPredictResponse]: @@ -1045,7 +1089,7 @@ def stream_direct_raw_predict( *, 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]]] = (), ) -> Awaitable[AsyncIterable[prediction_service.StreamDirectRawPredictResponse]]: r"""Perform a streaming online prediction request to a gRPC model server for custom containers. @@ -1105,8 +1149,10 @@ def request_generator(): 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: AsyncIterable[google.cloud.aiplatform_v1.types.StreamDirectRawPredictResponse]: @@ -1143,7 +1189,7 @@ def streaming_predict( *, 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]]] = (), ) -> Awaitable[AsyncIterable[prediction_service.StreamingPredictResponse]]: r"""Perform a streaming online prediction request for Vertex first-party products and frameworks. @@ -1197,8 +1243,10 @@ def request_generator(): 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: AsyncIterable[google.cloud.aiplatform_v1.types.StreamingPredictResponse]: @@ -1235,7 +1283,7 @@ def server_streaming_predict( *, 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]]] = (), ) -> Awaitable[AsyncIterable[prediction_service.StreamingPredictResponse]]: r"""Perform a server-side streaming online prediction request for Vertex LLM streaming. @@ -1279,8 +1327,10 @@ async def sample_server_streaming_predict(): 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: AsyncIterable[google.cloud.aiplatform_v1.types.StreamingPredictResponse]: @@ -1328,7 +1378,7 @@ def streaming_raw_predict( *, 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]]] = (), ) -> Awaitable[AsyncIterable[prediction_service.StreamingRawPredictResponse]]: r"""Perform a streaming online prediction request through gRPC. @@ -1388,8 +1438,10 @@ def request_generator(): 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: AsyncIterable[google.cloud.aiplatform_v1.types.StreamingRawPredictResponse]: @@ -1428,7 +1480,7 @@ async def explain( deployed_model_id: 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]]] = (), ) -> prediction_service.ExplainResponse: r"""Perform an online explanation. @@ -1522,8 +1574,10 @@ async def sample_explain(): 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.aiplatform_v1.types.ExplainResponse: @@ -1591,7 +1645,7 @@ async def generate_content( contents: Optional[MutableSequence[content.Content]] = 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]]] = (), ) -> prediction_service.GenerateContentResponse: r"""Generate content with multimodal inputs. @@ -1655,8 +1709,10 @@ async def sample_generate_content(): 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.aiplatform_v1.types.GenerateContentResponse: @@ -1722,7 +1778,7 @@ def stream_generate_content( contents: Optional[MutableSequence[content.Content]] = 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]]] = (), ) -> Awaitable[AsyncIterable[prediction_service.GenerateContentResponse]]: r"""Generate content with multimodal inputs with streaming support. @@ -1788,8 +1844,10 @@ async def sample_stream_generate_content(): 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: AsyncIterable[google.cloud.aiplatform_v1.types.GenerateContentResponse]: @@ -1851,7 +1909,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. @@ -1862,8 +1920,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. @@ -1904,7 +1964,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. @@ -1915,8 +1975,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. @@ -1957,7 +2019,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. @@ -1973,8 +2035,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 """ @@ -2011,7 +2075,7 @@ async def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -2026,8 +2090,10 @@ async def cancel_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 """ @@ -2064,7 +2130,7 @@ async def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -2081,8 +2147,10 @@ async def wait_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. @@ -2123,7 +2191,7 @@ async def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -2136,8 +2204,10 @@ async def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -2242,7 +2312,7 @@ async def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -2256,8 +2326,10 @@ async def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -2362,7 +2434,7 @@ async def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -2377,8 +2449,10 @@ async def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -2422,7 +2496,7 @@ async def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -2433,8 +2507,10 @@ async def get_location( 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: ~.location_pb2.Location: Location object. @@ -2475,7 +2551,7 @@ async def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -2486,8 +2562,10 @@ async def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1/services/prediction_service/client.py b/google/cloud/aiplatform_v1/services/prediction_service/client.py index 25797ccfc7..5ba11e3715 100644 --- a/google/cloud/aiplatform_v1/services/prediction_service/client.py +++ b/google/cloud/aiplatform_v1/services/prediction_service/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 import httpbody_pb2 # type: ignore from google.cloud.aiplatform_v1.types import content from google.cloud.aiplatform_v1.types import explanation @@ -650,6 +660,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( @@ -741,6 +755,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.aiplatform_v1.PredictionServiceClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PredictionService", + "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.aiplatform.v1.PredictionService", + "credentialsType": None, + }, + ) + def predict( self, request: Optional[Union[prediction_service.PredictRequest, dict]] = None, @@ -750,7 +787,7 @@ def predict( parameters: Optional[struct_pb2.Value] = 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]]] = (), ) -> prediction_service.PredictResponse: r"""Perform an online prediction. @@ -826,8 +863,10 @@ def sample_predict(): 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.aiplatform_v1.types.PredictResponse: @@ -890,7 +929,7 @@ def raw_predict( http_body: Optional[httpbody_pb2.HttpBody] = 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]]] = (), ) -> httpbody_pb2.HttpBody: r"""Perform an online prediction with an arbitrary HTTP payload. @@ -971,8 +1010,10 @@ def sample_raw_predict(): 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.httpbody_pb2.HttpBody: @@ -1079,7 +1120,7 @@ def stream_raw_predict( http_body: Optional[httpbody_pb2.HttpBody] = 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]]] = (), ) -> Iterable[httpbody_pb2.HttpBody]: r"""Perform a streaming online prediction with an arbitrary HTTP payload. @@ -1133,8 +1174,10 @@ def sample_stream_raw_predict(): 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: Iterable[google.api.httpbody_pb2.HttpBody]: @@ -1237,7 +1280,7 @@ def direct_predict( *, 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]]] = (), ) -> prediction_service.DirectPredictResponse: r"""Perform an unary online prediction request to a gRPC model server for Vertex first-party products and @@ -1276,8 +1319,10 @@ def sample_direct_predict(): 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.aiplatform_v1.types.DirectPredictResponse: @@ -1323,7 +1368,7 @@ def direct_raw_predict( *, 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]]] = (), ) -> prediction_service.DirectRawPredictResponse: r"""Perform an unary online prediction request to a gRPC model server for custom containers. @@ -1361,8 +1406,10 @@ def sample_direct_raw_predict(): 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.aiplatform_v1.types.DirectRawPredictResponse: @@ -1408,7 +1455,7 @@ def stream_direct_predict( *, 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]]] = (), ) -> Iterable[prediction_service.StreamDirectPredictResponse]: r"""Perform a streaming online prediction request to a gRPC model server for Vertex first-party products and @@ -1463,8 +1510,10 @@ def request_generator(): 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: Iterable[google.cloud.aiplatform_v1.types.StreamDirectPredictResponse]: @@ -1499,7 +1548,7 @@ def stream_direct_raw_predict( *, 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]]] = (), ) -> Iterable[prediction_service.StreamDirectRawPredictResponse]: r"""Perform a streaming online prediction request to a gRPC model server for custom containers. @@ -1559,8 +1608,10 @@ def request_generator(): 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: Iterable[google.cloud.aiplatform_v1.types.StreamDirectRawPredictResponse]: @@ -1595,7 +1646,7 @@ def streaming_predict( *, 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]]] = (), ) -> Iterable[prediction_service.StreamingPredictResponse]: r"""Perform a streaming online prediction request for Vertex first-party products and frameworks. @@ -1649,8 +1700,10 @@ def request_generator(): 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: Iterable[google.cloud.aiplatform_v1.types.StreamingPredictResponse]: @@ -1685,7 +1738,7 @@ def server_streaming_predict( *, 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]]] = (), ) -> Iterable[prediction_service.StreamingPredictResponse]: r"""Perform a server-side streaming online prediction request for Vertex LLM streaming. @@ -1729,8 +1782,10 @@ def sample_server_streaming_predict(): 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: Iterable[google.cloud.aiplatform_v1.types.StreamingPredictResponse]: @@ -1776,7 +1831,7 @@ def streaming_raw_predict( *, 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]]] = (), ) -> Iterable[prediction_service.StreamingRawPredictResponse]: r"""Perform a streaming online prediction request through gRPC. @@ -1836,8 +1891,10 @@ def request_generator(): 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: Iterable[google.cloud.aiplatform_v1.types.StreamingRawPredictResponse]: @@ -1874,7 +1931,7 @@ def explain( deployed_model_id: 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]]] = (), ) -> prediction_service.ExplainResponse: r"""Perform an online explanation. @@ -1968,8 +2025,10 @@ def sample_explain(): 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.aiplatform_v1.types.ExplainResponse: @@ -2036,7 +2095,7 @@ def generate_content( contents: Optional[MutableSequence[content.Content]] = 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]]] = (), ) -> prediction_service.GenerateContentResponse: r"""Generate content with multimodal inputs. @@ -2100,8 +2159,10 @@ def sample_generate_content(): 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.aiplatform_v1.types.GenerateContentResponse: @@ -2164,7 +2225,7 @@ def stream_generate_content( contents: Optional[MutableSequence[content.Content]] = 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]]] = (), ) -> Iterable[prediction_service.GenerateContentResponse]: r"""Generate content with multimodal inputs with streaming support. @@ -2230,8 +2291,10 @@ def sample_stream_generate_content(): 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: Iterable[google.cloud.aiplatform_v1.types.GenerateContentResponse]: @@ -2303,7 +2366,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. @@ -2314,8 +2377,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. @@ -2356,7 +2421,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. @@ -2367,8 +2432,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. @@ -2409,7 +2476,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. @@ -2425,8 +2492,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 """ @@ -2463,7 +2532,7 @@ def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -2478,8 +2547,10 @@ def cancel_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 """ @@ -2516,7 +2587,7 @@ def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -2533,8 +2604,10 @@ def wait_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. @@ -2575,7 +2648,7 @@ def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -2588,8 +2661,10 @@ def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -2694,7 +2769,7 @@ def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -2708,8 +2783,10 @@ def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -2814,7 +2891,7 @@ def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -2829,8 +2906,10 @@ def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -2872,7 +2951,7 @@ def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -2883,8 +2962,10 @@ def get_location( 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: ~.location_pb2.Location: Location object. @@ -2925,7 +3006,7 @@ def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -2936,8 +3017,10 @@ def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1/services/prediction_service/transports/grpc.py b/google/cloud/aiplatform_v1/services/prediction_service/transports/grpc.py index 337b4e905d..1dfbc54700 100644 --- a/google/cloud/aiplatform_v1/services/prediction_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1/services/prediction_service/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 import warnings from typing import Callable, Dict, Optional, Sequence, Tuple, Union @@ -21,8 +24,11 @@ import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from google.api import httpbody_pb2 # type: ignore from google.cloud.aiplatform_v1.types import prediction_service @@ -32,6 +38,81 @@ from google.longrunning import operations_pb2 # type: ignore from .base import PredictionServiceTransport, DEFAULT_CLIENT_INFO +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.aiplatform.v1.PredictionService", + "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.aiplatform.v1.PredictionService", + "rpcName": client_call_details.method, + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class PredictionServiceGrpcTransport(PredictionServiceTransport): """gRPC backend transport for PredictionService. @@ -185,7 +266,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 @@ -261,7 +347,7 @@ def predict( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "predict" not in self._stubs: - self._stubs["predict"] = self.grpc_channel.unary_unary( + self._stubs["predict"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.PredictionService/Predict", request_serializer=prediction_service.PredictRequest.serialize, response_deserializer=prediction_service.PredictResponse.deserialize, @@ -297,7 +383,7 @@ def raw_predict( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "raw_predict" not in self._stubs: - self._stubs["raw_predict"] = self.grpc_channel.unary_unary( + self._stubs["raw_predict"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.PredictionService/RawPredict", request_serializer=prediction_service.RawPredictRequest.serialize, response_deserializer=httpbody_pb2.HttpBody.FromString, @@ -324,7 +410,7 @@ def stream_raw_predict( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "stream_raw_predict" not in self._stubs: - self._stubs["stream_raw_predict"] = self.grpc_channel.unary_stream( + self._stubs["stream_raw_predict"] = self._logged_channel.unary_stream( "/google.cloud.aiplatform.v1.PredictionService/StreamRawPredict", request_serializer=prediction_service.StreamRawPredictRequest.serialize, response_deserializer=httpbody_pb2.HttpBody.FromString, @@ -355,7 +441,7 @@ def direct_predict( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "direct_predict" not in self._stubs: - self._stubs["direct_predict"] = self.grpc_channel.unary_unary( + self._stubs["direct_predict"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.PredictionService/DirectPredict", request_serializer=prediction_service.DirectPredictRequest.serialize, response_deserializer=prediction_service.DirectPredictResponse.deserialize, @@ -385,7 +471,7 @@ def direct_raw_predict( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "direct_raw_predict" not in self._stubs: - self._stubs["direct_raw_predict"] = self.grpc_channel.unary_unary( + self._stubs["direct_raw_predict"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.PredictionService/DirectRawPredict", request_serializer=prediction_service.DirectRawPredictRequest.serialize, response_deserializer=prediction_service.DirectRawPredictResponse.deserialize, @@ -416,7 +502,7 @@ def stream_direct_predict( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "stream_direct_predict" not in self._stubs: - self._stubs["stream_direct_predict"] = self.grpc_channel.stream_stream( + self._stubs["stream_direct_predict"] = self._logged_channel.stream_stream( "/google.cloud.aiplatform.v1.PredictionService/StreamDirectPredict", request_serializer=prediction_service.StreamDirectPredictRequest.serialize, response_deserializer=prediction_service.StreamDirectPredictResponse.deserialize, @@ -446,7 +532,9 @@ def stream_direct_raw_predict( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "stream_direct_raw_predict" not in self._stubs: - self._stubs["stream_direct_raw_predict"] = self.grpc_channel.stream_stream( + self._stubs[ + "stream_direct_raw_predict" + ] = self._logged_channel.stream_stream( "/google.cloud.aiplatform.v1.PredictionService/StreamDirectRawPredict", request_serializer=prediction_service.StreamDirectRawPredictRequest.serialize, response_deserializer=prediction_service.StreamDirectRawPredictResponse.deserialize, @@ -476,7 +564,7 @@ def streaming_predict( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "streaming_predict" not in self._stubs: - self._stubs["streaming_predict"] = self.grpc_channel.stream_stream( + self._stubs["streaming_predict"] = self._logged_channel.stream_stream( "/google.cloud.aiplatform.v1.PredictionService/StreamingPredict", request_serializer=prediction_service.StreamingPredictRequest.serialize, response_deserializer=prediction_service.StreamingPredictResponse.deserialize, @@ -506,7 +594,7 @@ def server_streaming_predict( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "server_streaming_predict" not in self._stubs: - self._stubs["server_streaming_predict"] = self.grpc_channel.unary_stream( + self._stubs["server_streaming_predict"] = self._logged_channel.unary_stream( "/google.cloud.aiplatform.v1.PredictionService/ServerStreamingPredict", request_serializer=prediction_service.StreamingPredictRequest.serialize, response_deserializer=prediction_service.StreamingPredictResponse.deserialize, @@ -536,7 +624,7 @@ def streaming_raw_predict( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "streaming_raw_predict" not in self._stubs: - self._stubs["streaming_raw_predict"] = self.grpc_channel.stream_stream( + self._stubs["streaming_raw_predict"] = self._logged_channel.stream_stream( "/google.cloud.aiplatform.v1.PredictionService/StreamingRawPredict", request_serializer=prediction_service.StreamingRawPredictRequest.serialize, response_deserializer=prediction_service.StreamingRawPredictResponse.deserialize, @@ -574,7 +662,7 @@ def explain( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "explain" not in self._stubs: - self._stubs["explain"] = self.grpc_channel.unary_unary( + self._stubs["explain"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.PredictionService/Explain", request_serializer=prediction_service.ExplainRequest.serialize, response_deserializer=prediction_service.ExplainResponse.deserialize, @@ -603,7 +691,7 @@ def generate_content( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "generate_content" not in self._stubs: - self._stubs["generate_content"] = self.grpc_channel.unary_unary( + self._stubs["generate_content"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.PredictionService/GenerateContent", request_serializer=prediction_service.GenerateContentRequest.serialize, response_deserializer=prediction_service.GenerateContentResponse.deserialize, @@ -633,7 +721,7 @@ def stream_generate_content( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "stream_generate_content" not in self._stubs: - self._stubs["stream_generate_content"] = self.grpc_channel.unary_stream( + self._stubs["stream_generate_content"] = self._logged_channel.unary_stream( "/google.cloud.aiplatform.v1.PredictionService/StreamGenerateContent", request_serializer=prediction_service.GenerateContentRequest.serialize, response_deserializer=prediction_service.GenerateContentResponse.deserialize, @@ -641,7 +729,7 @@ def stream_generate_content( return self._stubs["stream_generate_content"] def close(self): - self.grpc_channel.close() + self._logged_channel.close() @property def delete_operation( @@ -653,7 +741,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, @@ -670,7 +758,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -687,7 +775,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -704,7 +792,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, @@ -723,7 +811,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, @@ -742,7 +830,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -759,7 +847,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -784,7 +872,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -810,7 +898,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -839,7 +927,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1/services/prediction_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1/services/prediction_service/transports/grpc_asyncio.py index e40c7f31ae..63abdda3f7 100644 --- a/google/cloud/aiplatform_v1/services/prediction_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1/services/prediction_service/transports/grpc_asyncio.py @@ -14,6 +14,9 @@ # limitations under the License. # import inspect +import json +import pickle +import logging as std_logging import warnings from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union @@ -23,8 +26,11 @@ from google.api_core import retry_async as retries from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from grpc.experimental import aio # type: ignore from google.api import httpbody_pb2 # type: ignore @@ -36,6 +42,82 @@ from .base import PredictionServiceTransport, DEFAULT_CLIENT_INFO from .grpc import PredictionServiceGrpcTransport +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.aiplatform.v1.PredictionService", + "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.aiplatform.v1.PredictionService", + "rpcName": str(client_call_details.method), + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class PredictionServiceGrpcAsyncIOTransport(PredictionServiceTransport): """gRPC AsyncIO backend transport for PredictionService. @@ -232,10 +314,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 @@ -270,7 +355,7 @@ def predict( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "predict" not in self._stubs: - self._stubs["predict"] = self.grpc_channel.unary_unary( + self._stubs["predict"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.PredictionService/Predict", request_serializer=prediction_service.PredictRequest.serialize, response_deserializer=prediction_service.PredictResponse.deserialize, @@ -308,7 +393,7 @@ def raw_predict( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "raw_predict" not in self._stubs: - self._stubs["raw_predict"] = self.grpc_channel.unary_unary( + self._stubs["raw_predict"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.PredictionService/RawPredict", request_serializer=prediction_service.RawPredictRequest.serialize, response_deserializer=httpbody_pb2.HttpBody.FromString, @@ -337,7 +422,7 @@ def stream_raw_predict( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "stream_raw_predict" not in self._stubs: - self._stubs["stream_raw_predict"] = self.grpc_channel.unary_stream( + self._stubs["stream_raw_predict"] = self._logged_channel.unary_stream( "/google.cloud.aiplatform.v1.PredictionService/StreamRawPredict", request_serializer=prediction_service.StreamRawPredictRequest.serialize, response_deserializer=httpbody_pb2.HttpBody.FromString, @@ -368,7 +453,7 @@ def direct_predict( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "direct_predict" not in self._stubs: - self._stubs["direct_predict"] = self.grpc_channel.unary_unary( + self._stubs["direct_predict"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.PredictionService/DirectPredict", request_serializer=prediction_service.DirectPredictRequest.serialize, response_deserializer=prediction_service.DirectPredictResponse.deserialize, @@ -398,7 +483,7 @@ def direct_raw_predict( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "direct_raw_predict" not in self._stubs: - self._stubs["direct_raw_predict"] = self.grpc_channel.unary_unary( + self._stubs["direct_raw_predict"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.PredictionService/DirectRawPredict", request_serializer=prediction_service.DirectRawPredictRequest.serialize, response_deserializer=prediction_service.DirectRawPredictResponse.deserialize, @@ -429,7 +514,7 @@ def stream_direct_predict( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "stream_direct_predict" not in self._stubs: - self._stubs["stream_direct_predict"] = self.grpc_channel.stream_stream( + self._stubs["stream_direct_predict"] = self._logged_channel.stream_stream( "/google.cloud.aiplatform.v1.PredictionService/StreamDirectPredict", request_serializer=prediction_service.StreamDirectPredictRequest.serialize, response_deserializer=prediction_service.StreamDirectPredictResponse.deserialize, @@ -459,7 +544,9 @@ def stream_direct_raw_predict( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "stream_direct_raw_predict" not in self._stubs: - self._stubs["stream_direct_raw_predict"] = self.grpc_channel.stream_stream( + self._stubs[ + "stream_direct_raw_predict" + ] = self._logged_channel.stream_stream( "/google.cloud.aiplatform.v1.PredictionService/StreamDirectRawPredict", request_serializer=prediction_service.StreamDirectRawPredictRequest.serialize, response_deserializer=prediction_service.StreamDirectRawPredictResponse.deserialize, @@ -489,7 +576,7 @@ def streaming_predict( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "streaming_predict" not in self._stubs: - self._stubs["streaming_predict"] = self.grpc_channel.stream_stream( + self._stubs["streaming_predict"] = self._logged_channel.stream_stream( "/google.cloud.aiplatform.v1.PredictionService/StreamingPredict", request_serializer=prediction_service.StreamingPredictRequest.serialize, response_deserializer=prediction_service.StreamingPredictResponse.deserialize, @@ -519,7 +606,7 @@ def server_streaming_predict( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "server_streaming_predict" not in self._stubs: - self._stubs["server_streaming_predict"] = self.grpc_channel.unary_stream( + self._stubs["server_streaming_predict"] = self._logged_channel.unary_stream( "/google.cloud.aiplatform.v1.PredictionService/ServerStreamingPredict", request_serializer=prediction_service.StreamingPredictRequest.serialize, response_deserializer=prediction_service.StreamingPredictResponse.deserialize, @@ -549,7 +636,7 @@ def streaming_raw_predict( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "streaming_raw_predict" not in self._stubs: - self._stubs["streaming_raw_predict"] = self.grpc_channel.stream_stream( + self._stubs["streaming_raw_predict"] = self._logged_channel.stream_stream( "/google.cloud.aiplatform.v1.PredictionService/StreamingRawPredict", request_serializer=prediction_service.StreamingRawPredictRequest.serialize, response_deserializer=prediction_service.StreamingRawPredictResponse.deserialize, @@ -588,7 +675,7 @@ def explain( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "explain" not in self._stubs: - self._stubs["explain"] = self.grpc_channel.unary_unary( + self._stubs["explain"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.PredictionService/Explain", request_serializer=prediction_service.ExplainRequest.serialize, response_deserializer=prediction_service.ExplainResponse.deserialize, @@ -617,7 +704,7 @@ def generate_content( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "generate_content" not in self._stubs: - self._stubs["generate_content"] = self.grpc_channel.unary_unary( + self._stubs["generate_content"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.PredictionService/GenerateContent", request_serializer=prediction_service.GenerateContentRequest.serialize, response_deserializer=prediction_service.GenerateContentResponse.deserialize, @@ -647,7 +734,7 @@ def stream_generate_content( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "stream_generate_content" not in self._stubs: - self._stubs["stream_generate_content"] = self.grpc_channel.unary_stream( + self._stubs["stream_generate_content"] = self._logged_channel.unary_stream( "/google.cloud.aiplatform.v1.PredictionService/StreamGenerateContent", request_serializer=prediction_service.GenerateContentRequest.serialize, response_deserializer=prediction_service.GenerateContentResponse.deserialize, @@ -780,7 +867,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: @@ -796,7 +883,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, @@ -813,7 +900,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -830,7 +917,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -847,7 +934,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, @@ -866,7 +953,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, @@ -885,7 +972,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -902,7 +989,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -927,7 +1014,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -953,7 +1040,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -982,7 +1069,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1/services/prediction_service/transports/rest.py b/google/cloud/aiplatform_v1/services/prediction_service/transports/rest.py index 59bb1fe5af..2aee01cdf9 100644 --- a/google/cloud/aiplatform_v1/services/prediction_service/transports/rest.py +++ b/google/cloud/aiplatform_v1/services/prediction_service/transports/rest.py @@ -13,9 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging +import json # type: ignore from google.auth.transport.requests import AuthorizedSession # type: ignore -import json # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.api_core import exceptions as core_exceptions from google.api_core import retry as retries @@ -47,6 +48,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, @@ -151,8 +160,10 @@ def post_stream_raw_predict(self, response): def pre_direct_predict( self, request: prediction_service.DirectPredictRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[prediction_service.DirectPredictRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + prediction_service.DirectPredictRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for direct_predict Override in a subclass to manipulate the request or metadata @@ -174,8 +185,11 @@ def post_direct_predict( def pre_direct_raw_predict( self, request: prediction_service.DirectRawPredictRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[prediction_service.DirectRawPredictRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + prediction_service.DirectRawPredictRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for direct_raw_predict Override in a subclass to manipulate the request or metadata @@ -197,8 +211,10 @@ def post_direct_raw_predict( def pre_explain( self, request: prediction_service.ExplainRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[prediction_service.ExplainRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + prediction_service.ExplainRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for explain Override in a subclass to manipulate the request or metadata @@ -220,8 +236,11 @@ def post_explain( def pre_generate_content( self, request: prediction_service.GenerateContentRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[prediction_service.GenerateContentRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + prediction_service.GenerateContentRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for generate_content Override in a subclass to manipulate the request or metadata @@ -243,8 +262,10 @@ def post_generate_content( def pre_predict( self, request: prediction_service.PredictRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[prediction_service.PredictRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + prediction_service.PredictRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for predict Override in a subclass to manipulate the request or metadata @@ -266,8 +287,10 @@ def post_predict( def pre_raw_predict( self, request: prediction_service.RawPredictRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[prediction_service.RawPredictRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + prediction_service.RawPredictRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for raw_predict Override in a subclass to manipulate the request or metadata @@ -289,8 +312,11 @@ def post_raw_predict( def pre_server_streaming_predict( self, request: prediction_service.StreamingPredictRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[prediction_service.StreamingPredictRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + prediction_service.StreamingPredictRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for server_streaming_predict Override in a subclass to manipulate the request or metadata @@ -312,8 +338,11 @@ def post_server_streaming_predict( def pre_stream_generate_content( self, request: prediction_service.GenerateContentRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[prediction_service.GenerateContentRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + prediction_service.GenerateContentRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for stream_generate_content Override in a subclass to manipulate the request or metadata @@ -335,8 +364,11 @@ def post_stream_generate_content( def pre_stream_raw_predict( self, request: prediction_service.StreamRawPredictRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[prediction_service.StreamRawPredictRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + prediction_service.StreamRawPredictRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for stream_raw_predict Override in a subclass to manipulate the request or metadata @@ -358,8 +390,10 @@ def post_stream_raw_predict( def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -381,8 +415,10 @@ def post_get_location( def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -404,8 +440,10 @@ def post_list_locations( def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -425,8 +463,10 @@ def post_get_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -446,8 +486,11 @@ def post_set_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -469,8 +512,10 @@ def post_test_iam_permissions( def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -490,8 +535,10 @@ def post_cancel_operation(self, response: None) -> None: 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 @@ -511,8 +558,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 @@ -534,8 +583,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 @@ -557,8 +608,10 @@ def post_list_operations( def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -701,7 +754,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]]] = (), ) -> prediction_service.DirectPredictResponse: r"""Call the direct predict method over HTTP. @@ -712,8 +765,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: ~.prediction_service.DirectPredictResponse: @@ -725,6 +780,7 @@ def __call__( http_options = ( _BasePredictionServiceRestTransport._BaseDirectPredict._get_http_options() ) + request, metadata = self._interceptor.pre_direct_predict(request, metadata) transcoded_request = _BasePredictionServiceRestTransport._BaseDirectPredict._get_transcoded_request( http_options, request @@ -739,6 +795,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.aiplatform_v1.PredictionServiceClient.DirectPredict", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PredictionService", + "rpcName": "DirectPredict", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = PredictionServiceRestTransport._DirectPredict._get_response( self._host, @@ -760,7 +843,31 @@ def __call__( pb_resp = prediction_service.DirectPredictResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_direct_predict(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = prediction_service.DirectPredictResponse.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.aiplatform_v1.PredictionServiceClient.direct_predict", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PredictionService", + "rpcName": "DirectPredict", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _DirectRawPredict( @@ -800,7 +907,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]]] = (), ) -> prediction_service.DirectRawPredictResponse: r"""Call the direct raw predict method over HTTP. @@ -811,8 +918,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: ~.prediction_service.DirectRawPredictResponse: @@ -824,6 +933,7 @@ def __call__( http_options = ( _BasePredictionServiceRestTransport._BaseDirectRawPredict._get_http_options() ) + request, metadata = self._interceptor.pre_direct_raw_predict( request, metadata ) @@ -840,6 +950,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.aiplatform_v1.PredictionServiceClient.DirectRawPredict", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PredictionService", + "rpcName": "DirectRawPredict", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = PredictionServiceRestTransport._DirectRawPredict._get_response( self._host, @@ -861,7 +998,31 @@ def __call__( pb_resp = prediction_service.DirectRawPredictResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_direct_raw_predict(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + prediction_service.DirectRawPredictResponse.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.aiplatform_v1.PredictionServiceClient.direct_raw_predict", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PredictionService", + "rpcName": "DirectRawPredict", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _Explain( @@ -900,7 +1061,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]]] = (), ) -> prediction_service.ExplainResponse: r"""Call the explain method over HTTP. @@ -911,8 +1072,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: ~.prediction_service.ExplainResponse: @@ -924,6 +1087,7 @@ def __call__( http_options = ( _BasePredictionServiceRestTransport._BaseExplain._get_http_options() ) + request, metadata = self._interceptor.pre_explain(request, metadata) transcoded_request = _BasePredictionServiceRestTransport._BaseExplain._get_transcoded_request( http_options, request @@ -942,6 +1106,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 = 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.aiplatform_v1.PredictionServiceClient.Explain", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PredictionService", + "rpcName": "Explain", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = PredictionServiceRestTransport._Explain._get_response( self._host, @@ -963,7 +1154,31 @@ def __call__( pb_resp = prediction_service.ExplainResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_explain(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = prediction_service.ExplainResponse.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.aiplatform_v1.PredictionServiceClient.explain", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PredictionService", + "rpcName": "Explain", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _GenerateContent( @@ -1003,7 +1218,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]]] = (), ) -> prediction_service.GenerateContentResponse: r"""Call the generate content method over HTTP. @@ -1013,8 +1228,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: ~.prediction_service.GenerateContentResponse: @@ -1026,6 +1243,7 @@ def __call__( http_options = ( _BasePredictionServiceRestTransport._BaseGenerateContent._get_http_options() ) + request, metadata = self._interceptor.pre_generate_content( request, metadata ) @@ -1042,6 +1260,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.aiplatform_v1.PredictionServiceClient.GenerateContent", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PredictionService", + "rpcName": "GenerateContent", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = PredictionServiceRestTransport._GenerateContent._get_response( self._host, @@ -1063,7 +1308,31 @@ def __call__( pb_resp = prediction_service.GenerateContentResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_generate_content(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + prediction_service.GenerateContentResponse.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.aiplatform_v1.PredictionServiceClient.generate_content", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PredictionService", + "rpcName": "GenerateContent", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _Predict( @@ -1102,7 +1371,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]]] = (), ) -> prediction_service.PredictResponse: r"""Call the predict method over HTTP. @@ -1113,8 +1382,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: ~.prediction_service.PredictResponse: @@ -1126,6 +1397,7 @@ def __call__( http_options = ( _BasePredictionServiceRestTransport._BasePredict._get_http_options() ) + request, metadata = self._interceptor.pre_predict(request, metadata) transcoded_request = _BasePredictionServiceRestTransport._BasePredict._get_transcoded_request( http_options, request @@ -1144,6 +1416,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 = 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.aiplatform_v1.PredictionServiceClient.Predict", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PredictionService", + "rpcName": "Predict", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = PredictionServiceRestTransport._Predict._get_response( self._host, @@ -1165,7 +1464,31 @@ def __call__( pb_resp = prediction_service.PredictResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_predict(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = prediction_service.PredictResponse.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.aiplatform_v1.PredictionServiceClient.predict", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PredictionService", + "rpcName": "Predict", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _RawPredict( @@ -1204,7 +1527,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]]] = (), ) -> httpbody_pb2.HttpBody: r"""Call the raw predict method over HTTP. @@ -1215,8 +1538,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: ~.httpbody_pb2.HttpBody: @@ -1275,6 +1600,7 @@ def __call__( http_options = ( _BasePredictionServiceRestTransport._BaseRawPredict._get_http_options() ) + request, metadata = self._interceptor.pre_raw_predict(request, metadata) transcoded_request = _BasePredictionServiceRestTransport._BaseRawPredict._get_transcoded_request( http_options, request @@ -1289,6 +1615,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.aiplatform_v1.PredictionServiceClient.RawPredict", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PredictionService", + "rpcName": "RawPredict", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = PredictionServiceRestTransport._RawPredict._get_response( self._host, @@ -1310,7 +1663,29 @@ def __call__( pb_resp = resp json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_raw_predict(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.aiplatform_v1.PredictionServiceClient.raw_predict", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PredictionService", + "rpcName": "RawPredict", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ServerStreamingPredict( @@ -1351,7 +1726,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]]] = (), ) -> rest_streaming.ResponseIterator: r"""Call the server streaming predict method over HTTP. @@ -1367,8 +1742,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: ~.prediction_service.StreamingPredictResponse: @@ -1380,6 +1757,7 @@ def __call__( http_options = ( _BasePredictionServiceRestTransport._BaseServerStreamingPredict._get_http_options() ) + request, metadata = self._interceptor.pre_server_streaming_predict( request, metadata ) @@ -1396,6 +1774,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.aiplatform_v1.PredictionServiceClient.ServerStreamingPredict", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PredictionService", + "rpcName": "ServerStreamingPredict", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( PredictionServiceRestTransport._ServerStreamingPredict._get_response( @@ -1418,6 +1823,7 @@ def __call__( resp = rest_streaming.ResponseIterator( response, prediction_service.StreamingPredictResponse ) + resp = self._interceptor.post_server_streaming_predict(resp) return resp @@ -1434,7 +1840,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]]] = (), ) -> rest_streaming.ResponseIterator: raise NotImplementedError( "Method StreamDirectPredict is not available over REST transport" @@ -1453,7 +1859,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]]] = (), ) -> rest_streaming.ResponseIterator: raise NotImplementedError( "Method StreamDirectRawPredict is not available over REST transport" @@ -1497,7 +1903,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]]] = (), ) -> rest_streaming.ResponseIterator: r"""Call the stream generate content method over HTTP. @@ -1507,8 +1913,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: ~.prediction_service.GenerateContentResponse: @@ -1520,6 +1928,7 @@ def __call__( http_options = ( _BasePredictionServiceRestTransport._BaseStreamGenerateContent._get_http_options() ) + request, metadata = self._interceptor.pre_stream_generate_content( request, metadata ) @@ -1536,6 +1945,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.aiplatform_v1.PredictionServiceClient.StreamGenerateContent", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PredictionService", + "rpcName": "StreamGenerateContent", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( PredictionServiceRestTransport._StreamGenerateContent._get_response( @@ -1558,6 +1994,7 @@ def __call__( resp = rest_streaming.ResponseIterator( response, prediction_service.GenerateContentResponse ) + resp = self._interceptor.post_stream_generate_content(resp) return resp @@ -1574,7 +2011,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]]] = (), ) -> rest_streaming.ResponseIterator: raise NotImplementedError( "Method StreamingPredict is not available over REST transport" @@ -1593,7 +2030,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]]] = (), ) -> rest_streaming.ResponseIterator: raise NotImplementedError( "Method StreamingRawPredict is not available over REST transport" @@ -1637,7 +2074,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]]] = (), ) -> rest_streaming.ResponseIterator: r"""Call the stream raw predict method over HTTP. @@ -1648,8 +2085,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: ~.httpbody_pb2.HttpBody: @@ -1708,6 +2147,7 @@ def __call__( http_options = ( _BasePredictionServiceRestTransport._BaseStreamRawPredict._get_http_options() ) + request, metadata = self._interceptor.pre_stream_raw_predict( request, metadata ) @@ -1724,6 +2164,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.aiplatform_v1.PredictionServiceClient.StreamRawPredict", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PredictionService", + "rpcName": "StreamRawPredict", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = PredictionServiceRestTransport._StreamRawPredict._get_response( self._host, @@ -1742,6 +2209,7 @@ def __call__( # Return the response resp = rest_streaming.ResponseIterator(response, httpbody_pb2.HttpBody) + resp = self._interceptor.post_stream_raw_predict(resp) return resp @@ -1919,7 +2387,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]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -1930,8 +2398,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: locations_pb2.Location: Response from GetLocation method. @@ -1940,6 +2410,7 @@ def __call__( http_options = ( _BasePredictionServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = self._interceptor.pre_get_location(request, metadata) transcoded_request = _BasePredictionServiceRestTransport._BaseGetLocation._get_transcoded_request( http_options, request @@ -1950,6 +2421,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.aiplatform_v1.PredictionServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PredictionService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = PredictionServiceRestTransport._GetLocation._get_response( self._host, @@ -1969,6 +2467,27 @@ def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_location(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.aiplatform_v1.PredictionServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PredictionService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -2011,7 +2530,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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -2022,8 +2541,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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -2032,6 +2553,7 @@ def __call__( http_options = ( _BasePredictionServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = self._interceptor.pre_list_locations(request, metadata) transcoded_request = _BasePredictionServiceRestTransport._BaseListLocations._get_transcoded_request( http_options, request @@ -2042,6 +2564,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.aiplatform_v1.PredictionServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PredictionService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = PredictionServiceRestTransport._ListLocations._get_response( self._host, @@ -2061,6 +2610,27 @@ def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_list_locations(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.aiplatform_v1.PredictionServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PredictionService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -2102,7 +2672,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]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -2113,8 +2683,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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -2123,6 +2695,7 @@ def __call__( http_options = ( _BasePredictionServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_get_iam_policy(request, metadata) transcoded_request = _BasePredictionServiceRestTransport._BaseGetIamPolicy._get_transcoded_request( http_options, request @@ -2133,6 +2706,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.aiplatform_v1.PredictionServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PredictionService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = PredictionServiceRestTransport._GetIamPolicy._get_response( self._host, @@ -2152,6 +2752,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_iam_policy(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.aiplatform_v1.PredictionServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PredictionService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -2194,7 +2815,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]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -2205,8 +2826,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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -2215,6 +2838,7 @@ def __call__( http_options = ( _BasePredictionServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_set_iam_policy(request, metadata) transcoded_request = _BasePredictionServiceRestTransport._BaseSetIamPolicy._get_transcoded_request( http_options, request @@ -2229,6 +2853,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.aiplatform_v1.PredictionServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PredictionService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = PredictionServiceRestTransport._SetIamPolicy._get_response( self._host, @@ -2249,6 +2900,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_set_iam_policy(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.aiplatform_v1.PredictionServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PredictionService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -2291,7 +2963,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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -2302,8 +2974,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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -2312,6 +2986,7 @@ def __call__( http_options = ( _BasePredictionServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -2324,6 +2999,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.aiplatform_v1.PredictionServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PredictionService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = PredictionServiceRestTransport._TestIamPermissions._get_response( self._host, @@ -2343,6 +3045,27 @@ def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_test_iam_permissions(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.aiplatform_v1.PredictionServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PredictionService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -2385,7 +3108,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 cancel operation method over HTTP. @@ -2396,13 +3119,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 = ( _BasePredictionServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = self._interceptor.pre_cancel_operation( request, metadata ) @@ -2415,6 +3141,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.aiplatform_v1.PredictionServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PredictionService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = PredictionServiceRestTransport._CancelOperation._get_response( self._host, @@ -2472,7 +3225,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. @@ -2483,13 +3236,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 = ( _BasePredictionServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = self._interceptor.pre_delete_operation( request, metadata ) @@ -2502,6 +3258,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.aiplatform_v1.PredictionServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PredictionService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = PredictionServiceRestTransport._DeleteOperation._get_response( self._host, @@ -2558,7 +3341,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. @@ -2569,8 +3352,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. @@ -2579,6 +3364,7 @@ def __call__( http_options = ( _BasePredictionServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = self._interceptor.pre_get_operation(request, metadata) transcoded_request = _BasePredictionServiceRestTransport._BaseGetOperation._get_transcoded_request( http_options, request @@ -2589,6 +3375,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.aiplatform_v1.PredictionServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PredictionService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = PredictionServiceRestTransport._GetOperation._get_response( self._host, @@ -2608,6 +3421,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.aiplatform_v1.PredictionServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PredictionService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -2650,7 +3484,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. @@ -2661,8 +3495,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. @@ -2671,6 +3507,7 @@ def __call__( http_options = ( _BasePredictionServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = self._interceptor.pre_list_operations(request, metadata) transcoded_request = _BasePredictionServiceRestTransport._BaseListOperations._get_transcoded_request( http_options, request @@ -2681,6 +3518,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.aiplatform_v1.PredictionServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PredictionService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = PredictionServiceRestTransport._ListOperations._get_response( self._host, @@ -2700,6 +3564,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.aiplatform_v1.PredictionServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PredictionService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -2742,7 +3627,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 wait operation method over HTTP. @@ -2753,8 +3638,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 WaitOperation method. @@ -2763,6 +3650,7 @@ def __call__( http_options = ( _BasePredictionServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = self._interceptor.pre_wait_operation(request, metadata) transcoded_request = _BasePredictionServiceRestTransport._BaseWaitOperation._get_transcoded_request( http_options, request @@ -2773,6 +3661,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.aiplatform_v1.PredictionServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PredictionService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = PredictionServiceRestTransport._WaitOperation._get_response( self._host, @@ -2792,6 +3707,27 @@ def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = self._interceptor.post_wait_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.aiplatform_v1.PredictionServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PredictionService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1/services/prediction_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1/services/prediction_service/transports/rest_asyncio.py index 0a3b44136f..aceded8522 100644 --- a/google/cloud/aiplatform_v1/services/prediction_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1/services/prediction_service/transports/rest_asyncio.py @@ -57,6 +57,18 @@ from .base import DEFAULT_CLIENT_INFO as BASE_DEFAULT_CLIENT_INFO + +import logging + +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__) + try: OptionalRetry = Union[retries.AsyncRetry, gapic_v1.method._MethodDefault, None] except AttributeError: # pragma: NO COVER @@ -165,8 +177,10 @@ async def post_stream_raw_predict(self, response): async def pre_direct_predict( self, request: prediction_service.DirectPredictRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[prediction_service.DirectPredictRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + prediction_service.DirectPredictRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for direct_predict Override in a subclass to manipulate the request or metadata @@ -188,8 +202,11 @@ async def post_direct_predict( async def pre_direct_raw_predict( self, request: prediction_service.DirectRawPredictRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[prediction_service.DirectRawPredictRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + prediction_service.DirectRawPredictRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for direct_raw_predict Override in a subclass to manipulate the request or metadata @@ -211,8 +228,10 @@ async def post_direct_raw_predict( async def pre_explain( self, request: prediction_service.ExplainRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[prediction_service.ExplainRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + prediction_service.ExplainRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for explain Override in a subclass to manipulate the request or metadata @@ -234,8 +253,11 @@ async def post_explain( async def pre_generate_content( self, request: prediction_service.GenerateContentRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[prediction_service.GenerateContentRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + prediction_service.GenerateContentRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for generate_content Override in a subclass to manipulate the request or metadata @@ -257,8 +279,10 @@ async def post_generate_content( async def pre_predict( self, request: prediction_service.PredictRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[prediction_service.PredictRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + prediction_service.PredictRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for predict Override in a subclass to manipulate the request or metadata @@ -280,8 +304,10 @@ async def post_predict( async def pre_raw_predict( self, request: prediction_service.RawPredictRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[prediction_service.RawPredictRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + prediction_service.RawPredictRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for raw_predict Override in a subclass to manipulate the request or metadata @@ -303,8 +329,11 @@ async def post_raw_predict( async def pre_server_streaming_predict( self, request: prediction_service.StreamingPredictRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[prediction_service.StreamingPredictRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + prediction_service.StreamingPredictRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for server_streaming_predict Override in a subclass to manipulate the request or metadata @@ -326,8 +355,11 @@ async def post_server_streaming_predict( async def pre_stream_generate_content( self, request: prediction_service.GenerateContentRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[prediction_service.GenerateContentRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + prediction_service.GenerateContentRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for stream_generate_content Override in a subclass to manipulate the request or metadata @@ -349,8 +381,11 @@ async def post_stream_generate_content( async def pre_stream_raw_predict( self, request: prediction_service.StreamRawPredictRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[prediction_service.StreamRawPredictRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + prediction_service.StreamRawPredictRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for stream_raw_predict Override in a subclass to manipulate the request or metadata @@ -372,8 +407,10 @@ async def post_stream_raw_predict( async def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -395,8 +432,10 @@ async def post_get_location( async def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -418,8 +457,10 @@ async def post_list_locations( async def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -441,8 +482,10 @@ async def post_get_iam_policy( async def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -464,8 +507,11 @@ async def post_set_iam_policy( async def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -487,8 +533,10 @@ async def post_test_iam_permissions( async def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -508,8 +556,10 @@ async def post_cancel_operation(self, response: None) -> None: async 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 @@ -529,8 +579,10 @@ async def post_delete_operation(self, response: None) -> None: async 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 @@ -552,8 +604,10 @@ async def post_get_operation( async 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 @@ -575,8 +629,10 @@ async def post_list_operations( async def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -819,7 +875,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> prediction_service.DirectPredictResponse: r"""Call the direct predict method over HTTP. @@ -830,8 +886,10 @@ async def __call__( 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: ~.prediction_service.DirectPredictResponse: @@ -843,6 +901,7 @@ async def __call__( http_options = ( _BasePredictionServiceRestTransport._BaseDirectPredict._get_http_options() ) + request, metadata = await self._interceptor.pre_direct_predict( request, metadata ) @@ -859,6 +918,33 @@ async 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.aiplatform_v1.PredictionServiceClient.DirectPredict", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PredictionService", + "rpcName": "DirectPredict", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncPredictionServiceRestTransport._DirectPredict._get_response( @@ -889,6 +975,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_direct_predict(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = prediction_service.DirectPredictResponse.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.PredictionServiceAsyncClient.direct_predict", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PredictionService", + "rpcName": "DirectPredict", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _DirectRawPredict( @@ -928,7 +1038,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> prediction_service.DirectRawPredictResponse: r"""Call the direct raw predict method over HTTP. @@ -939,8 +1049,10 @@ async def __call__( 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: ~.prediction_service.DirectRawPredictResponse: @@ -952,6 +1064,7 @@ async def __call__( http_options = ( _BasePredictionServiceRestTransport._BaseDirectRawPredict._get_http_options() ) + request, metadata = await self._interceptor.pre_direct_raw_predict( request, metadata ) @@ -968,6 +1081,33 @@ async 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.aiplatform_v1.PredictionServiceClient.DirectRawPredict", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PredictionService", + "rpcName": "DirectRawPredict", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncPredictionServiceRestTransport._DirectRawPredict._get_response( self._host, @@ -996,6 +1136,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_direct_raw_predict(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + prediction_service.DirectRawPredictResponse.to_json(response) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.PredictionServiceAsyncClient.direct_raw_predict", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PredictionService", + "rpcName": "DirectRawPredict", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _Explain( @@ -1034,7 +1198,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> prediction_service.ExplainResponse: r"""Call the explain method over HTTP. @@ -1045,8 +1209,10 @@ async def __call__( 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: ~.prediction_service.ExplainResponse: @@ -1058,6 +1224,7 @@ async def __call__( http_options = ( _BasePredictionServiceRestTransport._BaseExplain._get_http_options() ) + request, metadata = await self._interceptor.pre_explain(request, metadata) transcoded_request = _BasePredictionServiceRestTransport._BaseExplain._get_transcoded_request( http_options, request @@ -1076,6 +1243,33 @@ async 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 = 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.aiplatform_v1.PredictionServiceClient.Explain", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PredictionService", + "rpcName": "Explain", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncPredictionServiceRestTransport._Explain._get_response( self._host, @@ -1104,6 +1298,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_explain(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = prediction_service.ExplainResponse.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.PredictionServiceAsyncClient.explain", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PredictionService", + "rpcName": "Explain", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _GenerateContent( @@ -1143,7 +1361,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> prediction_service.GenerateContentResponse: r"""Call the generate content method over HTTP. @@ -1153,8 +1371,10 @@ async def __call__( 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: ~.prediction_service.GenerateContentResponse: @@ -1166,6 +1386,7 @@ async def __call__( http_options = ( _BasePredictionServiceRestTransport._BaseGenerateContent._get_http_options() ) + request, metadata = await self._interceptor.pre_generate_content( request, metadata ) @@ -1182,6 +1403,33 @@ async 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.aiplatform_v1.PredictionServiceClient.GenerateContent", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PredictionService", + "rpcName": "GenerateContent", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncPredictionServiceRestTransport._GenerateContent._get_response( self._host, @@ -1210,6 +1458,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_generate_content(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + prediction_service.GenerateContentResponse.to_json(response) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.PredictionServiceAsyncClient.generate_content", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PredictionService", + "rpcName": "GenerateContent", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _Predict( @@ -1248,7 +1520,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> prediction_service.PredictResponse: r"""Call the predict method over HTTP. @@ -1259,8 +1531,10 @@ async def __call__( 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: ~.prediction_service.PredictResponse: @@ -1272,6 +1546,7 @@ async def __call__( http_options = ( _BasePredictionServiceRestTransport._BasePredict._get_http_options() ) + request, metadata = await self._interceptor.pre_predict(request, metadata) transcoded_request = _BasePredictionServiceRestTransport._BasePredict._get_transcoded_request( http_options, request @@ -1290,6 +1565,33 @@ async 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 = 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.aiplatform_v1.PredictionServiceClient.Predict", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PredictionService", + "rpcName": "Predict", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncPredictionServiceRestTransport._Predict._get_response( self._host, @@ -1318,6 +1620,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_predict(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = prediction_service.PredictResponse.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.PredictionServiceAsyncClient.predict", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PredictionService", + "rpcName": "Predict", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _RawPredict( @@ -1357,7 +1683,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> httpbody_pb2.HttpBody: r"""Call the raw predict method over HTTP. @@ -1368,8 +1694,10 @@ async def __call__( 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: ~.httpbody_pb2.HttpBody: @@ -1428,6 +1756,7 @@ async def __call__( http_options = ( _BasePredictionServiceRestTransport._BaseRawPredict._get_http_options() ) + request, metadata = await self._interceptor.pre_raw_predict( request, metadata ) @@ -1444,6 +1773,33 @@ async 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.aiplatform_v1.PredictionServiceClient.RawPredict", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PredictionService", + "rpcName": "RawPredict", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncPredictionServiceRestTransport._RawPredict._get_response( @@ -1474,6 +1830,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_raw_predict(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.PredictionServiceAsyncClient.raw_predict", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PredictionService", + "rpcName": "RawPredict", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ServerStreamingPredict( @@ -1513,7 +1891,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> rest_streaming_async.AsyncResponseIterator: r"""Call the server streaming predict method over HTTP. @@ -1529,8 +1907,10 @@ async def __call__( 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: ~.prediction_service.StreamingPredictResponse: @@ -1542,6 +1922,7 @@ async def __call__( http_options = ( _BasePredictionServiceRestTransport._BaseServerStreamingPredict._get_http_options() ) + request, metadata = await self._interceptor.pre_server_streaming_predict( request, metadata ) @@ -1558,6 +1939,33 @@ async 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.aiplatform_v1.PredictionServiceClient.ServerStreamingPredict", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PredictionService", + "rpcName": "ServerStreamingPredict", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncPredictionServiceRestTransport._ServerStreamingPredict._get_response( self._host, @@ -1600,7 +2008,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> rest_streaming_async.AsyncResponseIterator: raise NotImplementedError( "Method StreamDirectPredict is not available over REST transport" @@ -1619,7 +2027,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> rest_streaming_async.AsyncResponseIterator: raise NotImplementedError( "Method StreamDirectRawPredict is not available over REST transport" @@ -1662,7 +2070,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> rest_streaming_async.AsyncResponseIterator: r"""Call the stream generate content method over HTTP. @@ -1672,8 +2080,10 @@ async def __call__( 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: ~.prediction_service.GenerateContentResponse: @@ -1685,6 +2095,7 @@ async def __call__( http_options = ( _BasePredictionServiceRestTransport._BaseStreamGenerateContent._get_http_options() ) + request, metadata = await self._interceptor.pre_stream_generate_content( request, metadata ) @@ -1701,6 +2112,33 @@ async 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.aiplatform_v1.PredictionServiceClient.StreamGenerateContent", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PredictionService", + "rpcName": "StreamGenerateContent", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncPredictionServiceRestTransport._StreamGenerateContent._get_response( self._host, @@ -1743,7 +2181,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> rest_streaming_async.AsyncResponseIterator: raise NotImplementedError( "Method StreamingPredict is not available over REST transport" @@ -1762,7 +2200,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> rest_streaming_async.AsyncResponseIterator: raise NotImplementedError( "Method StreamingRawPredict is not available over REST transport" @@ -1805,7 +2243,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> rest_streaming_async.AsyncResponseIterator: r"""Call the stream raw predict method over HTTP. @@ -1816,8 +2254,10 @@ async def __call__( 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: ~.httpbody_pb2.HttpBody: @@ -1876,6 +2316,7 @@ async def __call__( http_options = ( _BasePredictionServiceRestTransport._BaseStreamRawPredict._get_http_options() ) + request, metadata = await self._interceptor.pre_stream_raw_predict( request, metadata ) @@ -1892,6 +2333,33 @@ async 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.aiplatform_v1.PredictionServiceClient.StreamRawPredict", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PredictionService", + "rpcName": "StreamRawPredict", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncPredictionServiceRestTransport._StreamRawPredict._get_response( self._host, @@ -2070,7 +2538,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -2081,8 +2549,10 @@ async def __call__( 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: locations_pb2.Location: Response from GetLocation method. @@ -2091,6 +2561,7 @@ async def __call__( http_options = ( _BasePredictionServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_location( request, metadata ) @@ -2103,6 +2574,33 @@ async 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.aiplatform_v1.PredictionServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PredictionService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncPredictionServiceRestTransport._GetLocation._get_response( @@ -2130,6 +2628,27 @@ async def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_location(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.aiplatform_v1.PredictionServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PredictionService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -2172,7 +2691,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -2183,8 +2702,10 @@ async def __call__( 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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -2193,6 +2714,7 @@ async def __call__( http_options = ( _BasePredictionServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_locations( request, metadata ) @@ -2205,6 +2727,33 @@ async 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.aiplatform_v1.PredictionServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PredictionService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncPredictionServiceRestTransport._ListLocations._get_response( @@ -2232,6 +2781,27 @@ async def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_list_locations(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.aiplatform_v1.PredictionServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PredictionService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -2274,7 +2844,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -2285,8 +2855,10 @@ async def __call__( 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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -2295,6 +2867,7 @@ async def __call__( http_options = ( _BasePredictionServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_get_iam_policy( request, metadata ) @@ -2307,6 +2880,33 @@ async 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.aiplatform_v1.PredictionServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PredictionService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncPredictionServiceRestTransport._GetIamPolicy._get_response( @@ -2334,6 +2934,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_iam_policy(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.aiplatform_v1.PredictionServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PredictionService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -2377,7 +2998,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -2388,8 +3009,10 @@ async def __call__( 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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -2398,6 +3021,7 @@ async def __call__( http_options = ( _BasePredictionServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_set_iam_policy( request, metadata ) @@ -2414,6 +3038,33 @@ async 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.aiplatform_v1.PredictionServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PredictionService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncPredictionServiceRestTransport._SetIamPolicy._get_response( @@ -2442,6 +3093,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_set_iam_policy(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.aiplatform_v1.PredictionServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PredictionService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -2484,7 +3156,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -2495,8 +3167,10 @@ async def __call__( 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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -2505,6 +3179,7 @@ async def __call__( http_options = ( _BasePredictionServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = await self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -2517,6 +3192,33 @@ async 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.aiplatform_v1.PredictionServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PredictionService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncPredictionServiceRestTransport._TestIamPermissions._get_response( self._host, @@ -2542,6 +3244,27 @@ async def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_test_iam_permissions(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.aiplatform_v1.PredictionServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PredictionService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -2584,7 +3307,7 @@ async 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 cancel operation method over HTTP. @@ -2595,13 +3318,16 @@ async def __call__( 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`. """ http_options = ( _BasePredictionServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_cancel_operation( request, metadata ) @@ -2614,6 +3340,33 @@ async 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.aiplatform_v1.PredictionServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PredictionService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncPredictionServiceRestTransport._CancelOperation._get_response( self._host, @@ -2677,7 +3430,7 @@ async 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. @@ -2688,13 +3441,16 @@ async def __call__( 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`. """ http_options = ( _BasePredictionServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_operation( request, metadata ) @@ -2707,6 +3463,33 @@ async 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.aiplatform_v1.PredictionServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PredictionService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncPredictionServiceRestTransport._DeleteOperation._get_response( self._host, @@ -2770,7 +3553,7 @@ async 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. @@ -2781,8 +3564,10 @@ async def __call__( 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: Response from GetOperation method. @@ -2791,6 +3576,7 @@ async def __call__( http_options = ( _BasePredictionServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_operation( request, metadata ) @@ -2803,6 +3589,33 @@ async 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.aiplatform_v1.PredictionServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PredictionService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncPredictionServiceRestTransport._GetOperation._get_response( @@ -2830,6 +3643,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1.PredictionServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PredictionService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -2872,7 +3706,7 @@ async 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. @@ -2883,8 +3717,10 @@ async def __call__( 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 from ListOperations method. @@ -2893,6 +3729,7 @@ async def __call__( http_options = ( _BasePredictionServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_operations( request, metadata ) @@ -2905,6 +3742,33 @@ async 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.aiplatform_v1.PredictionServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PredictionService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncPredictionServiceRestTransport._ListOperations._get_response( @@ -2932,6 +3796,27 @@ async def __call__( resp = operations_pb2.ListOperationsResponse() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1.PredictionServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PredictionService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -2974,7 +3859,7 @@ async 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 wait operation method over HTTP. @@ -2985,8 +3870,10 @@ async def __call__( 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: Response from WaitOperation method. @@ -2995,6 +3882,7 @@ async def __call__( http_options = ( _BasePredictionServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_wait_operation( request, metadata ) @@ -3007,6 +3895,33 @@ async 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.aiplatform_v1.PredictionServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PredictionService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncPredictionServiceRestTransport._WaitOperation._get_response( @@ -3034,6 +3949,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_wait_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.aiplatform_v1.PredictionServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.PredictionService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1/services/schedule_service/async_client.py b/google/cloud/aiplatform_v1/services/schedule_service/async_client.py index 71aa0326ca..b92b95a6b3 100644 --- a/google/cloud/aiplatform_v1/services/schedule_service/async_client.py +++ b/google/cloud/aiplatform_v1/services/schedule_service/async_client.py @@ -13,6 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging as std_logging from collections import OrderedDict import re from typing import ( @@ -63,6 +64,15 @@ from .transports.grpc_asyncio import ScheduleServiceGrpcAsyncIOTransport from .client import ScheduleServiceClient +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 ScheduleServiceAsyncClient: """A service for creating and managing Vertex AI's Schedule @@ -303,6 +313,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.aiplatform_v1.ScheduleServiceAsyncClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ScheduleService", + "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.aiplatform.v1.ScheduleService", + "credentialsType": None, + }, + ) + async def create_schedule( self, request: Optional[Union[schedule_service.CreateScheduleRequest, dict]] = None, @@ -311,7 +343,7 @@ async def create_schedule( schedule: Optional[gca_schedule.Schedule] = 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]]] = (), ) -> gca_schedule.Schedule: r"""Creates a Schedule. @@ -368,8 +400,10 @@ async def sample_create_schedule(): 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.aiplatform_v1.types.Schedule: @@ -434,7 +468,7 @@ async def delete_schedule( 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"""Deletes a Schedule. @@ -483,8 +517,10 @@ async def sample_delete_schedule(): 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: @@ -563,7 +599,7 @@ async def get_schedule( 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]]] = (), ) -> schedule.Schedule: r"""Gets a Schedule. @@ -607,8 +643,10 @@ async def sample_get_schedule(): 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.aiplatform_v1.types.Schedule: @@ -671,7 +709,7 @@ async def list_schedules( 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.ListSchedulesAsyncPager: r"""Lists Schedules in a Location. @@ -717,8 +755,10 @@ async def sample_list_schedules(): 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.aiplatform_v1.services.schedule_service.pagers.ListSchedulesAsyncPager: @@ -793,7 +833,7 @@ async def pause_schedule( 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"""Pauses a Schedule. Will mark [Schedule.state][google.cloud.aiplatform.v1.Schedule.state] to @@ -838,8 +878,10 @@ async def sample_pause_schedule(): 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 @@ -892,7 +934,7 @@ async def resume_schedule( catch_up: Optional[bool] = 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"""Resumes a paused Schedule to start scheduling new runs. Will mark [Schedule.state][google.cloud.aiplatform.v1.Schedule.state] @@ -955,8 +997,10 @@ async def sample_resume_schedule(): 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 @@ -1011,7 +1055,7 @@ async def update_schedule( 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]]] = (), ) -> gca_schedule.Schedule: r"""Updates an active or paused Schedule. @@ -1078,8 +1122,10 @@ async def sample_update_schedule(): 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.aiplatform_v1.types.Schedule: @@ -1145,7 +1191,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. @@ -1156,8 +1202,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. @@ -1198,7 +1246,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. @@ -1209,8 +1257,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. @@ -1251,7 +1301,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. @@ -1267,8 +1317,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 """ @@ -1305,7 +1357,7 @@ async def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -1320,8 +1372,10 @@ async def cancel_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 """ @@ -1358,7 +1412,7 @@ async def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -1375,8 +1429,10 @@ async def wait_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. @@ -1417,7 +1473,7 @@ async def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -1430,8 +1486,10 @@ async def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -1536,7 +1594,7 @@ async def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -1550,8 +1608,10 @@ async def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -1656,7 +1716,7 @@ async def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -1671,8 +1731,10 @@ async def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -1716,7 +1778,7 @@ async def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -1727,8 +1789,10 @@ async def get_location( 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: ~.location_pb2.Location: Location object. @@ -1769,7 +1833,7 @@ async def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -1780,8 +1844,10 @@ async def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1/services/schedule_service/client.py b/google/cloud/aiplatform_v1/services/schedule_service/client.py index 55396531b5..cbf5650550 100644 --- a/google/cloud/aiplatform_v1/services/schedule_service/client.py +++ b/google/cloud/aiplatform_v1/services/schedule_service/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 ( @@ -48,6 +49,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 as gac_operation # type: ignore from google.api_core import operation_async # type: ignore from google.cloud.aiplatform_v1.services.schedule_service import pagers @@ -833,6 +843,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( @@ -923,6 +937,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.aiplatform_v1.ScheduleServiceClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ScheduleService", + "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.aiplatform.v1.ScheduleService", + "credentialsType": None, + }, + ) + def create_schedule( self, request: Optional[Union[schedule_service.CreateScheduleRequest, dict]] = None, @@ -931,7 +968,7 @@ def create_schedule( schedule: Optional[gca_schedule.Schedule] = 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]]] = (), ) -> gca_schedule.Schedule: r"""Creates a Schedule. @@ -988,8 +1025,10 @@ def sample_create_schedule(): 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.aiplatform_v1.types.Schedule: @@ -1051,7 +1090,7 @@ def delete_schedule( 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]]] = (), ) -> gac_operation.Operation: r"""Deletes a Schedule. @@ -1100,8 +1139,10 @@ def sample_delete_schedule(): 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: @@ -1177,7 +1218,7 @@ def get_schedule( 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]]] = (), ) -> schedule.Schedule: r"""Gets a Schedule. @@ -1221,8 +1262,10 @@ def sample_get_schedule(): 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.aiplatform_v1.types.Schedule: @@ -1282,7 +1325,7 @@ def list_schedules( 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.ListSchedulesPager: r"""Lists Schedules in a Location. @@ -1328,8 +1371,10 @@ def sample_list_schedules(): 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.aiplatform_v1.services.schedule_service.pagers.ListSchedulesPager: @@ -1401,7 +1446,7 @@ def pause_schedule( 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"""Pauses a Schedule. Will mark [Schedule.state][google.cloud.aiplatform.v1.Schedule.state] to @@ -1446,8 +1491,10 @@ def sample_pause_schedule(): 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 @@ -1497,7 +1544,7 @@ def resume_schedule( catch_up: Optional[bool] = 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"""Resumes a paused Schedule to start scheduling new runs. Will mark [Schedule.state][google.cloud.aiplatform.v1.Schedule.state] @@ -1560,8 +1607,10 @@ def sample_resume_schedule(): 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 @@ -1613,7 +1662,7 @@ def update_schedule( 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]]] = (), ) -> gca_schedule.Schedule: r"""Updates an active or paused Schedule. @@ -1680,8 +1729,10 @@ def sample_update_schedule(): 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.aiplatform_v1.types.Schedule: @@ -1757,7 +1808,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. @@ -1768,8 +1819,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. @@ -1810,7 +1863,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. @@ -1821,8 +1874,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. @@ -1863,7 +1918,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. @@ -1879,8 +1934,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 """ @@ -1917,7 +1974,7 @@ def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -1932,8 +1989,10 @@ def cancel_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 """ @@ -1970,7 +2029,7 @@ def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -1987,8 +2046,10 @@ def wait_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. @@ -2029,7 +2090,7 @@ def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -2042,8 +2103,10 @@ def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -2148,7 +2211,7 @@ def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -2162,8 +2225,10 @@ def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -2268,7 +2333,7 @@ def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -2283,8 +2348,10 @@ def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -2326,7 +2393,7 @@ def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -2337,8 +2404,10 @@ def get_location( 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: ~.location_pb2.Location: Location object. @@ -2379,7 +2448,7 @@ def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -2390,8 +2459,10 @@ def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1/services/schedule_service/pagers.py b/google/cloud/aiplatform_v1/services/schedule_service/pagers.py index 2ceeb86850..6fcb02661e 100644 --- a/google/cloud/aiplatform_v1/services/schedule_service/pagers.py +++ b/google/cloud/aiplatform_v1/services/schedule_service/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 = schedule_service.ListSchedulesRequest(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 = schedule_service.ListSchedulesRequest(request) diff --git a/google/cloud/aiplatform_v1/services/schedule_service/transports/grpc.py b/google/cloud/aiplatform_v1/services/schedule_service/transports/grpc.py index ddc7dedaec..66ecf5131e 100644 --- a/google/cloud/aiplatform_v1/services/schedule_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1/services/schedule_service/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 import warnings from typing import Callable, Dict, Optional, Sequence, Tuple, Union @@ -22,8 +25,11 @@ import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from google.cloud.aiplatform_v1.types import schedule from google.cloud.aiplatform_v1.types import schedule as gca_schedule @@ -35,6 +41,81 @@ from google.protobuf import empty_pb2 # type: ignore from .base import ScheduleServiceTransport, DEFAULT_CLIENT_INFO +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.aiplatform.v1.ScheduleService", + "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.aiplatform.v1.ScheduleService", + "rpcName": client_call_details.method, + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class ScheduleServiceGrpcTransport(ScheduleServiceTransport): """gRPC backend transport for ScheduleService. @@ -191,7 +272,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 @@ -255,7 +341,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 @@ -279,7 +367,7 @@ def create_schedule( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_schedule" not in self._stubs: - self._stubs["create_schedule"] = self.grpc_channel.unary_unary( + self._stubs["create_schedule"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.ScheduleService/CreateSchedule", request_serializer=schedule_service.CreateScheduleRequest.serialize, response_deserializer=gca_schedule.Schedule.deserialize, @@ -305,7 +393,7 @@ def delete_schedule( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_schedule" not in self._stubs: - self._stubs["delete_schedule"] = self.grpc_channel.unary_unary( + self._stubs["delete_schedule"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.ScheduleService/DeleteSchedule", request_serializer=schedule_service.DeleteScheduleRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -331,7 +419,7 @@ def get_schedule( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_schedule" not in self._stubs: - self._stubs["get_schedule"] = self.grpc_channel.unary_unary( + self._stubs["get_schedule"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.ScheduleService/GetSchedule", request_serializer=schedule_service.GetScheduleRequest.serialize, response_deserializer=schedule.Schedule.deserialize, @@ -359,7 +447,7 @@ def list_schedules( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_schedules" not in self._stubs: - self._stubs["list_schedules"] = self.grpc_channel.unary_unary( + self._stubs["list_schedules"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.ScheduleService/ListSchedules", request_serializer=schedule_service.ListSchedulesRequest.serialize, response_deserializer=schedule_service.ListSchedulesResponse.deserialize, @@ -388,7 +476,7 @@ def pause_schedule( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "pause_schedule" not in self._stubs: - self._stubs["pause_schedule"] = self.grpc_channel.unary_unary( + self._stubs["pause_schedule"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.ScheduleService/PauseSchedule", request_serializer=schedule_service.PauseScheduleRequest.serialize, response_deserializer=empty_pb2.Empty.FromString, @@ -423,7 +511,7 @@ def resume_schedule( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "resume_schedule" not in self._stubs: - self._stubs["resume_schedule"] = self.grpc_channel.unary_unary( + self._stubs["resume_schedule"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.ScheduleService/ResumeSchedule", request_serializer=schedule_service.ResumeScheduleRequest.serialize, response_deserializer=empty_pb2.Empty.FromString, @@ -455,7 +543,7 @@ def update_schedule( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_schedule" not in self._stubs: - self._stubs["update_schedule"] = self.grpc_channel.unary_unary( + self._stubs["update_schedule"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.ScheduleService/UpdateSchedule", request_serializer=schedule_service.UpdateScheduleRequest.serialize, response_deserializer=gca_schedule.Schedule.deserialize, @@ -463,7 +551,7 @@ def update_schedule( return self._stubs["update_schedule"] def close(self): - self.grpc_channel.close() + self._logged_channel.close() @property def delete_operation( @@ -475,7 +563,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, @@ -492,7 +580,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -509,7 +597,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -526,7 +614,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, @@ -545,7 +633,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, @@ -564,7 +652,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -581,7 +669,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -606,7 +694,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -632,7 +720,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -661,7 +749,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1/services/schedule_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1/services/schedule_service/transports/grpc_asyncio.py index de94b5f24c..cab5381fb0 100644 --- a/google/cloud/aiplatform_v1/services/schedule_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1/services/schedule_service/transports/grpc_asyncio.py @@ -14,6 +14,9 @@ # limitations under the License. # import inspect +import json +import pickle +import logging as std_logging import warnings from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union @@ -24,8 +27,11 @@ from google.api_core import operations_v1 from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from grpc.experimental import aio # type: ignore from google.cloud.aiplatform_v1.types import schedule @@ -39,6 +45,82 @@ from .base import ScheduleServiceTransport, DEFAULT_CLIENT_INFO from .grpc import ScheduleServiceGrpcTransport +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.aiplatform.v1.ScheduleService", + "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.aiplatform.v1.ScheduleService", + "rpcName": str(client_call_details.method), + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class ScheduleServiceGrpcAsyncIOTransport(ScheduleServiceTransport): """gRPC AsyncIO backend transport for ScheduleService. @@ -238,10 +320,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 @@ -264,7 +349,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. @@ -291,7 +376,7 @@ def create_schedule( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_schedule" not in self._stubs: - self._stubs["create_schedule"] = self.grpc_channel.unary_unary( + self._stubs["create_schedule"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.ScheduleService/CreateSchedule", request_serializer=schedule_service.CreateScheduleRequest.serialize, response_deserializer=gca_schedule.Schedule.deserialize, @@ -319,7 +404,7 @@ def delete_schedule( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_schedule" not in self._stubs: - self._stubs["delete_schedule"] = self.grpc_channel.unary_unary( + self._stubs["delete_schedule"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.ScheduleService/DeleteSchedule", request_serializer=schedule_service.DeleteScheduleRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -345,7 +430,7 @@ def get_schedule( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_schedule" not in self._stubs: - self._stubs["get_schedule"] = self.grpc_channel.unary_unary( + self._stubs["get_schedule"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.ScheduleService/GetSchedule", request_serializer=schedule_service.GetScheduleRequest.serialize, response_deserializer=schedule.Schedule.deserialize, @@ -374,7 +459,7 @@ def list_schedules( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_schedules" not in self._stubs: - self._stubs["list_schedules"] = self.grpc_channel.unary_unary( + self._stubs["list_schedules"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.ScheduleService/ListSchedules", request_serializer=schedule_service.ListSchedulesRequest.serialize, response_deserializer=schedule_service.ListSchedulesResponse.deserialize, @@ -403,7 +488,7 @@ def pause_schedule( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "pause_schedule" not in self._stubs: - self._stubs["pause_schedule"] = self.grpc_channel.unary_unary( + self._stubs["pause_schedule"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.ScheduleService/PauseSchedule", request_serializer=schedule_service.PauseScheduleRequest.serialize, response_deserializer=empty_pb2.Empty.FromString, @@ -438,7 +523,7 @@ def resume_schedule( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "resume_schedule" not in self._stubs: - self._stubs["resume_schedule"] = self.grpc_channel.unary_unary( + self._stubs["resume_schedule"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.ScheduleService/ResumeSchedule", request_serializer=schedule_service.ResumeScheduleRequest.serialize, response_deserializer=empty_pb2.Empty.FromString, @@ -472,7 +557,7 @@ def update_schedule( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_schedule" not in self._stubs: - self._stubs["update_schedule"] = self.grpc_channel.unary_unary( + self._stubs["update_schedule"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.ScheduleService/UpdateSchedule", request_serializer=schedule_service.UpdateScheduleRequest.serialize, response_deserializer=gca_schedule.Schedule.deserialize, @@ -575,7 +660,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: @@ -591,7 +676,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, @@ -608,7 +693,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -625,7 +710,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -642,7 +727,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, @@ -661,7 +746,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, @@ -680,7 +765,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -697,7 +782,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -722,7 +807,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -748,7 +833,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -777,7 +862,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1/services/schedule_service/transports/rest.py b/google/cloud/aiplatform_v1/services/schedule_service/transports/rest.py index 6136c330d6..49a804d113 100644 --- a/google/cloud/aiplatform_v1/services/schedule_service/transports/rest.py +++ b/google/cloud/aiplatform_v1/services/schedule_service/transports/rest.py @@ -13,9 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging +import json # type: ignore from google.auth.transport.requests import AuthorizedSession # type: ignore -import json # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.api_core import exceptions as core_exceptions from google.api_core import retry as retries @@ -50,6 +51,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, @@ -130,8 +139,10 @@ def post_update_schedule(self, response): def pre_create_schedule( self, request: schedule_service.CreateScheduleRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[schedule_service.CreateScheduleRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + schedule_service.CreateScheduleRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for create_schedule Override in a subclass to manipulate the request or metadata @@ -153,8 +164,10 @@ def post_create_schedule( def pre_delete_schedule( self, request: schedule_service.DeleteScheduleRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[schedule_service.DeleteScheduleRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + schedule_service.DeleteScheduleRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for delete_schedule Override in a subclass to manipulate the request or metadata @@ -176,8 +189,10 @@ def post_delete_schedule( def pre_get_schedule( self, request: schedule_service.GetScheduleRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[schedule_service.GetScheduleRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + schedule_service.GetScheduleRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_schedule Override in a subclass to manipulate the request or metadata @@ -197,8 +212,10 @@ def post_get_schedule(self, response: schedule.Schedule) -> schedule.Schedule: def pre_list_schedules( self, request: schedule_service.ListSchedulesRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[schedule_service.ListSchedulesRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + schedule_service.ListSchedulesRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_schedules Override in a subclass to manipulate the request or metadata @@ -220,8 +237,10 @@ def post_list_schedules( def pre_pause_schedule( self, request: schedule_service.PauseScheduleRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[schedule_service.PauseScheduleRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + schedule_service.PauseScheduleRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for pause_schedule Override in a subclass to manipulate the request or metadata @@ -232,8 +251,10 @@ def pre_pause_schedule( def pre_resume_schedule( self, request: schedule_service.ResumeScheduleRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[schedule_service.ResumeScheduleRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + schedule_service.ResumeScheduleRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for resume_schedule Override in a subclass to manipulate the request or metadata @@ -244,8 +265,10 @@ def pre_resume_schedule( def pre_update_schedule( self, request: schedule_service.UpdateScheduleRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[schedule_service.UpdateScheduleRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + schedule_service.UpdateScheduleRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for update_schedule Override in a subclass to manipulate the request or metadata @@ -267,8 +290,10 @@ def post_update_schedule( def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -290,8 +315,10 @@ def post_get_location( def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -313,8 +340,10 @@ def post_list_locations( def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -334,8 +363,10 @@ def post_get_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -355,8 +386,11 @@ def post_set_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -378,8 +412,10 @@ def post_test_iam_permissions( def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -399,8 +435,10 @@ def post_cancel_operation(self, response: None) -> None: 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 @@ -420,8 +458,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 @@ -443,8 +483,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 @@ -466,8 +508,10 @@ def post_list_operations( def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -2490,7 +2534,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]]] = (), ) -> gca_schedule.Schedule: r"""Call the create schedule method over HTTP. @@ -2501,8 +2545,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: ~.gca_schedule.Schedule: @@ -2516,6 +2562,7 @@ def __call__( http_options = ( _BaseScheduleServiceRestTransport._BaseCreateSchedule._get_http_options() ) + request, metadata = self._interceptor.pre_create_schedule(request, metadata) transcoded_request = _BaseScheduleServiceRestTransport._BaseCreateSchedule._get_transcoded_request( http_options, request @@ -2530,6 +2577,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.aiplatform_v1.ScheduleServiceClient.CreateSchedule", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ScheduleService", + "rpcName": "CreateSchedule", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ScheduleServiceRestTransport._CreateSchedule._get_response( self._host, @@ -2551,7 +2625,29 @@ def __call__( pb_resp = gca_schedule.Schedule.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_create_schedule(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gca_schedule.Schedule.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.aiplatform_v1.ScheduleServiceClient.create_schedule", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ScheduleService", + "rpcName": "CreateSchedule", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _DeleteSchedule( @@ -2589,7 +2685,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 schedule method over HTTP. @@ -2600,8 +2696,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: @@ -2614,6 +2712,7 @@ def __call__( http_options = ( _BaseScheduleServiceRestTransport._BaseDeleteSchedule._get_http_options() ) + request, metadata = self._interceptor.pre_delete_schedule(request, metadata) transcoded_request = _BaseScheduleServiceRestTransport._BaseDeleteSchedule._get_transcoded_request( http_options, request @@ -2624,6 +2723,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.aiplatform_v1.ScheduleServiceClient.DeleteSchedule", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ScheduleService", + "rpcName": "DeleteSchedule", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ScheduleServiceRestTransport._DeleteSchedule._get_response( self._host, @@ -2642,7 +2768,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_schedule(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.aiplatform_v1.ScheduleServiceClient.delete_schedule", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ScheduleService", + "rpcName": "DeleteSchedule", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _GetSchedule( @@ -2680,7 +2828,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]]] = (), ) -> schedule.Schedule: r"""Call the get schedule method over HTTP. @@ -2691,8 +2839,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: ~.schedule.Schedule: @@ -2706,6 +2856,7 @@ def __call__( http_options = ( _BaseScheduleServiceRestTransport._BaseGetSchedule._get_http_options() ) + request, metadata = self._interceptor.pre_get_schedule(request, metadata) transcoded_request = _BaseScheduleServiceRestTransport._BaseGetSchedule._get_transcoded_request( http_options, request @@ -2716,6 +2867,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.aiplatform_v1.ScheduleServiceClient.GetSchedule", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ScheduleService", + "rpcName": "GetSchedule", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ScheduleServiceRestTransport._GetSchedule._get_response( self._host, @@ -2736,7 +2914,29 @@ def __call__( pb_resp = schedule.Schedule.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_schedule(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = schedule.Schedule.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.aiplatform_v1.ScheduleServiceClient.get_schedule", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ScheduleService", + "rpcName": "GetSchedule", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListSchedules( @@ -2774,7 +2974,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]]] = (), ) -> schedule_service.ListSchedulesResponse: r"""Call the list schedules method over HTTP. @@ -2785,8 +2985,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: ~.schedule_service.ListSchedulesResponse: @@ -2798,6 +3000,7 @@ def __call__( http_options = ( _BaseScheduleServiceRestTransport._BaseListSchedules._get_http_options() ) + request, metadata = self._interceptor.pre_list_schedules(request, metadata) transcoded_request = _BaseScheduleServiceRestTransport._BaseListSchedules._get_transcoded_request( http_options, request @@ -2808,6 +3011,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.aiplatform_v1.ScheduleServiceClient.ListSchedules", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ScheduleService", + "rpcName": "ListSchedules", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ScheduleServiceRestTransport._ListSchedules._get_response( self._host, @@ -2828,7 +3058,31 @@ def __call__( pb_resp = schedule_service.ListSchedulesResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_schedules(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = schedule_service.ListSchedulesResponse.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.aiplatform_v1.ScheduleServiceClient.list_schedules", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ScheduleService", + "rpcName": "ListSchedules", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _PauseSchedule( @@ -2867,7 +3121,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 pause schedule method over HTTP. @@ -2878,13 +3132,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 = ( _BaseScheduleServiceRestTransport._BasePauseSchedule._get_http_options() ) + request, metadata = self._interceptor.pre_pause_schedule(request, metadata) transcoded_request = _BaseScheduleServiceRestTransport._BasePauseSchedule._get_transcoded_request( http_options, request @@ -2899,6 +3156,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.aiplatform_v1.ScheduleServiceClient.PauseSchedule", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ScheduleService", + "rpcName": "PauseSchedule", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ScheduleServiceRestTransport._PauseSchedule._get_response( self._host, @@ -2951,7 +3235,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 resume schedule method over HTTP. @@ -2962,13 +3246,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 = ( _BaseScheduleServiceRestTransport._BaseResumeSchedule._get_http_options() ) + request, metadata = self._interceptor.pre_resume_schedule(request, metadata) transcoded_request = _BaseScheduleServiceRestTransport._BaseResumeSchedule._get_transcoded_request( http_options, request @@ -2983,6 +3270,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.aiplatform_v1.ScheduleServiceClient.ResumeSchedule", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ScheduleService", + "rpcName": "ResumeSchedule", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ScheduleServiceRestTransport._ResumeSchedule._get_response( self._host, @@ -3035,7 +3349,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]]] = (), ) -> gca_schedule.Schedule: r"""Call the update schedule method over HTTP. @@ -3046,8 +3360,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: ~.gca_schedule.Schedule: @@ -3061,6 +3377,7 @@ def __call__( http_options = ( _BaseScheduleServiceRestTransport._BaseUpdateSchedule._get_http_options() ) + request, metadata = self._interceptor.pre_update_schedule(request, metadata) transcoded_request = _BaseScheduleServiceRestTransport._BaseUpdateSchedule._get_transcoded_request( http_options, request @@ -3075,6 +3392,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.aiplatform_v1.ScheduleServiceClient.UpdateSchedule", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ScheduleService", + "rpcName": "UpdateSchedule", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ScheduleServiceRestTransport._UpdateSchedule._get_response( self._host, @@ -3096,7 +3440,29 @@ def __call__( pb_resp = gca_schedule.Schedule.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_update_schedule(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gca_schedule.Schedule.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.aiplatform_v1.ScheduleServiceClient.update_schedule", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ScheduleService", + "rpcName": "UpdateSchedule", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp @property @@ -3196,7 +3562,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]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -3207,8 +3573,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: locations_pb2.Location: Response from GetLocation method. @@ -3217,6 +3585,7 @@ def __call__( http_options = ( _BaseScheduleServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = self._interceptor.pre_get_location(request, metadata) transcoded_request = _BaseScheduleServiceRestTransport._BaseGetLocation._get_transcoded_request( http_options, request @@ -3227,6 +3596,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.aiplatform_v1.ScheduleServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ScheduleService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ScheduleServiceRestTransport._GetLocation._get_response( self._host, @@ -3246,6 +3642,27 @@ def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_location(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.aiplatform_v1.ScheduleServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ScheduleService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3287,7 +3704,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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -3298,8 +3715,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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -3308,6 +3727,7 @@ def __call__( http_options = ( _BaseScheduleServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = self._interceptor.pre_list_locations(request, metadata) transcoded_request = _BaseScheduleServiceRestTransport._BaseListLocations._get_transcoded_request( http_options, request @@ -3318,6 +3738,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.aiplatform_v1.ScheduleServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ScheduleService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ScheduleServiceRestTransport._ListLocations._get_response( self._host, @@ -3337,6 +3784,27 @@ def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_list_locations(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.aiplatform_v1.ScheduleServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ScheduleService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3378,7 +3846,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]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -3389,8 +3857,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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -3399,6 +3869,7 @@ def __call__( http_options = ( _BaseScheduleServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_get_iam_policy(request, metadata) transcoded_request = _BaseScheduleServiceRestTransport._BaseGetIamPolicy._get_transcoded_request( http_options, request @@ -3409,6 +3880,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.aiplatform_v1.ScheduleServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ScheduleService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ScheduleServiceRestTransport._GetIamPolicy._get_response( self._host, @@ -3428,6 +3926,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_iam_policy(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.aiplatform_v1.ScheduleServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ScheduleService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3470,7 +3989,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]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -3481,8 +4000,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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -3491,6 +4012,7 @@ def __call__( http_options = ( _BaseScheduleServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_set_iam_policy(request, metadata) transcoded_request = _BaseScheduleServiceRestTransport._BaseSetIamPolicy._get_transcoded_request( http_options, request @@ -3505,6 +4027,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.aiplatform_v1.ScheduleServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ScheduleService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ScheduleServiceRestTransport._SetIamPolicy._get_response( self._host, @@ -3525,6 +4074,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_set_iam_policy(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.aiplatform_v1.ScheduleServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ScheduleService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3567,7 +4137,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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -3578,8 +4148,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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -3588,6 +4160,7 @@ def __call__( http_options = ( _BaseScheduleServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -3600,6 +4173,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.aiplatform_v1.ScheduleServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ScheduleService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ScheduleServiceRestTransport._TestIamPermissions._get_response( self._host, @@ -3619,6 +4219,27 @@ def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_test_iam_permissions(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.aiplatform_v1.ScheduleServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ScheduleService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3660,7 +4281,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 cancel operation method over HTTP. @@ -3671,13 +4292,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 = ( _BaseScheduleServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = self._interceptor.pre_cancel_operation( request, metadata ) @@ -3690,6 +4314,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.aiplatform_v1.ScheduleServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ScheduleService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ScheduleServiceRestTransport._CancelOperation._get_response( self._host, @@ -3746,7 +4397,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. @@ -3757,13 +4408,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 = ( _BaseScheduleServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = self._interceptor.pre_delete_operation( request, metadata ) @@ -3776,6 +4430,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.aiplatform_v1.ScheduleServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ScheduleService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ScheduleServiceRestTransport._DeleteOperation._get_response( self._host, @@ -3832,7 +4513,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. @@ -3843,8 +4524,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. @@ -3853,6 +4536,7 @@ def __call__( http_options = ( _BaseScheduleServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = self._interceptor.pre_get_operation(request, metadata) transcoded_request = _BaseScheduleServiceRestTransport._BaseGetOperation._get_transcoded_request( http_options, request @@ -3863,6 +4547,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.aiplatform_v1.ScheduleServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ScheduleService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ScheduleServiceRestTransport._GetOperation._get_response( self._host, @@ -3882,6 +4593,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.aiplatform_v1.ScheduleServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ScheduleService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3923,7 +4655,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. @@ -3934,8 +4666,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. @@ -3944,6 +4678,7 @@ def __call__( http_options = ( _BaseScheduleServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = self._interceptor.pre_list_operations(request, metadata) transcoded_request = _BaseScheduleServiceRestTransport._BaseListOperations._get_transcoded_request( http_options, request @@ -3954,6 +4689,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.aiplatform_v1.ScheduleServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ScheduleService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ScheduleServiceRestTransport._ListOperations._get_response( self._host, @@ -3973,6 +4735,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.aiplatform_v1.ScheduleServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ScheduleService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4014,7 +4797,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 wait operation method over HTTP. @@ -4025,8 +4808,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 WaitOperation method. @@ -4035,6 +4820,7 @@ def __call__( http_options = ( _BaseScheduleServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = self._interceptor.pre_wait_operation(request, metadata) transcoded_request = _BaseScheduleServiceRestTransport._BaseWaitOperation._get_transcoded_request( http_options, request @@ -4045,6 +4831,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.aiplatform_v1.ScheduleServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ScheduleService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ScheduleServiceRestTransport._WaitOperation._get_response( self._host, @@ -4064,6 +4877,27 @@ def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = self._interceptor.post_wait_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.aiplatform_v1.ScheduleServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ScheduleService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1/services/schedule_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1/services/schedule_service/transports/rest_asyncio.py index c5817047ad..1fc665b553 100644 --- a/google/cloud/aiplatform_v1/services/schedule_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1/services/schedule_service/transports/rest_asyncio.py @@ -61,6 +61,18 @@ from .base import DEFAULT_CLIENT_INFO as BASE_DEFAULT_CLIENT_INFO + +import logging + +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__) + try: OptionalRetry = Union[retries.AsyncRetry, gapic_v1.method._MethodDefault, None] except AttributeError: # pragma: NO COVER @@ -145,8 +157,10 @@ async def post_update_schedule(self, response): async def pre_create_schedule( self, request: schedule_service.CreateScheduleRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[schedule_service.CreateScheduleRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + schedule_service.CreateScheduleRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for create_schedule Override in a subclass to manipulate the request or metadata @@ -168,8 +182,10 @@ async def post_create_schedule( async def pre_delete_schedule( self, request: schedule_service.DeleteScheduleRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[schedule_service.DeleteScheduleRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + schedule_service.DeleteScheduleRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for delete_schedule Override in a subclass to manipulate the request or metadata @@ -191,8 +207,10 @@ async def post_delete_schedule( async def pre_get_schedule( self, request: schedule_service.GetScheduleRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[schedule_service.GetScheduleRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + schedule_service.GetScheduleRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_schedule Override in a subclass to manipulate the request or metadata @@ -212,8 +230,10 @@ async def post_get_schedule(self, response: schedule.Schedule) -> schedule.Sched async def pre_list_schedules( self, request: schedule_service.ListSchedulesRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[schedule_service.ListSchedulesRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + schedule_service.ListSchedulesRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_schedules Override in a subclass to manipulate the request or metadata @@ -235,8 +255,10 @@ async def post_list_schedules( async def pre_pause_schedule( self, request: schedule_service.PauseScheduleRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[schedule_service.PauseScheduleRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + schedule_service.PauseScheduleRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for pause_schedule Override in a subclass to manipulate the request or metadata @@ -247,8 +269,10 @@ async def pre_pause_schedule( async def pre_resume_schedule( self, request: schedule_service.ResumeScheduleRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[schedule_service.ResumeScheduleRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + schedule_service.ResumeScheduleRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for resume_schedule Override in a subclass to manipulate the request or metadata @@ -259,8 +283,10 @@ async def pre_resume_schedule( async def pre_update_schedule( self, request: schedule_service.UpdateScheduleRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[schedule_service.UpdateScheduleRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + schedule_service.UpdateScheduleRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for update_schedule Override in a subclass to manipulate the request or metadata @@ -282,8 +308,10 @@ async def post_update_schedule( async def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -305,8 +333,10 @@ async def post_get_location( async def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -328,8 +358,10 @@ async def post_list_locations( async def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -351,8 +383,10 @@ async def post_get_iam_policy( async def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -374,8 +408,11 @@ async def post_set_iam_policy( async def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -397,8 +434,10 @@ async def post_test_iam_permissions( async def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -418,8 +457,10 @@ async def post_cancel_operation(self, response: None) -> None: async 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 @@ -439,8 +480,10 @@ async def post_delete_operation(self, response: None) -> None: async 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 @@ -462,8 +505,10 @@ async def post_get_operation( async 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 @@ -485,8 +530,10 @@ async def post_list_operations( async def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -704,7 +751,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> gca_schedule.Schedule: r"""Call the create schedule method over HTTP. @@ -715,8 +762,10 @@ async def __call__( 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: ~.gca_schedule.Schedule: @@ -730,6 +779,7 @@ async def __call__( http_options = ( _BaseScheduleServiceRestTransport._BaseCreateSchedule._get_http_options() ) + request, metadata = await self._interceptor.pre_create_schedule( request, metadata ) @@ -746,6 +796,33 @@ async 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.aiplatform_v1.ScheduleServiceClient.CreateSchedule", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ScheduleService", + "rpcName": "CreateSchedule", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncScheduleServiceRestTransport._CreateSchedule._get_response( @@ -776,6 +853,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_create_schedule(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gca_schedule.Schedule.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.ScheduleServiceAsyncClient.create_schedule", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ScheduleService", + "rpcName": "CreateSchedule", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _DeleteSchedule( @@ -814,7 +913,7 @@ async 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 schedule method over HTTP. @@ -825,8 +924,10 @@ async def __call__( 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: @@ -839,6 +940,7 @@ async def __call__( http_options = ( _BaseScheduleServiceRestTransport._BaseDeleteSchedule._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_schedule( request, metadata ) @@ -851,6 +953,33 @@ async 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.aiplatform_v1.ScheduleServiceClient.DeleteSchedule", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ScheduleService", + "rpcName": "DeleteSchedule", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncScheduleServiceRestTransport._DeleteSchedule._get_response( @@ -880,6 +1009,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_delete_schedule(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.ScheduleServiceAsyncClient.delete_schedule", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ScheduleService", + "rpcName": "DeleteSchedule", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _GetSchedule( @@ -917,7 +1068,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> schedule.Schedule: r"""Call the get schedule method over HTTP. @@ -928,8 +1079,10 @@ async def __call__( 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: ~.schedule.Schedule: @@ -943,6 +1096,7 @@ async def __call__( http_options = ( _BaseScheduleServiceRestTransport._BaseGetSchedule._get_http_options() ) + request, metadata = await self._interceptor.pre_get_schedule( request, metadata ) @@ -955,6 +1109,33 @@ async 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.aiplatform_v1.ScheduleServiceClient.GetSchedule", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ScheduleService", + "rpcName": "GetSchedule", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncScheduleServiceRestTransport._GetSchedule._get_response( @@ -984,6 +1165,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_get_schedule(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = schedule.Schedule.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.ScheduleServiceAsyncClient.get_schedule", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ScheduleService", + "rpcName": "GetSchedule", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ListSchedules( @@ -1022,7 +1225,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> schedule_service.ListSchedulesResponse: r"""Call the list schedules method over HTTP. @@ -1033,8 +1236,10 @@ async def __call__( 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: ~.schedule_service.ListSchedulesResponse: @@ -1046,6 +1251,7 @@ async def __call__( http_options = ( _BaseScheduleServiceRestTransport._BaseListSchedules._get_http_options() ) + request, metadata = await self._interceptor.pre_list_schedules( request, metadata ) @@ -1058,6 +1264,33 @@ async 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.aiplatform_v1.ScheduleServiceClient.ListSchedules", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ScheduleService", + "rpcName": "ListSchedules", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncScheduleServiceRestTransport._ListSchedules._get_response( @@ -1087,6 +1320,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_list_schedules(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = schedule_service.ListSchedulesResponse.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.ScheduleServiceAsyncClient.list_schedules", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ScheduleService", + "rpcName": "ListSchedules", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _PauseSchedule( @@ -1126,7 +1383,7 @@ async 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 pause schedule method over HTTP. @@ -1137,13 +1394,16 @@ async def __call__( 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`. """ http_options = ( _BaseScheduleServiceRestTransport._BasePauseSchedule._get_http_options() ) + request, metadata = await self._interceptor.pre_pause_schedule( request, metadata ) @@ -1160,6 +1420,33 @@ async 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.aiplatform_v1.ScheduleServiceClient.PauseSchedule", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ScheduleService", + "rpcName": "PauseSchedule", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncScheduleServiceRestTransport._PauseSchedule._get_response( @@ -1221,7 +1508,7 @@ async 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 resume schedule method over HTTP. @@ -1232,13 +1519,16 @@ async def __call__( 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`. """ http_options = ( _BaseScheduleServiceRestTransport._BaseResumeSchedule._get_http_options() ) + request, metadata = await self._interceptor.pre_resume_schedule( request, metadata ) @@ -1255,6 +1545,33 @@ async 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.aiplatform_v1.ScheduleServiceClient.ResumeSchedule", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ScheduleService", + "rpcName": "ResumeSchedule", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncScheduleServiceRestTransport._ResumeSchedule._get_response( @@ -1316,7 +1633,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> gca_schedule.Schedule: r"""Call the update schedule method over HTTP. @@ -1327,8 +1644,10 @@ async def __call__( 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: ~.gca_schedule.Schedule: @@ -1342,6 +1661,7 @@ async def __call__( http_options = ( _BaseScheduleServiceRestTransport._BaseUpdateSchedule._get_http_options() ) + request, metadata = await self._interceptor.pre_update_schedule( request, metadata ) @@ -1358,6 +1678,33 @@ async 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.aiplatform_v1.ScheduleServiceClient.UpdateSchedule", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ScheduleService", + "rpcName": "UpdateSchedule", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncScheduleServiceRestTransport._UpdateSchedule._get_response( @@ -1388,6 +1735,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_update_schedule(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gca_schedule.Schedule.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.ScheduleServiceAsyncClient.update_schedule", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ScheduleService", + "rpcName": "UpdateSchedule", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp @property @@ -3350,7 +3719,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -3361,8 +3730,10 @@ async def __call__( 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: locations_pb2.Location: Response from GetLocation method. @@ -3371,6 +3742,7 @@ async def __call__( http_options = ( _BaseScheduleServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_location( request, metadata ) @@ -3383,6 +3755,33 @@ async 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.aiplatform_v1.ScheduleServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ScheduleService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncScheduleServiceRestTransport._GetLocation._get_response( @@ -3410,6 +3809,27 @@ async def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_location(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.aiplatform_v1.ScheduleServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ScheduleService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3452,7 +3872,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -3463,8 +3883,10 @@ async def __call__( 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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -3473,6 +3895,7 @@ async def __call__( http_options = ( _BaseScheduleServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_locations( request, metadata ) @@ -3485,6 +3908,33 @@ async 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.aiplatform_v1.ScheduleServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ScheduleService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncScheduleServiceRestTransport._ListLocations._get_response( @@ -3512,6 +3962,27 @@ async def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_list_locations(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.aiplatform_v1.ScheduleServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ScheduleService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3554,7 +4025,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -3565,8 +4036,10 @@ async def __call__( 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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -3575,6 +4048,7 @@ async def __call__( http_options = ( _BaseScheduleServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_get_iam_policy( request, metadata ) @@ -3587,6 +4061,33 @@ async 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.aiplatform_v1.ScheduleServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ScheduleService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncScheduleServiceRestTransport._GetIamPolicy._get_response( @@ -3614,6 +4115,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_iam_policy(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.aiplatform_v1.ScheduleServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ScheduleService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3657,7 +4179,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -3668,8 +4190,10 @@ async def __call__( 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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -3678,6 +4202,7 @@ async def __call__( http_options = ( _BaseScheduleServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_set_iam_policy( request, metadata ) @@ -3694,6 +4219,33 @@ async 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.aiplatform_v1.ScheduleServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ScheduleService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncScheduleServiceRestTransport._SetIamPolicy._get_response( @@ -3722,6 +4274,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_set_iam_policy(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.aiplatform_v1.ScheduleServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ScheduleService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3764,7 +4337,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -3775,8 +4348,10 @@ async def __call__( 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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -3785,6 +4360,7 @@ async def __call__( http_options = ( _BaseScheduleServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = await self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -3797,6 +4373,33 @@ async 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.aiplatform_v1.ScheduleServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ScheduleService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncScheduleServiceRestTransport._TestIamPermissions._get_response( self._host, @@ -3822,6 +4425,27 @@ async def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_test_iam_permissions(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.aiplatform_v1.ScheduleServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ScheduleService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3864,7 +4488,7 @@ async 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 cancel operation method over HTTP. @@ -3875,13 +4499,16 @@ async def __call__( 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`. """ http_options = ( _BaseScheduleServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_cancel_operation( request, metadata ) @@ -3894,6 +4521,33 @@ async 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.aiplatform_v1.ScheduleServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ScheduleService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncScheduleServiceRestTransport._CancelOperation._get_response( @@ -3959,7 +4613,7 @@ async 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. @@ -3970,13 +4624,16 @@ async def __call__( 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`. """ http_options = ( _BaseScheduleServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_operation( request, metadata ) @@ -3989,6 +4646,33 @@ async 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.aiplatform_v1.ScheduleServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ScheduleService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncScheduleServiceRestTransport._DeleteOperation._get_response( @@ -4054,7 +4738,7 @@ async 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. @@ -4065,8 +4749,10 @@ async def __call__( 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: Response from GetOperation method. @@ -4075,6 +4761,7 @@ async def __call__( http_options = ( _BaseScheduleServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_operation( request, metadata ) @@ -4087,6 +4774,33 @@ async 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.aiplatform_v1.ScheduleServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ScheduleService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncScheduleServiceRestTransport._GetOperation._get_response( @@ -4114,6 +4828,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1.ScheduleServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ScheduleService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4156,7 +4891,7 @@ async 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. @@ -4167,8 +4902,10 @@ async def __call__( 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 from ListOperations method. @@ -4177,6 +4914,7 @@ async def __call__( http_options = ( _BaseScheduleServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_operations( request, metadata ) @@ -4189,6 +4927,33 @@ async 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.aiplatform_v1.ScheduleServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ScheduleService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncScheduleServiceRestTransport._ListOperations._get_response( @@ -4216,6 +4981,27 @@ async def __call__( resp = operations_pb2.ListOperationsResponse() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1.ScheduleServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ScheduleService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4258,7 +5044,7 @@ async 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 wait operation method over HTTP. @@ -4269,8 +5055,10 @@ async def __call__( 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: Response from WaitOperation method. @@ -4279,6 +5067,7 @@ async def __call__( http_options = ( _BaseScheduleServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_wait_operation( request, metadata ) @@ -4291,6 +5080,33 @@ async 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.aiplatform_v1.ScheduleServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ScheduleService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncScheduleServiceRestTransport._WaitOperation._get_response( @@ -4318,6 +5134,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_wait_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.aiplatform_v1.ScheduleServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.ScheduleService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1/services/specialist_pool_service/async_client.py b/google/cloud/aiplatform_v1/services/specialist_pool_service/async_client.py index 0136cc31b0..c4398169f2 100644 --- a/google/cloud/aiplatform_v1/services/specialist_pool_service/async_client.py +++ b/google/cloud/aiplatform_v1/services/specialist_pool_service/async_client.py @@ -13,6 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging as std_logging from collections import OrderedDict import re from typing import ( @@ -60,6 +61,15 @@ from .transports.grpc_asyncio import SpecialistPoolServiceGrpcAsyncIOTransport from .client import SpecialistPoolServiceClient +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 SpecialistPoolServiceAsyncClient: """A service for creating and managing Customer SpecialistPools. @@ -281,6 +291,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.aiplatform_v1.SpecialistPoolServiceAsyncClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1.SpecialistPoolService", + "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.aiplatform.v1.SpecialistPoolService", + "credentialsType": None, + }, + ) + async def create_specialist_pool( self, request: Optional[ @@ -291,7 +323,7 @@ async def create_specialist_pool( specialist_pool: Optional[gca_specialist_pool.SpecialistPool] = 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"""Creates a SpecialistPool. @@ -352,8 +384,10 @@ async def sample_create_specialist_pool(): 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: @@ -434,7 +468,7 @@ async def get_specialist_pool( 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]]] = (), ) -> specialist_pool.SpecialistPool: r"""Gets a SpecialistPool. @@ -479,8 +513,10 @@ async def sample_get_specialist_pool(): 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.aiplatform_v1.types.SpecialistPool: @@ -553,7 +589,7 @@ async def list_specialist_pools( 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.ListSpecialistPoolsAsyncPager: r"""Lists SpecialistPools in a Location. @@ -599,8 +635,10 @@ async def sample_list_specialist_pools(): 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.aiplatform_v1.services.specialist_pool_service.pagers.ListSpecialistPoolsAsyncPager: @@ -677,7 +715,7 @@ async def delete_specialist_pool( 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"""Deletes a SpecialistPool as well as all Specialists in the pool. @@ -727,8 +765,10 @@ async def sample_delete_specialist_pool(): 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: @@ -810,7 +850,7 @@ async def update_specialist_pool( 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"""Updates a SpecialistPool. @@ -869,8 +909,10 @@ async def sample_update_specialist_pool(): 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: @@ -950,7 +992,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. @@ -961,8 +1003,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. @@ -1003,7 +1047,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. @@ -1014,8 +1058,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. @@ -1056,7 +1102,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. @@ -1072,8 +1118,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 """ @@ -1110,7 +1158,7 @@ async def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -1125,8 +1173,10 @@ async def cancel_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 """ @@ -1163,7 +1213,7 @@ async def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -1180,8 +1230,10 @@ async def wait_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. @@ -1222,7 +1274,7 @@ async def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -1235,8 +1287,10 @@ async def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -1341,7 +1395,7 @@ async def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -1355,8 +1409,10 @@ async def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -1461,7 +1517,7 @@ async def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -1476,8 +1532,10 @@ async def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -1521,7 +1579,7 @@ async def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -1532,8 +1590,10 @@ async def get_location( 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: ~.location_pb2.Location: Location object. @@ -1574,7 +1634,7 @@ async def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -1585,8 +1645,10 @@ async def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1/services/specialist_pool_service/client.py b/google/cloud/aiplatform_v1/services/specialist_pool_service/client.py index 87685485a0..765334c6ed 100644 --- a/google/cloud/aiplatform_v1/services/specialist_pool_service/client.py +++ b/google/cloud/aiplatform_v1/services/specialist_pool_service/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 ( @@ -48,6 +49,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 as gac_operation # type: ignore from google.api_core import operation_async # type: ignore from google.cloud.aiplatform_v1.services.specialist_pool_service import pagers @@ -614,6 +624,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( @@ -705,6 +719,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.aiplatform_v1.SpecialistPoolServiceClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1.SpecialistPoolService", + "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.aiplatform.v1.SpecialistPoolService", + "credentialsType": None, + }, + ) + def create_specialist_pool( self, request: Optional[ @@ -715,7 +752,7 @@ def create_specialist_pool( specialist_pool: Optional[gca_specialist_pool.SpecialistPool] = 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]]] = (), ) -> gac_operation.Operation: r"""Creates a SpecialistPool. @@ -776,8 +813,10 @@ def sample_create_specialist_pool(): 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: @@ -855,7 +894,7 @@ def get_specialist_pool( 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]]] = (), ) -> specialist_pool.SpecialistPool: r"""Gets a SpecialistPool. @@ -900,8 +939,10 @@ def sample_get_specialist_pool(): 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.aiplatform_v1.types.SpecialistPool: @@ -971,7 +1012,7 @@ def list_specialist_pools( 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.ListSpecialistPoolsPager: r"""Lists SpecialistPools in a Location. @@ -1017,8 +1058,10 @@ def sample_list_specialist_pools(): 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.aiplatform_v1.services.specialist_pool_service.pagers.ListSpecialistPoolsPager: @@ -1092,7 +1135,7 @@ def delete_specialist_pool( 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]]] = (), ) -> gac_operation.Operation: r"""Deletes a SpecialistPool as well as all Specialists in the pool. @@ -1142,8 +1185,10 @@ def sample_delete_specialist_pool(): 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: @@ -1222,7 +1267,7 @@ def update_specialist_pool( 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]]] = (), ) -> gac_operation.Operation: r"""Updates a SpecialistPool. @@ -1281,8 +1326,10 @@ def sample_update_specialist_pool(): 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: @@ -1372,7 +1419,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. @@ -1383,8 +1430,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. @@ -1425,7 +1474,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. @@ -1436,8 +1485,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. @@ -1478,7 +1529,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. @@ -1494,8 +1545,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 """ @@ -1532,7 +1585,7 @@ def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -1547,8 +1600,10 @@ def cancel_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 """ @@ -1585,7 +1640,7 @@ def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -1602,8 +1657,10 @@ def wait_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. @@ -1644,7 +1701,7 @@ def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -1657,8 +1714,10 @@ def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -1763,7 +1822,7 @@ def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -1777,8 +1836,10 @@ def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -1883,7 +1944,7 @@ def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -1898,8 +1959,10 @@ def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -1941,7 +2004,7 @@ def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -1952,8 +2015,10 @@ def get_location( 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: ~.location_pb2.Location: Location object. @@ -1994,7 +2059,7 @@ def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -2005,8 +2070,10 @@ def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1/services/specialist_pool_service/pagers.py b/google/cloud/aiplatform_v1/services/specialist_pool_service/pagers.py index 9661ffae3d..fb55907aec 100644 --- a/google/cloud/aiplatform_v1/services/specialist_pool_service/pagers.py +++ b/google/cloud/aiplatform_v1/services/specialist_pool_service/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 = specialist_pool_service.ListSpecialistPoolsRequest(request) @@ -143,7 +145,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. @@ -157,8 +159,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 = specialist_pool_service.ListSpecialistPoolsRequest(request) diff --git a/google/cloud/aiplatform_v1/services/specialist_pool_service/transports/grpc.py b/google/cloud/aiplatform_v1/services/specialist_pool_service/transports/grpc.py index f4d4f20482..ddb17dd0af 100644 --- a/google/cloud/aiplatform_v1/services/specialist_pool_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1/services/specialist_pool_service/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 import warnings from typing import Callable, Dict, Optional, Sequence, Tuple, Union @@ -22,8 +25,11 @@ import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from google.cloud.aiplatform_v1.types import specialist_pool from google.cloud.aiplatform_v1.types import specialist_pool_service @@ -33,6 +39,81 @@ from google.longrunning import operations_pb2 # type: ignore from .base import SpecialistPoolServiceTransport, DEFAULT_CLIENT_INFO +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.aiplatform.v1.SpecialistPoolService", + "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.aiplatform.v1.SpecialistPoolService", + "rpcName": client_call_details.method, + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class SpecialistPoolServiceGrpcTransport(SpecialistPoolServiceTransport): """gRPC backend transport for SpecialistPoolService. @@ -192,7 +273,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 @@ -256,7 +342,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 @@ -282,7 +370,7 @@ def create_specialist_pool( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_specialist_pool" not in self._stubs: - self._stubs["create_specialist_pool"] = self.grpc_channel.unary_unary( + self._stubs["create_specialist_pool"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.SpecialistPoolService/CreateSpecialistPool", request_serializer=specialist_pool_service.CreateSpecialistPoolRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -311,7 +399,7 @@ def get_specialist_pool( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_specialist_pool" not in self._stubs: - self._stubs["get_specialist_pool"] = self.grpc_channel.unary_unary( + self._stubs["get_specialist_pool"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.SpecialistPoolService/GetSpecialistPool", request_serializer=specialist_pool_service.GetSpecialistPoolRequest.serialize, response_deserializer=specialist_pool.SpecialistPool.deserialize, @@ -340,7 +428,7 @@ def list_specialist_pools( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_specialist_pools" not in self._stubs: - self._stubs["list_specialist_pools"] = self.grpc_channel.unary_unary( + self._stubs["list_specialist_pools"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.SpecialistPoolService/ListSpecialistPools", request_serializer=specialist_pool_service.ListSpecialistPoolsRequest.serialize, response_deserializer=specialist_pool_service.ListSpecialistPoolsResponse.deserialize, @@ -369,7 +457,7 @@ def delete_specialist_pool( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_specialist_pool" not in self._stubs: - self._stubs["delete_specialist_pool"] = self.grpc_channel.unary_unary( + self._stubs["delete_specialist_pool"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.SpecialistPoolService/DeleteSpecialistPool", request_serializer=specialist_pool_service.DeleteSpecialistPoolRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -397,7 +485,7 @@ def update_specialist_pool( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_specialist_pool" not in self._stubs: - self._stubs["update_specialist_pool"] = self.grpc_channel.unary_unary( + self._stubs["update_specialist_pool"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.SpecialistPoolService/UpdateSpecialistPool", request_serializer=specialist_pool_service.UpdateSpecialistPoolRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -405,7 +493,7 @@ def update_specialist_pool( return self._stubs["update_specialist_pool"] def close(self): - self.grpc_channel.close() + self._logged_channel.close() @property def delete_operation( @@ -417,7 +505,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, @@ -434,7 +522,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -451,7 +539,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -468,7 +556,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, @@ -487,7 +575,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, @@ -506,7 +594,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -523,7 +611,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -548,7 +636,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -574,7 +662,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -603,7 +691,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1/services/specialist_pool_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1/services/specialist_pool_service/transports/grpc_asyncio.py index 4b83bc1686..d40d165963 100644 --- a/google/cloud/aiplatform_v1/services/specialist_pool_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1/services/specialist_pool_service/transports/grpc_asyncio.py @@ -14,6 +14,9 @@ # limitations under the License. # import inspect +import json +import pickle +import logging as std_logging import warnings from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union @@ -24,8 +27,11 @@ from google.api_core import operations_v1 from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from grpc.experimental import aio # type: ignore from google.cloud.aiplatform_v1.types import specialist_pool @@ -37,6 +43,82 @@ from .base import SpecialistPoolServiceTransport, DEFAULT_CLIENT_INFO from .grpc import SpecialistPoolServiceGrpcTransport +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.aiplatform.v1.SpecialistPoolService", + "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.aiplatform.v1.SpecialistPoolService", + "rpcName": str(client_call_details.method), + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class SpecialistPoolServiceGrpcAsyncIOTransport(SpecialistPoolServiceTransport): """gRPC AsyncIO backend transport for SpecialistPoolService. @@ -239,10 +321,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 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. @@ -293,7 +378,7 @@ def create_specialist_pool( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_specialist_pool" not in self._stubs: - self._stubs["create_specialist_pool"] = self.grpc_channel.unary_unary( + self._stubs["create_specialist_pool"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.SpecialistPoolService/CreateSpecialistPool", request_serializer=specialist_pool_service.CreateSpecialistPoolRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -322,7 +407,7 @@ def get_specialist_pool( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_specialist_pool" not in self._stubs: - self._stubs["get_specialist_pool"] = self.grpc_channel.unary_unary( + self._stubs["get_specialist_pool"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.SpecialistPoolService/GetSpecialistPool", request_serializer=specialist_pool_service.GetSpecialistPoolRequest.serialize, response_deserializer=specialist_pool.SpecialistPool.deserialize, @@ -351,7 +436,7 @@ def list_specialist_pools( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_specialist_pools" not in self._stubs: - self._stubs["list_specialist_pools"] = self.grpc_channel.unary_unary( + self._stubs["list_specialist_pools"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.SpecialistPoolService/ListSpecialistPools", request_serializer=specialist_pool_service.ListSpecialistPoolsRequest.serialize, response_deserializer=specialist_pool_service.ListSpecialistPoolsResponse.deserialize, @@ -381,7 +466,7 @@ def delete_specialist_pool( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_specialist_pool" not in self._stubs: - self._stubs["delete_specialist_pool"] = self.grpc_channel.unary_unary( + self._stubs["delete_specialist_pool"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.SpecialistPoolService/DeleteSpecialistPool", request_serializer=specialist_pool_service.DeleteSpecialistPoolRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -410,7 +495,7 @@ def update_specialist_pool( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_specialist_pool" not in self._stubs: - self._stubs["update_specialist_pool"] = self.grpc_channel.unary_unary( + self._stubs["update_specialist_pool"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.SpecialistPoolService/UpdateSpecialistPool", request_serializer=specialist_pool_service.UpdateSpecialistPoolRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -503,7 +588,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: @@ -519,7 +604,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, @@ -536,7 +621,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -553,7 +638,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -570,7 +655,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, @@ -589,7 +674,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, @@ -608,7 +693,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -625,7 +710,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -650,7 +735,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -676,7 +761,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -705,7 +790,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1/services/specialist_pool_service/transports/rest.py b/google/cloud/aiplatform_v1/services/specialist_pool_service/transports/rest.py index 78323176bc..9f9e1cb99d 100644 --- a/google/cloud/aiplatform_v1/services/specialist_pool_service/transports/rest.py +++ b/google/cloud/aiplatform_v1/services/specialist_pool_service/transports/rest.py @@ -13,9 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging +import json # type: ignore from google.auth.transport.requests import AuthorizedSession # type: ignore -import json # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.api_core import exceptions as core_exceptions from google.api_core import retry as retries @@ -48,6 +49,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, @@ -120,9 +129,10 @@ def post_update_specialist_pool(self, response): def pre_create_specialist_pool( self, request: specialist_pool_service.CreateSpecialistPoolRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - specialist_pool_service.CreateSpecialistPoolRequest, Sequence[Tuple[str, str]] + specialist_pool_service.CreateSpecialistPoolRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for create_specialist_pool @@ -145,9 +155,10 @@ def post_create_specialist_pool( def pre_delete_specialist_pool( self, request: specialist_pool_service.DeleteSpecialistPoolRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - specialist_pool_service.DeleteSpecialistPoolRequest, Sequence[Tuple[str, str]] + specialist_pool_service.DeleteSpecialistPoolRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for delete_specialist_pool @@ -170,9 +181,10 @@ def post_delete_specialist_pool( def pre_get_specialist_pool( self, request: specialist_pool_service.GetSpecialistPoolRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - specialist_pool_service.GetSpecialistPoolRequest, Sequence[Tuple[str, str]] + specialist_pool_service.GetSpecialistPoolRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for get_specialist_pool @@ -195,9 +207,10 @@ def post_get_specialist_pool( def pre_list_specialist_pools( self, request: specialist_pool_service.ListSpecialistPoolsRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - specialist_pool_service.ListSpecialistPoolsRequest, Sequence[Tuple[str, str]] + specialist_pool_service.ListSpecialistPoolsRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for list_specialist_pools @@ -220,9 +233,10 @@ def post_list_specialist_pools( def pre_update_specialist_pool( self, request: specialist_pool_service.UpdateSpecialistPoolRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - specialist_pool_service.UpdateSpecialistPoolRequest, Sequence[Tuple[str, str]] + specialist_pool_service.UpdateSpecialistPoolRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for update_specialist_pool @@ -245,8 +259,10 @@ def post_update_specialist_pool( def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -268,8 +284,10 @@ def post_get_location( def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -291,8 +309,10 @@ def post_list_locations( def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -312,8 +332,10 @@ def post_get_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -333,8 +355,11 @@ def post_set_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -356,8 +381,10 @@ def post_test_iam_permissions( def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -377,8 +404,10 @@ def post_cancel_operation(self, response: None) -> None: 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 @@ -398,8 +427,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 @@ -421,8 +452,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 @@ -444,8 +477,10 @@ def post_list_operations( def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -2472,7 +2507,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 specialist pool method over HTTP. @@ -2483,8 +2518,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: @@ -2497,6 +2534,7 @@ def __call__( http_options = ( _BaseSpecialistPoolServiceRestTransport._BaseCreateSpecialistPool._get_http_options() ) + request, metadata = self._interceptor.pre_create_specialist_pool( request, metadata ) @@ -2513,6 +2551,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.aiplatform_v1.SpecialistPoolServiceClient.CreateSpecialistPool", + extra={ + "serviceName": "google.cloud.aiplatform.v1.SpecialistPoolService", + "rpcName": "CreateSpecialistPool", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( SpecialistPoolServiceRestTransport._CreateSpecialistPool._get_response( @@ -2534,7 +2599,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_specialist_pool(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.aiplatform_v1.SpecialistPoolServiceClient.create_specialist_pool", + extra={ + "serviceName": "google.cloud.aiplatform.v1.SpecialistPoolService", + "rpcName": "CreateSpecialistPool", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _DeleteSpecialistPool( @@ -2573,7 +2660,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 specialist pool method over HTTP. @@ -2584,8 +2671,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: @@ -2598,6 +2687,7 @@ def __call__( http_options = ( _BaseSpecialistPoolServiceRestTransport._BaseDeleteSpecialistPool._get_http_options() ) + request, metadata = self._interceptor.pre_delete_specialist_pool( request, metadata ) @@ -2610,6 +2700,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.aiplatform_v1.SpecialistPoolServiceClient.DeleteSpecialistPool", + extra={ + "serviceName": "google.cloud.aiplatform.v1.SpecialistPoolService", + "rpcName": "DeleteSpecialistPool", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( SpecialistPoolServiceRestTransport._DeleteSpecialistPool._get_response( @@ -2630,7 +2747,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_specialist_pool(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.aiplatform_v1.SpecialistPoolServiceClient.delete_specialist_pool", + extra={ + "serviceName": "google.cloud.aiplatform.v1.SpecialistPoolService", + "rpcName": "DeleteSpecialistPool", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _GetSpecialistPool( @@ -2669,7 +2808,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]]] = (), ) -> specialist_pool.SpecialistPool: r"""Call the get specialist pool method over HTTP. @@ -2680,8 +2819,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: ~.specialist_pool.SpecialistPool: @@ -2703,6 +2844,7 @@ def __call__( http_options = ( _BaseSpecialistPoolServiceRestTransport._BaseGetSpecialistPool._get_http_options() ) + request, metadata = self._interceptor.pre_get_specialist_pool( request, metadata ) @@ -2715,6 +2857,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.aiplatform_v1.SpecialistPoolServiceClient.GetSpecialistPool", + extra={ + "serviceName": "google.cloud.aiplatform.v1.SpecialistPoolService", + "rpcName": "GetSpecialistPool", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( SpecialistPoolServiceRestTransport._GetSpecialistPool._get_response( @@ -2737,7 +2906,29 @@ def __call__( pb_resp = specialist_pool.SpecialistPool.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_specialist_pool(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = specialist_pool.SpecialistPool.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.aiplatform_v1.SpecialistPoolServiceClient.get_specialist_pool", + extra={ + "serviceName": "google.cloud.aiplatform.v1.SpecialistPoolService", + "rpcName": "GetSpecialistPool", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListSpecialistPools( @@ -2776,7 +2967,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]]] = (), ) -> specialist_pool_service.ListSpecialistPoolsResponse: r"""Call the list specialist pools method over HTTP. @@ -2787,8 +2978,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: ~.specialist_pool_service.ListSpecialistPoolsResponse: @@ -2800,6 +2993,7 @@ def __call__( http_options = ( _BaseSpecialistPoolServiceRestTransport._BaseListSpecialistPools._get_http_options() ) + request, metadata = self._interceptor.pre_list_specialist_pools( request, metadata ) @@ -2812,6 +3006,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.aiplatform_v1.SpecialistPoolServiceClient.ListSpecialistPools", + extra={ + "serviceName": "google.cloud.aiplatform.v1.SpecialistPoolService", + "rpcName": "ListSpecialistPools", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( SpecialistPoolServiceRestTransport._ListSpecialistPools._get_response( @@ -2834,7 +3055,33 @@ def __call__( pb_resp = specialist_pool_service.ListSpecialistPoolsResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_specialist_pools(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + specialist_pool_service.ListSpecialistPoolsResponse.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.aiplatform_v1.SpecialistPoolServiceClient.list_specialist_pools", + extra={ + "serviceName": "google.cloud.aiplatform.v1.SpecialistPoolService", + "rpcName": "ListSpecialistPools", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _UpdateSpecialistPool( @@ -2874,7 +3121,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 specialist pool method over HTTP. @@ -2885,8 +3132,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: @@ -2899,6 +3148,7 @@ def __call__( http_options = ( _BaseSpecialistPoolServiceRestTransport._BaseUpdateSpecialistPool._get_http_options() ) + request, metadata = self._interceptor.pre_update_specialist_pool( request, metadata ) @@ -2915,6 +3165,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.aiplatform_v1.SpecialistPoolServiceClient.UpdateSpecialistPool", + extra={ + "serviceName": "google.cloud.aiplatform.v1.SpecialistPoolService", + "rpcName": "UpdateSpecialistPool", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( SpecialistPoolServiceRestTransport._UpdateSpecialistPool._get_response( @@ -2936,7 +3213,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_specialist_pool(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.aiplatform_v1.SpecialistPoolServiceClient.update_specialist_pool", + extra={ + "serviceName": "google.cloud.aiplatform.v1.SpecialistPoolService", + "rpcName": "UpdateSpecialistPool", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp @property @@ -3031,7 +3330,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]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -3042,8 +3341,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: locations_pb2.Location: Response from GetLocation method. @@ -3052,6 +3353,7 @@ def __call__( http_options = ( _BaseSpecialistPoolServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = self._interceptor.pre_get_location(request, metadata) transcoded_request = _BaseSpecialistPoolServiceRestTransport._BaseGetLocation._get_transcoded_request( http_options, request @@ -3062,6 +3364,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.aiplatform_v1.SpecialistPoolServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.SpecialistPoolService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = SpecialistPoolServiceRestTransport._GetLocation._get_response( self._host, @@ -3081,6 +3410,27 @@ def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_location(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.aiplatform_v1.SpecialistPoolServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.SpecialistPoolService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3123,7 +3473,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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -3134,8 +3484,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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -3144,6 +3496,7 @@ def __call__( http_options = ( _BaseSpecialistPoolServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = self._interceptor.pre_list_locations(request, metadata) transcoded_request = _BaseSpecialistPoolServiceRestTransport._BaseListLocations._get_transcoded_request( http_options, request @@ -3154,6 +3507,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.aiplatform_v1.SpecialistPoolServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.SpecialistPoolService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = SpecialistPoolServiceRestTransport._ListLocations._get_response( self._host, @@ -3173,6 +3553,27 @@ def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_list_locations(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.aiplatform_v1.SpecialistPoolServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.SpecialistPoolService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3215,7 +3616,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]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -3226,8 +3627,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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -3236,6 +3639,7 @@ def __call__( http_options = ( _BaseSpecialistPoolServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_get_iam_policy(request, metadata) transcoded_request = _BaseSpecialistPoolServiceRestTransport._BaseGetIamPolicy._get_transcoded_request( http_options, request @@ -3246,6 +3650,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.aiplatform_v1.SpecialistPoolServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.SpecialistPoolService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = SpecialistPoolServiceRestTransport._GetIamPolicy._get_response( self._host, @@ -3265,6 +3696,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_iam_policy(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.aiplatform_v1.SpecialistPoolServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.SpecialistPoolService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3308,7 +3760,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]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -3319,8 +3771,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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -3329,6 +3783,7 @@ def __call__( http_options = ( _BaseSpecialistPoolServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_set_iam_policy(request, metadata) transcoded_request = _BaseSpecialistPoolServiceRestTransport._BaseSetIamPolicy._get_transcoded_request( http_options, request @@ -3343,6 +3798,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.aiplatform_v1.SpecialistPoolServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.SpecialistPoolService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = SpecialistPoolServiceRestTransport._SetIamPolicy._get_response( self._host, @@ -3363,6 +3845,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_set_iam_policy(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.aiplatform_v1.SpecialistPoolServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.SpecialistPoolService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3405,7 +3908,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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -3416,8 +3919,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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -3426,6 +3931,7 @@ def __call__( http_options = ( _BaseSpecialistPoolServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -3438,6 +3944,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.aiplatform_v1.SpecialistPoolServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.SpecialistPoolService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( SpecialistPoolServiceRestTransport._TestIamPermissions._get_response( @@ -3459,6 +3992,27 @@ def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_test_iam_permissions(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.aiplatform_v1.SpecialistPoolServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.SpecialistPoolService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3501,7 +4055,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 cancel operation method over HTTP. @@ -3512,13 +4066,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 = ( _BaseSpecialistPoolServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = self._interceptor.pre_cancel_operation( request, metadata ) @@ -3531,6 +4088,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.aiplatform_v1.SpecialistPoolServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.SpecialistPoolService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( SpecialistPoolServiceRestTransport._CancelOperation._get_response( @@ -3590,7 +4174,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. @@ -3601,13 +4185,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 = ( _BaseSpecialistPoolServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = self._interceptor.pre_delete_operation( request, metadata ) @@ -3620,6 +4207,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.aiplatform_v1.SpecialistPoolServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.SpecialistPoolService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( SpecialistPoolServiceRestTransport._DeleteOperation._get_response( @@ -3679,7 +4293,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. @@ -3690,8 +4304,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. @@ -3700,6 +4316,7 @@ def __call__( http_options = ( _BaseSpecialistPoolServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = self._interceptor.pre_get_operation(request, metadata) transcoded_request = _BaseSpecialistPoolServiceRestTransport._BaseGetOperation._get_transcoded_request( http_options, request @@ -3710,6 +4327,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.aiplatform_v1.SpecialistPoolServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.SpecialistPoolService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = SpecialistPoolServiceRestTransport._GetOperation._get_response( self._host, @@ -3729,6 +4373,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.aiplatform_v1.SpecialistPoolServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.SpecialistPoolService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3771,7 +4436,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. @@ -3782,8 +4447,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. @@ -3792,6 +4459,7 @@ def __call__( http_options = ( _BaseSpecialistPoolServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = self._interceptor.pre_list_operations(request, metadata) transcoded_request = _BaseSpecialistPoolServiceRestTransport._BaseListOperations._get_transcoded_request( http_options, request @@ -3802,6 +4470,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.aiplatform_v1.SpecialistPoolServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.SpecialistPoolService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = SpecialistPoolServiceRestTransport._ListOperations._get_response( self._host, @@ -3821,6 +4516,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.aiplatform_v1.SpecialistPoolServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.SpecialistPoolService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3863,7 +4579,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 wait operation method over HTTP. @@ -3874,8 +4590,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 WaitOperation method. @@ -3884,6 +4602,7 @@ def __call__( http_options = ( _BaseSpecialistPoolServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = self._interceptor.pre_wait_operation(request, metadata) transcoded_request = _BaseSpecialistPoolServiceRestTransport._BaseWaitOperation._get_transcoded_request( http_options, request @@ -3894,6 +4613,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.aiplatform_v1.SpecialistPoolServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.SpecialistPoolService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = SpecialistPoolServiceRestTransport._WaitOperation._get_response( self._host, @@ -3913,6 +4659,27 @@ def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = self._interceptor.post_wait_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.aiplatform_v1.SpecialistPoolServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.SpecialistPoolService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1/services/specialist_pool_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1/services/specialist_pool_service/transports/rest_asyncio.py index a1d66de2c7..64f0f6f352 100644 --- a/google/cloud/aiplatform_v1/services/specialist_pool_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1/services/specialist_pool_service/transports/rest_asyncio.py @@ -59,6 +59,18 @@ from .base import DEFAULT_CLIENT_INFO as BASE_DEFAULT_CLIENT_INFO + +import logging + +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__) + try: OptionalRetry = Union[retries.AsyncRetry, gapic_v1.method._MethodDefault, None] except AttributeError: # pragma: NO COVER @@ -135,9 +147,10 @@ async def post_update_specialist_pool(self, response): async def pre_create_specialist_pool( self, request: specialist_pool_service.CreateSpecialistPoolRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - specialist_pool_service.CreateSpecialistPoolRequest, Sequence[Tuple[str, str]] + specialist_pool_service.CreateSpecialistPoolRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for create_specialist_pool @@ -160,9 +173,10 @@ async def post_create_specialist_pool( async def pre_delete_specialist_pool( self, request: specialist_pool_service.DeleteSpecialistPoolRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - specialist_pool_service.DeleteSpecialistPoolRequest, Sequence[Tuple[str, str]] + specialist_pool_service.DeleteSpecialistPoolRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for delete_specialist_pool @@ -185,9 +199,10 @@ async def post_delete_specialist_pool( async def pre_get_specialist_pool( self, request: specialist_pool_service.GetSpecialistPoolRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - specialist_pool_service.GetSpecialistPoolRequest, Sequence[Tuple[str, str]] + specialist_pool_service.GetSpecialistPoolRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for get_specialist_pool @@ -210,9 +225,10 @@ async def post_get_specialist_pool( async def pre_list_specialist_pools( self, request: specialist_pool_service.ListSpecialistPoolsRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - specialist_pool_service.ListSpecialistPoolsRequest, Sequence[Tuple[str, str]] + specialist_pool_service.ListSpecialistPoolsRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for list_specialist_pools @@ -235,9 +251,10 @@ async def post_list_specialist_pools( async def pre_update_specialist_pool( self, request: specialist_pool_service.UpdateSpecialistPoolRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - specialist_pool_service.UpdateSpecialistPoolRequest, Sequence[Tuple[str, str]] + specialist_pool_service.UpdateSpecialistPoolRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for update_specialist_pool @@ -260,8 +277,10 @@ async def post_update_specialist_pool( async def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -283,8 +302,10 @@ async def post_get_location( async def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -306,8 +327,10 @@ async def post_list_locations( async def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -329,8 +352,10 @@ async def post_get_iam_policy( async def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -352,8 +377,11 @@ async def post_set_iam_policy( async def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -375,8 +403,10 @@ async def post_test_iam_permissions( async def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -396,8 +426,10 @@ async def post_cancel_operation(self, response: None) -> None: async 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 @@ -417,8 +449,10 @@ async def post_delete_operation(self, response: None) -> None: async 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 @@ -440,8 +474,10 @@ async def post_get_operation( async 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 @@ -463,8 +499,10 @@ async def post_list_operations( async def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -675,7 +713,7 @@ async 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 specialist pool method over HTTP. @@ -686,8 +724,10 @@ async def __call__( 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: @@ -700,6 +740,7 @@ async def __call__( http_options = ( _BaseSpecialistPoolServiceRestTransport._BaseCreateSpecialistPool._get_http_options() ) + request, metadata = await self._interceptor.pre_create_specialist_pool( request, metadata ) @@ -716,6 +757,33 @@ async 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.aiplatform_v1.SpecialistPoolServiceClient.CreateSpecialistPool", + extra={ + "serviceName": "google.cloud.aiplatform.v1.SpecialistPoolService", + "rpcName": "CreateSpecialistPool", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncSpecialistPoolServiceRestTransport._CreateSpecialistPool._get_response( self._host, @@ -744,6 +812,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_create_specialist_pool(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.SpecialistPoolServiceAsyncClient.create_specialist_pool", + extra={ + "serviceName": "google.cloud.aiplatform.v1.SpecialistPoolService", + "rpcName": "CreateSpecialistPool", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _DeleteSpecialistPool( @@ -782,7 +872,7 @@ async 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 specialist pool method over HTTP. @@ -793,8 +883,10 @@ async def __call__( 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: @@ -807,6 +899,7 @@ async def __call__( http_options = ( _BaseSpecialistPoolServiceRestTransport._BaseDeleteSpecialistPool._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_specialist_pool( request, metadata ) @@ -819,6 +912,33 @@ async 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.aiplatform_v1.SpecialistPoolServiceClient.DeleteSpecialistPool", + extra={ + "serviceName": "google.cloud.aiplatform.v1.SpecialistPoolService", + "rpcName": "DeleteSpecialistPool", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncSpecialistPoolServiceRestTransport._DeleteSpecialistPool._get_response( self._host, @@ -846,6 +966,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_delete_specialist_pool(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.SpecialistPoolServiceAsyncClient.delete_specialist_pool", + extra={ + "serviceName": "google.cloud.aiplatform.v1.SpecialistPoolService", + "rpcName": "DeleteSpecialistPool", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _GetSpecialistPool( @@ -884,7 +1026,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> specialist_pool.SpecialistPool: r"""Call the get specialist pool method over HTTP. @@ -895,8 +1037,10 @@ async def __call__( 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: ~.specialist_pool.SpecialistPool: @@ -918,6 +1062,7 @@ async def __call__( http_options = ( _BaseSpecialistPoolServiceRestTransport._BaseGetSpecialistPool._get_http_options() ) + request, metadata = await self._interceptor.pre_get_specialist_pool( request, metadata ) @@ -930,6 +1075,33 @@ async 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.aiplatform_v1.SpecialistPoolServiceClient.GetSpecialistPool", + extra={ + "serviceName": "google.cloud.aiplatform.v1.SpecialistPoolService", + "rpcName": "GetSpecialistPool", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncSpecialistPoolServiceRestTransport._GetSpecialistPool._get_response( self._host, @@ -957,6 +1129,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_get_specialist_pool(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = specialist_pool.SpecialistPool.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.SpecialistPoolServiceAsyncClient.get_specialist_pool", + extra={ + "serviceName": "google.cloud.aiplatform.v1.SpecialistPoolService", + "rpcName": "GetSpecialistPool", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ListSpecialistPools( @@ -995,7 +1189,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> specialist_pool_service.ListSpecialistPoolsResponse: r"""Call the list specialist pools method over HTTP. @@ -1006,8 +1200,10 @@ async def __call__( 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: ~.specialist_pool_service.ListSpecialistPoolsResponse: @@ -1019,6 +1215,7 @@ async def __call__( http_options = ( _BaseSpecialistPoolServiceRestTransport._BaseListSpecialistPools._get_http_options() ) + request, metadata = await self._interceptor.pre_list_specialist_pools( request, metadata ) @@ -1031,6 +1228,33 @@ async 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.aiplatform_v1.SpecialistPoolServiceClient.ListSpecialistPools", + extra={ + "serviceName": "google.cloud.aiplatform.v1.SpecialistPoolService", + "rpcName": "ListSpecialistPools", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncSpecialistPoolServiceRestTransport._ListSpecialistPools._get_response( self._host, @@ -1058,6 +1282,32 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_list_specialist_pools(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + specialist_pool_service.ListSpecialistPoolsResponse.to_json( + response + ) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.SpecialistPoolServiceAsyncClient.list_specialist_pools", + extra={ + "serviceName": "google.cloud.aiplatform.v1.SpecialistPoolService", + "rpcName": "ListSpecialistPools", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _UpdateSpecialistPool( @@ -1097,7 +1347,7 @@ async 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 specialist pool method over HTTP. @@ -1108,8 +1358,10 @@ async def __call__( 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: @@ -1122,6 +1374,7 @@ async def __call__( http_options = ( _BaseSpecialistPoolServiceRestTransport._BaseUpdateSpecialistPool._get_http_options() ) + request, metadata = await self._interceptor.pre_update_specialist_pool( request, metadata ) @@ -1138,6 +1391,33 @@ async 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.aiplatform_v1.SpecialistPoolServiceClient.UpdateSpecialistPool", + extra={ + "serviceName": "google.cloud.aiplatform.v1.SpecialistPoolService", + "rpcName": "UpdateSpecialistPool", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncSpecialistPoolServiceRestTransport._UpdateSpecialistPool._get_response( self._host, @@ -1166,6 +1446,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_update_specialist_pool(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.SpecialistPoolServiceAsyncClient.update_specialist_pool", + extra={ + "serviceName": "google.cloud.aiplatform.v1.SpecialistPoolService", + "rpcName": "UpdateSpecialistPool", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp @property @@ -3127,7 +3429,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -3138,8 +3440,10 @@ async def __call__( 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: locations_pb2.Location: Response from GetLocation method. @@ -3148,6 +3452,7 @@ async def __call__( http_options = ( _BaseSpecialistPoolServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_location( request, metadata ) @@ -3160,6 +3465,33 @@ async 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.aiplatform_v1.SpecialistPoolServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.SpecialistPoolService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncSpecialistPoolServiceRestTransport._GetLocation._get_response( self._host, @@ -3185,6 +3517,27 @@ async def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_location(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.aiplatform_v1.SpecialistPoolServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.SpecialistPoolService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3227,7 +3580,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -3238,8 +3591,10 @@ async def __call__( 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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -3248,6 +3603,7 @@ async def __call__( http_options = ( _BaseSpecialistPoolServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_locations( request, metadata ) @@ -3260,6 +3616,33 @@ async 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.aiplatform_v1.SpecialistPoolServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.SpecialistPoolService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncSpecialistPoolServiceRestTransport._ListLocations._get_response( self._host, @@ -3285,6 +3668,27 @@ async def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_list_locations(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.aiplatform_v1.SpecialistPoolServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.SpecialistPoolService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3327,7 +3731,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -3338,8 +3742,10 @@ async def __call__( 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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -3348,6 +3754,7 @@ async def __call__( http_options = ( _BaseSpecialistPoolServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_get_iam_policy( request, metadata ) @@ -3360,6 +3767,33 @@ async 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.aiplatform_v1.SpecialistPoolServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.SpecialistPoolService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncSpecialistPoolServiceRestTransport._GetIamPolicy._get_response( self._host, @@ -3385,6 +3819,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_iam_policy(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.aiplatform_v1.SpecialistPoolServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.SpecialistPoolService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3428,7 +3883,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -3439,8 +3894,10 @@ async def __call__( 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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -3449,6 +3906,7 @@ async def __call__( http_options = ( _BaseSpecialistPoolServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_set_iam_policy( request, metadata ) @@ -3465,6 +3923,33 @@ async 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.aiplatform_v1.SpecialistPoolServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.SpecialistPoolService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncSpecialistPoolServiceRestTransport._SetIamPolicy._get_response( self._host, @@ -3491,6 +3976,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_set_iam_policy(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.aiplatform_v1.SpecialistPoolServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.SpecialistPoolService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3533,7 +4039,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -3544,8 +4050,10 @@ async def __call__( 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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -3554,6 +4062,7 @@ async def __call__( http_options = ( _BaseSpecialistPoolServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = await self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -3566,6 +4075,33 @@ async 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.aiplatform_v1.SpecialistPoolServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.SpecialistPoolService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncSpecialistPoolServiceRestTransport._TestIamPermissions._get_response( self._host, @@ -3591,6 +4127,27 @@ async def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_test_iam_permissions(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.aiplatform_v1.SpecialistPoolServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.SpecialistPoolService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3633,7 +4190,7 @@ async 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 cancel operation method over HTTP. @@ -3644,13 +4201,16 @@ async def __call__( 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`. """ http_options = ( _BaseSpecialistPoolServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_cancel_operation( request, metadata ) @@ -3663,6 +4223,33 @@ async 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.aiplatform_v1.SpecialistPoolServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.SpecialistPoolService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncSpecialistPoolServiceRestTransport._CancelOperation._get_response( self._host, @@ -3726,7 +4313,7 @@ async 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. @@ -3737,13 +4324,16 @@ async def __call__( 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`. """ http_options = ( _BaseSpecialistPoolServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_operation( request, metadata ) @@ -3756,6 +4346,33 @@ async 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.aiplatform_v1.SpecialistPoolServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.SpecialistPoolService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncSpecialistPoolServiceRestTransport._DeleteOperation._get_response( self._host, @@ -3819,7 +4436,7 @@ async 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. @@ -3830,8 +4447,10 @@ async def __call__( 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: Response from GetOperation method. @@ -3840,6 +4459,7 @@ async def __call__( http_options = ( _BaseSpecialistPoolServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_operation( request, metadata ) @@ -3852,6 +4472,33 @@ async 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.aiplatform_v1.SpecialistPoolServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.SpecialistPoolService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncSpecialistPoolServiceRestTransport._GetOperation._get_response( self._host, @@ -3877,6 +4524,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1.SpecialistPoolServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.SpecialistPoolService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3919,7 +4587,7 @@ async 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. @@ -3930,8 +4598,10 @@ async def __call__( 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 from ListOperations method. @@ -3940,6 +4610,7 @@ async def __call__( http_options = ( _BaseSpecialistPoolServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_operations( request, metadata ) @@ -3952,6 +4623,33 @@ async 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.aiplatform_v1.SpecialistPoolServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.SpecialistPoolService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncSpecialistPoolServiceRestTransport._ListOperations._get_response( self._host, @@ -3977,6 +4675,27 @@ async def __call__( resp = operations_pb2.ListOperationsResponse() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1.SpecialistPoolServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.SpecialistPoolService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4019,7 +4738,7 @@ async 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 wait operation method over HTTP. @@ -4030,8 +4749,10 @@ async def __call__( 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: Response from WaitOperation method. @@ -4040,6 +4761,7 @@ async def __call__( http_options = ( _BaseSpecialistPoolServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_wait_operation( request, metadata ) @@ -4052,6 +4774,33 @@ async 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.aiplatform_v1.SpecialistPoolServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.SpecialistPoolService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncSpecialistPoolServiceRestTransport._WaitOperation._get_response( self._host, @@ -4077,6 +4826,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_wait_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.aiplatform_v1.SpecialistPoolServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.SpecialistPoolService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1/services/tensorboard_service/async_client.py b/google/cloud/aiplatform_v1/services/tensorboard_service/async_client.py index 64226e7caf..1428fab813 100644 --- a/google/cloud/aiplatform_v1/services/tensorboard_service/async_client.py +++ b/google/cloud/aiplatform_v1/services/tensorboard_service/async_client.py @@ -13,6 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging as std_logging from collections import OrderedDict import re from typing import ( @@ -75,6 +76,15 @@ from .transports.grpc_asyncio import TensorboardServiceGrpcAsyncIOTransport from .client import TensorboardServiceClient +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 TensorboardServiceAsyncClient: """TensorboardService""" @@ -302,6 +312,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.aiplatform_v1.TensorboardServiceAsyncClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "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.aiplatform.v1.TensorboardService", + "credentialsType": None, + }, + ) + async def create_tensorboard( self, request: Optional[ @@ -312,7 +344,7 @@ async def create_tensorboard( tensorboard: Optional[gca_tensorboard.Tensorboard] = 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"""Creates a Tensorboard. @@ -370,8 +402,10 @@ async def sample_create_tensorboard(): 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: @@ -448,7 +482,7 @@ async def get_tensorboard( 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]]] = (), ) -> tensorboard.Tensorboard: r"""Gets a Tensorboard. @@ -492,8 +526,10 @@ async def sample_get_tensorboard(): 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.aiplatform_v1.types.Tensorboard: @@ -561,7 +597,7 @@ async def update_tensorboard( 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"""Updates a Tensorboard. @@ -625,8 +661,10 @@ async def sample_update_tensorboard(): 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: @@ -705,7 +743,7 @@ async def list_tensorboards( 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.ListTensorboardsAsyncPager: r"""Lists Tensorboards in a Location. @@ -751,8 +789,10 @@ async def sample_list_tensorboards(): 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.aiplatform_v1.services.tensorboard_service.pagers.ListTensorboardsAsyncPager: @@ -829,7 +869,7 @@ async def delete_tensorboard( 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"""Deletes a Tensorboard. @@ -878,8 +918,10 @@ async def sample_delete_tensorboard(): 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: @@ -960,7 +1002,7 @@ async def read_tensorboard_usage( tensorboard: 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]]] = (), ) -> tensorboard_service.ReadTensorboardUsageResponse: r"""Returns a list of monthly active users for a given TensorBoard instance. @@ -1005,8 +1047,10 @@ async def sample_read_tensorboard_usage(): 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.aiplatform_v1.types.ReadTensorboardUsageResponse: @@ -1071,7 +1115,7 @@ async def read_tensorboard_size( tensorboard: 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]]] = (), ) -> tensorboard_service.ReadTensorboardSizeResponse: r"""Returns the storage size for a given TensorBoard instance. @@ -1116,8 +1160,10 @@ async def sample_read_tensorboard_size(): 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.aiplatform_v1.types.ReadTensorboardSizeResponse: @@ -1186,7 +1232,7 @@ async def create_tensorboard_experiment( tensorboard_experiment_id: 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]]] = (), ) -> gca_tensorboard_experiment.TensorboardExperiment: r"""Creates a TensorboardExperiment. @@ -1248,8 +1294,10 @@ async def sample_create_tensorboard_experiment(): 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.aiplatform_v1.types.TensorboardExperiment: @@ -1322,7 +1370,7 @@ async def get_tensorboard_experiment( 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]]] = (), ) -> tensorboard_experiment.TensorboardExperiment: r"""Gets a TensorboardExperiment. @@ -1367,8 +1415,10 @@ async def sample_get_tensorboard_experiment(): 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.aiplatform_v1.types.TensorboardExperiment: @@ -1436,7 +1486,7 @@ async def update_tensorboard_experiment( 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]]] = (), ) -> gca_tensorboard_experiment.TensorboardExperiment: r"""Updates a TensorboardExperiment. @@ -1493,8 +1543,10 @@ async def sample_update_tensorboard_experiment(): 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.aiplatform_v1.types.TensorboardExperiment: @@ -1565,7 +1617,7 @@ async def list_tensorboard_experiments( 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.ListTensorboardExperimentsAsyncPager: r"""Lists TensorboardExperiments in a Location. @@ -1611,8 +1663,10 @@ async def sample_list_tensorboard_experiments(): 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.aiplatform_v1.services.tensorboard_service.pagers.ListTensorboardExperimentsAsyncPager: @@ -1691,7 +1745,7 @@ async def delete_tensorboard_experiment( 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"""Deletes a TensorboardExperiment. @@ -1740,8 +1794,10 @@ async def sample_delete_tensorboard_experiment(): 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: @@ -1826,7 +1882,7 @@ async def create_tensorboard_run( tensorboard_run_id: 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]]] = (), ) -> gca_tensorboard_run.TensorboardRun: r"""Creates a TensorboardRun. @@ -1894,8 +1950,10 @@ async def sample_create_tensorboard_run(): 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.aiplatform_v1.types.TensorboardRun: @@ -1967,7 +2025,7 @@ async def batch_create_tensorboard_runs( ] = 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]]] = (), ) -> tensorboard_service.BatchCreateTensorboardRunsResponse: r"""Batch create TensorboardRuns. @@ -2030,8 +2088,10 @@ async def sample_batch_create_tensorboard_runs(): 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.aiplatform_v1.types.BatchCreateTensorboardRunsResponse: @@ -2098,7 +2158,7 @@ async def get_tensorboard_run( 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]]] = (), ) -> tensorboard_run.TensorboardRun: r"""Gets a TensorboardRun. @@ -2143,8 +2203,10 @@ async def sample_get_tensorboard_run(): 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.aiplatform_v1.types.TensorboardRun: @@ -2210,7 +2272,7 @@ async def update_tensorboard_run( 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]]] = (), ) -> gca_tensorboard_run.TensorboardRun: r"""Updates a TensorboardRun. @@ -2270,8 +2332,10 @@ async def sample_update_tensorboard_run(): 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.aiplatform_v1.types.TensorboardRun: @@ -2340,7 +2404,7 @@ async def list_tensorboard_runs( 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.ListTensorboardRunsAsyncPager: r"""Lists TensorboardRuns in a Location. @@ -2386,8 +2450,10 @@ async def sample_list_tensorboard_runs(): 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.aiplatform_v1.services.tensorboard_service.pagers.ListTensorboardRunsAsyncPager: @@ -2464,7 +2530,7 @@ async def delete_tensorboard_run( 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"""Deletes a TensorboardRun. @@ -2513,8 +2579,10 @@ async def sample_delete_tensorboard_run(): 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: @@ -2598,7 +2666,7 @@ async def batch_create_tensorboard_time_series( ] = 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]]] = (), ) -> tensorboard_service.BatchCreateTensorboardTimeSeriesResponse: r"""Batch create TensorboardTimeSeries that belong to a TensorboardExperiment. @@ -2663,8 +2731,10 @@ async def sample_batch_create_tensorboard_time_series(): 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.aiplatform_v1.types.BatchCreateTensorboardTimeSeriesResponse: @@ -2736,7 +2806,7 @@ async def create_tensorboard_time_series( ] = 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]]] = (), ) -> gca_tensorboard_time_series.TensorboardTimeSeries: r"""Creates a TensorboardTimeSeries. @@ -2793,8 +2863,10 @@ async def sample_create_tensorboard_time_series(): 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.aiplatform_v1.types.TensorboardTimeSeries: @@ -2861,7 +2933,7 @@ async def get_tensorboard_time_series( 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]]] = (), ) -> tensorboard_time_series.TensorboardTimeSeries: r"""Gets a TensorboardTimeSeries. @@ -2906,8 +2978,10 @@ async def sample_get_tensorboard_time_series(): 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.aiplatform_v1.types.TensorboardTimeSeries: @@ -2973,7 +3047,7 @@ async def update_tensorboard_time_series( 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]]] = (), ) -> gca_tensorboard_time_series.TensorboardTimeSeries: r"""Updates a TensorboardTimeSeries. @@ -3035,8 +3109,10 @@ async def sample_update_tensorboard_time_series(): 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.aiplatform_v1.types.TensorboardTimeSeries: @@ -3110,7 +3186,7 @@ async def list_tensorboard_time_series( 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.ListTensorboardTimeSeriesAsyncPager: r"""Lists TensorboardTimeSeries in a Location. @@ -3156,8 +3232,10 @@ async def sample_list_tensorboard_time_series(): 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.aiplatform_v1.services.tensorboard_service.pagers.ListTensorboardTimeSeriesAsyncPager: @@ -3236,7 +3314,7 @@ async def delete_tensorboard_time_series( 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"""Deletes a TensorboardTimeSeries. @@ -3285,8 +3363,10 @@ async def sample_delete_tensorboard_time_series(): 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: @@ -3369,7 +3449,7 @@ async def batch_read_tensorboard_time_series_data( tensorboard: 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]]] = (), ) -> tensorboard_service.BatchReadTensorboardTimeSeriesDataResponse: r"""Reads multiple TensorboardTimeSeries' data. The data point number limit is 1000 for scalars, 100 for tensors @@ -3424,8 +3504,10 @@ async def sample_batch_read_tensorboard_time_series_data(): 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.aiplatform_v1.types.BatchReadTensorboardTimeSeriesDataResponse: @@ -3494,7 +3576,7 @@ async def read_tensorboard_time_series_data( tensorboard_time_series: 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]]] = (), ) -> tensorboard_service.ReadTensorboardTimeSeriesDataResponse: r"""Reads a TensorboardTimeSeries' data. By default, if the number of data points stored is less than 1000, all data is returned. @@ -3543,8 +3625,10 @@ async def sample_read_tensorboard_time_series_data(): 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.aiplatform_v1.types.ReadTensorboardTimeSeriesDataResponse: @@ -3611,7 +3695,7 @@ def read_tensorboard_blob_data( time_series: 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]]] = (), ) -> Awaitable[AsyncIterable[tensorboard_service.ReadTensorboardBlobDataResponse]]: r"""Gets bytes of TensorboardBlobs. This is to allow reading blob data stored in consumer @@ -3660,8 +3744,10 @@ async def sample_read_tensorboard_blob_data(): 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: AsyncIterable[google.cloud.aiplatform_v1.types.ReadTensorboardBlobDataResponse]: @@ -3729,7 +3815,7 @@ async def write_tensorboard_experiment_data( ] = 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]]] = (), ) -> tensorboard_service.WriteTensorboardExperimentDataResponse: r"""Write time series data points of multiple TensorboardTimeSeries in multiple TensorboardRun's. If @@ -3789,8 +3875,10 @@ async def sample_write_tensorboard_experiment_data(): 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.aiplatform_v1.types.WriteTensorboardExperimentDataResponse: @@ -3862,7 +3950,7 @@ async def write_tensorboard_run_data( ] = 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]]] = (), ) -> tensorboard_service.WriteTensorboardRunDataResponse: r"""Write time series data points into multiple TensorboardTimeSeries under a TensorboardRun. If any @@ -3927,8 +4015,10 @@ async def sample_write_tensorboard_run_data(): 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.aiplatform_v1.types.WriteTensorboardRunDataResponse: @@ -3995,7 +4085,7 @@ async def export_tensorboard_time_series_data( tensorboard_time_series: 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.ExportTensorboardTimeSeriesDataAsyncPager: r"""Exports a TensorboardTimeSeries' data. Data is returned in paginated responses. @@ -4042,8 +4132,10 @@ async def sample_export_tensorboard_time_series_data(): 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.aiplatform_v1.services.tensorboard_service.pagers.ExportTensorboardTimeSeriesDataAsyncPager: @@ -4123,7 +4215,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. @@ -4134,8 +4226,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. @@ -4176,7 +4270,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. @@ -4187,8 +4281,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. @@ -4229,7 +4325,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. @@ -4245,8 +4341,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 """ @@ -4283,7 +4381,7 @@ async def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -4298,8 +4396,10 @@ async def cancel_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 """ @@ -4336,7 +4436,7 @@ async def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -4353,8 +4453,10 @@ async def wait_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. @@ -4395,7 +4497,7 @@ async def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -4408,8 +4510,10 @@ async def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -4514,7 +4618,7 @@ async def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -4528,8 +4632,10 @@ async def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -4634,7 +4740,7 @@ async def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -4649,8 +4755,10 @@ async def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -4694,7 +4802,7 @@ async def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -4705,8 +4813,10 @@ async def get_location( 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: ~.location_pb2.Location: Location object. @@ -4747,7 +4857,7 @@ async def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -4758,8 +4868,10 @@ async def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1/services/tensorboard_service/client.py b/google/cloud/aiplatform_v1/services/tensorboard_service/client.py index ae000b3b7c..f6a7ff5e06 100644 --- a/google/cloud/aiplatform_v1/services/tensorboard_service/client.py +++ b/google/cloud/aiplatform_v1/services/tensorboard_service/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 ( @@ -49,6 +50,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 as gac_operation # type: ignore from google.api_core import operation_async # type: ignore from google.cloud.aiplatform_v1.services.tensorboard_service import pagers @@ -700,6 +710,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( @@ -791,6 +805,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.aiplatform_v1.TensorboardServiceClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "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.aiplatform.v1.TensorboardService", + "credentialsType": None, + }, + ) + def create_tensorboard( self, request: Optional[ @@ -801,7 +838,7 @@ def create_tensorboard( tensorboard: Optional[gca_tensorboard.Tensorboard] = 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]]] = (), ) -> gac_operation.Operation: r"""Creates a Tensorboard. @@ -859,8 +896,10 @@ def sample_create_tensorboard(): 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: @@ -934,7 +973,7 @@ def get_tensorboard( 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]]] = (), ) -> tensorboard.Tensorboard: r"""Gets a Tensorboard. @@ -978,8 +1017,10 @@ def sample_get_tensorboard(): 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.aiplatform_v1.types.Tensorboard: @@ -1044,7 +1085,7 @@ def update_tensorboard( 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]]] = (), ) -> gac_operation.Operation: r"""Updates a Tensorboard. @@ -1108,8 +1149,10 @@ def sample_update_tensorboard(): 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: @@ -1185,7 +1228,7 @@ def list_tensorboards( 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.ListTensorboardsPager: r"""Lists Tensorboards in a Location. @@ -1231,8 +1274,10 @@ def sample_list_tensorboards(): 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.aiplatform_v1.services.tensorboard_service.pagers.ListTensorboardsPager: @@ -1306,7 +1351,7 @@ def delete_tensorboard( 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]]] = (), ) -> gac_operation.Operation: r"""Deletes a Tensorboard. @@ -1355,8 +1400,10 @@ def sample_delete_tensorboard(): 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: @@ -1434,7 +1481,7 @@ def read_tensorboard_usage( tensorboard: 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]]] = (), ) -> tensorboard_service.ReadTensorboardUsageResponse: r"""Returns a list of monthly active users for a given TensorBoard instance. @@ -1479,8 +1526,10 @@ def sample_read_tensorboard_usage(): 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.aiplatform_v1.types.ReadTensorboardUsageResponse: @@ -1542,7 +1591,7 @@ def read_tensorboard_size( tensorboard: 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]]] = (), ) -> tensorboard_service.ReadTensorboardSizeResponse: r"""Returns the storage size for a given TensorBoard instance. @@ -1587,8 +1636,10 @@ def sample_read_tensorboard_size(): 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.aiplatform_v1.types.ReadTensorboardSizeResponse: @@ -1654,7 +1705,7 @@ def create_tensorboard_experiment( tensorboard_experiment_id: 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]]] = (), ) -> gca_tensorboard_experiment.TensorboardExperiment: r"""Creates a TensorboardExperiment. @@ -1716,8 +1767,10 @@ def sample_create_tensorboard_experiment(): 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.aiplatform_v1.types.TensorboardExperiment: @@ -1789,7 +1842,7 @@ def get_tensorboard_experiment( 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]]] = (), ) -> tensorboard_experiment.TensorboardExperiment: r"""Gets a TensorboardExperiment. @@ -1834,8 +1887,10 @@ def sample_get_tensorboard_experiment(): 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.aiplatform_v1.types.TensorboardExperiment: @@ -1902,7 +1957,7 @@ def update_tensorboard_experiment( 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]]] = (), ) -> gca_tensorboard_experiment.TensorboardExperiment: r"""Updates a TensorboardExperiment. @@ -1959,8 +2014,10 @@ def sample_update_tensorboard_experiment(): 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.aiplatform_v1.types.TensorboardExperiment: @@ -2030,7 +2087,7 @@ def list_tensorboard_experiments( 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.ListTensorboardExperimentsPager: r"""Lists TensorboardExperiments in a Location. @@ -2076,8 +2133,10 @@ def sample_list_tensorboard_experiments(): 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.aiplatform_v1.services.tensorboard_service.pagers.ListTensorboardExperimentsPager: @@ -2155,7 +2214,7 @@ def delete_tensorboard_experiment( 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]]] = (), ) -> gac_operation.Operation: r"""Deletes a TensorboardExperiment. @@ -2204,8 +2263,10 @@ def sample_delete_tensorboard_experiment(): 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: @@ -2289,7 +2350,7 @@ def create_tensorboard_run( tensorboard_run_id: 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]]] = (), ) -> gca_tensorboard_run.TensorboardRun: r"""Creates a TensorboardRun. @@ -2357,8 +2418,10 @@ def sample_create_tensorboard_run(): 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.aiplatform_v1.types.TensorboardRun: @@ -2427,7 +2490,7 @@ def batch_create_tensorboard_runs( ] = 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]]] = (), ) -> tensorboard_service.BatchCreateTensorboardRunsResponse: r"""Batch create TensorboardRuns. @@ -2490,8 +2553,10 @@ def sample_batch_create_tensorboard_runs(): 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.aiplatform_v1.types.BatchCreateTensorboardRunsResponse: @@ -2557,7 +2622,7 @@ def get_tensorboard_run( 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]]] = (), ) -> tensorboard_run.TensorboardRun: r"""Gets a TensorboardRun. @@ -2602,8 +2667,10 @@ def sample_get_tensorboard_run(): 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.aiplatform_v1.types.TensorboardRun: @@ -2666,7 +2733,7 @@ def update_tensorboard_run( 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]]] = (), ) -> gca_tensorboard_run.TensorboardRun: r"""Updates a TensorboardRun. @@ -2726,8 +2793,10 @@ def sample_update_tensorboard_run(): 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.aiplatform_v1.types.TensorboardRun: @@ -2793,7 +2862,7 @@ def list_tensorboard_runs( 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.ListTensorboardRunsPager: r"""Lists TensorboardRuns in a Location. @@ -2839,8 +2908,10 @@ def sample_list_tensorboard_runs(): 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.aiplatform_v1.services.tensorboard_service.pagers.ListTensorboardRunsPager: @@ -2914,7 +2985,7 @@ def delete_tensorboard_run( 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]]] = (), ) -> gac_operation.Operation: r"""Deletes a TensorboardRun. @@ -2963,8 +3034,10 @@ def sample_delete_tensorboard_run(): 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: @@ -3045,7 +3118,7 @@ def batch_create_tensorboard_time_series( ] = 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]]] = (), ) -> tensorboard_service.BatchCreateTensorboardTimeSeriesResponse: r"""Batch create TensorboardTimeSeries that belong to a TensorboardExperiment. @@ -3110,8 +3183,10 @@ def sample_batch_create_tensorboard_time_series(): 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.aiplatform_v1.types.BatchCreateTensorboardTimeSeriesResponse: @@ -3182,7 +3257,7 @@ def create_tensorboard_time_series( ] = 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]]] = (), ) -> gca_tensorboard_time_series.TensorboardTimeSeries: r"""Creates a TensorboardTimeSeries. @@ -3239,8 +3314,10 @@ def sample_create_tensorboard_time_series(): 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.aiplatform_v1.types.TensorboardTimeSeries: @@ -3306,7 +3383,7 @@ def get_tensorboard_time_series( 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]]] = (), ) -> tensorboard_time_series.TensorboardTimeSeries: r"""Gets a TensorboardTimeSeries. @@ -3351,8 +3428,10 @@ def sample_get_tensorboard_time_series(): 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.aiplatform_v1.types.TensorboardTimeSeries: @@ -3417,7 +3496,7 @@ def update_tensorboard_time_series( 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]]] = (), ) -> gca_tensorboard_time_series.TensorboardTimeSeries: r"""Updates a TensorboardTimeSeries. @@ -3479,8 +3558,10 @@ def sample_update_tensorboard_time_series(): 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.aiplatform_v1.types.TensorboardTimeSeries: @@ -3553,7 +3634,7 @@ def list_tensorboard_time_series( 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.ListTensorboardTimeSeriesPager: r"""Lists TensorboardTimeSeries in a Location. @@ -3599,8 +3680,10 @@ def sample_list_tensorboard_time_series(): 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.aiplatform_v1.services.tensorboard_service.pagers.ListTensorboardTimeSeriesPager: @@ -3678,7 +3761,7 @@ def delete_tensorboard_time_series( 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]]] = (), ) -> gac_operation.Operation: r"""Deletes a TensorboardTimeSeries. @@ -3727,8 +3810,10 @@ def sample_delete_tensorboard_time_series(): 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: @@ -3810,7 +3895,7 @@ def batch_read_tensorboard_time_series_data( tensorboard: 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]]] = (), ) -> tensorboard_service.BatchReadTensorboardTimeSeriesDataResponse: r"""Reads multiple TensorboardTimeSeries' data. The data point number limit is 1000 for scalars, 100 for tensors @@ -3865,8 +3950,10 @@ def sample_batch_read_tensorboard_time_series_data(): 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.aiplatform_v1.types.BatchReadTensorboardTimeSeriesDataResponse: @@ -3934,7 +4021,7 @@ def read_tensorboard_time_series_data( tensorboard_time_series: 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]]] = (), ) -> tensorboard_service.ReadTensorboardTimeSeriesDataResponse: r"""Reads a TensorboardTimeSeries' data. By default, if the number of data points stored is less than 1000, all data is returned. @@ -3983,8 +4070,10 @@ def sample_read_tensorboard_time_series_data(): 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.aiplatform_v1.types.ReadTensorboardTimeSeriesDataResponse: @@ -4050,7 +4139,7 @@ def read_tensorboard_blob_data( time_series: 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]]] = (), ) -> Iterable[tensorboard_service.ReadTensorboardBlobDataResponse]: r"""Gets bytes of TensorboardBlobs. This is to allow reading blob data stored in consumer @@ -4099,8 +4188,10 @@ def sample_read_tensorboard_blob_data(): 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: Iterable[google.cloud.aiplatform_v1.types.ReadTensorboardBlobDataResponse]: @@ -4167,7 +4258,7 @@ def write_tensorboard_experiment_data( ] = 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]]] = (), ) -> tensorboard_service.WriteTensorboardExperimentDataResponse: r"""Write time series data points of multiple TensorboardTimeSeries in multiple TensorboardRun's. If @@ -4227,8 +4318,10 @@ def sample_write_tensorboard_experiment_data(): 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.aiplatform_v1.types.WriteTensorboardExperimentDataResponse: @@ -4299,7 +4392,7 @@ def write_tensorboard_run_data( ] = 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]]] = (), ) -> tensorboard_service.WriteTensorboardRunDataResponse: r"""Write time series data points into multiple TensorboardTimeSeries under a TensorboardRun. If any @@ -4364,8 +4457,10 @@ def sample_write_tensorboard_run_data(): 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.aiplatform_v1.types.WriteTensorboardRunDataResponse: @@ -4431,7 +4526,7 @@ def export_tensorboard_time_series_data( tensorboard_time_series: 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.ExportTensorboardTimeSeriesDataPager: r"""Exports a TensorboardTimeSeries' data. Data is returned in paginated responses. @@ -4478,8 +4573,10 @@ def sample_export_tensorboard_time_series_data(): 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.aiplatform_v1.services.tensorboard_service.pagers.ExportTensorboardTimeSeriesDataPager: @@ -4571,7 +4668,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. @@ -4582,8 +4679,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. @@ -4624,7 +4723,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. @@ -4635,8 +4734,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. @@ -4677,7 +4778,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. @@ -4693,8 +4794,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 """ @@ -4731,7 +4834,7 @@ def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -4746,8 +4849,10 @@ def cancel_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 """ @@ -4784,7 +4889,7 @@ def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -4801,8 +4906,10 @@ def wait_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. @@ -4843,7 +4950,7 @@ def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -4856,8 +4963,10 @@ def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -4962,7 +5071,7 @@ def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -4976,8 +5085,10 @@ def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -5082,7 +5193,7 @@ def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -5097,8 +5208,10 @@ def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -5140,7 +5253,7 @@ def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -5151,8 +5264,10 @@ def get_location( 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: ~.location_pb2.Location: Location object. @@ -5193,7 +5308,7 @@ def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -5204,8 +5319,10 @@ def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1/services/tensorboard_service/pagers.py b/google/cloud/aiplatform_v1/services/tensorboard_service/pagers.py index 5e59dd121e..b920ccad08 100644 --- a/google/cloud/aiplatform_v1/services/tensorboard_service/pagers.py +++ b/google/cloud/aiplatform_v1/services/tensorboard_service/pagers.py @@ -71,7 +71,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. @@ -85,8 +85,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 = tensorboard_service.ListTensorboardsRequest(request) @@ -145,7 +147,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. @@ -159,8 +161,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 = tensorboard_service.ListTensorboardsRequest(request) @@ -225,7 +229,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. @@ -239,8 +243,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 = tensorboard_service.ListTensorboardExperimentsRequest(request) @@ -301,7 +307,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. @@ -315,8 +321,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 = tensorboard_service.ListTensorboardExperimentsRequest(request) @@ -381,7 +389,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. @@ -395,8 +403,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 = tensorboard_service.ListTensorboardRunsRequest(request) @@ -457,7 +467,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. @@ -471,8 +481,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 = tensorboard_service.ListTensorboardRunsRequest(request) @@ -537,7 +549,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. @@ -551,8 +563,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 = tensorboard_service.ListTensorboardTimeSeriesRequest(request) @@ -613,7 +627,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. @@ -627,8 +641,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 = tensorboard_service.ListTensorboardTimeSeriesRequest(request) @@ -695,7 +711,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. @@ -709,8 +725,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 = tensorboard_service.ExportTensorboardTimeSeriesDataRequest( @@ -775,7 +793,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. @@ -789,8 +807,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 = tensorboard_service.ExportTensorboardTimeSeriesDataRequest( diff --git a/google/cloud/aiplatform_v1/services/tensorboard_service/transports/grpc.py b/google/cloud/aiplatform_v1/services/tensorboard_service/transports/grpc.py index d75badd395..dd583f0ea2 100644 --- a/google/cloud/aiplatform_v1/services/tensorboard_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1/services/tensorboard_service/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 import warnings from typing import Callable, Dict, Optional, Sequence, Tuple, Union @@ -22,8 +25,11 @@ import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from google.cloud.aiplatform_v1.types import tensorboard from google.cloud.aiplatform_v1.types import tensorboard_experiment @@ -43,6 +49,81 @@ from google.longrunning import operations_pb2 # type: ignore from .base import TensorboardServiceTransport, DEFAULT_CLIENT_INFO +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.aiplatform.v1.TensorboardService", + "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.aiplatform.v1.TensorboardService", + "rpcName": client_call_details.method, + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class TensorboardServiceGrpcTransport(TensorboardServiceTransport): """gRPC backend transport for TensorboardService. @@ -197,7 +278,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 @@ -261,7 +347,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 @@ -287,7 +375,7 @@ def create_tensorboard( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_tensorboard" not in self._stubs: - self._stubs["create_tensorboard"] = self.grpc_channel.unary_unary( + self._stubs["create_tensorboard"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.TensorboardService/CreateTensorboard", request_serializer=tensorboard_service.CreateTensorboardRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -313,7 +401,7 @@ def get_tensorboard( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_tensorboard" not in self._stubs: - self._stubs["get_tensorboard"] = self.grpc_channel.unary_unary( + self._stubs["get_tensorboard"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.TensorboardService/GetTensorboard", request_serializer=tensorboard_service.GetTensorboardRequest.serialize, response_deserializer=tensorboard.Tensorboard.deserialize, @@ -341,7 +429,7 @@ def update_tensorboard( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_tensorboard" not in self._stubs: - self._stubs["update_tensorboard"] = self.grpc_channel.unary_unary( + self._stubs["update_tensorboard"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.TensorboardService/UpdateTensorboard", request_serializer=tensorboard_service.UpdateTensorboardRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -370,7 +458,7 @@ def list_tensorboards( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_tensorboards" not in self._stubs: - self._stubs["list_tensorboards"] = self.grpc_channel.unary_unary( + self._stubs["list_tensorboards"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.TensorboardService/ListTensorboards", request_serializer=tensorboard_service.ListTensorboardsRequest.serialize, response_deserializer=tensorboard_service.ListTensorboardsResponse.deserialize, @@ -398,7 +486,7 @@ def delete_tensorboard( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_tensorboard" not in self._stubs: - self._stubs["delete_tensorboard"] = self.grpc_channel.unary_unary( + self._stubs["delete_tensorboard"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.TensorboardService/DeleteTensorboard", request_serializer=tensorboard_service.DeleteTensorboardRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -428,7 +516,7 @@ def read_tensorboard_usage( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "read_tensorboard_usage" not in self._stubs: - self._stubs["read_tensorboard_usage"] = self.grpc_channel.unary_unary( + self._stubs["read_tensorboard_usage"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.TensorboardService/ReadTensorboardUsage", request_serializer=tensorboard_service.ReadTensorboardUsageRequest.serialize, response_deserializer=tensorboard_service.ReadTensorboardUsageResponse.deserialize, @@ -458,7 +546,7 @@ def read_tensorboard_size( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "read_tensorboard_size" not in self._stubs: - self._stubs["read_tensorboard_size"] = self.grpc_channel.unary_unary( + self._stubs["read_tensorboard_size"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.TensorboardService/ReadTensorboardSize", request_serializer=tensorboard_service.ReadTensorboardSizeRequest.serialize, response_deserializer=tensorboard_service.ReadTensorboardSizeResponse.deserialize, @@ -489,7 +577,7 @@ def create_tensorboard_experiment( if "create_tensorboard_experiment" not in self._stubs: self._stubs[ "create_tensorboard_experiment" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.TensorboardService/CreateTensorboardExperiment", request_serializer=tensorboard_service.CreateTensorboardExperimentRequest.serialize, response_deserializer=gca_tensorboard_experiment.TensorboardExperiment.deserialize, @@ -518,7 +606,9 @@ def get_tensorboard_experiment( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_tensorboard_experiment" not in self._stubs: - self._stubs["get_tensorboard_experiment"] = self.grpc_channel.unary_unary( + self._stubs[ + "get_tensorboard_experiment" + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.TensorboardService/GetTensorboardExperiment", request_serializer=tensorboard_service.GetTensorboardExperimentRequest.serialize, response_deserializer=tensorboard_experiment.TensorboardExperiment.deserialize, @@ -549,7 +639,7 @@ def update_tensorboard_experiment( if "update_tensorboard_experiment" not in self._stubs: self._stubs[ "update_tensorboard_experiment" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.TensorboardService/UpdateTensorboardExperiment", request_serializer=tensorboard_service.UpdateTensorboardExperimentRequest.serialize, response_deserializer=gca_tensorboard_experiment.TensorboardExperiment.deserialize, @@ -578,7 +668,9 @@ def list_tensorboard_experiments( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_tensorboard_experiments" not in self._stubs: - self._stubs["list_tensorboard_experiments"] = self.grpc_channel.unary_unary( + self._stubs[ + "list_tensorboard_experiments" + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.TensorboardService/ListTensorboardExperiments", request_serializer=tensorboard_service.ListTensorboardExperimentsRequest.serialize, response_deserializer=tensorboard_service.ListTensorboardExperimentsResponse.deserialize, @@ -609,7 +701,7 @@ def delete_tensorboard_experiment( if "delete_tensorboard_experiment" not in self._stubs: self._stubs[ "delete_tensorboard_experiment" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.TensorboardService/DeleteTensorboardExperiment", request_serializer=tensorboard_service.DeleteTensorboardExperimentRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -638,7 +730,7 @@ def create_tensorboard_run( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_tensorboard_run" not in self._stubs: - self._stubs["create_tensorboard_run"] = self.grpc_channel.unary_unary( + self._stubs["create_tensorboard_run"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.TensorboardService/CreateTensorboardRun", request_serializer=tensorboard_service.CreateTensorboardRunRequest.serialize, response_deserializer=gca_tensorboard_run.TensorboardRun.deserialize, @@ -669,7 +761,7 @@ def batch_create_tensorboard_runs( if "batch_create_tensorboard_runs" not in self._stubs: self._stubs[ "batch_create_tensorboard_runs" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.TensorboardService/BatchCreateTensorboardRuns", request_serializer=tensorboard_service.BatchCreateTensorboardRunsRequest.serialize, response_deserializer=tensorboard_service.BatchCreateTensorboardRunsResponse.deserialize, @@ -697,7 +789,7 @@ def get_tensorboard_run( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_tensorboard_run" not in self._stubs: - self._stubs["get_tensorboard_run"] = self.grpc_channel.unary_unary( + self._stubs["get_tensorboard_run"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.TensorboardService/GetTensorboardRun", request_serializer=tensorboard_service.GetTensorboardRunRequest.serialize, response_deserializer=tensorboard_run.TensorboardRun.deserialize, @@ -726,7 +818,7 @@ def update_tensorboard_run( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_tensorboard_run" not in self._stubs: - self._stubs["update_tensorboard_run"] = self.grpc_channel.unary_unary( + self._stubs["update_tensorboard_run"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.TensorboardService/UpdateTensorboardRun", request_serializer=tensorboard_service.UpdateTensorboardRunRequest.serialize, response_deserializer=gca_tensorboard_run.TensorboardRun.deserialize, @@ -755,7 +847,7 @@ def list_tensorboard_runs( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_tensorboard_runs" not in self._stubs: - self._stubs["list_tensorboard_runs"] = self.grpc_channel.unary_unary( + self._stubs["list_tensorboard_runs"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.TensorboardService/ListTensorboardRuns", request_serializer=tensorboard_service.ListTensorboardRunsRequest.serialize, response_deserializer=tensorboard_service.ListTensorboardRunsResponse.deserialize, @@ -783,7 +875,7 @@ def delete_tensorboard_run( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_tensorboard_run" not in self._stubs: - self._stubs["delete_tensorboard_run"] = self.grpc_channel.unary_unary( + self._stubs["delete_tensorboard_run"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.TensorboardService/DeleteTensorboardRun", request_serializer=tensorboard_service.DeleteTensorboardRunRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -816,7 +908,7 @@ def batch_create_tensorboard_time_series( if "batch_create_tensorboard_time_series" not in self._stubs: self._stubs[ "batch_create_tensorboard_time_series" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.TensorboardService/BatchCreateTensorboardTimeSeries", request_serializer=tensorboard_service.BatchCreateTensorboardTimeSeriesRequest.serialize, response_deserializer=tensorboard_service.BatchCreateTensorboardTimeSeriesResponse.deserialize, @@ -847,7 +939,7 @@ def create_tensorboard_time_series( if "create_tensorboard_time_series" not in self._stubs: self._stubs[ "create_tensorboard_time_series" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.TensorboardService/CreateTensorboardTimeSeries", request_serializer=tensorboard_service.CreateTensorboardTimeSeriesRequest.serialize, response_deserializer=gca_tensorboard_time_series.TensorboardTimeSeries.deserialize, @@ -876,7 +968,9 @@ def get_tensorboard_time_series( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_tensorboard_time_series" not in self._stubs: - self._stubs["get_tensorboard_time_series"] = self.grpc_channel.unary_unary( + self._stubs[ + "get_tensorboard_time_series" + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.TensorboardService/GetTensorboardTimeSeries", request_serializer=tensorboard_service.GetTensorboardTimeSeriesRequest.serialize, response_deserializer=tensorboard_time_series.TensorboardTimeSeries.deserialize, @@ -907,7 +1001,7 @@ def update_tensorboard_time_series( if "update_tensorboard_time_series" not in self._stubs: self._stubs[ "update_tensorboard_time_series" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.TensorboardService/UpdateTensorboardTimeSeries", request_serializer=tensorboard_service.UpdateTensorboardTimeSeriesRequest.serialize, response_deserializer=gca_tensorboard_time_series.TensorboardTimeSeries.deserialize, @@ -936,7 +1030,9 @@ def list_tensorboard_time_series( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_tensorboard_time_series" not in self._stubs: - self._stubs["list_tensorboard_time_series"] = self.grpc_channel.unary_unary( + self._stubs[ + "list_tensorboard_time_series" + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.TensorboardService/ListTensorboardTimeSeries", request_serializer=tensorboard_service.ListTensorboardTimeSeriesRequest.serialize, response_deserializer=tensorboard_service.ListTensorboardTimeSeriesResponse.deserialize, @@ -967,7 +1063,7 @@ def delete_tensorboard_time_series( if "delete_tensorboard_time_series" not in self._stubs: self._stubs[ "delete_tensorboard_time_series" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.TensorboardService/DeleteTensorboardTimeSeries", request_serializer=tensorboard_service.DeleteTensorboardTimeSeriesRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -1004,7 +1100,7 @@ def batch_read_tensorboard_time_series_data( if "batch_read_tensorboard_time_series_data" not in self._stubs: self._stubs[ "batch_read_tensorboard_time_series_data" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.TensorboardService/BatchReadTensorboardTimeSeriesData", request_serializer=tensorboard_service.BatchReadTensorboardTimeSeriesDataRequest.serialize, response_deserializer=tensorboard_service.BatchReadTensorboardTimeSeriesDataResponse.deserialize, @@ -1040,7 +1136,7 @@ def read_tensorboard_time_series_data( if "read_tensorboard_time_series_data" not in self._stubs: self._stubs[ "read_tensorboard_time_series_data" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.TensorboardService/ReadTensorboardTimeSeriesData", request_serializer=tensorboard_service.ReadTensorboardTimeSeriesDataRequest.serialize, response_deserializer=tensorboard_service.ReadTensorboardTimeSeriesDataResponse.deserialize, @@ -1072,7 +1168,9 @@ def read_tensorboard_blob_data( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "read_tensorboard_blob_data" not in self._stubs: - self._stubs["read_tensorboard_blob_data"] = self.grpc_channel.unary_stream( + self._stubs[ + "read_tensorboard_blob_data" + ] = self._logged_channel.unary_stream( "/google.cloud.aiplatform.v1.TensorboardService/ReadTensorboardBlobData", request_serializer=tensorboard_service.ReadTensorboardBlobDataRequest.serialize, response_deserializer=tensorboard_service.ReadTensorboardBlobDataResponse.deserialize, @@ -1106,7 +1204,7 @@ def write_tensorboard_experiment_data( if "write_tensorboard_experiment_data" not in self._stubs: self._stubs[ "write_tensorboard_experiment_data" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.TensorboardService/WriteTensorboardExperimentData", request_serializer=tensorboard_service.WriteTensorboardExperimentDataRequest.serialize, response_deserializer=tensorboard_service.WriteTensorboardExperimentDataResponse.deserialize, @@ -1137,7 +1235,9 @@ def write_tensorboard_run_data( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "write_tensorboard_run_data" not in self._stubs: - self._stubs["write_tensorboard_run_data"] = self.grpc_channel.unary_unary( + self._stubs[ + "write_tensorboard_run_data" + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.TensorboardService/WriteTensorboardRunData", request_serializer=tensorboard_service.WriteTensorboardRunDataRequest.serialize, response_deserializer=tensorboard_service.WriteTensorboardRunDataResponse.deserialize, @@ -1170,7 +1270,7 @@ def export_tensorboard_time_series_data( if "export_tensorboard_time_series_data" not in self._stubs: self._stubs[ "export_tensorboard_time_series_data" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.TensorboardService/ExportTensorboardTimeSeriesData", request_serializer=tensorboard_service.ExportTensorboardTimeSeriesDataRequest.serialize, response_deserializer=tensorboard_service.ExportTensorboardTimeSeriesDataResponse.deserialize, @@ -1178,7 +1278,7 @@ def export_tensorboard_time_series_data( return self._stubs["export_tensorboard_time_series_data"] def close(self): - self.grpc_channel.close() + self._logged_channel.close() @property def delete_operation( @@ -1190,7 +1290,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, @@ -1207,7 +1307,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -1224,7 +1324,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -1241,7 +1341,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, @@ -1260,7 +1360,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, @@ -1279,7 +1379,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -1296,7 +1396,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -1321,7 +1421,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -1347,7 +1447,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -1376,7 +1476,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1/services/tensorboard_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1/services/tensorboard_service/transports/grpc_asyncio.py index 342bd68656..0edf7139c6 100644 --- a/google/cloud/aiplatform_v1/services/tensorboard_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1/services/tensorboard_service/transports/grpc_asyncio.py @@ -14,6 +14,9 @@ # limitations under the License. # import inspect +import json +import pickle +import logging as std_logging import warnings from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union @@ -24,8 +27,11 @@ from google.api_core import operations_v1 from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from grpc.experimental import aio # type: ignore from google.cloud.aiplatform_v1.types import tensorboard @@ -47,6 +53,82 @@ from .base import TensorboardServiceTransport, DEFAULT_CLIENT_INFO from .grpc import TensorboardServiceGrpcTransport +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.aiplatform.v1.TensorboardService", + "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.aiplatform.v1.TensorboardService", + "rpcName": str(client_call_details.method), + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class TensorboardServiceGrpcAsyncIOTransport(TensorboardServiceTransport): """gRPC AsyncIO backend transport for TensorboardService. @@ -244,10 +326,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 @@ -270,7 +355,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. @@ -298,7 +383,7 @@ def create_tensorboard( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_tensorboard" not in self._stubs: - self._stubs["create_tensorboard"] = self.grpc_channel.unary_unary( + self._stubs["create_tensorboard"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.TensorboardService/CreateTensorboard", request_serializer=tensorboard_service.CreateTensorboardRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -326,7 +411,7 @@ def get_tensorboard( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_tensorboard" not in self._stubs: - self._stubs["get_tensorboard"] = self.grpc_channel.unary_unary( + self._stubs["get_tensorboard"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.TensorboardService/GetTensorboard", request_serializer=tensorboard_service.GetTensorboardRequest.serialize, response_deserializer=tensorboard.Tensorboard.deserialize, @@ -355,7 +440,7 @@ def update_tensorboard( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_tensorboard" not in self._stubs: - self._stubs["update_tensorboard"] = self.grpc_channel.unary_unary( + self._stubs["update_tensorboard"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.TensorboardService/UpdateTensorboard", request_serializer=tensorboard_service.UpdateTensorboardRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -384,7 +469,7 @@ def list_tensorboards( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_tensorboards" not in self._stubs: - self._stubs["list_tensorboards"] = self.grpc_channel.unary_unary( + self._stubs["list_tensorboards"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.TensorboardService/ListTensorboards", request_serializer=tensorboard_service.ListTensorboardsRequest.serialize, response_deserializer=tensorboard_service.ListTensorboardsResponse.deserialize, @@ -413,7 +498,7 @@ def delete_tensorboard( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_tensorboard" not in self._stubs: - self._stubs["delete_tensorboard"] = self.grpc_channel.unary_unary( + self._stubs["delete_tensorboard"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.TensorboardService/DeleteTensorboard", request_serializer=tensorboard_service.DeleteTensorboardRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -443,7 +528,7 @@ def read_tensorboard_usage( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "read_tensorboard_usage" not in self._stubs: - self._stubs["read_tensorboard_usage"] = self.grpc_channel.unary_unary( + self._stubs["read_tensorboard_usage"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.TensorboardService/ReadTensorboardUsage", request_serializer=tensorboard_service.ReadTensorboardUsageRequest.serialize, response_deserializer=tensorboard_service.ReadTensorboardUsageResponse.deserialize, @@ -473,7 +558,7 @@ def read_tensorboard_size( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "read_tensorboard_size" not in self._stubs: - self._stubs["read_tensorboard_size"] = self.grpc_channel.unary_unary( + self._stubs["read_tensorboard_size"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.TensorboardService/ReadTensorboardSize", request_serializer=tensorboard_service.ReadTensorboardSizeRequest.serialize, response_deserializer=tensorboard_service.ReadTensorboardSizeResponse.deserialize, @@ -504,7 +589,7 @@ def create_tensorboard_experiment( if "create_tensorboard_experiment" not in self._stubs: self._stubs[ "create_tensorboard_experiment" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.TensorboardService/CreateTensorboardExperiment", request_serializer=tensorboard_service.CreateTensorboardExperimentRequest.serialize, response_deserializer=gca_tensorboard_experiment.TensorboardExperiment.deserialize, @@ -533,7 +618,9 @@ def get_tensorboard_experiment( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_tensorboard_experiment" not in self._stubs: - self._stubs["get_tensorboard_experiment"] = self.grpc_channel.unary_unary( + self._stubs[ + "get_tensorboard_experiment" + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.TensorboardService/GetTensorboardExperiment", request_serializer=tensorboard_service.GetTensorboardExperimentRequest.serialize, response_deserializer=tensorboard_experiment.TensorboardExperiment.deserialize, @@ -564,7 +651,7 @@ def update_tensorboard_experiment( if "update_tensorboard_experiment" not in self._stubs: self._stubs[ "update_tensorboard_experiment" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.TensorboardService/UpdateTensorboardExperiment", request_serializer=tensorboard_service.UpdateTensorboardExperimentRequest.serialize, response_deserializer=gca_tensorboard_experiment.TensorboardExperiment.deserialize, @@ -593,7 +680,9 @@ def list_tensorboard_experiments( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_tensorboard_experiments" not in self._stubs: - self._stubs["list_tensorboard_experiments"] = self.grpc_channel.unary_unary( + self._stubs[ + "list_tensorboard_experiments" + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.TensorboardService/ListTensorboardExperiments", request_serializer=tensorboard_service.ListTensorboardExperimentsRequest.serialize, response_deserializer=tensorboard_service.ListTensorboardExperimentsResponse.deserialize, @@ -624,7 +713,7 @@ def delete_tensorboard_experiment( if "delete_tensorboard_experiment" not in self._stubs: self._stubs[ "delete_tensorboard_experiment" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.TensorboardService/DeleteTensorboardExperiment", request_serializer=tensorboard_service.DeleteTensorboardExperimentRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -653,7 +742,7 @@ def create_tensorboard_run( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_tensorboard_run" not in self._stubs: - self._stubs["create_tensorboard_run"] = self.grpc_channel.unary_unary( + self._stubs["create_tensorboard_run"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.TensorboardService/CreateTensorboardRun", request_serializer=tensorboard_service.CreateTensorboardRunRequest.serialize, response_deserializer=gca_tensorboard_run.TensorboardRun.deserialize, @@ -684,7 +773,7 @@ def batch_create_tensorboard_runs( if "batch_create_tensorboard_runs" not in self._stubs: self._stubs[ "batch_create_tensorboard_runs" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.TensorboardService/BatchCreateTensorboardRuns", request_serializer=tensorboard_service.BatchCreateTensorboardRunsRequest.serialize, response_deserializer=tensorboard_service.BatchCreateTensorboardRunsResponse.deserialize, @@ -713,7 +802,7 @@ def get_tensorboard_run( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_tensorboard_run" not in self._stubs: - self._stubs["get_tensorboard_run"] = self.grpc_channel.unary_unary( + self._stubs["get_tensorboard_run"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.TensorboardService/GetTensorboardRun", request_serializer=tensorboard_service.GetTensorboardRunRequest.serialize, response_deserializer=tensorboard_run.TensorboardRun.deserialize, @@ -742,7 +831,7 @@ def update_tensorboard_run( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_tensorboard_run" not in self._stubs: - self._stubs["update_tensorboard_run"] = self.grpc_channel.unary_unary( + self._stubs["update_tensorboard_run"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.TensorboardService/UpdateTensorboardRun", request_serializer=tensorboard_service.UpdateTensorboardRunRequest.serialize, response_deserializer=gca_tensorboard_run.TensorboardRun.deserialize, @@ -771,7 +860,7 @@ def list_tensorboard_runs( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_tensorboard_runs" not in self._stubs: - self._stubs["list_tensorboard_runs"] = self.grpc_channel.unary_unary( + self._stubs["list_tensorboard_runs"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.TensorboardService/ListTensorboardRuns", request_serializer=tensorboard_service.ListTensorboardRunsRequest.serialize, response_deserializer=tensorboard_service.ListTensorboardRunsResponse.deserialize, @@ -800,7 +889,7 @@ def delete_tensorboard_run( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_tensorboard_run" not in self._stubs: - self._stubs["delete_tensorboard_run"] = self.grpc_channel.unary_unary( + self._stubs["delete_tensorboard_run"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.TensorboardService/DeleteTensorboardRun", request_serializer=tensorboard_service.DeleteTensorboardRunRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -833,7 +922,7 @@ def batch_create_tensorboard_time_series( if "batch_create_tensorboard_time_series" not in self._stubs: self._stubs[ "batch_create_tensorboard_time_series" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.TensorboardService/BatchCreateTensorboardTimeSeries", request_serializer=tensorboard_service.BatchCreateTensorboardTimeSeriesRequest.serialize, response_deserializer=tensorboard_service.BatchCreateTensorboardTimeSeriesResponse.deserialize, @@ -864,7 +953,7 @@ def create_tensorboard_time_series( if "create_tensorboard_time_series" not in self._stubs: self._stubs[ "create_tensorboard_time_series" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.TensorboardService/CreateTensorboardTimeSeries", request_serializer=tensorboard_service.CreateTensorboardTimeSeriesRequest.serialize, response_deserializer=gca_tensorboard_time_series.TensorboardTimeSeries.deserialize, @@ -893,7 +982,9 @@ def get_tensorboard_time_series( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_tensorboard_time_series" not in self._stubs: - self._stubs["get_tensorboard_time_series"] = self.grpc_channel.unary_unary( + self._stubs[ + "get_tensorboard_time_series" + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.TensorboardService/GetTensorboardTimeSeries", request_serializer=tensorboard_service.GetTensorboardTimeSeriesRequest.serialize, response_deserializer=tensorboard_time_series.TensorboardTimeSeries.deserialize, @@ -924,7 +1015,7 @@ def update_tensorboard_time_series( if "update_tensorboard_time_series" not in self._stubs: self._stubs[ "update_tensorboard_time_series" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.TensorboardService/UpdateTensorboardTimeSeries", request_serializer=tensorboard_service.UpdateTensorboardTimeSeriesRequest.serialize, response_deserializer=gca_tensorboard_time_series.TensorboardTimeSeries.deserialize, @@ -953,7 +1044,9 @@ def list_tensorboard_time_series( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_tensorboard_time_series" not in self._stubs: - self._stubs["list_tensorboard_time_series"] = self.grpc_channel.unary_unary( + self._stubs[ + "list_tensorboard_time_series" + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.TensorboardService/ListTensorboardTimeSeries", request_serializer=tensorboard_service.ListTensorboardTimeSeriesRequest.serialize, response_deserializer=tensorboard_service.ListTensorboardTimeSeriesResponse.deserialize, @@ -984,7 +1077,7 @@ def delete_tensorboard_time_series( if "delete_tensorboard_time_series" not in self._stubs: self._stubs[ "delete_tensorboard_time_series" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.TensorboardService/DeleteTensorboardTimeSeries", request_serializer=tensorboard_service.DeleteTensorboardTimeSeriesRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -1021,7 +1114,7 @@ def batch_read_tensorboard_time_series_data( if "batch_read_tensorboard_time_series_data" not in self._stubs: self._stubs[ "batch_read_tensorboard_time_series_data" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.TensorboardService/BatchReadTensorboardTimeSeriesData", request_serializer=tensorboard_service.BatchReadTensorboardTimeSeriesDataRequest.serialize, response_deserializer=tensorboard_service.BatchReadTensorboardTimeSeriesDataResponse.deserialize, @@ -1057,7 +1150,7 @@ def read_tensorboard_time_series_data( if "read_tensorboard_time_series_data" not in self._stubs: self._stubs[ "read_tensorboard_time_series_data" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.TensorboardService/ReadTensorboardTimeSeriesData", request_serializer=tensorboard_service.ReadTensorboardTimeSeriesDataRequest.serialize, response_deserializer=tensorboard_service.ReadTensorboardTimeSeriesDataResponse.deserialize, @@ -1089,7 +1182,9 @@ def read_tensorboard_blob_data( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "read_tensorboard_blob_data" not in self._stubs: - self._stubs["read_tensorboard_blob_data"] = self.grpc_channel.unary_stream( + self._stubs[ + "read_tensorboard_blob_data" + ] = self._logged_channel.unary_stream( "/google.cloud.aiplatform.v1.TensorboardService/ReadTensorboardBlobData", request_serializer=tensorboard_service.ReadTensorboardBlobDataRequest.serialize, response_deserializer=tensorboard_service.ReadTensorboardBlobDataResponse.deserialize, @@ -1123,7 +1218,7 @@ def write_tensorboard_experiment_data( if "write_tensorboard_experiment_data" not in self._stubs: self._stubs[ "write_tensorboard_experiment_data" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.TensorboardService/WriteTensorboardExperimentData", request_serializer=tensorboard_service.WriteTensorboardExperimentDataRequest.serialize, response_deserializer=tensorboard_service.WriteTensorboardExperimentDataResponse.deserialize, @@ -1154,7 +1249,9 @@ def write_tensorboard_run_data( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "write_tensorboard_run_data" not in self._stubs: - self._stubs["write_tensorboard_run_data"] = self.grpc_channel.unary_unary( + self._stubs[ + "write_tensorboard_run_data" + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.TensorboardService/WriteTensorboardRunData", request_serializer=tensorboard_service.WriteTensorboardRunDataRequest.serialize, response_deserializer=tensorboard_service.WriteTensorboardRunDataResponse.deserialize, @@ -1187,7 +1284,7 @@ def export_tensorboard_time_series_data( if "export_tensorboard_time_series_data" not in self._stubs: self._stubs[ "export_tensorboard_time_series_data" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.TensorboardService/ExportTensorboardTimeSeriesData", request_serializer=tensorboard_service.ExportTensorboardTimeSeriesDataRequest.serialize, response_deserializer=tensorboard_service.ExportTensorboardTimeSeriesDataResponse.deserialize, @@ -1405,7 +1502,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: @@ -1421,7 +1518,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, @@ -1438,7 +1535,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -1455,7 +1552,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -1472,7 +1569,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, @@ -1491,7 +1588,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, @@ -1510,7 +1607,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -1527,7 +1624,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -1552,7 +1649,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -1578,7 +1675,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -1607,7 +1704,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1/services/tensorboard_service/transports/rest.py b/google/cloud/aiplatform_v1/services/tensorboard_service/transports/rest.py index 4781d0bae2..c6b30ccf70 100644 --- a/google/cloud/aiplatform_v1/services/tensorboard_service/transports/rest.py +++ b/google/cloud/aiplatform_v1/services/tensorboard_service/transports/rest.py @@ -13,9 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging +import json # type: ignore from google.auth.transport.requests import AuthorizedSession # type: ignore -import json # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.api_core import exceptions as core_exceptions from google.api_core import retry as retries @@ -58,6 +59,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, @@ -330,9 +339,10 @@ def post_write_tensorboard_run_data(self, response): def pre_batch_create_tensorboard_runs( self, request: tensorboard_service.BatchCreateTensorboardRunsRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - tensorboard_service.BatchCreateTensorboardRunsRequest, Sequence[Tuple[str, str]] + tensorboard_service.BatchCreateTensorboardRunsRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for batch_create_tensorboard_runs @@ -355,10 +365,10 @@ def post_batch_create_tensorboard_runs( def pre_batch_create_tensorboard_time_series( self, request: tensorboard_service.BatchCreateTensorboardTimeSeriesRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ tensorboard_service.BatchCreateTensorboardTimeSeriesRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for batch_create_tensorboard_time_series @@ -381,10 +391,10 @@ def post_batch_create_tensorboard_time_series( def pre_batch_read_tensorboard_time_series_data( self, request: tensorboard_service.BatchReadTensorboardTimeSeriesDataRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ tensorboard_service.BatchReadTensorboardTimeSeriesDataRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for batch_read_tensorboard_time_series_data @@ -407,8 +417,11 @@ def post_batch_read_tensorboard_time_series_data( def pre_create_tensorboard( self, request: tensorboard_service.CreateTensorboardRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[tensorboard_service.CreateTensorboardRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + tensorboard_service.CreateTensorboardRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for create_tensorboard Override in a subclass to manipulate the request or metadata @@ -430,10 +443,10 @@ def post_create_tensorboard( def pre_create_tensorboard_experiment( self, request: tensorboard_service.CreateTensorboardExperimentRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ tensorboard_service.CreateTensorboardExperimentRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for create_tensorboard_experiment @@ -456,9 +469,10 @@ def post_create_tensorboard_experiment( def pre_create_tensorboard_run( self, request: tensorboard_service.CreateTensorboardRunRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - tensorboard_service.CreateTensorboardRunRequest, Sequence[Tuple[str, str]] + tensorboard_service.CreateTensorboardRunRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for create_tensorboard_run @@ -481,10 +495,10 @@ def post_create_tensorboard_run( def pre_create_tensorboard_time_series( self, request: tensorboard_service.CreateTensorboardTimeSeriesRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ tensorboard_service.CreateTensorboardTimeSeriesRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for create_tensorboard_time_series @@ -507,8 +521,11 @@ def post_create_tensorboard_time_series( def pre_delete_tensorboard( self, request: tensorboard_service.DeleteTensorboardRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[tensorboard_service.DeleteTensorboardRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + tensorboard_service.DeleteTensorboardRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for delete_tensorboard Override in a subclass to manipulate the request or metadata @@ -530,10 +547,10 @@ def post_delete_tensorboard( def pre_delete_tensorboard_experiment( self, request: tensorboard_service.DeleteTensorboardExperimentRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ tensorboard_service.DeleteTensorboardExperimentRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for delete_tensorboard_experiment @@ -556,9 +573,10 @@ def post_delete_tensorboard_experiment( def pre_delete_tensorboard_run( self, request: tensorboard_service.DeleteTensorboardRunRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - tensorboard_service.DeleteTensorboardRunRequest, Sequence[Tuple[str, str]] + tensorboard_service.DeleteTensorboardRunRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for delete_tensorboard_run @@ -581,10 +599,10 @@ def post_delete_tensorboard_run( def pre_delete_tensorboard_time_series( self, request: tensorboard_service.DeleteTensorboardTimeSeriesRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ tensorboard_service.DeleteTensorboardTimeSeriesRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for delete_tensorboard_time_series @@ -607,10 +625,10 @@ def post_delete_tensorboard_time_series( def pre_export_tensorboard_time_series_data( self, request: tensorboard_service.ExportTensorboardTimeSeriesDataRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ tensorboard_service.ExportTensorboardTimeSeriesDataRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for export_tensorboard_time_series_data @@ -633,8 +651,11 @@ def post_export_tensorboard_time_series_data( def pre_get_tensorboard( self, request: tensorboard_service.GetTensorboardRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[tensorboard_service.GetTensorboardRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + tensorboard_service.GetTensorboardRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for get_tensorboard Override in a subclass to manipulate the request or metadata @@ -656,9 +677,10 @@ def post_get_tensorboard( def pre_get_tensorboard_experiment( self, request: tensorboard_service.GetTensorboardExperimentRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - tensorboard_service.GetTensorboardExperimentRequest, Sequence[Tuple[str, str]] + tensorboard_service.GetTensorboardExperimentRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for get_tensorboard_experiment @@ -681,8 +703,11 @@ def post_get_tensorboard_experiment( def pre_get_tensorboard_run( self, request: tensorboard_service.GetTensorboardRunRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[tensorboard_service.GetTensorboardRunRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + tensorboard_service.GetTensorboardRunRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for get_tensorboard_run Override in a subclass to manipulate the request or metadata @@ -704,9 +729,10 @@ def post_get_tensorboard_run( def pre_get_tensorboard_time_series( self, request: tensorboard_service.GetTensorboardTimeSeriesRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - tensorboard_service.GetTensorboardTimeSeriesRequest, Sequence[Tuple[str, str]] + tensorboard_service.GetTensorboardTimeSeriesRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for get_tensorboard_time_series @@ -729,9 +755,10 @@ def post_get_tensorboard_time_series( def pre_list_tensorboard_experiments( self, request: tensorboard_service.ListTensorboardExperimentsRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - tensorboard_service.ListTensorboardExperimentsRequest, Sequence[Tuple[str, str]] + tensorboard_service.ListTensorboardExperimentsRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for list_tensorboard_experiments @@ -754,9 +781,10 @@ def post_list_tensorboard_experiments( def pre_list_tensorboard_runs( self, request: tensorboard_service.ListTensorboardRunsRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - tensorboard_service.ListTensorboardRunsRequest, Sequence[Tuple[str, str]] + tensorboard_service.ListTensorboardRunsRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for list_tensorboard_runs @@ -779,8 +807,11 @@ def post_list_tensorboard_runs( def pre_list_tensorboards( self, request: tensorboard_service.ListTensorboardsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[tensorboard_service.ListTensorboardsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + tensorboard_service.ListTensorboardsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for list_tensorboards Override in a subclass to manipulate the request or metadata @@ -802,9 +833,10 @@ def post_list_tensorboards( def pre_list_tensorboard_time_series( self, request: tensorboard_service.ListTensorboardTimeSeriesRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - tensorboard_service.ListTensorboardTimeSeriesRequest, Sequence[Tuple[str, str]] + tensorboard_service.ListTensorboardTimeSeriesRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for list_tensorboard_time_series @@ -827,9 +859,10 @@ def post_list_tensorboard_time_series( def pre_read_tensorboard_blob_data( self, request: tensorboard_service.ReadTensorboardBlobDataRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - tensorboard_service.ReadTensorboardBlobDataRequest, Sequence[Tuple[str, str]] + tensorboard_service.ReadTensorboardBlobDataRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for read_tensorboard_blob_data @@ -852,9 +885,10 @@ def post_read_tensorboard_blob_data( def pre_read_tensorboard_size( self, request: tensorboard_service.ReadTensorboardSizeRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - tensorboard_service.ReadTensorboardSizeRequest, Sequence[Tuple[str, str]] + tensorboard_service.ReadTensorboardSizeRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for read_tensorboard_size @@ -877,10 +911,10 @@ def post_read_tensorboard_size( def pre_read_tensorboard_time_series_data( self, request: tensorboard_service.ReadTensorboardTimeSeriesDataRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ tensorboard_service.ReadTensorboardTimeSeriesDataRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for read_tensorboard_time_series_data @@ -903,9 +937,10 @@ def post_read_tensorboard_time_series_data( def pre_read_tensorboard_usage( self, request: tensorboard_service.ReadTensorboardUsageRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - tensorboard_service.ReadTensorboardUsageRequest, Sequence[Tuple[str, str]] + tensorboard_service.ReadTensorboardUsageRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for read_tensorboard_usage @@ -928,8 +963,11 @@ def post_read_tensorboard_usage( def pre_update_tensorboard( self, request: tensorboard_service.UpdateTensorboardRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[tensorboard_service.UpdateTensorboardRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + tensorboard_service.UpdateTensorboardRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for update_tensorboard Override in a subclass to manipulate the request or metadata @@ -951,10 +989,10 @@ def post_update_tensorboard( def pre_update_tensorboard_experiment( self, request: tensorboard_service.UpdateTensorboardExperimentRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ tensorboard_service.UpdateTensorboardExperimentRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for update_tensorboard_experiment @@ -977,9 +1015,10 @@ def post_update_tensorboard_experiment( def pre_update_tensorboard_run( self, request: tensorboard_service.UpdateTensorboardRunRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - tensorboard_service.UpdateTensorboardRunRequest, Sequence[Tuple[str, str]] + tensorboard_service.UpdateTensorboardRunRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for update_tensorboard_run @@ -1002,10 +1041,10 @@ def post_update_tensorboard_run( def pre_update_tensorboard_time_series( self, request: tensorboard_service.UpdateTensorboardTimeSeriesRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ tensorboard_service.UpdateTensorboardTimeSeriesRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for update_tensorboard_time_series @@ -1028,10 +1067,10 @@ def post_update_tensorboard_time_series( def pre_write_tensorboard_experiment_data( self, request: tensorboard_service.WriteTensorboardExperimentDataRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ tensorboard_service.WriteTensorboardExperimentDataRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for write_tensorboard_experiment_data @@ -1054,9 +1093,10 @@ def post_write_tensorboard_experiment_data( def pre_write_tensorboard_run_data( self, request: tensorboard_service.WriteTensorboardRunDataRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - tensorboard_service.WriteTensorboardRunDataRequest, Sequence[Tuple[str, str]] + tensorboard_service.WriteTensorboardRunDataRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for write_tensorboard_run_data @@ -1079,8 +1119,10 @@ def post_write_tensorboard_run_data( def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -1102,8 +1144,10 @@ def post_get_location( def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -1125,8 +1169,10 @@ def post_list_locations( def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -1146,8 +1192,10 @@ def post_get_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -1167,8 +1215,11 @@ def post_set_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -1190,8 +1241,10 @@ def post_test_iam_permissions( def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -1211,8 +1264,10 @@ def post_cancel_operation(self, response: None) -> None: 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 @@ -1232,8 +1287,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 @@ -1255,8 +1312,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 @@ -1278,8 +1337,10 @@ def post_list_operations( def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -3301,7 +3362,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]]] = (), ) -> tensorboard_service.BatchCreateTensorboardRunsResponse: r"""Call the batch create tensorboard runs method over HTTP. @@ -3313,8 +3374,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: ~.tensorboard_service.BatchCreateTensorboardRunsResponse: @@ -3326,6 +3389,7 @@ def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseBatchCreateTensorboardRuns._get_http_options() ) + request, metadata = self._interceptor.pre_batch_create_tensorboard_runs( request, metadata ) @@ -3342,6 +3406,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.aiplatform_v1.TensorboardServiceClient.BatchCreateTensorboardRuns", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "BatchCreateTensorboardRuns", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = TensorboardServiceRestTransport._BatchCreateTensorboardRuns._get_response( self._host, @@ -3363,7 +3454,33 @@ def __call__( pb_resp = tensorboard_service.BatchCreateTensorboardRunsResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_batch_create_tensorboard_runs(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + tensorboard_service.BatchCreateTensorboardRunsResponse.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.aiplatform_v1.TensorboardServiceClient.batch_create_tensorboard_runs", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "BatchCreateTensorboardRuns", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _BatchCreateTensorboardTimeSeries( @@ -3405,7 +3522,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]]] = (), ) -> tensorboard_service.BatchCreateTensorboardTimeSeriesResponse: r"""Call the batch create tensorboard time series method over HTTP. @@ -3417,8 +3534,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: ~.tensorboard_service.BatchCreateTensorboardTimeSeriesResponse: @@ -3430,6 +3549,7 @@ def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseBatchCreateTensorboardTimeSeries._get_http_options() ) + ( request, metadata, @@ -3449,6 +3569,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.aiplatform_v1.TensorboardServiceClient.BatchCreateTensorboardTimeSeries", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "BatchCreateTensorboardTimeSeries", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = TensorboardServiceRestTransport._BatchCreateTensorboardTimeSeries._get_response( self._host, @@ -3472,7 +3619,31 @@ def __call__( ) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_batch_create_tensorboard_time_series(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = tensorboard_service.BatchCreateTensorboardTimeSeriesResponse.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.aiplatform_v1.TensorboardServiceClient.batch_create_tensorboard_time_series", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "BatchCreateTensorboardTimeSeries", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _BatchReadTensorboardTimeSeriesData( @@ -3513,7 +3684,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]]] = (), ) -> tensorboard_service.BatchReadTensorboardTimeSeriesDataResponse: r"""Call the batch read tensorboard time series data method over HTTP. @@ -3525,8 +3696,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: ~.tensorboard_service.BatchReadTensorboardTimeSeriesDataResponse: @@ -3538,6 +3711,7 @@ def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseBatchReadTensorboardTimeSeriesData._get_http_options() ) + ( request, metadata, @@ -3553,6 +3727,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.aiplatform_v1.TensorboardServiceClient.BatchReadTensorboardTimeSeriesData", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "BatchReadTensorboardTimeSeriesData", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = TensorboardServiceRestTransport._BatchReadTensorboardTimeSeriesData._get_response( self._host, @@ -3575,7 +3776,31 @@ def __call__( ) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_batch_read_tensorboard_time_series_data(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = tensorboard_service.BatchReadTensorboardTimeSeriesDataResponse.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.aiplatform_v1.TensorboardServiceClient.batch_read_tensorboard_time_series_data", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "BatchReadTensorboardTimeSeriesData", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _CreateTensorboard( @@ -3615,7 +3840,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 tensorboard method over HTTP. @@ -3626,8 +3851,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: @@ -3640,6 +3867,7 @@ def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseCreateTensorboard._get_http_options() ) + request, metadata = self._interceptor.pre_create_tensorboard( request, metadata ) @@ -3656,6 +3884,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.aiplatform_v1.TensorboardServiceClient.CreateTensorboard", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "CreateTensorboard", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = TensorboardServiceRestTransport._CreateTensorboard._get_response( self._host, @@ -3675,7 +3930,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_tensorboard(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.aiplatform_v1.TensorboardServiceClient.create_tensorboard", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "CreateTensorboard", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _CreateTensorboardExperiment( @@ -3715,7 +3992,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]]] = (), ) -> gca_tensorboard_experiment.TensorboardExperiment: r"""Call the create tensorboard experiment method over HTTP. @@ -3727,8 +4004,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: ~.gca_tensorboard_experiment.TensorboardExperiment: @@ -3742,6 +4021,7 @@ def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseCreateTensorboardExperiment._get_http_options() ) + request, metadata = self._interceptor.pre_create_tensorboard_experiment( request, metadata ) @@ -3758,6 +4038,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.aiplatform_v1.TensorboardServiceClient.CreateTensorboardExperiment", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "CreateTensorboardExperiment", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = TensorboardServiceRestTransport._CreateTensorboardExperiment._get_response( self._host, @@ -3779,7 +4086,33 @@ def __call__( pb_resp = gca_tensorboard_experiment.TensorboardExperiment.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_create_tensorboard_experiment(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + gca_tensorboard_experiment.TensorboardExperiment.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.aiplatform_v1.TensorboardServiceClient.create_tensorboard_experiment", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "CreateTensorboardExperiment", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _CreateTensorboardRun( @@ -3819,7 +4152,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]]] = (), ) -> gca_tensorboard_run.TensorboardRun: r"""Call the create tensorboard run method over HTTP. @@ -3830,8 +4163,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: ~.gca_tensorboard_run.TensorboardRun: @@ -3845,6 +4180,7 @@ def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseCreateTensorboardRun._get_http_options() ) + request, metadata = self._interceptor.pre_create_tensorboard_run( request, metadata ) @@ -3861,6 +4197,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.aiplatform_v1.TensorboardServiceClient.CreateTensorboardRun", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "CreateTensorboardRun", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( TensorboardServiceRestTransport._CreateTensorboardRun._get_response( @@ -3884,7 +4247,31 @@ def __call__( pb_resp = gca_tensorboard_run.TensorboardRun.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_create_tensorboard_run(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gca_tensorboard_run.TensorboardRun.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.aiplatform_v1.TensorboardServiceClient.create_tensorboard_run", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "CreateTensorboardRun", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _CreateTensorboardTimeSeries( @@ -3924,7 +4311,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]]] = (), ) -> gca_tensorboard_time_series.TensorboardTimeSeries: r"""Call the create tensorboard time series method over HTTP. @@ -3936,8 +4323,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: ~.gca_tensorboard_time_series.TensorboardTimeSeries: @@ -3949,6 +4338,7 @@ def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseCreateTensorboardTimeSeries._get_http_options() ) + request, metadata = self._interceptor.pre_create_tensorboard_time_series( request, metadata ) @@ -3965,6 +4355,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.aiplatform_v1.TensorboardServiceClient.CreateTensorboardTimeSeries", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "CreateTensorboardTimeSeries", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = TensorboardServiceRestTransport._CreateTensorboardTimeSeries._get_response( self._host, @@ -3986,7 +4403,33 @@ def __call__( pb_resp = gca_tensorboard_time_series.TensorboardTimeSeries.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_create_tensorboard_time_series(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + gca_tensorboard_time_series.TensorboardTimeSeries.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.aiplatform_v1.TensorboardServiceClient.create_tensorboard_time_series", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "CreateTensorboardTimeSeries", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _DeleteTensorboard( @@ -4025,7 +4468,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 tensorboard method over HTTP. @@ -4036,8 +4479,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: @@ -4050,6 +4495,7 @@ def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseDeleteTensorboard._get_http_options() ) + request, metadata = self._interceptor.pre_delete_tensorboard( request, metadata ) @@ -4062,6 +4508,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.aiplatform_v1.TensorboardServiceClient.DeleteTensorboard", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "DeleteTensorboard", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = TensorboardServiceRestTransport._DeleteTensorboard._get_response( self._host, @@ -4080,7 +4553,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_tensorboard(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.aiplatform_v1.TensorboardServiceClient.delete_tensorboard", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "DeleteTensorboard", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _DeleteTensorboardExperiment( @@ -4119,7 +4614,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 tensorboard experiment method over HTTP. @@ -4131,8 +4626,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: @@ -4145,6 +4642,7 @@ def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseDeleteTensorboardExperiment._get_http_options() ) + request, metadata = self._interceptor.pre_delete_tensorboard_experiment( request, metadata ) @@ -4157,6 +4655,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.aiplatform_v1.TensorboardServiceClient.DeleteTensorboardExperiment", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "DeleteTensorboardExperiment", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = TensorboardServiceRestTransport._DeleteTensorboardExperiment._get_response( self._host, @@ -4175,7 +4700,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_tensorboard_experiment(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.aiplatform_v1.TensorboardServiceClient.delete_tensorboard_experiment", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "DeleteTensorboardExperiment", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _DeleteTensorboardRun( @@ -4214,7 +4761,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 tensorboard run method over HTTP. @@ -4225,8 +4772,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: @@ -4239,6 +4788,7 @@ def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseDeleteTensorboardRun._get_http_options() ) + request, metadata = self._interceptor.pre_delete_tensorboard_run( request, metadata ) @@ -4251,6 +4801,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.aiplatform_v1.TensorboardServiceClient.DeleteTensorboardRun", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "DeleteTensorboardRun", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( TensorboardServiceRestTransport._DeleteTensorboardRun._get_response( @@ -4271,7 +4848,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_tensorboard_run(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.aiplatform_v1.TensorboardServiceClient.delete_tensorboard_run", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "DeleteTensorboardRun", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _DeleteTensorboardTimeSeries( @@ -4310,7 +4909,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 tensorboard time series method over HTTP. @@ -4322,8 +4921,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: @@ -4336,6 +4937,7 @@ def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseDeleteTensorboardTimeSeries._get_http_options() ) + request, metadata = self._interceptor.pre_delete_tensorboard_time_series( request, metadata ) @@ -4348,6 +4950,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.aiplatform_v1.TensorboardServiceClient.DeleteTensorboardTimeSeries", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "DeleteTensorboardTimeSeries", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = TensorboardServiceRestTransport._DeleteTensorboardTimeSeries._get_response( self._host, @@ -4366,7 +4995,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_tensorboard_time_series(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.aiplatform_v1.TensorboardServiceClient.delete_tensorboard_time_series", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "DeleteTensorboardTimeSeries", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ExportTensorboardTimeSeriesData( @@ -4408,7 +5059,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]]] = (), ) -> tensorboard_service.ExportTensorboardTimeSeriesDataResponse: r"""Call the export tensorboard time series data method over HTTP. @@ -4420,8 +5071,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: ~.tensorboard_service.ExportTensorboardTimeSeriesDataResponse: @@ -4433,6 +5086,7 @@ def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseExportTensorboardTimeSeriesData._get_http_options() ) + ( request, metadata, @@ -4452,6 +5106,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.aiplatform_v1.TensorboardServiceClient.ExportTensorboardTimeSeriesData", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "ExportTensorboardTimeSeriesData", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = TensorboardServiceRestTransport._ExportTensorboardTimeSeriesData._get_response( self._host, @@ -4475,7 +5156,31 @@ def __call__( ) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_export_tensorboard_time_series_data(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = tensorboard_service.ExportTensorboardTimeSeriesDataResponse.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.aiplatform_v1.TensorboardServiceClient.export_tensorboard_time_series_data", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "ExportTensorboardTimeSeriesData", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _GetTensorboard( @@ -4514,7 +5219,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]]] = (), ) -> tensorboard.Tensorboard: r"""Call the get tensorboard method over HTTP. @@ -4525,8 +5230,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: ~.tensorboard.Tensorboard: @@ -4542,6 +5249,7 @@ def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseGetTensorboard._get_http_options() ) + request, metadata = self._interceptor.pre_get_tensorboard(request, metadata) transcoded_request = _BaseTensorboardServiceRestTransport._BaseGetTensorboard._get_transcoded_request( http_options, request @@ -4552,6 +5260,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.aiplatform_v1.TensorboardServiceClient.GetTensorboard", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "GetTensorboard", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = TensorboardServiceRestTransport._GetTensorboard._get_response( self._host, @@ -4572,7 +5307,29 @@ def __call__( pb_resp = tensorboard.Tensorboard.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_tensorboard(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = tensorboard.Tensorboard.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.aiplatform_v1.TensorboardServiceClient.get_tensorboard", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "GetTensorboard", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _GetTensorboardExperiment( @@ -4611,7 +5368,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]]] = (), ) -> tensorboard_experiment.TensorboardExperiment: r"""Call the get tensorboard experiment method over HTTP. @@ -4623,8 +5380,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: ~.tensorboard_experiment.TensorboardExperiment: @@ -4638,6 +5397,7 @@ def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseGetTensorboardExperiment._get_http_options() ) + request, metadata = self._interceptor.pre_get_tensorboard_experiment( request, metadata ) @@ -4650,6 +5410,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.aiplatform_v1.TensorboardServiceClient.GetTensorboardExperiment", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "GetTensorboardExperiment", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( TensorboardServiceRestTransport._GetTensorboardExperiment._get_response( @@ -4672,7 +5459,31 @@ def __call__( pb_resp = tensorboard_experiment.TensorboardExperiment.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_tensorboard_experiment(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + tensorboard_experiment.TensorboardExperiment.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.aiplatform_v1.TensorboardServiceClient.get_tensorboard_experiment", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "GetTensorboardExperiment", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _GetTensorboardRun( @@ -4711,7 +5522,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]]] = (), ) -> tensorboard_run.TensorboardRun: r"""Call the get tensorboard run method over HTTP. @@ -4722,8 +5533,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: ~.tensorboard_run.TensorboardRun: @@ -4737,6 +5550,7 @@ def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseGetTensorboardRun._get_http_options() ) + request, metadata = self._interceptor.pre_get_tensorboard_run( request, metadata ) @@ -4749,6 +5563,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.aiplatform_v1.TensorboardServiceClient.GetTensorboardRun", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "GetTensorboardRun", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = TensorboardServiceRestTransport._GetTensorboardRun._get_response( self._host, @@ -4769,7 +5610,29 @@ def __call__( pb_resp = tensorboard_run.TensorboardRun.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_tensorboard_run(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = tensorboard_run.TensorboardRun.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.aiplatform_v1.TensorboardServiceClient.get_tensorboard_run", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "GetTensorboardRun", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _GetTensorboardTimeSeries( @@ -4808,7 +5671,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]]] = (), ) -> tensorboard_time_series.TensorboardTimeSeries: r"""Call the get tensorboard time series method over HTTP. @@ -4820,8 +5683,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: ~.tensorboard_time_series.TensorboardTimeSeries: @@ -4833,6 +5698,7 @@ def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseGetTensorboardTimeSeries._get_http_options() ) + request, metadata = self._interceptor.pre_get_tensorboard_time_series( request, metadata ) @@ -4845,6 +5711,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.aiplatform_v1.TensorboardServiceClient.GetTensorboardTimeSeries", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "GetTensorboardTimeSeries", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( TensorboardServiceRestTransport._GetTensorboardTimeSeries._get_response( @@ -4867,7 +5760,31 @@ def __call__( pb_resp = tensorboard_time_series.TensorboardTimeSeries.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_tensorboard_time_series(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + tensorboard_time_series.TensorboardTimeSeries.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.aiplatform_v1.TensorboardServiceClient.get_tensorboard_time_series", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "GetTensorboardTimeSeries", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListTensorboardExperiments( @@ -4906,7 +5823,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]]] = (), ) -> tensorboard_service.ListTensorboardExperimentsResponse: r"""Call the list tensorboard experiments method over HTTP. @@ -4918,8 +5835,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: ~.tensorboard_service.ListTensorboardExperimentsResponse: @@ -4931,6 +5850,7 @@ def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseListTensorboardExperiments._get_http_options() ) + request, metadata = self._interceptor.pre_list_tensorboard_experiments( request, metadata ) @@ -4943,6 +5863,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.aiplatform_v1.TensorboardServiceClient.ListTensorboardExperiments", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "ListTensorboardExperiments", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = TensorboardServiceRestTransport._ListTensorboardExperiments._get_response( self._host, @@ -4963,7 +5910,33 @@ def __call__( pb_resp = tensorboard_service.ListTensorboardExperimentsResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_tensorboard_experiments(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + tensorboard_service.ListTensorboardExperimentsResponse.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.aiplatform_v1.TensorboardServiceClient.list_tensorboard_experiments", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "ListTensorboardExperiments", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListTensorboardRuns( @@ -5002,7 +5975,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]]] = (), ) -> tensorboard_service.ListTensorboardRunsResponse: r"""Call the list tensorboard runs method over HTTP. @@ -5013,8 +5986,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: ~.tensorboard_service.ListTensorboardRunsResponse: @@ -5026,6 +6001,7 @@ def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseListTensorboardRuns._get_http_options() ) + request, metadata = self._interceptor.pre_list_tensorboard_runs( request, metadata ) @@ -5038,6 +6014,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.aiplatform_v1.TensorboardServiceClient.ListTensorboardRuns", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "ListTensorboardRuns", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( TensorboardServiceRestTransport._ListTensorboardRuns._get_response( @@ -5060,7 +6063,33 @@ def __call__( pb_resp = tensorboard_service.ListTensorboardRunsResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_tensorboard_runs(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + tensorboard_service.ListTensorboardRunsResponse.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.aiplatform_v1.TensorboardServiceClient.list_tensorboard_runs", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "ListTensorboardRuns", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListTensorboards( @@ -5099,7 +6128,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]]] = (), ) -> tensorboard_service.ListTensorboardsResponse: r"""Call the list tensorboards method over HTTP. @@ -5110,8 +6139,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: ~.tensorboard_service.ListTensorboardsResponse: @@ -5123,6 +6154,7 @@ def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseListTensorboards._get_http_options() ) + request, metadata = self._interceptor.pre_list_tensorboards( request, metadata ) @@ -5135,6 +6167,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.aiplatform_v1.TensorboardServiceClient.ListTensorboards", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "ListTensorboards", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = TensorboardServiceRestTransport._ListTensorboards._get_response( self._host, @@ -5155,7 +6214,31 @@ def __call__( pb_resp = tensorboard_service.ListTensorboardsResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_tensorboards(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + tensorboard_service.ListTensorboardsResponse.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.aiplatform_v1.TensorboardServiceClient.list_tensorboards", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "ListTensorboards", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListTensorboardTimeSeries( @@ -5194,7 +6277,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]]] = (), ) -> tensorboard_service.ListTensorboardTimeSeriesResponse: r"""Call the list tensorboard time series method over HTTP. @@ -5206,8 +6289,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: ~.tensorboard_service.ListTensorboardTimeSeriesResponse: @@ -5219,6 +6304,7 @@ def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseListTensorboardTimeSeries._get_http_options() ) + request, metadata = self._interceptor.pre_list_tensorboard_time_series( request, metadata ) @@ -5231,6 +6317,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.aiplatform_v1.TensorboardServiceClient.ListTensorboardTimeSeries", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "ListTensorboardTimeSeries", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = TensorboardServiceRestTransport._ListTensorboardTimeSeries._get_response( self._host, @@ -5251,7 +6364,33 @@ def __call__( pb_resp = tensorboard_service.ListTensorboardTimeSeriesResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_tensorboard_time_series(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + tensorboard_service.ListTensorboardTimeSeriesResponse.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.aiplatform_v1.TensorboardServiceClient.list_tensorboard_time_series", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "ListTensorboardTimeSeries", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ReadTensorboardBlobData( @@ -5291,7 +6430,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]]] = (), ) -> rest_streaming.ResponseIterator: r"""Call the read tensorboard blob data method over HTTP. @@ -5303,8 +6442,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: ~.tensorboard_service.ReadTensorboardBlobDataResponse: @@ -5316,6 +6457,7 @@ def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseReadTensorboardBlobData._get_http_options() ) + request, metadata = self._interceptor.pre_read_tensorboard_blob_data( request, metadata ) @@ -5328,6 +6470,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.aiplatform_v1.TensorboardServiceClient.ReadTensorboardBlobData", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "ReadTensorboardBlobData", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( TensorboardServiceRestTransport._ReadTensorboardBlobData._get_response( @@ -5349,6 +6518,7 @@ def __call__( resp = rest_streaming.ResponseIterator( response, tensorboard_service.ReadTensorboardBlobDataResponse ) + resp = self._interceptor.post_read_tensorboard_blob_data(resp) return resp @@ -5388,7 +6558,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]]] = (), ) -> tensorboard_service.ReadTensorboardSizeResponse: r"""Call the read tensorboard size method over HTTP. @@ -5399,8 +6569,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: ~.tensorboard_service.ReadTensorboardSizeResponse: @@ -5412,6 +6584,7 @@ def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseReadTensorboardSize._get_http_options() ) + request, metadata = self._interceptor.pre_read_tensorboard_size( request, metadata ) @@ -5424,6 +6597,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.aiplatform_v1.TensorboardServiceClient.ReadTensorboardSize", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "ReadTensorboardSize", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( TensorboardServiceRestTransport._ReadTensorboardSize._get_response( @@ -5446,7 +6646,33 @@ def __call__( pb_resp = tensorboard_service.ReadTensorboardSizeResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_read_tensorboard_size(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + tensorboard_service.ReadTensorboardSizeResponse.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.aiplatform_v1.TensorboardServiceClient.read_tensorboard_size", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "ReadTensorboardSize", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ReadTensorboardTimeSeriesData( @@ -5485,7 +6711,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]]] = (), ) -> tensorboard_service.ReadTensorboardTimeSeriesDataResponse: r"""Call the read tensorboard time series data method over HTTP. @@ -5497,8 +6723,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: ~.tensorboard_service.ReadTensorboardTimeSeriesDataResponse: @@ -5510,6 +6738,7 @@ def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseReadTensorboardTimeSeriesData._get_http_options() ) + request, metadata = self._interceptor.pre_read_tensorboard_time_series_data( request, metadata ) @@ -5522,6 +6751,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.aiplatform_v1.TensorboardServiceClient.ReadTensorboardTimeSeriesData", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "ReadTensorboardTimeSeriesData", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = TensorboardServiceRestTransport._ReadTensorboardTimeSeriesData._get_response( self._host, @@ -5542,7 +6798,31 @@ def __call__( pb_resp = tensorboard_service.ReadTensorboardTimeSeriesDataResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_read_tensorboard_time_series_data(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = tensorboard_service.ReadTensorboardTimeSeriesDataResponse.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.aiplatform_v1.TensorboardServiceClient.read_tensorboard_time_series_data", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "ReadTensorboardTimeSeriesData", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ReadTensorboardUsage( @@ -5581,7 +6861,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]]] = (), ) -> tensorboard_service.ReadTensorboardUsageResponse: r"""Call the read tensorboard usage method over HTTP. @@ -5592,8 +6872,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: ~.tensorboard_service.ReadTensorboardUsageResponse: @@ -5605,6 +6887,7 @@ def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseReadTensorboardUsage._get_http_options() ) + request, metadata = self._interceptor.pre_read_tensorboard_usage( request, metadata ) @@ -5617,6 +6900,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.aiplatform_v1.TensorboardServiceClient.ReadTensorboardUsage", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "ReadTensorboardUsage", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( TensorboardServiceRestTransport._ReadTensorboardUsage._get_response( @@ -5639,7 +6949,33 @@ def __call__( pb_resp = tensorboard_service.ReadTensorboardUsageResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_read_tensorboard_usage(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + tensorboard_service.ReadTensorboardUsageResponse.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.aiplatform_v1.TensorboardServiceClient.read_tensorboard_usage", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "ReadTensorboardUsage", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _UpdateTensorboard( @@ -5679,7 +7015,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 tensorboard method over HTTP. @@ -5690,8 +7026,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: @@ -5704,6 +7042,7 @@ def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseUpdateTensorboard._get_http_options() ) + request, metadata = self._interceptor.pre_update_tensorboard( request, metadata ) @@ -5720,6 +7059,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.aiplatform_v1.TensorboardServiceClient.UpdateTensorboard", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "UpdateTensorboard", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = TensorboardServiceRestTransport._UpdateTensorboard._get_response( self._host, @@ -5739,7 +7105,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_tensorboard(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.aiplatform_v1.TensorboardServiceClient.update_tensorboard", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "UpdateTensorboard", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _UpdateTensorboardExperiment( @@ -5779,7 +7167,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]]] = (), ) -> gca_tensorboard_experiment.TensorboardExperiment: r"""Call the update tensorboard experiment method over HTTP. @@ -5791,8 +7179,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: ~.gca_tensorboard_experiment.TensorboardExperiment: @@ -5806,6 +7196,7 @@ def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseUpdateTensorboardExperiment._get_http_options() ) + request, metadata = self._interceptor.pre_update_tensorboard_experiment( request, metadata ) @@ -5822,6 +7213,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.aiplatform_v1.TensorboardServiceClient.UpdateTensorboardExperiment", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "UpdateTensorboardExperiment", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = TensorboardServiceRestTransport._UpdateTensorboardExperiment._get_response( self._host, @@ -5843,7 +7261,33 @@ def __call__( pb_resp = gca_tensorboard_experiment.TensorboardExperiment.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_update_tensorboard_experiment(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + gca_tensorboard_experiment.TensorboardExperiment.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.aiplatform_v1.TensorboardServiceClient.update_tensorboard_experiment", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "UpdateTensorboardExperiment", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _UpdateTensorboardRun( @@ -5883,7 +7327,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]]] = (), ) -> gca_tensorboard_run.TensorboardRun: r"""Call the update tensorboard run method over HTTP. @@ -5894,8 +7338,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: ~.gca_tensorboard_run.TensorboardRun: @@ -5909,6 +7355,7 @@ def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseUpdateTensorboardRun._get_http_options() ) + request, metadata = self._interceptor.pre_update_tensorboard_run( request, metadata ) @@ -5925,6 +7372,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.aiplatform_v1.TensorboardServiceClient.UpdateTensorboardRun", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "UpdateTensorboardRun", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( TensorboardServiceRestTransport._UpdateTensorboardRun._get_response( @@ -5948,7 +7422,31 @@ def __call__( pb_resp = gca_tensorboard_run.TensorboardRun.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_update_tensorboard_run(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gca_tensorboard_run.TensorboardRun.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.aiplatform_v1.TensorboardServiceClient.update_tensorboard_run", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "UpdateTensorboardRun", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _UpdateTensorboardTimeSeries( @@ -5988,7 +7486,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]]] = (), ) -> gca_tensorboard_time_series.TensorboardTimeSeries: r"""Call the update tensorboard time series method over HTTP. @@ -6000,8 +7498,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: ~.gca_tensorboard_time_series.TensorboardTimeSeries: @@ -6013,6 +7513,7 @@ def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseUpdateTensorboardTimeSeries._get_http_options() ) + request, metadata = self._interceptor.pre_update_tensorboard_time_series( request, metadata ) @@ -6029,6 +7530,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.aiplatform_v1.TensorboardServiceClient.UpdateTensorboardTimeSeries", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "UpdateTensorboardTimeSeries", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = TensorboardServiceRestTransport._UpdateTensorboardTimeSeries._get_response( self._host, @@ -6050,7 +7578,33 @@ def __call__( pb_resp = gca_tensorboard_time_series.TensorboardTimeSeries.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_update_tensorboard_time_series(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + gca_tensorboard_time_series.TensorboardTimeSeries.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.aiplatform_v1.TensorboardServiceClient.update_tensorboard_time_series", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "UpdateTensorboardTimeSeries", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _WriteTensorboardExperimentData( @@ -6092,7 +7646,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]]] = (), ) -> tensorboard_service.WriteTensorboardExperimentDataResponse: r"""Call the write tensorboard experiment data method over HTTP. @@ -6104,8 +7658,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: ~.tensorboard_service.WriteTensorboardExperimentDataResponse: @@ -6117,6 +7673,7 @@ def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseWriteTensorboardExperimentData._get_http_options() ) + request, metadata = self._interceptor.pre_write_tensorboard_experiment_data( request, metadata ) @@ -6133,6 +7690,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.aiplatform_v1.TensorboardServiceClient.WriteTensorboardExperimentData", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "WriteTensorboardExperimentData", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = TensorboardServiceRestTransport._WriteTensorboardExperimentData._get_response( self._host, @@ -6156,7 +7740,31 @@ def __call__( ) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_write_tensorboard_experiment_data(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = tensorboard_service.WriteTensorboardExperimentDataResponse.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.aiplatform_v1.TensorboardServiceClient.write_tensorboard_experiment_data", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "WriteTensorboardExperimentData", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _WriteTensorboardRunData( @@ -6196,7 +7804,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]]] = (), ) -> tensorboard_service.WriteTensorboardRunDataResponse: r"""Call the write tensorboard run data method over HTTP. @@ -6208,8 +7816,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: ~.tensorboard_service.WriteTensorboardRunDataResponse: @@ -6221,6 +7831,7 @@ def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseWriteTensorboardRunData._get_http_options() ) + request, metadata = self._interceptor.pre_write_tensorboard_run_data( request, metadata ) @@ -6237,6 +7848,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.aiplatform_v1.TensorboardServiceClient.WriteTensorboardRunData", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "WriteTensorboardRunData", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( TensorboardServiceRestTransport._WriteTensorboardRunData._get_response( @@ -6260,7 +7898,33 @@ def __call__( pb_resp = tensorboard_service.WriteTensorboardRunDataResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_write_tensorboard_run_data(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + tensorboard_service.WriteTensorboardRunDataResponse.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.aiplatform_v1.TensorboardServiceClient.write_tensorboard_run_data", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "WriteTensorboardRunData", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp @property @@ -6625,7 +8289,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]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -6636,8 +8300,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: locations_pb2.Location: Response from GetLocation method. @@ -6646,6 +8312,7 @@ def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = self._interceptor.pre_get_location(request, metadata) transcoded_request = _BaseTensorboardServiceRestTransport._BaseGetLocation._get_transcoded_request( http_options, request @@ -6656,6 +8323,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.aiplatform_v1.TensorboardServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = TensorboardServiceRestTransport._GetLocation._get_response( self._host, @@ -6675,6 +8369,27 @@ def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_location(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.aiplatform_v1.TensorboardServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -6717,7 +8432,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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -6728,8 +8443,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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -6738,6 +8455,7 @@ def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = self._interceptor.pre_list_locations(request, metadata) transcoded_request = _BaseTensorboardServiceRestTransport._BaseListLocations._get_transcoded_request( http_options, request @@ -6748,6 +8466,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.aiplatform_v1.TensorboardServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = TensorboardServiceRestTransport._ListLocations._get_response( self._host, @@ -6767,6 +8512,27 @@ def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_list_locations(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.aiplatform_v1.TensorboardServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -6809,7 +8575,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]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -6820,8 +8586,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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -6830,6 +8598,7 @@ def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_get_iam_policy(request, metadata) transcoded_request = _BaseTensorboardServiceRestTransport._BaseGetIamPolicy._get_transcoded_request( http_options, request @@ -6840,6 +8609,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.aiplatform_v1.TensorboardServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = TensorboardServiceRestTransport._GetIamPolicy._get_response( self._host, @@ -6859,6 +8655,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_iam_policy(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.aiplatform_v1.TensorboardServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -6902,7 +8719,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]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -6913,8 +8730,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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -6923,6 +8742,7 @@ def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_set_iam_policy(request, metadata) transcoded_request = _BaseTensorboardServiceRestTransport._BaseSetIamPolicy._get_transcoded_request( http_options, request @@ -6937,6 +8757,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.aiplatform_v1.TensorboardServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = TensorboardServiceRestTransport._SetIamPolicy._get_response( self._host, @@ -6957,6 +8804,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_set_iam_policy(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.aiplatform_v1.TensorboardServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -6999,7 +8867,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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -7010,8 +8878,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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -7020,6 +8890,7 @@ def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -7032,6 +8903,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.aiplatform_v1.TensorboardServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( TensorboardServiceRestTransport._TestIamPermissions._get_response( @@ -7053,6 +8951,27 @@ def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_test_iam_permissions(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.aiplatform_v1.TensorboardServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -7095,7 +9014,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 cancel operation method over HTTP. @@ -7106,13 +9025,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 = ( _BaseTensorboardServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = self._interceptor.pre_cancel_operation( request, metadata ) @@ -7125,6 +9047,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.aiplatform_v1.TensorboardServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = TensorboardServiceRestTransport._CancelOperation._get_response( self._host, @@ -7182,7 +9131,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. @@ -7193,13 +9142,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 = ( _BaseTensorboardServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = self._interceptor.pre_delete_operation( request, metadata ) @@ -7212,6 +9164,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.aiplatform_v1.TensorboardServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = TensorboardServiceRestTransport._DeleteOperation._get_response( self._host, @@ -7269,7 +9248,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. @@ -7280,8 +9259,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. @@ -7290,6 +9271,7 @@ def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = self._interceptor.pre_get_operation(request, metadata) transcoded_request = _BaseTensorboardServiceRestTransport._BaseGetOperation._get_transcoded_request( http_options, request @@ -7300,6 +9282,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.aiplatform_v1.TensorboardServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = TensorboardServiceRestTransport._GetOperation._get_response( self._host, @@ -7319,6 +9328,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.aiplatform_v1.TensorboardServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -7361,7 +9391,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. @@ -7372,8 +9402,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. @@ -7382,6 +9414,7 @@ def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = self._interceptor.pre_list_operations(request, metadata) transcoded_request = _BaseTensorboardServiceRestTransport._BaseListOperations._get_transcoded_request( http_options, request @@ -7392,6 +9425,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.aiplatform_v1.TensorboardServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = TensorboardServiceRestTransport._ListOperations._get_response( self._host, @@ -7411,6 +9471,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.aiplatform_v1.TensorboardServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -7453,7 +9534,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 wait operation method over HTTP. @@ -7464,8 +9545,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 WaitOperation method. @@ -7474,6 +9557,7 @@ def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = self._interceptor.pre_wait_operation(request, metadata) transcoded_request = _BaseTensorboardServiceRestTransport._BaseWaitOperation._get_transcoded_request( http_options, request @@ -7484,6 +9568,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.aiplatform_v1.TensorboardServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = TensorboardServiceRestTransport._WaitOperation._get_response( self._host, @@ -7503,6 +9614,27 @@ def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = self._interceptor.post_wait_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.aiplatform_v1.TensorboardServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1/services/tensorboard_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1/services/tensorboard_service/transports/rest_asyncio.py index f6f0b579c6..3d542ffea7 100644 --- a/google/cloud/aiplatform_v1/services/tensorboard_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1/services/tensorboard_service/transports/rest_asyncio.py @@ -69,6 +69,18 @@ from .base import DEFAULT_CLIENT_INFO as BASE_DEFAULT_CLIENT_INFO + +import logging + +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__) + try: OptionalRetry = Union[retries.AsyncRetry, gapic_v1.method._MethodDefault, None] except AttributeError: # pragma: NO COVER @@ -345,9 +357,10 @@ async def post_write_tensorboard_run_data(self, response): async def pre_batch_create_tensorboard_runs( self, request: tensorboard_service.BatchCreateTensorboardRunsRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - tensorboard_service.BatchCreateTensorboardRunsRequest, Sequence[Tuple[str, str]] + tensorboard_service.BatchCreateTensorboardRunsRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for batch_create_tensorboard_runs @@ -370,10 +383,10 @@ async def post_batch_create_tensorboard_runs( async def pre_batch_create_tensorboard_time_series( self, request: tensorboard_service.BatchCreateTensorboardTimeSeriesRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ tensorboard_service.BatchCreateTensorboardTimeSeriesRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for batch_create_tensorboard_time_series @@ -396,10 +409,10 @@ async def post_batch_create_tensorboard_time_series( async def pre_batch_read_tensorboard_time_series_data( self, request: tensorboard_service.BatchReadTensorboardTimeSeriesDataRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ tensorboard_service.BatchReadTensorboardTimeSeriesDataRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for batch_read_tensorboard_time_series_data @@ -422,8 +435,11 @@ async def post_batch_read_tensorboard_time_series_data( async def pre_create_tensorboard( self, request: tensorboard_service.CreateTensorboardRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[tensorboard_service.CreateTensorboardRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + tensorboard_service.CreateTensorboardRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for create_tensorboard Override in a subclass to manipulate the request or metadata @@ -445,10 +461,10 @@ async def post_create_tensorboard( async def pre_create_tensorboard_experiment( self, request: tensorboard_service.CreateTensorboardExperimentRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ tensorboard_service.CreateTensorboardExperimentRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for create_tensorboard_experiment @@ -471,9 +487,10 @@ async def post_create_tensorboard_experiment( async def pre_create_tensorboard_run( self, request: tensorboard_service.CreateTensorboardRunRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - tensorboard_service.CreateTensorboardRunRequest, Sequence[Tuple[str, str]] + tensorboard_service.CreateTensorboardRunRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for create_tensorboard_run @@ -496,10 +513,10 @@ async def post_create_tensorboard_run( async def pre_create_tensorboard_time_series( self, request: tensorboard_service.CreateTensorboardTimeSeriesRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ tensorboard_service.CreateTensorboardTimeSeriesRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for create_tensorboard_time_series @@ -522,8 +539,11 @@ async def post_create_tensorboard_time_series( async def pre_delete_tensorboard( self, request: tensorboard_service.DeleteTensorboardRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[tensorboard_service.DeleteTensorboardRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + tensorboard_service.DeleteTensorboardRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for delete_tensorboard Override in a subclass to manipulate the request or metadata @@ -545,10 +565,10 @@ async def post_delete_tensorboard( async def pre_delete_tensorboard_experiment( self, request: tensorboard_service.DeleteTensorboardExperimentRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ tensorboard_service.DeleteTensorboardExperimentRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for delete_tensorboard_experiment @@ -571,9 +591,10 @@ async def post_delete_tensorboard_experiment( async def pre_delete_tensorboard_run( self, request: tensorboard_service.DeleteTensorboardRunRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - tensorboard_service.DeleteTensorboardRunRequest, Sequence[Tuple[str, str]] + tensorboard_service.DeleteTensorboardRunRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for delete_tensorboard_run @@ -596,10 +617,10 @@ async def post_delete_tensorboard_run( async def pre_delete_tensorboard_time_series( self, request: tensorboard_service.DeleteTensorboardTimeSeriesRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ tensorboard_service.DeleteTensorboardTimeSeriesRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for delete_tensorboard_time_series @@ -622,10 +643,10 @@ async def post_delete_tensorboard_time_series( async def pre_export_tensorboard_time_series_data( self, request: tensorboard_service.ExportTensorboardTimeSeriesDataRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ tensorboard_service.ExportTensorboardTimeSeriesDataRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for export_tensorboard_time_series_data @@ -648,8 +669,11 @@ async def post_export_tensorboard_time_series_data( async def pre_get_tensorboard( self, request: tensorboard_service.GetTensorboardRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[tensorboard_service.GetTensorboardRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + tensorboard_service.GetTensorboardRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for get_tensorboard Override in a subclass to manipulate the request or metadata @@ -671,9 +695,10 @@ async def post_get_tensorboard( async def pre_get_tensorboard_experiment( self, request: tensorboard_service.GetTensorboardExperimentRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - tensorboard_service.GetTensorboardExperimentRequest, Sequence[Tuple[str, str]] + tensorboard_service.GetTensorboardExperimentRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for get_tensorboard_experiment @@ -696,8 +721,11 @@ async def post_get_tensorboard_experiment( async def pre_get_tensorboard_run( self, request: tensorboard_service.GetTensorboardRunRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[tensorboard_service.GetTensorboardRunRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + tensorboard_service.GetTensorboardRunRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for get_tensorboard_run Override in a subclass to manipulate the request or metadata @@ -719,9 +747,10 @@ async def post_get_tensorboard_run( async def pre_get_tensorboard_time_series( self, request: tensorboard_service.GetTensorboardTimeSeriesRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - tensorboard_service.GetTensorboardTimeSeriesRequest, Sequence[Tuple[str, str]] + tensorboard_service.GetTensorboardTimeSeriesRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for get_tensorboard_time_series @@ -744,9 +773,10 @@ async def post_get_tensorboard_time_series( async def pre_list_tensorboard_experiments( self, request: tensorboard_service.ListTensorboardExperimentsRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - tensorboard_service.ListTensorboardExperimentsRequest, Sequence[Tuple[str, str]] + tensorboard_service.ListTensorboardExperimentsRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for list_tensorboard_experiments @@ -769,9 +799,10 @@ async def post_list_tensorboard_experiments( async def pre_list_tensorboard_runs( self, request: tensorboard_service.ListTensorboardRunsRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - tensorboard_service.ListTensorboardRunsRequest, Sequence[Tuple[str, str]] + tensorboard_service.ListTensorboardRunsRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for list_tensorboard_runs @@ -794,8 +825,11 @@ async def post_list_tensorboard_runs( async def pre_list_tensorboards( self, request: tensorboard_service.ListTensorboardsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[tensorboard_service.ListTensorboardsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + tensorboard_service.ListTensorboardsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for list_tensorboards Override in a subclass to manipulate the request or metadata @@ -817,9 +851,10 @@ async def post_list_tensorboards( async def pre_list_tensorboard_time_series( self, request: tensorboard_service.ListTensorboardTimeSeriesRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - tensorboard_service.ListTensorboardTimeSeriesRequest, Sequence[Tuple[str, str]] + tensorboard_service.ListTensorboardTimeSeriesRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for list_tensorboard_time_series @@ -842,9 +877,10 @@ async def post_list_tensorboard_time_series( async def pre_read_tensorboard_blob_data( self, request: tensorboard_service.ReadTensorboardBlobDataRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - tensorboard_service.ReadTensorboardBlobDataRequest, Sequence[Tuple[str, str]] + tensorboard_service.ReadTensorboardBlobDataRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for read_tensorboard_blob_data @@ -867,9 +903,10 @@ async def post_read_tensorboard_blob_data( async def pre_read_tensorboard_size( self, request: tensorboard_service.ReadTensorboardSizeRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - tensorboard_service.ReadTensorboardSizeRequest, Sequence[Tuple[str, str]] + tensorboard_service.ReadTensorboardSizeRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for read_tensorboard_size @@ -892,10 +929,10 @@ async def post_read_tensorboard_size( async def pre_read_tensorboard_time_series_data( self, request: tensorboard_service.ReadTensorboardTimeSeriesDataRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ tensorboard_service.ReadTensorboardTimeSeriesDataRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for read_tensorboard_time_series_data @@ -918,9 +955,10 @@ async def post_read_tensorboard_time_series_data( async def pre_read_tensorboard_usage( self, request: tensorboard_service.ReadTensorboardUsageRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - tensorboard_service.ReadTensorboardUsageRequest, Sequence[Tuple[str, str]] + tensorboard_service.ReadTensorboardUsageRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for read_tensorboard_usage @@ -943,8 +981,11 @@ async def post_read_tensorboard_usage( async def pre_update_tensorboard( self, request: tensorboard_service.UpdateTensorboardRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[tensorboard_service.UpdateTensorboardRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + tensorboard_service.UpdateTensorboardRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for update_tensorboard Override in a subclass to manipulate the request or metadata @@ -966,10 +1007,10 @@ async def post_update_tensorboard( async def pre_update_tensorboard_experiment( self, request: tensorboard_service.UpdateTensorboardExperimentRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ tensorboard_service.UpdateTensorboardExperimentRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for update_tensorboard_experiment @@ -992,9 +1033,10 @@ async def post_update_tensorboard_experiment( async def pre_update_tensorboard_run( self, request: tensorboard_service.UpdateTensorboardRunRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - tensorboard_service.UpdateTensorboardRunRequest, Sequence[Tuple[str, str]] + tensorboard_service.UpdateTensorboardRunRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for update_tensorboard_run @@ -1017,10 +1059,10 @@ async def post_update_tensorboard_run( async def pre_update_tensorboard_time_series( self, request: tensorboard_service.UpdateTensorboardTimeSeriesRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ tensorboard_service.UpdateTensorboardTimeSeriesRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for update_tensorboard_time_series @@ -1043,10 +1085,10 @@ async def post_update_tensorboard_time_series( async def pre_write_tensorboard_experiment_data( self, request: tensorboard_service.WriteTensorboardExperimentDataRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ tensorboard_service.WriteTensorboardExperimentDataRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for write_tensorboard_experiment_data @@ -1069,9 +1111,10 @@ async def post_write_tensorboard_experiment_data( async def pre_write_tensorboard_run_data( self, request: tensorboard_service.WriteTensorboardRunDataRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - tensorboard_service.WriteTensorboardRunDataRequest, Sequence[Tuple[str, str]] + tensorboard_service.WriteTensorboardRunDataRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for write_tensorboard_run_data @@ -1094,8 +1137,10 @@ async def post_write_tensorboard_run_data( async def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -1117,8 +1162,10 @@ async def post_get_location( async def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -1140,8 +1187,10 @@ async def post_list_locations( async def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -1163,8 +1212,10 @@ async def post_get_iam_policy( async def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -1186,8 +1237,11 @@ async def post_set_iam_policy( async def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -1209,8 +1263,10 @@ async def post_test_iam_permissions( async def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -1230,8 +1286,10 @@ async def post_cancel_operation(self, response: None) -> None: async 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 @@ -1251,8 +1309,10 @@ async def post_delete_operation(self, response: None) -> None: async 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 @@ -1274,8 +1334,10 @@ async def post_get_operation( async 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 @@ -1297,8 +1359,10 @@ async def post_list_operations( async def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -1631,7 +1695,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> tensorboard_service.BatchCreateTensorboardRunsResponse: r"""Call the batch create tensorboard runs method over HTTP. @@ -1643,8 +1707,10 @@ async def __call__( 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: ~.tensorboard_service.BatchCreateTensorboardRunsResponse: @@ -1656,6 +1722,7 @@ async def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseBatchCreateTensorboardRuns._get_http_options() ) + ( request, metadata, @@ -1675,6 +1742,33 @@ async 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.aiplatform_v1.TensorboardServiceClient.BatchCreateTensorboardRuns", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "BatchCreateTensorboardRuns", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncTensorboardServiceRestTransport._BatchCreateTensorboardRuns._get_response( self._host, @@ -1703,6 +1797,32 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_batch_create_tensorboard_runs(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + tensorboard_service.BatchCreateTensorboardRunsResponse.to_json( + response + ) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.TensorboardServiceAsyncClient.batch_create_tensorboard_runs", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "BatchCreateTensorboardRuns", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _BatchCreateTensorboardTimeSeries( @@ -1744,7 +1864,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> tensorboard_service.BatchCreateTensorboardTimeSeriesResponse: r"""Call the batch create tensorboard time series method over HTTP. @@ -1756,8 +1876,10 @@ async def __call__( 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: ~.tensorboard_service.BatchCreateTensorboardTimeSeriesResponse: @@ -1769,6 +1891,7 @@ async def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseBatchCreateTensorboardTimeSeries._get_http_options() ) + ( request, metadata, @@ -1788,6 +1911,33 @@ async 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.aiplatform_v1.TensorboardServiceClient.BatchCreateTensorboardTimeSeries", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "BatchCreateTensorboardTimeSeries", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncTensorboardServiceRestTransport._BatchCreateTensorboardTimeSeries._get_response( self._host, @@ -1820,6 +1970,30 @@ async def __call__( resp = await self._interceptor.post_batch_create_tensorboard_time_series( resp ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = tensorboard_service.BatchCreateTensorboardTimeSeriesResponse.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.TensorboardServiceAsyncClient.batch_create_tensorboard_time_series", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "BatchCreateTensorboardTimeSeries", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _BatchReadTensorboardTimeSeriesData( @@ -1860,7 +2034,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> tensorboard_service.BatchReadTensorboardTimeSeriesDataResponse: r"""Call the batch read tensorboard time series data method over HTTP. @@ -1872,8 +2046,10 @@ async def __call__( 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: ~.tensorboard_service.BatchReadTensorboardTimeSeriesDataResponse: @@ -1885,6 +2061,7 @@ async def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseBatchReadTensorboardTimeSeriesData._get_http_options() ) + ( request, metadata, @@ -1900,6 +2077,33 @@ async 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.aiplatform_v1.TensorboardServiceClient.BatchReadTensorboardTimeSeriesData", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "BatchReadTensorboardTimeSeriesData", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncTensorboardServiceRestTransport._BatchReadTensorboardTimeSeriesData._get_response( self._host, @@ -1931,6 +2135,30 @@ async def __call__( resp = await self._interceptor.post_batch_read_tensorboard_time_series_data( resp ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = tensorboard_service.BatchReadTensorboardTimeSeriesDataResponse.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.TensorboardServiceAsyncClient.batch_read_tensorboard_time_series_data", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "BatchReadTensorboardTimeSeriesData", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _CreateTensorboard( @@ -1970,7 +2198,7 @@ async 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 tensorboard method over HTTP. @@ -1981,8 +2209,10 @@ async def __call__( 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: @@ -1995,6 +2225,7 @@ async def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseCreateTensorboard._get_http_options() ) + request, metadata = await self._interceptor.pre_create_tensorboard( request, metadata ) @@ -2011,6 +2242,33 @@ async 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.aiplatform_v1.TensorboardServiceClient.CreateTensorboard", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "CreateTensorboard", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncTensorboardServiceRestTransport._CreateTensorboard._get_response( self._host, @@ -2039,6 +2297,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_create_tensorboard(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.TensorboardServiceAsyncClient.create_tensorboard", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "CreateTensorboard", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _CreateTensorboardExperiment( @@ -2080,7 +2360,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> gca_tensorboard_experiment.TensorboardExperiment: r"""Call the create tensorboard experiment method over HTTP. @@ -2092,8 +2372,10 @@ async def __call__( 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: ~.gca_tensorboard_experiment.TensorboardExperiment: @@ -2107,6 +2389,7 @@ async def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseCreateTensorboardExperiment._get_http_options() ) + ( request, metadata, @@ -2126,6 +2409,33 @@ async 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.aiplatform_v1.TensorboardServiceClient.CreateTensorboardExperiment", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "CreateTensorboardExperiment", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncTensorboardServiceRestTransport._CreateTensorboardExperiment._get_response( self._host, @@ -2154,6 +2464,32 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_create_tensorboard_experiment(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + gca_tensorboard_experiment.TensorboardExperiment.to_json( + response + ) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.TensorboardServiceAsyncClient.create_tensorboard_experiment", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "CreateTensorboardExperiment", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _CreateTensorboardRun( @@ -2193,7 +2529,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> gca_tensorboard_run.TensorboardRun: r"""Call the create tensorboard run method over HTTP. @@ -2204,8 +2540,10 @@ async def __call__( 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: ~.gca_tensorboard_run.TensorboardRun: @@ -2219,6 +2557,7 @@ async def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseCreateTensorboardRun._get_http_options() ) + request, metadata = await self._interceptor.pre_create_tensorboard_run( request, metadata ) @@ -2235,6 +2574,33 @@ async 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.aiplatform_v1.TensorboardServiceClient.CreateTensorboardRun", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "CreateTensorboardRun", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncTensorboardServiceRestTransport._CreateTensorboardRun._get_response( self._host, @@ -2263,6 +2629,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_create_tensorboard_run(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gca_tensorboard_run.TensorboardRun.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.TensorboardServiceAsyncClient.create_tensorboard_run", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "CreateTensorboardRun", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _CreateTensorboardTimeSeries( @@ -2304,7 +2694,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> gca_tensorboard_time_series.TensorboardTimeSeries: r"""Call the create tensorboard time series method over HTTP. @@ -2316,8 +2706,10 @@ async def __call__( 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: ~.gca_tensorboard_time_series.TensorboardTimeSeries: @@ -2329,6 +2721,7 @@ async def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseCreateTensorboardTimeSeries._get_http_options() ) + ( request, metadata, @@ -2348,6 +2741,33 @@ async 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.aiplatform_v1.TensorboardServiceClient.CreateTensorboardTimeSeries", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "CreateTensorboardTimeSeries", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncTensorboardServiceRestTransport._CreateTensorboardTimeSeries._get_response( self._host, @@ -2376,6 +2796,32 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_create_tensorboard_time_series(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + gca_tensorboard_time_series.TensorboardTimeSeries.to_json( + response + ) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.TensorboardServiceAsyncClient.create_tensorboard_time_series", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "CreateTensorboardTimeSeries", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _DeleteTensorboard( @@ -2414,7 +2860,7 @@ async 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 tensorboard method over HTTP. @@ -2425,8 +2871,10 @@ async def __call__( 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: @@ -2439,6 +2887,7 @@ async def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseDeleteTensorboard._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_tensorboard( request, metadata ) @@ -2451,6 +2900,33 @@ async 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.aiplatform_v1.TensorboardServiceClient.DeleteTensorboard", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "DeleteTensorboard", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncTensorboardServiceRestTransport._DeleteTensorboard._get_response( self._host, @@ -2478,6 +2954,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_delete_tensorboard(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.TensorboardServiceAsyncClient.delete_tensorboard", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "DeleteTensorboard", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _DeleteTensorboardExperiment( @@ -2518,7 +3016,7 @@ async 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 tensorboard experiment method over HTTP. @@ -2530,8 +3028,10 @@ async def __call__( 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: @@ -2544,6 +3044,7 @@ async def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseDeleteTensorboardExperiment._get_http_options() ) + ( request, metadata, @@ -2559,6 +3060,33 @@ async 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.aiplatform_v1.TensorboardServiceClient.DeleteTensorboardExperiment", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "DeleteTensorboardExperiment", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncTensorboardServiceRestTransport._DeleteTensorboardExperiment._get_response( self._host, @@ -2586,6 +3114,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_delete_tensorboard_experiment(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.TensorboardServiceAsyncClient.delete_tensorboard_experiment", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "DeleteTensorboardExperiment", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _DeleteTensorboardRun( @@ -2624,7 +3174,7 @@ async 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 tensorboard run method over HTTP. @@ -2635,8 +3185,10 @@ async def __call__( 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: @@ -2649,6 +3201,7 @@ async def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseDeleteTensorboardRun._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_tensorboard_run( request, metadata ) @@ -2661,6 +3214,33 @@ async 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.aiplatform_v1.TensorboardServiceClient.DeleteTensorboardRun", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "DeleteTensorboardRun", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncTensorboardServiceRestTransport._DeleteTensorboardRun._get_response( self._host, @@ -2688,6 +3268,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_delete_tensorboard_run(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.TensorboardServiceAsyncClient.delete_tensorboard_run", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "DeleteTensorboardRun", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _DeleteTensorboardTimeSeries( @@ -2728,7 +3330,7 @@ async 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 tensorboard time series method over HTTP. @@ -2740,8 +3342,10 @@ async def __call__( 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: @@ -2754,6 +3358,7 @@ async def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseDeleteTensorboardTimeSeries._get_http_options() ) + ( request, metadata, @@ -2769,6 +3374,33 @@ async 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.aiplatform_v1.TensorboardServiceClient.DeleteTensorboardTimeSeries", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "DeleteTensorboardTimeSeries", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncTensorboardServiceRestTransport._DeleteTensorboardTimeSeries._get_response( self._host, @@ -2796,6 +3428,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_delete_tensorboard_time_series(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.TensorboardServiceAsyncClient.delete_tensorboard_time_series", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "DeleteTensorboardTimeSeries", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ExportTensorboardTimeSeriesData( @@ -2837,7 +3491,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> tensorboard_service.ExportTensorboardTimeSeriesDataResponse: r"""Call the export tensorboard time series data method over HTTP. @@ -2849,8 +3503,10 @@ async def __call__( 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: ~.tensorboard_service.ExportTensorboardTimeSeriesDataResponse: @@ -2862,6 +3518,7 @@ async def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseExportTensorboardTimeSeriesData._get_http_options() ) + ( request, metadata, @@ -2881,6 +3538,33 @@ async 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.aiplatform_v1.TensorboardServiceClient.ExportTensorboardTimeSeriesData", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "ExportTensorboardTimeSeriesData", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncTensorboardServiceRestTransport._ExportTensorboardTimeSeriesData._get_response( self._host, @@ -2913,6 +3597,30 @@ async def __call__( resp = await self._interceptor.post_export_tensorboard_time_series_data( resp ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = tensorboard_service.ExportTensorboardTimeSeriesDataResponse.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.TensorboardServiceAsyncClient.export_tensorboard_time_series_data", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "ExportTensorboardTimeSeriesData", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _GetTensorboard( @@ -2951,7 +3659,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> tensorboard.Tensorboard: r"""Call the get tensorboard method over HTTP. @@ -2962,8 +3670,10 @@ async def __call__( 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: ~.tensorboard.Tensorboard: @@ -2979,6 +3689,7 @@ async def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseGetTensorboard._get_http_options() ) + request, metadata = await self._interceptor.pre_get_tensorboard( request, metadata ) @@ -2991,6 +3702,33 @@ async 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.aiplatform_v1.TensorboardServiceClient.GetTensorboard", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "GetTensorboard", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncTensorboardServiceRestTransport._GetTensorboard._get_response( self._host, @@ -3018,6 +3756,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_get_tensorboard(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = tensorboard.Tensorboard.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.TensorboardServiceAsyncClient.get_tensorboard", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "GetTensorboard", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _GetTensorboardExperiment( @@ -3056,7 +3816,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> tensorboard_experiment.TensorboardExperiment: r"""Call the get tensorboard experiment method over HTTP. @@ -3068,8 +3828,10 @@ async def __call__( 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: ~.tensorboard_experiment.TensorboardExperiment: @@ -3083,6 +3845,7 @@ async def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseGetTensorboardExperiment._get_http_options() ) + request, metadata = await self._interceptor.pre_get_tensorboard_experiment( request, metadata ) @@ -3095,6 +3858,33 @@ async 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.aiplatform_v1.TensorboardServiceClient.GetTensorboardExperiment", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "GetTensorboardExperiment", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncTensorboardServiceRestTransport._GetTensorboardExperiment._get_response( self._host, @@ -3122,6 +3912,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_get_tensorboard_experiment(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + tensorboard_experiment.TensorboardExperiment.to_json(response) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.TensorboardServiceAsyncClient.get_tensorboard_experiment", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "GetTensorboardExperiment", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _GetTensorboardRun( @@ -3160,7 +3974,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> tensorboard_run.TensorboardRun: r"""Call the get tensorboard run method over HTTP. @@ -3171,8 +3985,10 @@ async def __call__( 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: ~.tensorboard_run.TensorboardRun: @@ -3186,6 +4002,7 @@ async def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseGetTensorboardRun._get_http_options() ) + request, metadata = await self._interceptor.pre_get_tensorboard_run( request, metadata ) @@ -3198,6 +4015,33 @@ async 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.aiplatform_v1.TensorboardServiceClient.GetTensorboardRun", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "GetTensorboardRun", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncTensorboardServiceRestTransport._GetTensorboardRun._get_response( self._host, @@ -3225,6 +4069,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_get_tensorboard_run(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = tensorboard_run.TensorboardRun.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.TensorboardServiceAsyncClient.get_tensorboard_run", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "GetTensorboardRun", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _GetTensorboardTimeSeries( @@ -3263,7 +4129,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> tensorboard_time_series.TensorboardTimeSeries: r"""Call the get tensorboard time series method over HTTP. @@ -3275,8 +4141,10 @@ async def __call__( 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: ~.tensorboard_time_series.TensorboardTimeSeries: @@ -3288,6 +4156,7 @@ async def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseGetTensorboardTimeSeries._get_http_options() ) + request, metadata = await self._interceptor.pre_get_tensorboard_time_series( request, metadata ) @@ -3300,6 +4169,33 @@ async 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.aiplatform_v1.TensorboardServiceClient.GetTensorboardTimeSeries", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "GetTensorboardTimeSeries", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncTensorboardServiceRestTransport._GetTensorboardTimeSeries._get_response( self._host, @@ -3327,6 +4223,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_get_tensorboard_time_series(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + tensorboard_time_series.TensorboardTimeSeries.to_json(response) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.TensorboardServiceAsyncClient.get_tensorboard_time_series", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "GetTensorboardTimeSeries", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ListTensorboardExperiments( @@ -3367,7 +4287,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> tensorboard_service.ListTensorboardExperimentsResponse: r"""Call the list tensorboard experiments method over HTTP. @@ -3379,8 +4299,10 @@ async def __call__( 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: ~.tensorboard_service.ListTensorboardExperimentsResponse: @@ -3392,6 +4314,7 @@ async def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseListTensorboardExperiments._get_http_options() ) + ( request, metadata, @@ -3407,6 +4330,33 @@ async 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.aiplatform_v1.TensorboardServiceClient.ListTensorboardExperiments", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "ListTensorboardExperiments", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncTensorboardServiceRestTransport._ListTensorboardExperiments._get_response( self._host, @@ -3434,6 +4384,32 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_list_tensorboard_experiments(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + tensorboard_service.ListTensorboardExperimentsResponse.to_json( + response + ) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.TensorboardServiceAsyncClient.list_tensorboard_experiments", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "ListTensorboardExperiments", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ListTensorboardRuns( @@ -3472,7 +4448,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> tensorboard_service.ListTensorboardRunsResponse: r"""Call the list tensorboard runs method over HTTP. @@ -3483,8 +4459,10 @@ async def __call__( 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: ~.tensorboard_service.ListTensorboardRunsResponse: @@ -3496,6 +4474,7 @@ async def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseListTensorboardRuns._get_http_options() ) + request, metadata = await self._interceptor.pre_list_tensorboard_runs( request, metadata ) @@ -3508,6 +4487,33 @@ async 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.aiplatform_v1.TensorboardServiceClient.ListTensorboardRuns", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "ListTensorboardRuns", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncTensorboardServiceRestTransport._ListTensorboardRuns._get_response( self._host, @@ -3535,6 +4541,32 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_list_tensorboard_runs(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + tensorboard_service.ListTensorboardRunsResponse.to_json( + response + ) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.TensorboardServiceAsyncClient.list_tensorboard_runs", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "ListTensorboardRuns", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ListTensorboards( @@ -3573,7 +4605,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> tensorboard_service.ListTensorboardsResponse: r"""Call the list tensorboards method over HTTP. @@ -3584,8 +4616,10 @@ async def __call__( 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: ~.tensorboard_service.ListTensorboardsResponse: @@ -3597,6 +4631,7 @@ async def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseListTensorboards._get_http_options() ) + request, metadata = await self._interceptor.pre_list_tensorboards( request, metadata ) @@ -3609,6 +4644,33 @@ async 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.aiplatform_v1.TensorboardServiceClient.ListTensorboards", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "ListTensorboards", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncTensorboardServiceRestTransport._ListTensorboards._get_response( self._host, @@ -3636,6 +4698,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_list_tensorboards(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + tensorboard_service.ListTensorboardsResponse.to_json(response) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.TensorboardServiceAsyncClient.list_tensorboards", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "ListTensorboards", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ListTensorboardTimeSeries( @@ -3676,7 +4762,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> tensorboard_service.ListTensorboardTimeSeriesResponse: r"""Call the list tensorboard time series method over HTTP. @@ -3688,8 +4774,10 @@ async def __call__( 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: ~.tensorboard_service.ListTensorboardTimeSeriesResponse: @@ -3701,6 +4789,7 @@ async def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseListTensorboardTimeSeries._get_http_options() ) + ( request, metadata, @@ -3716,6 +4805,33 @@ async 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.aiplatform_v1.TensorboardServiceClient.ListTensorboardTimeSeries", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "ListTensorboardTimeSeries", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncTensorboardServiceRestTransport._ListTensorboardTimeSeries._get_response( self._host, @@ -3743,6 +4859,32 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_list_tensorboard_time_series(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + tensorboard_service.ListTensorboardTimeSeriesResponse.to_json( + response + ) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.TensorboardServiceAsyncClient.list_tensorboard_time_series", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "ListTensorboardTimeSeries", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ReadTensorboardBlobData( @@ -3781,7 +4923,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> rest_streaming_async.AsyncResponseIterator: r"""Call the read tensorboard blob data method over HTTP. @@ -3793,8 +4935,10 @@ async def __call__( 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: ~.tensorboard_service.ReadTensorboardBlobDataResponse: @@ -3806,6 +4950,7 @@ async def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseReadTensorboardBlobData._get_http_options() ) + request, metadata = await self._interceptor.pre_read_tensorboard_blob_data( request, metadata ) @@ -3818,6 +4963,33 @@ async 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.aiplatform_v1.TensorboardServiceClient.ReadTensorboardBlobData", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "ReadTensorboardBlobData", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncTensorboardServiceRestTransport._ReadTensorboardBlobData._get_response( self._host, @@ -3882,7 +5054,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> tensorboard_service.ReadTensorboardSizeResponse: r"""Call the read tensorboard size method over HTTP. @@ -3893,8 +5065,10 @@ async def __call__( 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: ~.tensorboard_service.ReadTensorboardSizeResponse: @@ -3906,6 +5080,7 @@ async def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseReadTensorboardSize._get_http_options() ) + request, metadata = await self._interceptor.pre_read_tensorboard_size( request, metadata ) @@ -3918,6 +5093,33 @@ async 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.aiplatform_v1.TensorboardServiceClient.ReadTensorboardSize", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "ReadTensorboardSize", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncTensorboardServiceRestTransport._ReadTensorboardSize._get_response( self._host, @@ -3945,6 +5147,32 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_read_tensorboard_size(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + tensorboard_service.ReadTensorboardSizeResponse.to_json( + response + ) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.TensorboardServiceAsyncClient.read_tensorboard_size", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "ReadTensorboardSize", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ReadTensorboardTimeSeriesData( @@ -3985,7 +5213,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> tensorboard_service.ReadTensorboardTimeSeriesDataResponse: r"""Call the read tensorboard time series data method over HTTP. @@ -3997,8 +5225,10 @@ async def __call__( 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: ~.tensorboard_service.ReadTensorboardTimeSeriesDataResponse: @@ -4010,6 +5240,7 @@ async def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseReadTensorboardTimeSeriesData._get_http_options() ) + ( request, metadata, @@ -4025,6 +5256,33 @@ async 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.aiplatform_v1.TensorboardServiceClient.ReadTensorboardTimeSeriesData", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "ReadTensorboardTimeSeriesData", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncTensorboardServiceRestTransport._ReadTensorboardTimeSeriesData._get_response( self._host, @@ -4052,6 +5310,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_read_tensorboard_time_series_data(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = tensorboard_service.ReadTensorboardTimeSeriesDataResponse.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.TensorboardServiceAsyncClient.read_tensorboard_time_series_data", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "ReadTensorboardTimeSeriesData", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ReadTensorboardUsage( @@ -4090,7 +5372,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> tensorboard_service.ReadTensorboardUsageResponse: r"""Call the read tensorboard usage method over HTTP. @@ -4101,8 +5383,10 @@ async def __call__( 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: ~.tensorboard_service.ReadTensorboardUsageResponse: @@ -4114,6 +5398,7 @@ async def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseReadTensorboardUsage._get_http_options() ) + request, metadata = await self._interceptor.pre_read_tensorboard_usage( request, metadata ) @@ -4126,6 +5411,33 @@ async 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.aiplatform_v1.TensorboardServiceClient.ReadTensorboardUsage", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "ReadTensorboardUsage", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncTensorboardServiceRestTransport._ReadTensorboardUsage._get_response( self._host, @@ -4153,6 +5465,32 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_read_tensorboard_usage(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + tensorboard_service.ReadTensorboardUsageResponse.to_json( + response + ) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.TensorboardServiceAsyncClient.read_tensorboard_usage", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "ReadTensorboardUsage", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _UpdateTensorboard( @@ -4192,7 +5530,7 @@ async 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 tensorboard method over HTTP. @@ -4203,8 +5541,10 @@ async def __call__( 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: @@ -4217,6 +5557,7 @@ async def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseUpdateTensorboard._get_http_options() ) + request, metadata = await self._interceptor.pre_update_tensorboard( request, metadata ) @@ -4233,6 +5574,33 @@ async 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.aiplatform_v1.TensorboardServiceClient.UpdateTensorboard", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "UpdateTensorboard", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncTensorboardServiceRestTransport._UpdateTensorboard._get_response( self._host, @@ -4261,6 +5629,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_update_tensorboard(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.TensorboardServiceAsyncClient.update_tensorboard", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "UpdateTensorboard", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _UpdateTensorboardExperiment( @@ -4302,7 +5692,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> gca_tensorboard_experiment.TensorboardExperiment: r"""Call the update tensorboard experiment method over HTTP. @@ -4314,8 +5704,10 @@ async def __call__( 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: ~.gca_tensorboard_experiment.TensorboardExperiment: @@ -4329,6 +5721,7 @@ async def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseUpdateTensorboardExperiment._get_http_options() ) + ( request, metadata, @@ -4348,6 +5741,33 @@ async 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.aiplatform_v1.TensorboardServiceClient.UpdateTensorboardExperiment", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "UpdateTensorboardExperiment", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncTensorboardServiceRestTransport._UpdateTensorboardExperiment._get_response( self._host, @@ -4376,6 +5796,32 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_update_tensorboard_experiment(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + gca_tensorboard_experiment.TensorboardExperiment.to_json( + response + ) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.TensorboardServiceAsyncClient.update_tensorboard_experiment", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "UpdateTensorboardExperiment", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _UpdateTensorboardRun( @@ -4415,7 +5861,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> gca_tensorboard_run.TensorboardRun: r"""Call the update tensorboard run method over HTTP. @@ -4426,8 +5872,10 @@ async def __call__( 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: ~.gca_tensorboard_run.TensorboardRun: @@ -4441,6 +5889,7 @@ async def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseUpdateTensorboardRun._get_http_options() ) + request, metadata = await self._interceptor.pre_update_tensorboard_run( request, metadata ) @@ -4457,6 +5906,33 @@ async 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.aiplatform_v1.TensorboardServiceClient.UpdateTensorboardRun", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "UpdateTensorboardRun", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncTensorboardServiceRestTransport._UpdateTensorboardRun._get_response( self._host, @@ -4485,6 +5961,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_update_tensorboard_run(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gca_tensorboard_run.TensorboardRun.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.TensorboardServiceAsyncClient.update_tensorboard_run", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "UpdateTensorboardRun", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _UpdateTensorboardTimeSeries( @@ -4526,7 +6026,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> gca_tensorboard_time_series.TensorboardTimeSeries: r"""Call the update tensorboard time series method over HTTP. @@ -4538,8 +6038,10 @@ async def __call__( 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: ~.gca_tensorboard_time_series.TensorboardTimeSeries: @@ -4551,6 +6053,7 @@ async def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseUpdateTensorboardTimeSeries._get_http_options() ) + ( request, metadata, @@ -4570,6 +6073,33 @@ async 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.aiplatform_v1.TensorboardServiceClient.UpdateTensorboardTimeSeries", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "UpdateTensorboardTimeSeries", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncTensorboardServiceRestTransport._UpdateTensorboardTimeSeries._get_response( self._host, @@ -4598,6 +6128,32 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_update_tensorboard_time_series(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + gca_tensorboard_time_series.TensorboardTimeSeries.to_json( + response + ) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.TensorboardServiceAsyncClient.update_tensorboard_time_series", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "UpdateTensorboardTimeSeries", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _WriteTensorboardExperimentData( @@ -4639,7 +6195,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> tensorboard_service.WriteTensorboardExperimentDataResponse: r"""Call the write tensorboard experiment data method over HTTP. @@ -4651,8 +6207,10 @@ async def __call__( 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: ~.tensorboard_service.WriteTensorboardExperimentDataResponse: @@ -4664,6 +6222,7 @@ async def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseWriteTensorboardExperimentData._get_http_options() ) + ( request, metadata, @@ -4683,6 +6242,33 @@ async 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.aiplatform_v1.TensorboardServiceClient.WriteTensorboardExperimentData", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "WriteTensorboardExperimentData", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncTensorboardServiceRestTransport._WriteTensorboardExperimentData._get_response( self._host, @@ -4713,6 +6299,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_write_tensorboard_experiment_data(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = tensorboard_service.WriteTensorboardExperimentDataResponse.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.TensorboardServiceAsyncClient.write_tensorboard_experiment_data", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "WriteTensorboardExperimentData", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _WriteTensorboardRunData( @@ -4752,7 +6362,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> tensorboard_service.WriteTensorboardRunDataResponse: r"""Call the write tensorboard run data method over HTTP. @@ -4764,8 +6374,10 @@ async def __call__( 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: ~.tensorboard_service.WriteTensorboardRunDataResponse: @@ -4777,6 +6389,7 @@ async def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseWriteTensorboardRunData._get_http_options() ) + request, metadata = await self._interceptor.pre_write_tensorboard_run_data( request, metadata ) @@ -4793,6 +6406,33 @@ async 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.aiplatform_v1.TensorboardServiceClient.WriteTensorboardRunData", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "WriteTensorboardRunData", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncTensorboardServiceRestTransport._WriteTensorboardRunData._get_response( self._host, @@ -4821,6 +6461,32 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_write_tensorboard_run_data(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + tensorboard_service.WriteTensorboardRunDataResponse.to_json( + response + ) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.TensorboardServiceAsyncClient.write_tensorboard_run_data", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "WriteTensorboardRunData", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp @property @@ -7002,7 +8668,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -7013,8 +8679,10 @@ async def __call__( 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: locations_pb2.Location: Response from GetLocation method. @@ -7023,6 +8691,7 @@ async def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_location( request, metadata ) @@ -7035,6 +8704,33 @@ async 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.aiplatform_v1.TensorboardServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncTensorboardServiceRestTransport._GetLocation._get_response( @@ -7062,6 +8758,27 @@ async def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_location(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.aiplatform_v1.TensorboardServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -7104,7 +8821,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -7115,8 +8832,10 @@ async def __call__( 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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -7125,6 +8844,7 @@ async def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_locations( request, metadata ) @@ -7137,6 +8857,33 @@ async 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.aiplatform_v1.TensorboardServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncTensorboardServiceRestTransport._ListLocations._get_response( @@ -7164,6 +8911,27 @@ async def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_list_locations(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.aiplatform_v1.TensorboardServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -7206,7 +8974,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -7217,8 +8985,10 @@ async def __call__( 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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -7227,6 +8997,7 @@ async def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_get_iam_policy( request, metadata ) @@ -7239,6 +9010,33 @@ async 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.aiplatform_v1.TensorboardServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncTensorboardServiceRestTransport._GetIamPolicy._get_response( @@ -7266,6 +9064,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_iam_policy(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.aiplatform_v1.TensorboardServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -7309,7 +9128,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -7320,8 +9139,10 @@ async def __call__( 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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -7330,6 +9151,7 @@ async def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_set_iam_policy( request, metadata ) @@ -7346,6 +9168,33 @@ async 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.aiplatform_v1.TensorboardServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncTensorboardServiceRestTransport._SetIamPolicy._get_response( @@ -7374,6 +9223,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_set_iam_policy(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.aiplatform_v1.TensorboardServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -7416,7 +9286,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -7427,8 +9297,10 @@ async def __call__( 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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -7437,6 +9309,7 @@ async def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = await self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -7449,6 +9322,33 @@ async 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.aiplatform_v1.TensorboardServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncTensorboardServiceRestTransport._TestIamPermissions._get_response( self._host, @@ -7474,6 +9374,27 @@ async def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_test_iam_permissions(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.aiplatform_v1.TensorboardServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -7516,7 +9437,7 @@ async 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 cancel operation method over HTTP. @@ -7527,13 +9448,16 @@ async def __call__( 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`. """ http_options = ( _BaseTensorboardServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_cancel_operation( request, metadata ) @@ -7546,6 +9470,33 @@ async 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.aiplatform_v1.TensorboardServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncTensorboardServiceRestTransport._CancelOperation._get_response( self._host, @@ -7609,7 +9560,7 @@ async 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. @@ -7620,13 +9571,16 @@ async def __call__( 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`. """ http_options = ( _BaseTensorboardServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_operation( request, metadata ) @@ -7639,6 +9593,33 @@ async 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.aiplatform_v1.TensorboardServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncTensorboardServiceRestTransport._DeleteOperation._get_response( self._host, @@ -7702,7 +9683,7 @@ async 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. @@ -7713,8 +9694,10 @@ async def __call__( 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: Response from GetOperation method. @@ -7723,6 +9706,7 @@ async def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_operation( request, metadata ) @@ -7735,6 +9719,33 @@ async 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.aiplatform_v1.TensorboardServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncTensorboardServiceRestTransport._GetOperation._get_response( @@ -7762,6 +9773,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1.TensorboardServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -7804,7 +9836,7 @@ async 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. @@ -7815,8 +9847,10 @@ async def __call__( 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 from ListOperations method. @@ -7825,6 +9859,7 @@ async def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_operations( request, metadata ) @@ -7837,6 +9872,33 @@ async 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.aiplatform_v1.TensorboardServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncTensorboardServiceRestTransport._ListOperations._get_response( self._host, @@ -7862,6 +9924,27 @@ async def __call__( resp = operations_pb2.ListOperationsResponse() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1.TensorboardServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -7904,7 +9987,7 @@ async 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 wait operation method over HTTP. @@ -7915,8 +9998,10 @@ async def __call__( 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: Response from WaitOperation method. @@ -7925,6 +10010,7 @@ async def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_wait_operation( request, metadata ) @@ -7937,6 +10023,33 @@ async 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.aiplatform_v1.TensorboardServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncTensorboardServiceRestTransport._WaitOperation._get_response( @@ -7964,6 +10077,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_wait_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.aiplatform_v1.TensorboardServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.TensorboardService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1/services/vertex_rag_data_service/async_client.py b/google/cloud/aiplatform_v1/services/vertex_rag_data_service/async_client.py index f177342c53..e9654ca098 100644 --- a/google/cloud/aiplatform_v1/services/vertex_rag_data_service/async_client.py +++ b/google/cloud/aiplatform_v1/services/vertex_rag_data_service/async_client.py @@ -13,6 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging as std_logging from collections import OrderedDict import re from typing import ( @@ -61,6 +62,15 @@ from .transports.grpc_asyncio import VertexRagDataServiceGrpcAsyncIOTransport from .client import VertexRagDataServiceClient +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 VertexRagDataServiceAsyncClient: """A service for managing user data for RAG.""" @@ -282,6 +292,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.aiplatform_v1.VertexRagDataServiceAsyncClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagDataService", + "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.aiplatform.v1.VertexRagDataService", + "credentialsType": None, + }, + ) + async def create_rag_corpus( self, request: Optional[ @@ -292,7 +324,7 @@ async def create_rag_corpus( rag_corpus: Optional[vertex_rag_data.RagCorpus] = 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"""Creates a RagCorpus. @@ -350,8 +382,10 @@ async def sample_create_rag_corpus(): 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: @@ -426,7 +460,7 @@ async def update_rag_corpus( rag_corpus: Optional[vertex_rag_data.RagCorpus] = 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"""Updates a RagCorpus. @@ -477,8 +511,10 @@ async def sample_update_rag_corpus(): 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: @@ -553,7 +589,7 @@ async def get_rag_corpus( 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]]] = (), ) -> vertex_rag_data.RagCorpus: r"""Gets a RagCorpus. @@ -597,8 +633,10 @@ async def sample_get_rag_corpus(): 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.aiplatform_v1.types.RagCorpus: @@ -662,7 +700,7 @@ async def list_rag_corpora( 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.ListRagCorporaAsyncPager: r"""Lists RagCorpora in a Location. @@ -708,8 +746,10 @@ async def sample_list_rag_corpora(): 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.aiplatform_v1.services.vertex_rag_data_service.pagers.ListRagCorporaAsyncPager: @@ -786,7 +826,7 @@ async def delete_rag_corpus( 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"""Deletes a RagCorpus. @@ -835,8 +875,10 @@ async def sample_delete_rag_corpus(): 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: @@ -919,7 +961,7 @@ async def upload_rag_file( upload_rag_file_config: Optional[vertex_rag_data.UploadRagFileConfig] = 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]]] = (), ) -> vertex_rag_data_service.UploadRagFileResponse: r"""Upload a file into a RagCorpus. @@ -982,8 +1024,10 @@ async def sample_upload_rag_file(): 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.aiplatform_v1.types.UploadRagFileResponse: @@ -1051,7 +1095,7 @@ async def import_rag_files( import_rag_files_config: Optional[vertex_rag_data.ImportRagFilesConfig] = 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"""Import files from Google Cloud Storage or Google Drive into a RagCorpus. @@ -1114,8 +1158,10 @@ async def sample_import_rag_files(): 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: @@ -1190,7 +1236,7 @@ async def get_rag_file( 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]]] = (), ) -> vertex_rag_data.RagFile: r"""Gets a RagFile. @@ -1234,8 +1280,10 @@ async def sample_get_rag_file(): 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.aiplatform_v1.types.RagFile: @@ -1298,7 +1346,7 @@ async def list_rag_files( 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.ListRagFilesAsyncPager: r"""Lists RagFiles in a RagCorpus. @@ -1344,8 +1392,10 @@ async def sample_list_rag_files(): 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.aiplatform_v1.services.vertex_rag_data_service.pagers.ListRagFilesAsyncPager: @@ -1422,7 +1472,7 @@ async def delete_rag_file( 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"""Deletes a RagFile. @@ -1471,8 +1521,10 @@ async def sample_delete_rag_file(): 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: @@ -1550,7 +1602,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. @@ -1561,8 +1613,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. @@ -1603,7 +1657,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. @@ -1614,8 +1668,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. @@ -1656,7 +1712,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. @@ -1672,8 +1728,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 """ @@ -1710,7 +1768,7 @@ async def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -1725,8 +1783,10 @@ async def cancel_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 """ @@ -1763,7 +1823,7 @@ async def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -1780,8 +1840,10 @@ async def wait_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. @@ -1822,7 +1884,7 @@ async def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -1835,8 +1897,10 @@ async def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -1941,7 +2005,7 @@ async def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -1955,8 +2019,10 @@ async def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -2061,7 +2127,7 @@ async def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -2076,8 +2142,10 @@ async def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -2121,7 +2189,7 @@ async def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -2132,8 +2200,10 @@ async def get_location( 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: ~.location_pb2.Location: Location object. @@ -2174,7 +2244,7 @@ async def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -2185,8 +2255,10 @@ async def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1/services/vertex_rag_data_service/client.py b/google/cloud/aiplatform_v1/services/vertex_rag_data_service/client.py index 950f3f2f1f..184f1a230b 100644 --- a/google/cloud/aiplatform_v1/services/vertex_rag_data_service/client.py +++ b/google/cloud/aiplatform_v1/services/vertex_rag_data_service/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 ( @@ -48,6 +49,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 as gac_operation # type: ignore from google.api_core import operation_async # type: ignore from google.cloud.aiplatform_v1.services.vertex_rag_data_service import pagers @@ -697,6 +707,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( @@ -788,6 +802,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.aiplatform_v1.VertexRagDataServiceClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagDataService", + "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.aiplatform.v1.VertexRagDataService", + "credentialsType": None, + }, + ) + def create_rag_corpus( self, request: Optional[ @@ -798,7 +835,7 @@ def create_rag_corpus( rag_corpus: Optional[vertex_rag_data.RagCorpus] = 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]]] = (), ) -> gac_operation.Operation: r"""Creates a RagCorpus. @@ -856,8 +893,10 @@ def sample_create_rag_corpus(): 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: @@ -929,7 +968,7 @@ def update_rag_corpus( rag_corpus: Optional[vertex_rag_data.RagCorpus] = 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]]] = (), ) -> gac_operation.Operation: r"""Updates a RagCorpus. @@ -980,8 +1019,10 @@ def sample_update_rag_corpus(): 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: @@ -1053,7 +1094,7 @@ def get_rag_corpus( 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]]] = (), ) -> vertex_rag_data.RagCorpus: r"""Gets a RagCorpus. @@ -1097,8 +1138,10 @@ def sample_get_rag_corpus(): 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.aiplatform_v1.types.RagCorpus: @@ -1159,7 +1202,7 @@ def list_rag_corpora( 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.ListRagCorporaPager: r"""Lists RagCorpora in a Location. @@ -1205,8 +1248,10 @@ def sample_list_rag_corpora(): 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.aiplatform_v1.services.vertex_rag_data_service.pagers.ListRagCorporaPager: @@ -1280,7 +1325,7 @@ def delete_rag_corpus( 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]]] = (), ) -> gac_operation.Operation: r"""Deletes a RagCorpus. @@ -1329,8 +1374,10 @@ def sample_delete_rag_corpus(): 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: @@ -1410,7 +1457,7 @@ def upload_rag_file( upload_rag_file_config: Optional[vertex_rag_data.UploadRagFileConfig] = 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]]] = (), ) -> vertex_rag_data_service.UploadRagFileResponse: r"""Upload a file into a RagCorpus. @@ -1473,8 +1520,10 @@ def sample_upload_rag_file(): 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.aiplatform_v1.types.UploadRagFileResponse: @@ -1539,7 +1588,7 @@ def import_rag_files( import_rag_files_config: Optional[vertex_rag_data.ImportRagFilesConfig] = 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]]] = (), ) -> gac_operation.Operation: r"""Import files from Google Cloud Storage or Google Drive into a RagCorpus. @@ -1602,8 +1651,10 @@ def sample_import_rag_files(): 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: @@ -1675,7 +1726,7 @@ def get_rag_file( 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]]] = (), ) -> vertex_rag_data.RagFile: r"""Gets a RagFile. @@ -1719,8 +1770,10 @@ def sample_get_rag_file(): 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.aiplatform_v1.types.RagFile: @@ -1780,7 +1833,7 @@ def list_rag_files( 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.ListRagFilesPager: r"""Lists RagFiles in a RagCorpus. @@ -1826,8 +1879,10 @@ def sample_list_rag_files(): 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.aiplatform_v1.services.vertex_rag_data_service.pagers.ListRagFilesPager: @@ -1901,7 +1956,7 @@ def delete_rag_file( 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]]] = (), ) -> gac_operation.Operation: r"""Deletes a RagFile. @@ -1950,8 +2005,10 @@ def sample_delete_rag_file(): 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: @@ -2039,7 +2096,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. @@ -2050,8 +2107,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. @@ -2092,7 +2151,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. @@ -2103,8 +2162,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. @@ -2145,7 +2206,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. @@ -2161,8 +2222,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 """ @@ -2199,7 +2262,7 @@ def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -2214,8 +2277,10 @@ def cancel_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 """ @@ -2252,7 +2317,7 @@ def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -2269,8 +2334,10 @@ def wait_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. @@ -2311,7 +2378,7 @@ def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -2324,8 +2391,10 @@ def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -2430,7 +2499,7 @@ def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -2444,8 +2513,10 @@ def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -2550,7 +2621,7 @@ def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -2565,8 +2636,10 @@ def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -2608,7 +2681,7 @@ def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -2619,8 +2692,10 @@ def get_location( 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: ~.location_pb2.Location: Location object. @@ -2661,7 +2736,7 @@ def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -2672,8 +2747,10 @@ def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1/services/vertex_rag_data_service/pagers.py b/google/cloud/aiplatform_v1/services/vertex_rag_data_service/pagers.py index b8c5052e10..ae588cf82e 100644 --- a/google/cloud/aiplatform_v1/services/vertex_rag_data_service/pagers.py +++ b/google/cloud/aiplatform_v1/services/vertex_rag_data_service/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 = vertex_rag_data_service.ListRagCorporaRequest(request) @@ -143,7 +145,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. @@ -157,8 +159,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 = vertex_rag_data_service.ListRagCorporaRequest(request) @@ -223,7 +227,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. @@ -237,8 +241,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 = vertex_rag_data_service.ListRagFilesRequest(request) @@ -297,7 +303,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. @@ -311,8 +317,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 = vertex_rag_data_service.ListRagFilesRequest(request) diff --git a/google/cloud/aiplatform_v1/services/vertex_rag_data_service/transports/grpc.py b/google/cloud/aiplatform_v1/services/vertex_rag_data_service/transports/grpc.py index 5b87a68dec..a6bb2046c5 100644 --- a/google/cloud/aiplatform_v1/services/vertex_rag_data_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1/services/vertex_rag_data_service/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 import warnings from typing import Callable, Dict, Optional, Sequence, Tuple, Union @@ -22,8 +25,11 @@ import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from google.cloud.aiplatform_v1.types import vertex_rag_data from google.cloud.aiplatform_v1.types import vertex_rag_data_service @@ -33,6 +39,81 @@ from google.longrunning import operations_pb2 # type: ignore from .base import VertexRagDataServiceTransport, DEFAULT_CLIENT_INFO +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.aiplatform.v1.VertexRagDataService", + "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.aiplatform.v1.VertexRagDataService", + "rpcName": client_call_details.method, + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class VertexRagDataServiceGrpcTransport(VertexRagDataServiceTransport): """gRPC backend transport for VertexRagDataService. @@ -187,7 +268,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 @@ -251,7 +337,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 @@ -277,7 +365,7 @@ def create_rag_corpus( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_rag_corpus" not in self._stubs: - self._stubs["create_rag_corpus"] = self.grpc_channel.unary_unary( + self._stubs["create_rag_corpus"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.VertexRagDataService/CreateRagCorpus", request_serializer=vertex_rag_data_service.CreateRagCorpusRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -305,7 +393,7 @@ def update_rag_corpus( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_rag_corpus" not in self._stubs: - self._stubs["update_rag_corpus"] = self.grpc_channel.unary_unary( + self._stubs["update_rag_corpus"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.VertexRagDataService/UpdateRagCorpus", request_serializer=vertex_rag_data_service.UpdateRagCorpusRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -333,7 +421,7 @@ def get_rag_corpus( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_rag_corpus" not in self._stubs: - self._stubs["get_rag_corpus"] = self.grpc_channel.unary_unary( + self._stubs["get_rag_corpus"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.VertexRagDataService/GetRagCorpus", request_serializer=vertex_rag_data_service.GetRagCorpusRequest.serialize, response_deserializer=vertex_rag_data.RagCorpus.deserialize, @@ -362,7 +450,7 @@ def list_rag_corpora( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_rag_corpora" not in self._stubs: - self._stubs["list_rag_corpora"] = self.grpc_channel.unary_unary( + self._stubs["list_rag_corpora"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.VertexRagDataService/ListRagCorpora", request_serializer=vertex_rag_data_service.ListRagCorporaRequest.serialize, response_deserializer=vertex_rag_data_service.ListRagCorporaResponse.deserialize, @@ -390,7 +478,7 @@ def delete_rag_corpus( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_rag_corpus" not in self._stubs: - self._stubs["delete_rag_corpus"] = self.grpc_channel.unary_unary( + self._stubs["delete_rag_corpus"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.VertexRagDataService/DeleteRagCorpus", request_serializer=vertex_rag_data_service.DeleteRagCorpusRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -419,7 +507,7 @@ def upload_rag_file( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "upload_rag_file" not in self._stubs: - self._stubs["upload_rag_file"] = self.grpc_channel.unary_unary( + self._stubs["upload_rag_file"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.VertexRagDataService/UploadRagFile", request_serializer=vertex_rag_data_service.UploadRagFileRequest.serialize, response_deserializer=vertex_rag_data_service.UploadRagFileResponse.deserialize, @@ -448,7 +536,7 @@ def import_rag_files( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "import_rag_files" not in self._stubs: - self._stubs["import_rag_files"] = self.grpc_channel.unary_unary( + self._stubs["import_rag_files"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.VertexRagDataService/ImportRagFiles", request_serializer=vertex_rag_data_service.ImportRagFilesRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -474,7 +562,7 @@ def get_rag_file( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_rag_file" not in self._stubs: - self._stubs["get_rag_file"] = self.grpc_channel.unary_unary( + self._stubs["get_rag_file"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.VertexRagDataService/GetRagFile", request_serializer=vertex_rag_data_service.GetRagFileRequest.serialize, response_deserializer=vertex_rag_data.RagFile.deserialize, @@ -503,7 +591,7 @@ def list_rag_files( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_rag_files" not in self._stubs: - self._stubs["list_rag_files"] = self.grpc_channel.unary_unary( + self._stubs["list_rag_files"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.VertexRagDataService/ListRagFiles", request_serializer=vertex_rag_data_service.ListRagFilesRequest.serialize, response_deserializer=vertex_rag_data_service.ListRagFilesResponse.deserialize, @@ -531,7 +619,7 @@ def delete_rag_file( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_rag_file" not in self._stubs: - self._stubs["delete_rag_file"] = self.grpc_channel.unary_unary( + self._stubs["delete_rag_file"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.VertexRagDataService/DeleteRagFile", request_serializer=vertex_rag_data_service.DeleteRagFileRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -539,7 +627,7 @@ def delete_rag_file( return self._stubs["delete_rag_file"] def close(self): - self.grpc_channel.close() + self._logged_channel.close() @property def delete_operation( @@ -551,7 +639,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, @@ -568,7 +656,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -585,7 +673,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -602,7 +690,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, @@ -621,7 +709,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, @@ -640,7 +728,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -657,7 +745,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -682,7 +770,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -708,7 +796,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -737,7 +825,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1/services/vertex_rag_data_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1/services/vertex_rag_data_service/transports/grpc_asyncio.py index 0e9f933d0c..26eb42de17 100644 --- a/google/cloud/aiplatform_v1/services/vertex_rag_data_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1/services/vertex_rag_data_service/transports/grpc_asyncio.py @@ -14,6 +14,9 @@ # limitations under the License. # import inspect +import json +import pickle +import logging as std_logging import warnings from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union @@ -24,8 +27,11 @@ from google.api_core import operations_v1 from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from grpc.experimental import aio # type: ignore from google.cloud.aiplatform_v1.types import vertex_rag_data @@ -37,6 +43,82 @@ from .base import VertexRagDataServiceTransport, DEFAULT_CLIENT_INFO from .grpc import VertexRagDataServiceGrpcTransport +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.aiplatform.v1.VertexRagDataService", + "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.aiplatform.v1.VertexRagDataService", + "rpcName": str(client_call_details.method), + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class VertexRagDataServiceGrpcAsyncIOTransport(VertexRagDataServiceTransport): """gRPC AsyncIO backend transport for VertexRagDataService. @@ -234,10 +316,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 @@ -260,7 +345,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. @@ -288,7 +373,7 @@ def create_rag_corpus( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_rag_corpus" not in self._stubs: - self._stubs["create_rag_corpus"] = self.grpc_channel.unary_unary( + self._stubs["create_rag_corpus"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.VertexRagDataService/CreateRagCorpus", request_serializer=vertex_rag_data_service.CreateRagCorpusRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -317,7 +402,7 @@ def update_rag_corpus( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_rag_corpus" not in self._stubs: - self._stubs["update_rag_corpus"] = self.grpc_channel.unary_unary( + self._stubs["update_rag_corpus"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.VertexRagDataService/UpdateRagCorpus", request_serializer=vertex_rag_data_service.UpdateRagCorpusRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -346,7 +431,7 @@ def get_rag_corpus( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_rag_corpus" not in self._stubs: - self._stubs["get_rag_corpus"] = self.grpc_channel.unary_unary( + self._stubs["get_rag_corpus"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.VertexRagDataService/GetRagCorpus", request_serializer=vertex_rag_data_service.GetRagCorpusRequest.serialize, response_deserializer=vertex_rag_data.RagCorpus.deserialize, @@ -375,7 +460,7 @@ def list_rag_corpora( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_rag_corpora" not in self._stubs: - self._stubs["list_rag_corpora"] = self.grpc_channel.unary_unary( + self._stubs["list_rag_corpora"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.VertexRagDataService/ListRagCorpora", request_serializer=vertex_rag_data_service.ListRagCorporaRequest.serialize, response_deserializer=vertex_rag_data_service.ListRagCorporaResponse.deserialize, @@ -404,7 +489,7 @@ def delete_rag_corpus( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_rag_corpus" not in self._stubs: - self._stubs["delete_rag_corpus"] = self.grpc_channel.unary_unary( + self._stubs["delete_rag_corpus"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.VertexRagDataService/DeleteRagCorpus", request_serializer=vertex_rag_data_service.DeleteRagCorpusRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -433,7 +518,7 @@ def upload_rag_file( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "upload_rag_file" not in self._stubs: - self._stubs["upload_rag_file"] = self.grpc_channel.unary_unary( + self._stubs["upload_rag_file"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.VertexRagDataService/UploadRagFile", request_serializer=vertex_rag_data_service.UploadRagFileRequest.serialize, response_deserializer=vertex_rag_data_service.UploadRagFileResponse.deserialize, @@ -463,7 +548,7 @@ def import_rag_files( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "import_rag_files" not in self._stubs: - self._stubs["import_rag_files"] = self.grpc_channel.unary_unary( + self._stubs["import_rag_files"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.VertexRagDataService/ImportRagFiles", request_serializer=vertex_rag_data_service.ImportRagFilesRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -491,7 +576,7 @@ def get_rag_file( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_rag_file" not in self._stubs: - self._stubs["get_rag_file"] = self.grpc_channel.unary_unary( + self._stubs["get_rag_file"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.VertexRagDataService/GetRagFile", request_serializer=vertex_rag_data_service.GetRagFileRequest.serialize, response_deserializer=vertex_rag_data.RagFile.deserialize, @@ -520,7 +605,7 @@ def list_rag_files( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_rag_files" not in self._stubs: - self._stubs["list_rag_files"] = self.grpc_channel.unary_unary( + self._stubs["list_rag_files"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.VertexRagDataService/ListRagFiles", request_serializer=vertex_rag_data_service.ListRagFilesRequest.serialize, response_deserializer=vertex_rag_data_service.ListRagFilesResponse.deserialize, @@ -549,7 +634,7 @@ def delete_rag_file( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_rag_file" not in self._stubs: - self._stubs["delete_rag_file"] = self.grpc_channel.unary_unary( + self._stubs["delete_rag_file"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.VertexRagDataService/DeleteRagFile", request_serializer=vertex_rag_data_service.DeleteRagFileRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -667,7 +752,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: @@ -683,7 +768,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, @@ -700,7 +785,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -717,7 +802,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -734,7 +819,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, @@ -753,7 +838,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, @@ -772,7 +857,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -789,7 +874,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -814,7 +899,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -840,7 +925,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -869,7 +954,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1/services/vertex_rag_data_service/transports/rest.py b/google/cloud/aiplatform_v1/services/vertex_rag_data_service/transports/rest.py index 151808912d..dbf455e7fb 100644 --- a/google/cloud/aiplatform_v1/services/vertex_rag_data_service/transports/rest.py +++ b/google/cloud/aiplatform_v1/services/vertex_rag_data_service/transports/rest.py @@ -13,9 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging +import json # type: ignore from google.auth.transport.requests import AuthorizedSession # type: ignore -import json # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.api_core import exceptions as core_exceptions from google.api_core import retry as retries @@ -48,6 +49,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, @@ -160,9 +169,10 @@ def post_upload_rag_file(self, response): def pre_create_rag_corpus( self, request: vertex_rag_data_service.CreateRagCorpusRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - vertex_rag_data_service.CreateRagCorpusRequest, Sequence[Tuple[str, str]] + vertex_rag_data_service.CreateRagCorpusRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for create_rag_corpus @@ -185,9 +195,10 @@ def post_create_rag_corpus( def pre_delete_rag_corpus( self, request: vertex_rag_data_service.DeleteRagCorpusRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - vertex_rag_data_service.DeleteRagCorpusRequest, Sequence[Tuple[str, str]] + vertex_rag_data_service.DeleteRagCorpusRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for delete_rag_corpus @@ -210,8 +221,11 @@ def post_delete_rag_corpus( def pre_delete_rag_file( self, request: vertex_rag_data_service.DeleteRagFileRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[vertex_rag_data_service.DeleteRagFileRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + vertex_rag_data_service.DeleteRagFileRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for delete_rag_file Override in a subclass to manipulate the request or metadata @@ -233,8 +247,11 @@ def post_delete_rag_file( def pre_get_rag_corpus( self, request: vertex_rag_data_service.GetRagCorpusRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[vertex_rag_data_service.GetRagCorpusRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + vertex_rag_data_service.GetRagCorpusRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for get_rag_corpus Override in a subclass to manipulate the request or metadata @@ -256,8 +273,11 @@ def post_get_rag_corpus( def pre_get_rag_file( self, request: vertex_rag_data_service.GetRagFileRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[vertex_rag_data_service.GetRagFileRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + vertex_rag_data_service.GetRagFileRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for get_rag_file Override in a subclass to manipulate the request or metadata @@ -279,9 +299,10 @@ def post_get_rag_file( def pre_import_rag_files( self, request: vertex_rag_data_service.ImportRagFilesRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - vertex_rag_data_service.ImportRagFilesRequest, Sequence[Tuple[str, str]] + vertex_rag_data_service.ImportRagFilesRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for import_rag_files @@ -304,9 +325,10 @@ def post_import_rag_files( def pre_list_rag_corpora( self, request: vertex_rag_data_service.ListRagCorporaRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - vertex_rag_data_service.ListRagCorporaRequest, Sequence[Tuple[str, str]] + vertex_rag_data_service.ListRagCorporaRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for list_rag_corpora @@ -329,8 +351,11 @@ def post_list_rag_corpora( def pre_list_rag_files( self, request: vertex_rag_data_service.ListRagFilesRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[vertex_rag_data_service.ListRagFilesRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + vertex_rag_data_service.ListRagFilesRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for list_rag_files Override in a subclass to manipulate the request or metadata @@ -352,9 +377,10 @@ def post_list_rag_files( def pre_update_rag_corpus( self, request: vertex_rag_data_service.UpdateRagCorpusRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - vertex_rag_data_service.UpdateRagCorpusRequest, Sequence[Tuple[str, str]] + vertex_rag_data_service.UpdateRagCorpusRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for update_rag_corpus @@ -377,8 +403,11 @@ def post_update_rag_corpus( def pre_upload_rag_file( self, request: vertex_rag_data_service.UploadRagFileRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[vertex_rag_data_service.UploadRagFileRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + vertex_rag_data_service.UploadRagFileRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for upload_rag_file Override in a subclass to manipulate the request or metadata @@ -400,8 +429,10 @@ def post_upload_rag_file( def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -423,8 +454,10 @@ def post_get_location( def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -446,8 +479,10 @@ def post_list_locations( def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -467,8 +502,10 @@ def post_get_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -488,8 +525,11 @@ def post_set_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -511,8 +551,10 @@ def post_test_iam_permissions( def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -532,8 +574,10 @@ def post_cancel_operation(self, response: None) -> None: 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 @@ -553,8 +597,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 @@ -576,8 +622,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 @@ -599,8 +647,10 @@ def post_list_operations( def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -2622,7 +2672,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 rag corpus method over HTTP. @@ -2633,8 +2683,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: @@ -2647,6 +2699,7 @@ def __call__( http_options = ( _BaseVertexRagDataServiceRestTransport._BaseCreateRagCorpus._get_http_options() ) + request, metadata = self._interceptor.pre_create_rag_corpus( request, metadata ) @@ -2663,6 +2716,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.aiplatform_v1.VertexRagDataServiceClient.CreateRagCorpus", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagDataService", + "rpcName": "CreateRagCorpus", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = VertexRagDataServiceRestTransport._CreateRagCorpus._get_response( self._host, @@ -2682,7 +2762,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_rag_corpus(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.aiplatform_v1.VertexRagDataServiceClient.create_rag_corpus", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagDataService", + "rpcName": "CreateRagCorpus", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _DeleteRagCorpus( @@ -2721,7 +2823,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 rag corpus method over HTTP. @@ -2732,8 +2834,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: @@ -2746,6 +2850,7 @@ def __call__( http_options = ( _BaseVertexRagDataServiceRestTransport._BaseDeleteRagCorpus._get_http_options() ) + request, metadata = self._interceptor.pre_delete_rag_corpus( request, metadata ) @@ -2758,6 +2863,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.aiplatform_v1.VertexRagDataServiceClient.DeleteRagCorpus", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagDataService", + "rpcName": "DeleteRagCorpus", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = VertexRagDataServiceRestTransport._DeleteRagCorpus._get_response( self._host, @@ -2776,7 +2908,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_rag_corpus(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.aiplatform_v1.VertexRagDataServiceClient.delete_rag_corpus", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagDataService", + "rpcName": "DeleteRagCorpus", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _DeleteRagFile( @@ -2815,7 +2969,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 rag file method over HTTP. @@ -2826,8 +2980,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: @@ -2840,6 +2996,7 @@ def __call__( http_options = ( _BaseVertexRagDataServiceRestTransport._BaseDeleteRagFile._get_http_options() ) + request, metadata = self._interceptor.pre_delete_rag_file(request, metadata) transcoded_request = _BaseVertexRagDataServiceRestTransport._BaseDeleteRagFile._get_transcoded_request( http_options, request @@ -2850,6 +3007,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.aiplatform_v1.VertexRagDataServiceClient.DeleteRagFile", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagDataService", + "rpcName": "DeleteRagFile", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = VertexRagDataServiceRestTransport._DeleteRagFile._get_response( self._host, @@ -2868,7 +3052,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_rag_file(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.aiplatform_v1.VertexRagDataServiceClient.delete_rag_file", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagDataService", + "rpcName": "DeleteRagFile", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _GetRagCorpus( @@ -2907,7 +3113,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]]] = (), ) -> vertex_rag_data.RagCorpus: r"""Call the get rag corpus method over HTTP. @@ -2918,8 +3124,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: ~.vertex_rag_data.RagCorpus: @@ -2932,6 +3140,7 @@ def __call__( http_options = ( _BaseVertexRagDataServiceRestTransport._BaseGetRagCorpus._get_http_options() ) + request, metadata = self._interceptor.pre_get_rag_corpus(request, metadata) transcoded_request = _BaseVertexRagDataServiceRestTransport._BaseGetRagCorpus._get_transcoded_request( http_options, request @@ -2942,6 +3151,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.aiplatform_v1.VertexRagDataServiceClient.GetRagCorpus", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagDataService", + "rpcName": "GetRagCorpus", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = VertexRagDataServiceRestTransport._GetRagCorpus._get_response( self._host, @@ -2962,7 +3198,29 @@ def __call__( pb_resp = vertex_rag_data.RagCorpus.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_rag_corpus(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = vertex_rag_data.RagCorpus.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.aiplatform_v1.VertexRagDataServiceClient.get_rag_corpus", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagDataService", + "rpcName": "GetRagCorpus", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _GetRagFile( @@ -3001,7 +3259,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]]] = (), ) -> vertex_rag_data.RagFile: r"""Call the get rag file method over HTTP. @@ -3012,8 +3270,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: ~.vertex_rag_data.RagFile: @@ -3025,6 +3285,7 @@ def __call__( http_options = ( _BaseVertexRagDataServiceRestTransport._BaseGetRagFile._get_http_options() ) + request, metadata = self._interceptor.pre_get_rag_file(request, metadata) transcoded_request = _BaseVertexRagDataServiceRestTransport._BaseGetRagFile._get_transcoded_request( http_options, request @@ -3035,6 +3296,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.aiplatform_v1.VertexRagDataServiceClient.GetRagFile", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagDataService", + "rpcName": "GetRagFile", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = VertexRagDataServiceRestTransport._GetRagFile._get_response( self._host, @@ -3055,7 +3343,29 @@ def __call__( pb_resp = vertex_rag_data.RagFile.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_rag_file(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = vertex_rag_data.RagFile.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.aiplatform_v1.VertexRagDataServiceClient.get_rag_file", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagDataService", + "rpcName": "GetRagFile", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ImportRagFiles( @@ -3095,7 +3405,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 import rag files method over HTTP. @@ -3106,8 +3416,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: @@ -3120,6 +3432,7 @@ def __call__( http_options = ( _BaseVertexRagDataServiceRestTransport._BaseImportRagFiles._get_http_options() ) + request, metadata = self._interceptor.pre_import_rag_files( request, metadata ) @@ -3136,6 +3449,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.aiplatform_v1.VertexRagDataServiceClient.ImportRagFiles", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagDataService", + "rpcName": "ImportRagFiles", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = VertexRagDataServiceRestTransport._ImportRagFiles._get_response( self._host, @@ -3155,7 +3495,29 @@ def __call__( # Return the response resp = operations_pb2.Operation() json_format.Parse(response.content, resp, ignore_unknown_fields=True) + resp = self._interceptor.post_import_rag_files(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.aiplatform_v1.VertexRagDataServiceClient.import_rag_files", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagDataService", + "rpcName": "ImportRagFiles", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListRagCorpora( @@ -3194,7 +3556,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]]] = (), ) -> vertex_rag_data_service.ListRagCorporaResponse: r"""Call the list rag corpora method over HTTP. @@ -3205,8 +3567,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: ~.vertex_rag_data_service.ListRagCorporaResponse: @@ -3218,6 +3582,7 @@ def __call__( http_options = ( _BaseVertexRagDataServiceRestTransport._BaseListRagCorpora._get_http_options() ) + request, metadata = self._interceptor.pre_list_rag_corpora( request, metadata ) @@ -3230,6 +3595,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.aiplatform_v1.VertexRagDataServiceClient.ListRagCorpora", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagDataService", + "rpcName": "ListRagCorpora", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = VertexRagDataServiceRestTransport._ListRagCorpora._get_response( self._host, @@ -3250,7 +3642,31 @@ def __call__( pb_resp = vertex_rag_data_service.ListRagCorporaResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_rag_corpora(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + vertex_rag_data_service.ListRagCorporaResponse.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.aiplatform_v1.VertexRagDataServiceClient.list_rag_corpora", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagDataService", + "rpcName": "ListRagCorpora", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListRagFiles( @@ -3289,7 +3705,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]]] = (), ) -> vertex_rag_data_service.ListRagFilesResponse: r"""Call the list rag files method over HTTP. @@ -3300,8 +3716,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: ~.vertex_rag_data_service.ListRagFilesResponse: @@ -3313,6 +3731,7 @@ def __call__( http_options = ( _BaseVertexRagDataServiceRestTransport._BaseListRagFiles._get_http_options() ) + request, metadata = self._interceptor.pre_list_rag_files(request, metadata) transcoded_request = _BaseVertexRagDataServiceRestTransport._BaseListRagFiles._get_transcoded_request( http_options, request @@ -3323,6 +3742,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.aiplatform_v1.VertexRagDataServiceClient.ListRagFiles", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagDataService", + "rpcName": "ListRagFiles", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = VertexRagDataServiceRestTransport._ListRagFiles._get_response( self._host, @@ -3343,7 +3789,31 @@ def __call__( pb_resp = vertex_rag_data_service.ListRagFilesResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_rag_files(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + vertex_rag_data_service.ListRagFilesResponse.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.aiplatform_v1.VertexRagDataServiceClient.list_rag_files", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagDataService", + "rpcName": "ListRagFiles", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _UpdateRagCorpus( @@ -3383,7 +3853,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 rag corpus method over HTTP. @@ -3394,8 +3864,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: @@ -3408,6 +3880,7 @@ def __call__( http_options = ( _BaseVertexRagDataServiceRestTransport._BaseUpdateRagCorpus._get_http_options() ) + request, metadata = self._interceptor.pre_update_rag_corpus( request, metadata ) @@ -3424,6 +3897,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.aiplatform_v1.VertexRagDataServiceClient.UpdateRagCorpus", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagDataService", + "rpcName": "UpdateRagCorpus", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = VertexRagDataServiceRestTransport._UpdateRagCorpus._get_response( self._host, @@ -3443,7 +3943,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_rag_corpus(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.aiplatform_v1.VertexRagDataServiceClient.update_rag_corpus", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagDataService", + "rpcName": "UpdateRagCorpus", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _UploadRagFile( @@ -3483,7 +4005,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]]] = (), ) -> vertex_rag_data_service.UploadRagFileResponse: r"""Call the upload rag file method over HTTP. @@ -3494,8 +4016,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: ~.vertex_rag_data_service.UploadRagFileResponse: @@ -3507,6 +4031,7 @@ def __call__( http_options = ( _BaseVertexRagDataServiceRestTransport._BaseUploadRagFile._get_http_options() ) + request, metadata = self._interceptor.pre_upload_rag_file(request, metadata) transcoded_request = _BaseVertexRagDataServiceRestTransport._BaseUploadRagFile._get_transcoded_request( http_options, request @@ -3521,6 +4046,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.aiplatform_v1.VertexRagDataServiceClient.UploadRagFile", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagDataService", + "rpcName": "UploadRagFile", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = VertexRagDataServiceRestTransport._UploadRagFile._get_response( self._host, @@ -3542,7 +4094,31 @@ def __call__( pb_resp = vertex_rag_data_service.UploadRagFileResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_upload_rag_file(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + vertex_rag_data_service.UploadRagFileResponse.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.aiplatform_v1.VertexRagDataServiceClient.upload_rag_file", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagDataService", + "rpcName": "UploadRagFile", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp @property @@ -3686,7 +4262,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]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -3697,8 +4273,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: locations_pb2.Location: Response from GetLocation method. @@ -3707,6 +4285,7 @@ def __call__( http_options = ( _BaseVertexRagDataServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = self._interceptor.pre_get_location(request, metadata) transcoded_request = _BaseVertexRagDataServiceRestTransport._BaseGetLocation._get_transcoded_request( http_options, request @@ -3717,6 +4296,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.aiplatform_v1.VertexRagDataServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagDataService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = VertexRagDataServiceRestTransport._GetLocation._get_response( self._host, @@ -3736,6 +4342,27 @@ def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_location(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.aiplatform_v1.VertexRagDataServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagDataService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3778,7 +4405,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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -3789,8 +4416,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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -3799,6 +4428,7 @@ def __call__( http_options = ( _BaseVertexRagDataServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = self._interceptor.pre_list_locations(request, metadata) transcoded_request = _BaseVertexRagDataServiceRestTransport._BaseListLocations._get_transcoded_request( http_options, request @@ -3809,6 +4439,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.aiplatform_v1.VertexRagDataServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagDataService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = VertexRagDataServiceRestTransport._ListLocations._get_response( self._host, @@ -3828,6 +4485,27 @@ def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_list_locations(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.aiplatform_v1.VertexRagDataServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagDataService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3870,7 +4548,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]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -3881,8 +4559,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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -3891,6 +4571,7 @@ def __call__( http_options = ( _BaseVertexRagDataServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_get_iam_policy(request, metadata) transcoded_request = _BaseVertexRagDataServiceRestTransport._BaseGetIamPolicy._get_transcoded_request( http_options, request @@ -3901,6 +4582,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.aiplatform_v1.VertexRagDataServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagDataService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = VertexRagDataServiceRestTransport._GetIamPolicy._get_response( self._host, @@ -3920,6 +4628,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_iam_policy(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.aiplatform_v1.VertexRagDataServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagDataService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3963,7 +4692,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]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -3974,8 +4703,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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -3984,6 +4715,7 @@ def __call__( http_options = ( _BaseVertexRagDataServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_set_iam_policy(request, metadata) transcoded_request = _BaseVertexRagDataServiceRestTransport._BaseSetIamPolicy._get_transcoded_request( http_options, request @@ -3998,6 +4730,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.aiplatform_v1.VertexRagDataServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagDataService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = VertexRagDataServiceRestTransport._SetIamPolicy._get_response( self._host, @@ -4018,6 +4777,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_set_iam_policy(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.aiplatform_v1.VertexRagDataServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagDataService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4060,7 +4840,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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -4071,8 +4851,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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -4081,6 +4863,7 @@ def __call__( http_options = ( _BaseVertexRagDataServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -4093,6 +4876,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.aiplatform_v1.VertexRagDataServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagDataService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( VertexRagDataServiceRestTransport._TestIamPermissions._get_response( @@ -4114,6 +4924,27 @@ def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_test_iam_permissions(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.aiplatform_v1.VertexRagDataServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagDataService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4156,7 +4987,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 cancel operation method over HTTP. @@ -4167,13 +4998,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 = ( _BaseVertexRagDataServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = self._interceptor.pre_cancel_operation( request, metadata ) @@ -4186,6 +5020,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.aiplatform_v1.VertexRagDataServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagDataService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = VertexRagDataServiceRestTransport._CancelOperation._get_response( self._host, @@ -4243,7 +5104,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. @@ -4254,13 +5115,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 = ( _BaseVertexRagDataServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = self._interceptor.pre_delete_operation( request, metadata ) @@ -4273,6 +5137,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.aiplatform_v1.VertexRagDataServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagDataService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = VertexRagDataServiceRestTransport._DeleteOperation._get_response( self._host, @@ -4330,7 +5221,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. @@ -4341,8 +5232,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. @@ -4351,6 +5244,7 @@ def __call__( http_options = ( _BaseVertexRagDataServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = self._interceptor.pre_get_operation(request, metadata) transcoded_request = _BaseVertexRagDataServiceRestTransport._BaseGetOperation._get_transcoded_request( http_options, request @@ -4361,6 +5255,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.aiplatform_v1.VertexRagDataServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagDataService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = VertexRagDataServiceRestTransport._GetOperation._get_response( self._host, @@ -4380,6 +5301,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.aiplatform_v1.VertexRagDataServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagDataService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4422,7 +5364,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. @@ -4433,8 +5375,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. @@ -4443,6 +5387,7 @@ def __call__( http_options = ( _BaseVertexRagDataServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = self._interceptor.pre_list_operations(request, metadata) transcoded_request = _BaseVertexRagDataServiceRestTransport._BaseListOperations._get_transcoded_request( http_options, request @@ -4453,6 +5398,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.aiplatform_v1.VertexRagDataServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagDataService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = VertexRagDataServiceRestTransport._ListOperations._get_response( self._host, @@ -4472,6 +5444,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.aiplatform_v1.VertexRagDataServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagDataService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4514,7 +5507,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 wait operation method over HTTP. @@ -4525,8 +5518,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 WaitOperation method. @@ -4535,6 +5530,7 @@ def __call__( http_options = ( _BaseVertexRagDataServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = self._interceptor.pre_wait_operation(request, metadata) transcoded_request = _BaseVertexRagDataServiceRestTransport._BaseWaitOperation._get_transcoded_request( http_options, request @@ -4545,6 +5541,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.aiplatform_v1.VertexRagDataServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagDataService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = VertexRagDataServiceRestTransport._WaitOperation._get_response( self._host, @@ -4564,6 +5587,27 @@ def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = self._interceptor.post_wait_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.aiplatform_v1.VertexRagDataServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagDataService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1/services/vertex_rag_data_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1/services/vertex_rag_data_service/transports/rest_asyncio.py index 5e2b74139c..ab0c9cec52 100644 --- a/google/cloud/aiplatform_v1/services/vertex_rag_data_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1/services/vertex_rag_data_service/transports/rest_asyncio.py @@ -59,6 +59,18 @@ from .base import DEFAULT_CLIENT_INFO as BASE_DEFAULT_CLIENT_INFO + +import logging + +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__) + try: OptionalRetry = Union[retries.AsyncRetry, gapic_v1.method._MethodDefault, None] except AttributeError: # pragma: NO COVER @@ -175,9 +187,10 @@ async def post_upload_rag_file(self, response): async def pre_create_rag_corpus( self, request: vertex_rag_data_service.CreateRagCorpusRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - vertex_rag_data_service.CreateRagCorpusRequest, Sequence[Tuple[str, str]] + vertex_rag_data_service.CreateRagCorpusRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for create_rag_corpus @@ -200,9 +213,10 @@ async def post_create_rag_corpus( async def pre_delete_rag_corpus( self, request: vertex_rag_data_service.DeleteRagCorpusRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - vertex_rag_data_service.DeleteRagCorpusRequest, Sequence[Tuple[str, str]] + vertex_rag_data_service.DeleteRagCorpusRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for delete_rag_corpus @@ -225,8 +239,11 @@ async def post_delete_rag_corpus( async def pre_delete_rag_file( self, request: vertex_rag_data_service.DeleteRagFileRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[vertex_rag_data_service.DeleteRagFileRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + vertex_rag_data_service.DeleteRagFileRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for delete_rag_file Override in a subclass to manipulate the request or metadata @@ -248,8 +265,11 @@ async def post_delete_rag_file( async def pre_get_rag_corpus( self, request: vertex_rag_data_service.GetRagCorpusRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[vertex_rag_data_service.GetRagCorpusRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + vertex_rag_data_service.GetRagCorpusRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for get_rag_corpus Override in a subclass to manipulate the request or metadata @@ -271,8 +291,11 @@ async def post_get_rag_corpus( async def pre_get_rag_file( self, request: vertex_rag_data_service.GetRagFileRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[vertex_rag_data_service.GetRagFileRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + vertex_rag_data_service.GetRagFileRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for get_rag_file Override in a subclass to manipulate the request or metadata @@ -294,9 +317,10 @@ async def post_get_rag_file( async def pre_import_rag_files( self, request: vertex_rag_data_service.ImportRagFilesRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - vertex_rag_data_service.ImportRagFilesRequest, Sequence[Tuple[str, str]] + vertex_rag_data_service.ImportRagFilesRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for import_rag_files @@ -319,9 +343,10 @@ async def post_import_rag_files( async def pre_list_rag_corpora( self, request: vertex_rag_data_service.ListRagCorporaRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - vertex_rag_data_service.ListRagCorporaRequest, Sequence[Tuple[str, str]] + vertex_rag_data_service.ListRagCorporaRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for list_rag_corpora @@ -344,8 +369,11 @@ async def post_list_rag_corpora( async def pre_list_rag_files( self, request: vertex_rag_data_service.ListRagFilesRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[vertex_rag_data_service.ListRagFilesRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + vertex_rag_data_service.ListRagFilesRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for list_rag_files Override in a subclass to manipulate the request or metadata @@ -367,9 +395,10 @@ async def post_list_rag_files( async def pre_update_rag_corpus( self, request: vertex_rag_data_service.UpdateRagCorpusRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - vertex_rag_data_service.UpdateRagCorpusRequest, Sequence[Tuple[str, str]] + vertex_rag_data_service.UpdateRagCorpusRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for update_rag_corpus @@ -392,8 +421,11 @@ async def post_update_rag_corpus( async def pre_upload_rag_file( self, request: vertex_rag_data_service.UploadRagFileRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[vertex_rag_data_service.UploadRagFileRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + vertex_rag_data_service.UploadRagFileRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for upload_rag_file Override in a subclass to manipulate the request or metadata @@ -415,8 +447,10 @@ async def post_upload_rag_file( async def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -438,8 +472,10 @@ async def post_get_location( async def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -461,8 +497,10 @@ async def post_list_locations( async def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -484,8 +522,10 @@ async def post_get_iam_policy( async def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -507,8 +547,11 @@ async def post_set_iam_policy( async def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -530,8 +573,10 @@ async def post_test_iam_permissions( async def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -551,8 +596,10 @@ async def post_cancel_operation(self, response: None) -> None: async 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 @@ -572,8 +619,10 @@ async def post_delete_operation(self, response: None) -> None: async 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 @@ -595,8 +644,10 @@ async def post_get_operation( async 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 @@ -618,8 +669,10 @@ async def post_list_operations( async def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -850,7 +903,7 @@ async 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 rag corpus method over HTTP. @@ -861,8 +914,10 @@ async def __call__( 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: @@ -875,6 +930,7 @@ async def __call__( http_options = ( _BaseVertexRagDataServiceRestTransport._BaseCreateRagCorpus._get_http_options() ) + request, metadata = await self._interceptor.pre_create_rag_corpus( request, metadata ) @@ -891,6 +947,33 @@ async 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.aiplatform_v1.VertexRagDataServiceClient.CreateRagCorpus", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagDataService", + "rpcName": "CreateRagCorpus", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncVertexRagDataServiceRestTransport._CreateRagCorpus._get_response( self._host, @@ -919,6 +1002,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_create_rag_corpus(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.VertexRagDataServiceAsyncClient.create_rag_corpus", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagDataService", + "rpcName": "CreateRagCorpus", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _DeleteRagCorpus( @@ -957,7 +1062,7 @@ async 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 rag corpus method over HTTP. @@ -968,8 +1073,10 @@ async def __call__( 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: @@ -982,6 +1089,7 @@ async def __call__( http_options = ( _BaseVertexRagDataServiceRestTransport._BaseDeleteRagCorpus._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_rag_corpus( request, metadata ) @@ -994,6 +1102,33 @@ async 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.aiplatform_v1.VertexRagDataServiceClient.DeleteRagCorpus", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagDataService", + "rpcName": "DeleteRagCorpus", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncVertexRagDataServiceRestTransport._DeleteRagCorpus._get_response( self._host, @@ -1021,6 +1156,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_delete_rag_corpus(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.VertexRagDataServiceAsyncClient.delete_rag_corpus", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagDataService", + "rpcName": "DeleteRagCorpus", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _DeleteRagFile( @@ -1059,7 +1216,7 @@ async 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 rag file method over HTTP. @@ -1070,8 +1227,10 @@ async def __call__( 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: @@ -1084,6 +1243,7 @@ async def __call__( http_options = ( _BaseVertexRagDataServiceRestTransport._BaseDeleteRagFile._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_rag_file( request, metadata ) @@ -1096,6 +1256,33 @@ async 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.aiplatform_v1.VertexRagDataServiceClient.DeleteRagFile", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagDataService", + "rpcName": "DeleteRagFile", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncVertexRagDataServiceRestTransport._DeleteRagFile._get_response( self._host, @@ -1123,6 +1310,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_delete_rag_file(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.VertexRagDataServiceAsyncClient.delete_rag_file", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagDataService", + "rpcName": "DeleteRagFile", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _GetRagCorpus( @@ -1161,7 +1370,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> vertex_rag_data.RagCorpus: r"""Call the get rag corpus method over HTTP. @@ -1172,8 +1381,10 @@ async def __call__( 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: ~.vertex_rag_data.RagCorpus: @@ -1186,6 +1397,7 @@ async def __call__( http_options = ( _BaseVertexRagDataServiceRestTransport._BaseGetRagCorpus._get_http_options() ) + request, metadata = await self._interceptor.pre_get_rag_corpus( request, metadata ) @@ -1198,6 +1410,33 @@ async 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.aiplatform_v1.VertexRagDataServiceClient.GetRagCorpus", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagDataService", + "rpcName": "GetRagCorpus", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncVertexRagDataServiceRestTransport._GetRagCorpus._get_response( self._host, @@ -1225,6 +1464,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_get_rag_corpus(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = vertex_rag_data.RagCorpus.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.VertexRagDataServiceAsyncClient.get_rag_corpus", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagDataService", + "rpcName": "GetRagCorpus", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _GetRagFile( @@ -1263,7 +1524,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> vertex_rag_data.RagFile: r"""Call the get rag file method over HTTP. @@ -1274,8 +1535,10 @@ async def __call__( 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: ~.vertex_rag_data.RagFile: @@ -1287,6 +1550,7 @@ async def __call__( http_options = ( _BaseVertexRagDataServiceRestTransport._BaseGetRagFile._get_http_options() ) + request, metadata = await self._interceptor.pre_get_rag_file( request, metadata ) @@ -1299,6 +1563,33 @@ async 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.aiplatform_v1.VertexRagDataServiceClient.GetRagFile", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagDataService", + "rpcName": "GetRagFile", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncVertexRagDataServiceRestTransport._GetRagFile._get_response( @@ -1328,6 +1619,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_get_rag_file(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = vertex_rag_data.RagFile.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.VertexRagDataServiceAsyncClient.get_rag_file", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagDataService", + "rpcName": "GetRagFile", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ImportRagFiles( @@ -1367,7 +1680,7 @@ async 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 import rag files method over HTTP. @@ -1378,8 +1691,10 @@ async def __call__( 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: @@ -1392,6 +1707,7 @@ async def __call__( http_options = ( _BaseVertexRagDataServiceRestTransport._BaseImportRagFiles._get_http_options() ) + request, metadata = await self._interceptor.pre_import_rag_files( request, metadata ) @@ -1408,6 +1724,33 @@ async 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.aiplatform_v1.VertexRagDataServiceClient.ImportRagFiles", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagDataService", + "rpcName": "ImportRagFiles", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncVertexRagDataServiceRestTransport._ImportRagFiles._get_response( self._host, @@ -1436,6 +1779,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_import_rag_files(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.VertexRagDataServiceAsyncClient.import_rag_files", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagDataService", + "rpcName": "ImportRagFiles", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ListRagCorpora( @@ -1474,7 +1839,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> vertex_rag_data_service.ListRagCorporaResponse: r"""Call the list rag corpora method over HTTP. @@ -1485,8 +1850,10 @@ async def __call__( 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: ~.vertex_rag_data_service.ListRagCorporaResponse: @@ -1498,6 +1865,7 @@ async def __call__( http_options = ( _BaseVertexRagDataServiceRestTransport._BaseListRagCorpora._get_http_options() ) + request, metadata = await self._interceptor.pre_list_rag_corpora( request, metadata ) @@ -1510,6 +1878,33 @@ async 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.aiplatform_v1.VertexRagDataServiceClient.ListRagCorpora", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagDataService", + "rpcName": "ListRagCorpora", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncVertexRagDataServiceRestTransport._ListRagCorpora._get_response( self._host, @@ -1537,6 +1932,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_list_rag_corpora(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + vertex_rag_data_service.ListRagCorporaResponse.to_json(response) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.VertexRagDataServiceAsyncClient.list_rag_corpora", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagDataService", + "rpcName": "ListRagCorpora", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ListRagFiles( @@ -1575,7 +1994,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> vertex_rag_data_service.ListRagFilesResponse: r"""Call the list rag files method over HTTP. @@ -1586,8 +2005,10 @@ async def __call__( 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: ~.vertex_rag_data_service.ListRagFilesResponse: @@ -1599,6 +2020,7 @@ async def __call__( http_options = ( _BaseVertexRagDataServiceRestTransport._BaseListRagFiles._get_http_options() ) + request, metadata = await self._interceptor.pre_list_rag_files( request, metadata ) @@ -1611,6 +2033,33 @@ async 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.aiplatform_v1.VertexRagDataServiceClient.ListRagFiles", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagDataService", + "rpcName": "ListRagFiles", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncVertexRagDataServiceRestTransport._ListRagFiles._get_response( self._host, @@ -1638,6 +2087,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_list_rag_files(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + vertex_rag_data_service.ListRagFilesResponse.to_json(response) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.VertexRagDataServiceAsyncClient.list_rag_files", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagDataService", + "rpcName": "ListRagFiles", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _UpdateRagCorpus( @@ -1677,7 +2150,7 @@ async 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 rag corpus method over HTTP. @@ -1688,8 +2161,10 @@ async def __call__( 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: @@ -1702,6 +2177,7 @@ async def __call__( http_options = ( _BaseVertexRagDataServiceRestTransport._BaseUpdateRagCorpus._get_http_options() ) + request, metadata = await self._interceptor.pre_update_rag_corpus( request, metadata ) @@ -1718,6 +2194,33 @@ async 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.aiplatform_v1.VertexRagDataServiceClient.UpdateRagCorpus", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagDataService", + "rpcName": "UpdateRagCorpus", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncVertexRagDataServiceRestTransport._UpdateRagCorpus._get_response( self._host, @@ -1746,6 +2249,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_update_rag_corpus(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.VertexRagDataServiceAsyncClient.update_rag_corpus", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagDataService", + "rpcName": "UpdateRagCorpus", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _UploadRagFile( @@ -1785,7 +2310,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> vertex_rag_data_service.UploadRagFileResponse: r"""Call the upload rag file method over HTTP. @@ -1796,8 +2321,10 @@ async def __call__( 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: ~.vertex_rag_data_service.UploadRagFileResponse: @@ -1809,6 +2336,7 @@ async def __call__( http_options = ( _BaseVertexRagDataServiceRestTransport._BaseUploadRagFile._get_http_options() ) + request, metadata = await self._interceptor.pre_upload_rag_file( request, metadata ) @@ -1825,6 +2353,33 @@ async 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.aiplatform_v1.VertexRagDataServiceClient.UploadRagFile", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagDataService", + "rpcName": "UploadRagFile", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncVertexRagDataServiceRestTransport._UploadRagFile._get_response( self._host, @@ -1853,6 +2408,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_upload_rag_file(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + vertex_rag_data_service.UploadRagFileResponse.to_json(response) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.VertexRagDataServiceAsyncClient.upload_rag_file", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagDataService", + "rpcName": "UploadRagFile", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp @property @@ -3853,7 +4432,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -3864,8 +4443,10 @@ async def __call__( 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: locations_pb2.Location: Response from GetLocation method. @@ -3874,6 +4455,7 @@ async def __call__( http_options = ( _BaseVertexRagDataServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_location( request, metadata ) @@ -3886,6 +4468,33 @@ async 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.aiplatform_v1.VertexRagDataServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagDataService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncVertexRagDataServiceRestTransport._GetLocation._get_response( @@ -3913,6 +4522,27 @@ async def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_location(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.aiplatform_v1.VertexRagDataServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagDataService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3955,7 +4585,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -3966,8 +4596,10 @@ async def __call__( 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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -3976,6 +4608,7 @@ async def __call__( http_options = ( _BaseVertexRagDataServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_locations( request, metadata ) @@ -3988,6 +4621,33 @@ async 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.aiplatform_v1.VertexRagDataServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagDataService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncVertexRagDataServiceRestTransport._ListLocations._get_response( self._host, @@ -4013,6 +4673,27 @@ async def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_list_locations(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.aiplatform_v1.VertexRagDataServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagDataService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4055,7 +4736,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -4066,8 +4747,10 @@ async def __call__( 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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -4076,6 +4759,7 @@ async def __call__( http_options = ( _BaseVertexRagDataServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_get_iam_policy( request, metadata ) @@ -4088,6 +4772,33 @@ async 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.aiplatform_v1.VertexRagDataServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagDataService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncVertexRagDataServiceRestTransport._GetIamPolicy._get_response( self._host, @@ -4113,6 +4824,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_iam_policy(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.aiplatform_v1.VertexRagDataServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagDataService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4156,7 +4888,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -4167,8 +4899,10 @@ async def __call__( 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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -4177,6 +4911,7 @@ async def __call__( http_options = ( _BaseVertexRagDataServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_set_iam_policy( request, metadata ) @@ -4193,6 +4928,33 @@ async 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.aiplatform_v1.VertexRagDataServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagDataService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncVertexRagDataServiceRestTransport._SetIamPolicy._get_response( self._host, @@ -4219,6 +4981,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_set_iam_policy(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.aiplatform_v1.VertexRagDataServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagDataService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4261,7 +5044,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -4272,8 +5055,10 @@ async def __call__( 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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -4282,6 +5067,7 @@ async def __call__( http_options = ( _BaseVertexRagDataServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = await self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -4294,6 +5080,33 @@ async 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.aiplatform_v1.VertexRagDataServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagDataService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncVertexRagDataServiceRestTransport._TestIamPermissions._get_response( self._host, @@ -4319,6 +5132,27 @@ async def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_test_iam_permissions(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.aiplatform_v1.VertexRagDataServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagDataService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4361,7 +5195,7 @@ async 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 cancel operation method over HTTP. @@ -4372,13 +5206,16 @@ async def __call__( 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`. """ http_options = ( _BaseVertexRagDataServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_cancel_operation( request, metadata ) @@ -4391,6 +5228,33 @@ async 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.aiplatform_v1.VertexRagDataServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagDataService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncVertexRagDataServiceRestTransport._CancelOperation._get_response( self._host, @@ -4454,7 +5318,7 @@ async 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. @@ -4465,13 +5329,16 @@ async def __call__( 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`. """ http_options = ( _BaseVertexRagDataServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_operation( request, metadata ) @@ -4484,6 +5351,33 @@ async 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.aiplatform_v1.VertexRagDataServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagDataService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncVertexRagDataServiceRestTransport._DeleteOperation._get_response( self._host, @@ -4547,7 +5441,7 @@ async 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. @@ -4558,8 +5452,10 @@ async def __call__( 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: Response from GetOperation method. @@ -4568,6 +5464,7 @@ async def __call__( http_options = ( _BaseVertexRagDataServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_operation( request, metadata ) @@ -4580,6 +5477,33 @@ async 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.aiplatform_v1.VertexRagDataServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagDataService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncVertexRagDataServiceRestTransport._GetOperation._get_response( self._host, @@ -4605,6 +5529,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1.VertexRagDataServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagDataService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4647,7 +5592,7 @@ async 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. @@ -4658,8 +5603,10 @@ async def __call__( 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 from ListOperations method. @@ -4668,6 +5615,7 @@ async def __call__( http_options = ( _BaseVertexRagDataServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_operations( request, metadata ) @@ -4680,6 +5628,33 @@ async 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.aiplatform_v1.VertexRagDataServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagDataService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncVertexRagDataServiceRestTransport._ListOperations._get_response( self._host, @@ -4705,6 +5680,27 @@ async def __call__( resp = operations_pb2.ListOperationsResponse() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1.VertexRagDataServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagDataService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4747,7 +5743,7 @@ async 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 wait operation method over HTTP. @@ -4758,8 +5754,10 @@ async def __call__( 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: Response from WaitOperation method. @@ -4768,6 +5766,7 @@ async def __call__( http_options = ( _BaseVertexRagDataServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_wait_operation( request, metadata ) @@ -4780,6 +5779,33 @@ async 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.aiplatform_v1.VertexRagDataServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagDataService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncVertexRagDataServiceRestTransport._WaitOperation._get_response( self._host, @@ -4805,6 +5831,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_wait_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.aiplatform_v1.VertexRagDataServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagDataService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1/services/vertex_rag_service/async_client.py b/google/cloud/aiplatform_v1/services/vertex_rag_service/async_client.py index 733f6e36b3..bce8d35094 100644 --- a/google/cloud/aiplatform_v1/services/vertex_rag_service/async_client.py +++ b/google/cloud/aiplatform_v1/services/vertex_rag_service/async_client.py @@ -13,6 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging as std_logging from collections import OrderedDict import re from typing import ( @@ -55,6 +56,15 @@ from .transports.grpc_asyncio import VertexRagServiceGrpcAsyncIOTransport from .client import VertexRagServiceClient +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 VertexRagServiceAsyncClient: """A service for retrieving relevant contexts.""" @@ -262,6 +272,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.aiplatform_v1.VertexRagServiceAsyncClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagService", + "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.aiplatform.v1.VertexRagService", + "credentialsType": None, + }, + ) + async def retrieve_contexts( self, request: Optional[ @@ -272,7 +304,7 @@ async def retrieve_contexts( query: Optional[vertex_rag_service.RagQuery] = 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]]] = (), ) -> vertex_rag_service.RetrieveContextsResponse: r"""Retrieves relevant contexts for a query. @@ -327,8 +359,10 @@ async def sample_retrieve_contexts(): 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.aiplatform_v1.types.RetrieveContextsResponse: @@ -393,7 +427,7 @@ async def augment_prompt( vertex_rag_store: Optional[tool.VertexRagStore] = 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]]] = (), ) -> vertex_rag_service.AugmentPromptResponse: r"""Given an input prompt, it returns augmented prompt from vertex rag store to guide LLM towards generating @@ -454,8 +488,10 @@ async def sample_augment_prompt(): 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.aiplatform_v1.types.AugmentPromptResponse: @@ -522,7 +558,7 @@ async def corroborate_content( facts: Optional[MutableSequence[vertex_rag_service.Fact]] = 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]]] = (), ) -> vertex_rag_service.CorroborateContentResponse: r"""Given an input text, it returns a score that evaluates the factuality of the text. It also extracts @@ -587,8 +623,10 @@ async def sample_corroborate_content(): 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.aiplatform_v1.types.CorroborateContentResponse: @@ -652,7 +690,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. @@ -663,8 +701,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. @@ -705,7 +745,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. @@ -716,8 +756,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. @@ -758,7 +800,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. @@ -774,8 +816,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 """ @@ -812,7 +856,7 @@ async def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -827,8 +871,10 @@ async def cancel_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 """ @@ -865,7 +911,7 @@ async def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -882,8 +928,10 @@ async def wait_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. @@ -924,7 +972,7 @@ async def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -937,8 +985,10 @@ async def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -1043,7 +1093,7 @@ async def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -1057,8 +1107,10 @@ async def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -1163,7 +1215,7 @@ async def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -1178,8 +1230,10 @@ async def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -1223,7 +1277,7 @@ async def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -1234,8 +1288,10 @@ async def get_location( 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: ~.location_pb2.Location: Location object. @@ -1276,7 +1332,7 @@ async def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -1287,8 +1343,10 @@ async def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1/services/vertex_rag_service/client.py b/google/cloud/aiplatform_v1/services/vertex_rag_service/client.py index 6bd6a0349c..4f8b6fe9f3 100644 --- a/google/cloud/aiplatform_v1/services/vertex_rag_service/client.py +++ b/google/cloud/aiplatform_v1/services/vertex_rag_service/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 ( @@ -48,6 +49,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.cloud.aiplatform_v1.types import content from google.cloud.aiplatform_v1.types import content as gca_content from google.cloud.aiplatform_v1.types import tool @@ -599,6 +609,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( @@ -690,6 +704,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.aiplatform_v1.VertexRagServiceClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagService", + "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.aiplatform.v1.VertexRagService", + "credentialsType": None, + }, + ) + def retrieve_contexts( self, request: Optional[ @@ -700,7 +737,7 @@ def retrieve_contexts( query: Optional[vertex_rag_service.RagQuery] = 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]]] = (), ) -> vertex_rag_service.RetrieveContextsResponse: r"""Retrieves relevant contexts for a query. @@ -755,8 +792,10 @@ def sample_retrieve_contexts(): 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.aiplatform_v1.types.RetrieveContextsResponse: @@ -818,7 +857,7 @@ def augment_prompt( vertex_rag_store: Optional[tool.VertexRagStore] = 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]]] = (), ) -> vertex_rag_service.AugmentPromptResponse: r"""Given an input prompt, it returns augmented prompt from vertex rag store to guide LLM towards generating @@ -879,8 +918,10 @@ def sample_augment_prompt(): 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.aiplatform_v1.types.AugmentPromptResponse: @@ -944,7 +985,7 @@ def corroborate_content( facts: Optional[MutableSequence[vertex_rag_service.Fact]] = 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]]] = (), ) -> vertex_rag_service.CorroborateContentResponse: r"""Given an input text, it returns a score that evaluates the factuality of the text. It also extracts @@ -1009,8 +1050,10 @@ def sample_corroborate_content(): 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.aiplatform_v1.types.CorroborateContentResponse: @@ -1084,7 +1127,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. @@ -1095,8 +1138,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. @@ -1137,7 +1182,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. @@ -1148,8 +1193,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. @@ -1190,7 +1237,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. @@ -1206,8 +1253,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 """ @@ -1244,7 +1293,7 @@ def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -1259,8 +1308,10 @@ def cancel_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 """ @@ -1297,7 +1348,7 @@ def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -1314,8 +1365,10 @@ def wait_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. @@ -1356,7 +1409,7 @@ def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -1369,8 +1422,10 @@ def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -1475,7 +1530,7 @@ def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -1489,8 +1544,10 @@ def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -1595,7 +1652,7 @@ def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -1610,8 +1667,10 @@ def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -1653,7 +1712,7 @@ def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -1664,8 +1723,10 @@ def get_location( 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: ~.location_pb2.Location: Location object. @@ -1706,7 +1767,7 @@ def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -1717,8 +1778,10 @@ def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1/services/vertex_rag_service/transports/grpc.py b/google/cloud/aiplatform_v1/services/vertex_rag_service/transports/grpc.py index c9bf5eb7ef..11c1cb093c 100644 --- a/google/cloud/aiplatform_v1/services/vertex_rag_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1/services/vertex_rag_service/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 import warnings from typing import Callable, Dict, Optional, Sequence, Tuple, Union @@ -21,8 +24,11 @@ import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from google.cloud.aiplatform_v1.types import vertex_rag_service from google.cloud.location import locations_pb2 # type: ignore @@ -31,6 +37,81 @@ from google.longrunning import operations_pb2 # type: ignore from .base import VertexRagServiceTransport, DEFAULT_CLIENT_INFO +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.aiplatform.v1.VertexRagService", + "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.aiplatform.v1.VertexRagService", + "rpcName": client_call_details.method, + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class VertexRagServiceGrpcTransport(VertexRagServiceTransport): """gRPC backend transport for VertexRagService. @@ -184,7 +265,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 @@ -261,7 +347,7 @@ def retrieve_contexts( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "retrieve_contexts" not in self._stubs: - self._stubs["retrieve_contexts"] = self.grpc_channel.unary_unary( + self._stubs["retrieve_contexts"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.VertexRagService/RetrieveContexts", request_serializer=vertex_rag_service.RetrieveContextsRequest.serialize, response_deserializer=vertex_rag_service.RetrieveContextsResponse.deserialize, @@ -292,7 +378,7 @@ def augment_prompt( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "augment_prompt" not in self._stubs: - self._stubs["augment_prompt"] = self.grpc_channel.unary_unary( + self._stubs["augment_prompt"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.VertexRagService/AugmentPrompt", request_serializer=vertex_rag_service.AugmentPromptRequest.serialize, response_deserializer=vertex_rag_service.AugmentPromptResponse.deserialize, @@ -324,7 +410,7 @@ def corroborate_content( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "corroborate_content" not in self._stubs: - self._stubs["corroborate_content"] = self.grpc_channel.unary_unary( + self._stubs["corroborate_content"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.VertexRagService/CorroborateContent", request_serializer=vertex_rag_service.CorroborateContentRequest.serialize, response_deserializer=vertex_rag_service.CorroborateContentResponse.deserialize, @@ -332,7 +418,7 @@ def corroborate_content( return self._stubs["corroborate_content"] def close(self): - self.grpc_channel.close() + self._logged_channel.close() @property def delete_operation( @@ -344,7 +430,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, @@ -361,7 +447,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -378,7 +464,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -395,7 +481,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, @@ -414,7 +500,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, @@ -433,7 +519,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -450,7 +536,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -475,7 +561,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -501,7 +587,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -530,7 +616,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1/services/vertex_rag_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1/services/vertex_rag_service/transports/grpc_asyncio.py index 8f790dd28b..b6c702d105 100644 --- a/google/cloud/aiplatform_v1/services/vertex_rag_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1/services/vertex_rag_service/transports/grpc_asyncio.py @@ -14,6 +14,9 @@ # limitations under the License. # import inspect +import json +import pickle +import logging as std_logging import warnings from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union @@ -23,8 +26,11 @@ from google.api_core import retry_async as retries from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from grpc.experimental import aio # type: ignore from google.cloud.aiplatform_v1.types import vertex_rag_service @@ -35,6 +41,82 @@ from .base import VertexRagServiceTransport, DEFAULT_CLIENT_INFO from .grpc import VertexRagServiceGrpcTransport +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.aiplatform.v1.VertexRagService", + "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.aiplatform.v1.VertexRagService", + "rpcName": str(client_call_details.method), + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class VertexRagServiceGrpcAsyncIOTransport(VertexRagServiceTransport): """gRPC AsyncIO backend transport for VertexRagService. @@ -231,10 +313,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 @@ -269,7 +354,7 @@ def retrieve_contexts( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "retrieve_contexts" not in self._stubs: - self._stubs["retrieve_contexts"] = self.grpc_channel.unary_unary( + self._stubs["retrieve_contexts"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.VertexRagService/RetrieveContexts", request_serializer=vertex_rag_service.RetrieveContextsRequest.serialize, response_deserializer=vertex_rag_service.RetrieveContextsResponse.deserialize, @@ -300,7 +385,7 @@ def augment_prompt( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "augment_prompt" not in self._stubs: - self._stubs["augment_prompt"] = self.grpc_channel.unary_unary( + self._stubs["augment_prompt"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.VertexRagService/AugmentPrompt", request_serializer=vertex_rag_service.AugmentPromptRequest.serialize, response_deserializer=vertex_rag_service.AugmentPromptResponse.deserialize, @@ -332,7 +417,7 @@ def corroborate_content( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "corroborate_content" not in self._stubs: - self._stubs["corroborate_content"] = self.grpc_channel.unary_unary( + self._stubs["corroborate_content"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.VertexRagService/CorroborateContent", request_serializer=vertex_rag_service.CorroborateContentRequest.serialize, response_deserializer=vertex_rag_service.CorroborateContentResponse.deserialize, @@ -415,7 +500,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: @@ -431,7 +516,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, @@ -448,7 +533,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -465,7 +550,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -482,7 +567,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, @@ -501,7 +586,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, @@ -520,7 +605,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -537,7 +622,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -562,7 +647,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -588,7 +673,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -617,7 +702,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1/services/vertex_rag_service/transports/rest.py b/google/cloud/aiplatform_v1/services/vertex_rag_service/transports/rest.py index ef3699a5bc..6f836581fa 100644 --- a/google/cloud/aiplatform_v1/services/vertex_rag_service/transports/rest.py +++ b/google/cloud/aiplatform_v1/services/vertex_rag_service/transports/rest.py @@ -13,9 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging +import json # type: ignore from google.auth.transport.requests import AuthorizedSession # type: ignore -import json # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.api_core import exceptions as core_exceptions from google.api_core import retry as retries @@ -46,6 +47,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, @@ -102,8 +111,10 @@ def post_retrieve_contexts(self, response): def pre_augment_prompt( self, request: vertex_rag_service.AugmentPromptRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[vertex_rag_service.AugmentPromptRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + vertex_rag_service.AugmentPromptRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for augment_prompt Override in a subclass to manipulate the request or metadata @@ -125,8 +136,11 @@ def post_augment_prompt( def pre_corroborate_content( self, request: vertex_rag_service.CorroborateContentRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[vertex_rag_service.CorroborateContentRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + vertex_rag_service.CorroborateContentRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for corroborate_content Override in a subclass to manipulate the request or metadata @@ -148,8 +162,11 @@ def post_corroborate_content( def pre_retrieve_contexts( self, request: vertex_rag_service.RetrieveContextsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[vertex_rag_service.RetrieveContextsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + vertex_rag_service.RetrieveContextsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for retrieve_contexts Override in a subclass to manipulate the request or metadata @@ -171,8 +188,10 @@ def post_retrieve_contexts( def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -194,8 +213,10 @@ def post_get_location( def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -217,8 +238,10 @@ def post_list_locations( def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -238,8 +261,10 @@ def post_get_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -259,8 +284,11 @@ def post_set_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -282,8 +310,10 @@ def post_test_iam_permissions( def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -303,8 +333,10 @@ def post_cancel_operation(self, response: None) -> None: 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 @@ -324,8 +356,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 @@ -347,8 +381,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 @@ -370,8 +406,10 @@ def post_list_operations( def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -513,7 +551,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]]] = (), ) -> vertex_rag_service.AugmentPromptResponse: r"""Call the augment prompt method over HTTP. @@ -523,8 +561,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: ~.vertex_rag_service.AugmentPromptResponse: @@ -534,6 +574,7 @@ def __call__( http_options = ( _BaseVertexRagServiceRestTransport._BaseAugmentPrompt._get_http_options() ) + request, metadata = self._interceptor.pre_augment_prompt(request, metadata) transcoded_request = _BaseVertexRagServiceRestTransport._BaseAugmentPrompt._get_transcoded_request( http_options, request @@ -548,6 +589,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.aiplatform_v1.VertexRagServiceClient.AugmentPrompt", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagService", + "rpcName": "AugmentPrompt", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = VertexRagServiceRestTransport._AugmentPrompt._get_response( self._host, @@ -569,7 +637,31 @@ def __call__( pb_resp = vertex_rag_service.AugmentPromptResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_augment_prompt(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = vertex_rag_service.AugmentPromptResponse.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.aiplatform_v1.VertexRagServiceClient.augment_prompt", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagService", + "rpcName": "AugmentPrompt", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _CorroborateContent( @@ -609,7 +701,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]]] = (), ) -> vertex_rag_service.CorroborateContentResponse: r"""Call the corroborate content method over HTTP. @@ -620,8 +712,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: ~.vertex_rag_service.CorroborateContentResponse: @@ -633,6 +727,7 @@ def __call__( http_options = ( _BaseVertexRagServiceRestTransport._BaseCorroborateContent._get_http_options() ) + request, metadata = self._interceptor.pre_corroborate_content( request, metadata ) @@ -649,6 +744,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.aiplatform_v1.VertexRagServiceClient.CorroborateContent", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagService", + "rpcName": "CorroborateContent", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = VertexRagServiceRestTransport._CorroborateContent._get_response( self._host, @@ -670,7 +792,31 @@ def __call__( pb_resp = vertex_rag_service.CorroborateContentResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_corroborate_content(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + vertex_rag_service.CorroborateContentResponse.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.aiplatform_v1.VertexRagServiceClient.corroborate_content", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagService", + "rpcName": "CorroborateContent", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _RetrieveContexts( @@ -710,7 +856,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]]] = (), ) -> vertex_rag_service.RetrieveContextsResponse: r"""Call the retrieve contexts method over HTTP. @@ -721,8 +867,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: ~.vertex_rag_service.RetrieveContextsResponse: @@ -734,6 +882,7 @@ def __call__( http_options = ( _BaseVertexRagServiceRestTransport._BaseRetrieveContexts._get_http_options() ) + request, metadata = self._interceptor.pre_retrieve_contexts( request, metadata ) @@ -750,6 +899,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.aiplatform_v1.VertexRagServiceClient.RetrieveContexts", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagService", + "rpcName": "RetrieveContexts", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = VertexRagServiceRestTransport._RetrieveContexts._get_response( self._host, @@ -771,7 +947,31 @@ def __call__( pb_resp = vertex_rag_service.RetrieveContextsResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_retrieve_contexts(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + vertex_rag_service.RetrieveContextsResponse.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.aiplatform_v1.VertexRagServiceClient.retrieve_contexts", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagService", + "rpcName": "RetrieveContexts", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp @property @@ -846,7 +1046,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]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -857,8 +1057,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: locations_pb2.Location: Response from GetLocation method. @@ -867,6 +1069,7 @@ def __call__( http_options = ( _BaseVertexRagServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = self._interceptor.pre_get_location(request, metadata) transcoded_request = _BaseVertexRagServiceRestTransport._BaseGetLocation._get_transcoded_request( http_options, request @@ -877,6 +1080,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.aiplatform_v1.VertexRagServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = VertexRagServiceRestTransport._GetLocation._get_response( self._host, @@ -896,6 +1126,27 @@ def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_location(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.aiplatform_v1.VertexRagServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -937,7 +1188,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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -948,8 +1199,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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -958,6 +1211,7 @@ def __call__( http_options = ( _BaseVertexRagServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = self._interceptor.pre_list_locations(request, metadata) transcoded_request = _BaseVertexRagServiceRestTransport._BaseListLocations._get_transcoded_request( http_options, request @@ -968,6 +1222,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.aiplatform_v1.VertexRagServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = VertexRagServiceRestTransport._ListLocations._get_response( self._host, @@ -987,6 +1268,27 @@ def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_list_locations(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.aiplatform_v1.VertexRagServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1028,7 +1330,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]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -1039,8 +1341,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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -1049,6 +1353,7 @@ def __call__( http_options = ( _BaseVertexRagServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_get_iam_policy(request, metadata) transcoded_request = _BaseVertexRagServiceRestTransport._BaseGetIamPolicy._get_transcoded_request( http_options, request @@ -1059,6 +1364,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.aiplatform_v1.VertexRagServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = VertexRagServiceRestTransport._GetIamPolicy._get_response( self._host, @@ -1078,6 +1410,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_iam_policy(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.aiplatform_v1.VertexRagServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1120,7 +1473,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]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -1131,8 +1484,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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -1141,6 +1496,7 @@ def __call__( http_options = ( _BaseVertexRagServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_set_iam_policy(request, metadata) transcoded_request = _BaseVertexRagServiceRestTransport._BaseSetIamPolicy._get_transcoded_request( http_options, request @@ -1155,6 +1511,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.aiplatform_v1.VertexRagServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = VertexRagServiceRestTransport._SetIamPolicy._get_response( self._host, @@ -1175,6 +1558,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_set_iam_policy(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.aiplatform_v1.VertexRagServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1217,7 +1621,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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -1228,8 +1632,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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -1238,6 +1644,7 @@ def __call__( http_options = ( _BaseVertexRagServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -1250,6 +1657,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.aiplatform_v1.VertexRagServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = VertexRagServiceRestTransport._TestIamPermissions._get_response( self._host, @@ -1269,6 +1703,27 @@ def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_test_iam_permissions(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.aiplatform_v1.VertexRagServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1311,7 +1766,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 cancel operation method over HTTP. @@ -1322,13 +1777,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 = ( _BaseVertexRagServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = self._interceptor.pre_cancel_operation( request, metadata ) @@ -1341,6 +1799,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.aiplatform_v1.VertexRagServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = VertexRagServiceRestTransport._CancelOperation._get_response( self._host, @@ -1398,7 +1883,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. @@ -1409,13 +1894,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 = ( _BaseVertexRagServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = self._interceptor.pre_delete_operation( request, metadata ) @@ -1428,6 +1916,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.aiplatform_v1.VertexRagServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = VertexRagServiceRestTransport._DeleteOperation._get_response( self._host, @@ -1484,7 +1999,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. @@ -1495,8 +2010,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. @@ -1505,6 +2022,7 @@ def __call__( http_options = ( _BaseVertexRagServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = self._interceptor.pre_get_operation(request, metadata) transcoded_request = _BaseVertexRagServiceRestTransport._BaseGetOperation._get_transcoded_request( http_options, request @@ -1515,6 +2033,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.aiplatform_v1.VertexRagServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = VertexRagServiceRestTransport._GetOperation._get_response( self._host, @@ -1534,6 +2079,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.aiplatform_v1.VertexRagServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1575,7 +2141,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. @@ -1586,8 +2152,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. @@ -1596,6 +2164,7 @@ def __call__( http_options = ( _BaseVertexRagServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = self._interceptor.pre_list_operations(request, metadata) transcoded_request = _BaseVertexRagServiceRestTransport._BaseListOperations._get_transcoded_request( http_options, request @@ -1606,6 +2175,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.aiplatform_v1.VertexRagServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = VertexRagServiceRestTransport._ListOperations._get_response( self._host, @@ -1625,6 +2221,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.aiplatform_v1.VertexRagServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1666,7 +2283,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 wait operation method over HTTP. @@ -1677,8 +2294,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 WaitOperation method. @@ -1687,6 +2306,7 @@ def __call__( http_options = ( _BaseVertexRagServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = self._interceptor.pre_wait_operation(request, metadata) transcoded_request = _BaseVertexRagServiceRestTransport._BaseWaitOperation._get_transcoded_request( http_options, request @@ -1697,6 +2317,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.aiplatform_v1.VertexRagServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = VertexRagServiceRestTransport._WaitOperation._get_response( self._host, @@ -1716,6 +2363,27 @@ def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = self._interceptor.post_wait_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.aiplatform_v1.VertexRagServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1/services/vertex_rag_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1/services/vertex_rag_service/transports/rest_asyncio.py index 4cd3976415..7eca082979 100644 --- a/google/cloud/aiplatform_v1/services/vertex_rag_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1/services/vertex_rag_service/transports/rest_asyncio.py @@ -56,6 +56,18 @@ from .base import DEFAULT_CLIENT_INFO as BASE_DEFAULT_CLIENT_INFO + +import logging + +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__) + try: OptionalRetry = Union[retries.AsyncRetry, gapic_v1.method._MethodDefault, None] except AttributeError: # pragma: NO COVER @@ -116,8 +128,10 @@ async def post_retrieve_contexts(self, response): async def pre_augment_prompt( self, request: vertex_rag_service.AugmentPromptRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[vertex_rag_service.AugmentPromptRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + vertex_rag_service.AugmentPromptRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for augment_prompt Override in a subclass to manipulate the request or metadata @@ -139,8 +153,11 @@ async def post_augment_prompt( async def pre_corroborate_content( self, request: vertex_rag_service.CorroborateContentRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[vertex_rag_service.CorroborateContentRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + vertex_rag_service.CorroborateContentRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for corroborate_content Override in a subclass to manipulate the request or metadata @@ -162,8 +179,11 @@ async def post_corroborate_content( async def pre_retrieve_contexts( self, request: vertex_rag_service.RetrieveContextsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[vertex_rag_service.RetrieveContextsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + vertex_rag_service.RetrieveContextsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for retrieve_contexts Override in a subclass to manipulate the request or metadata @@ -185,8 +205,10 @@ async def post_retrieve_contexts( async def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -208,8 +230,10 @@ async def post_get_location( async def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -231,8 +255,10 @@ async def post_list_locations( async def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -254,8 +280,10 @@ async def post_get_iam_policy( async def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -277,8 +305,11 @@ async def post_set_iam_policy( async def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -300,8 +331,10 @@ async def post_test_iam_permissions( async def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -321,8 +354,10 @@ async def post_cancel_operation(self, response: None) -> None: async 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 @@ -342,8 +377,10 @@ async def post_delete_operation(self, response: None) -> None: async 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 @@ -365,8 +402,10 @@ async def post_get_operation( async 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 @@ -388,8 +427,10 @@ async def post_list_operations( async def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -582,7 +623,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> vertex_rag_service.AugmentPromptResponse: r"""Call the augment prompt method over HTTP. @@ -592,8 +633,10 @@ async def __call__( 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: ~.vertex_rag_service.AugmentPromptResponse: @@ -603,6 +646,7 @@ async def __call__( http_options = ( _BaseVertexRagServiceRestTransport._BaseAugmentPrompt._get_http_options() ) + request, metadata = await self._interceptor.pre_augment_prompt( request, metadata ) @@ -619,6 +663,33 @@ async 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.aiplatform_v1.VertexRagServiceClient.AugmentPrompt", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagService", + "rpcName": "AugmentPrompt", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncVertexRagServiceRestTransport._AugmentPrompt._get_response( @@ -649,6 +720,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_augment_prompt(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = vertex_rag_service.AugmentPromptResponse.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.VertexRagServiceAsyncClient.augment_prompt", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagService", + "rpcName": "AugmentPrompt", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _CorroborateContent( @@ -688,7 +783,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> vertex_rag_service.CorroborateContentResponse: r"""Call the corroborate content method over HTTP. @@ -699,8 +794,10 @@ async def __call__( 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: ~.vertex_rag_service.CorroborateContentResponse: @@ -712,6 +809,7 @@ async def __call__( http_options = ( _BaseVertexRagServiceRestTransport._BaseCorroborateContent._get_http_options() ) + request, metadata = await self._interceptor.pre_corroborate_content( request, metadata ) @@ -728,6 +826,33 @@ async 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.aiplatform_v1.VertexRagServiceClient.CorroborateContent", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagService", + "rpcName": "CorroborateContent", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncVertexRagServiceRestTransport._CorroborateContent._get_response( self._host, @@ -756,6 +881,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_corroborate_content(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + vertex_rag_service.CorroborateContentResponse.to_json(response) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.VertexRagServiceAsyncClient.corroborate_content", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagService", + "rpcName": "CorroborateContent", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _RetrieveContexts( @@ -795,7 +944,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> vertex_rag_service.RetrieveContextsResponse: r"""Call the retrieve contexts method over HTTP. @@ -806,8 +955,10 @@ async def __call__( 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: ~.vertex_rag_service.RetrieveContextsResponse: @@ -819,6 +970,7 @@ async def __call__( http_options = ( _BaseVertexRagServiceRestTransport._BaseRetrieveContexts._get_http_options() ) + request, metadata = await self._interceptor.pre_retrieve_contexts( request, metadata ) @@ -835,6 +987,33 @@ async 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.aiplatform_v1.VertexRagServiceClient.RetrieveContexts", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagService", + "rpcName": "RetrieveContexts", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncVertexRagServiceRestTransport._RetrieveContexts._get_response( self._host, @@ -863,6 +1042,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_retrieve_contexts(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + vertex_rag_service.RetrieveContextsResponse.to_json(response) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.VertexRagServiceAsyncClient.retrieve_contexts", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagService", + "rpcName": "RetrieveContexts", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp @property @@ -932,7 +1135,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -943,8 +1146,10 @@ async def __call__( 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: locations_pb2.Location: Response from GetLocation method. @@ -953,6 +1158,7 @@ async def __call__( http_options = ( _BaseVertexRagServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_location( request, metadata ) @@ -965,6 +1171,33 @@ async 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.aiplatform_v1.VertexRagServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncVertexRagServiceRestTransport._GetLocation._get_response( @@ -992,6 +1225,27 @@ async def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_location(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.aiplatform_v1.VertexRagServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1034,7 +1288,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -1045,8 +1299,10 @@ async def __call__( 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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -1055,6 +1311,7 @@ async def __call__( http_options = ( _BaseVertexRagServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_locations( request, metadata ) @@ -1067,6 +1324,33 @@ async 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.aiplatform_v1.VertexRagServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncVertexRagServiceRestTransport._ListLocations._get_response( @@ -1094,6 +1378,27 @@ async def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_list_locations(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.aiplatform_v1.VertexRagServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1136,7 +1441,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -1147,8 +1452,10 @@ async def __call__( 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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -1157,6 +1464,7 @@ async def __call__( http_options = ( _BaseVertexRagServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_get_iam_policy( request, metadata ) @@ -1169,6 +1477,33 @@ async 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.aiplatform_v1.VertexRagServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncVertexRagServiceRestTransport._GetIamPolicy._get_response( @@ -1196,6 +1531,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_iam_policy(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.aiplatform_v1.VertexRagServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1239,7 +1595,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -1250,8 +1606,10 @@ async def __call__( 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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -1260,6 +1618,7 @@ async def __call__( http_options = ( _BaseVertexRagServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_set_iam_policy( request, metadata ) @@ -1276,6 +1635,33 @@ async 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.aiplatform_v1.VertexRagServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncVertexRagServiceRestTransport._SetIamPolicy._get_response( @@ -1304,6 +1690,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_set_iam_policy(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.aiplatform_v1.VertexRagServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1346,7 +1753,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -1357,8 +1764,10 @@ async def __call__( 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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -1367,6 +1776,7 @@ async def __call__( http_options = ( _BaseVertexRagServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = await self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -1379,6 +1789,33 @@ async 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.aiplatform_v1.VertexRagServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncVertexRagServiceRestTransport._TestIamPermissions._get_response( self._host, @@ -1404,6 +1841,27 @@ async def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_test_iam_permissions(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.aiplatform_v1.VertexRagServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1446,7 +1904,7 @@ async 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 cancel operation method over HTTP. @@ -1457,13 +1915,16 @@ async def __call__( 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`. """ http_options = ( _BaseVertexRagServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_cancel_operation( request, metadata ) @@ -1476,6 +1937,33 @@ async 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.aiplatform_v1.VertexRagServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncVertexRagServiceRestTransport._CancelOperation._get_response( @@ -1541,7 +2029,7 @@ async 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. @@ -1552,13 +2040,16 @@ async def __call__( 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`. """ http_options = ( _BaseVertexRagServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_operation( request, metadata ) @@ -1571,6 +2062,33 @@ async 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.aiplatform_v1.VertexRagServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncVertexRagServiceRestTransport._DeleteOperation._get_response( @@ -1636,7 +2154,7 @@ async 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. @@ -1647,8 +2165,10 @@ async def __call__( 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: Response from GetOperation method. @@ -1657,6 +2177,7 @@ async def __call__( http_options = ( _BaseVertexRagServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_operation( request, metadata ) @@ -1669,6 +2190,33 @@ async 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.aiplatform_v1.VertexRagServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncVertexRagServiceRestTransport._GetOperation._get_response( @@ -1696,6 +2244,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1.VertexRagServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1738,7 +2307,7 @@ async 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. @@ -1749,8 +2318,10 @@ async def __call__( 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 from ListOperations method. @@ -1759,6 +2330,7 @@ async def __call__( http_options = ( _BaseVertexRagServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_operations( request, metadata ) @@ -1771,6 +2343,33 @@ async 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.aiplatform_v1.VertexRagServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncVertexRagServiceRestTransport._ListOperations._get_response( @@ -1798,6 +2397,27 @@ async def __call__( resp = operations_pb2.ListOperationsResponse() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1.VertexRagServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1840,7 +2460,7 @@ async 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 wait operation method over HTTP. @@ -1851,8 +2471,10 @@ async def __call__( 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: Response from WaitOperation method. @@ -1861,6 +2483,7 @@ async def __call__( http_options = ( _BaseVertexRagServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_wait_operation( request, metadata ) @@ -1873,6 +2496,33 @@ async 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.aiplatform_v1.VertexRagServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncVertexRagServiceRestTransport._WaitOperation._get_response( @@ -1900,6 +2550,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_wait_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.aiplatform_v1.VertexRagServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VertexRagService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1/services/vizier_service/async_client.py b/google/cloud/aiplatform_v1/services/vizier_service/async_client.py index 2fb1ccca9b..0881e2a020 100644 --- a/google/cloud/aiplatform_v1/services/vizier_service/async_client.py +++ b/google/cloud/aiplatform_v1/services/vizier_service/async_client.py @@ -13,6 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging as std_logging from collections import OrderedDict import re from typing import ( @@ -58,6 +59,15 @@ from .transports.grpc_asyncio import VizierServiceGrpcAsyncIOTransport from .client import VizierServiceClient +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 VizierServiceAsyncClient: """Vertex AI Vizier API. @@ -272,6 +282,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.aiplatform_v1.VizierServiceAsyncClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VizierService", + "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.aiplatform.v1.VizierService", + "credentialsType": None, + }, + ) + async def create_study( self, request: Optional[Union[vizier_service.CreateStudyRequest, dict]] = None, @@ -280,7 +312,7 @@ async def create_study( study: Optional[gca_study.Study] = 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]]] = (), ) -> gca_study.Study: r"""Creates a Study. A resource name will be generated after creation of the Study. @@ -342,8 +374,10 @@ async def sample_create_study(): 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.aiplatform_v1.types.Study: @@ -404,7 +438,7 @@ async def get_study( 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]]] = (), ) -> study.Study: r"""Gets a Study by name. @@ -448,8 +482,10 @@ async def sample_get_study(): 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.aiplatform_v1.types.Study: @@ -508,7 +544,7 @@ async def list_studies( 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.ListStudiesAsyncPager: r"""Lists all the studies in a region for an associated project. @@ -555,8 +591,10 @@ async def sample_list_studies(): 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.aiplatform_v1.services.vizier_service.pagers.ListStudiesAsyncPager: @@ -631,7 +669,7 @@ async def delete_study( 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 Study. @@ -673,8 +711,10 @@ async def sample_delete_study(): 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 @@ -726,7 +766,7 @@ async def lookup_study( 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]]] = (), ) -> study.Study: r"""Looks a study up using the user-defined display_name field instead of the fully qualified resource name. @@ -773,8 +813,10 @@ async def sample_lookup_study(): 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.aiplatform_v1.types.Study: @@ -832,7 +874,7 @@ async def suggest_trials( *, 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"""Adds one or more Trials to a Study, with parameter values suggested by Vertex AI Vizier. Returns a long-running operation @@ -879,8 +921,10 @@ async def sample_suggest_trials(): 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: @@ -938,7 +982,7 @@ async def create_trial( trial: Optional[study.Trial] = 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]]] = (), ) -> study.Trial: r"""Adds a user provided Trial to a Study. @@ -988,8 +1032,10 @@ async def sample_create_trial(): 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.aiplatform_v1.types.Trial: @@ -1055,7 +1101,7 @@ async def get_trial( 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]]] = (), ) -> study.Trial: r"""Gets a Trial. @@ -1099,8 +1145,10 @@ async def sample_get_trial(): 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.aiplatform_v1.types.Trial: @@ -1164,7 +1212,7 @@ async def list_trials( 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.ListTrialsAsyncPager: r"""Lists the Trials associated with a Study. @@ -1210,8 +1258,10 @@ async def sample_list_trials(): 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.aiplatform_v1.services.vizier_service.pagers.ListTrialsAsyncPager: @@ -1287,7 +1337,7 @@ async def add_trial_measurement( *, 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]]] = (), ) -> study.Trial: r"""Adds a measurement of the objective metrics to a Trial. This measurement is assumed to have been taken @@ -1326,8 +1376,10 @@ async def sample_add_trial_measurement(): 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.aiplatform_v1.types.Trial: @@ -1378,7 +1430,7 @@ async def complete_trial( *, 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]]] = (), ) -> study.Trial: r"""Marks a Trial as complete. @@ -1415,8 +1467,10 @@ async def sample_complete_trial(): 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.aiplatform_v1.types.Trial: @@ -1466,7 +1520,7 @@ async def delete_trial( 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 Trial. @@ -1507,8 +1561,10 @@ async def sample_delete_trial(): 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 @@ -1561,7 +1617,7 @@ async def check_trial_early_stopping_state( *, 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"""Checks whether a Trial should stop or not. Returns a long-running operation. When the operation is successful, it @@ -1605,8 +1661,10 @@ async def sample_check_trial_early_stopping_state(): 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: @@ -1664,7 +1722,7 @@ async def stop_trial( *, 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]]] = (), ) -> study.Trial: r"""Stops a Trial. @@ -1701,8 +1759,10 @@ async def sample_stop_trial(): 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.aiplatform_v1.types.Trial: @@ -1752,7 +1812,7 @@ async def list_optimal_trials( 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]]] = (), ) -> vizier_service.ListOptimalTrialsResponse: r"""Lists the pareto-optimal Trials for multi-objective Study or the optimal Trials for single-objective Study. The definition of @@ -1799,8 +1859,10 @@ async def sample_list_optimal_trials(): 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.aiplatform_v1.types.ListOptimalTrialsResponse: @@ -1860,7 +1922,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. @@ -1871,8 +1933,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. @@ -1913,7 +1977,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. @@ -1924,8 +1988,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. @@ -1966,7 +2032,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. @@ -1982,8 +2048,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 """ @@ -2020,7 +2088,7 @@ async def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -2035,8 +2103,10 @@ async def cancel_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 """ @@ -2073,7 +2143,7 @@ async def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -2090,8 +2160,10 @@ async def wait_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. @@ -2132,7 +2204,7 @@ async def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -2145,8 +2217,10 @@ async def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -2251,7 +2325,7 @@ async def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -2265,8 +2339,10 @@ async def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -2371,7 +2447,7 @@ async def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -2386,8 +2462,10 @@ async def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -2431,7 +2509,7 @@ async def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -2442,8 +2520,10 @@ async def get_location( 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: ~.location_pb2.Location: Location object. @@ -2484,7 +2564,7 @@ async def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -2495,8 +2575,10 @@ async def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1/services/vizier_service/client.py b/google/cloud/aiplatform_v1/services/vizier_service/client.py index b3a53ff4a7..03e830dfc2 100644 --- a/google/cloud/aiplatform_v1/services/vizier_service/client.py +++ b/google/cloud/aiplatform_v1/services/vizier_service/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 ( @@ -48,6 +49,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.cloud.aiplatform_v1.services.vizier_service import pagers @@ -649,6 +659,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( @@ -739,6 +753,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.aiplatform_v1.VizierServiceClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VizierService", + "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.aiplatform.v1.VizierService", + "credentialsType": None, + }, + ) + def create_study( self, request: Optional[Union[vizier_service.CreateStudyRequest, dict]] = None, @@ -747,7 +784,7 @@ def create_study( study: Optional[gca_study.Study] = 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]]] = (), ) -> gca_study.Study: r"""Creates a Study. A resource name will be generated after creation of the Study. @@ -809,8 +846,10 @@ def sample_create_study(): 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.aiplatform_v1.types.Study: @@ -868,7 +907,7 @@ def get_study( 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]]] = (), ) -> study.Study: r"""Gets a Study by name. @@ -912,8 +951,10 @@ def sample_get_study(): 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.aiplatform_v1.types.Study: @@ -969,7 +1010,7 @@ def list_studies( 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.ListStudiesPager: r"""Lists all the studies in a region for an associated project. @@ -1016,8 +1057,10 @@ def sample_list_studies(): 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.aiplatform_v1.services.vizier_service.pagers.ListStudiesPager: @@ -1089,7 +1132,7 @@ def delete_study( 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 Study. @@ -1131,8 +1174,10 @@ def sample_delete_study(): 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 @@ -1181,7 +1226,7 @@ def lookup_study( 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]]] = (), ) -> study.Study: r"""Looks a study up using the user-defined display_name field instead of the fully qualified resource name. @@ -1228,8 +1273,10 @@ def sample_lookup_study(): 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.aiplatform_v1.types.Study: @@ -1284,7 +1331,7 @@ def suggest_trials( *, 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"""Adds one or more Trials to a Study, with parameter values suggested by Vertex AI Vizier. Returns a long-running operation @@ -1331,8 +1378,10 @@ def sample_suggest_trials(): 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: @@ -1388,7 +1437,7 @@ def create_trial( trial: Optional[study.Trial] = 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]]] = (), ) -> study.Trial: r"""Adds a user provided Trial to a Study. @@ -1438,8 +1487,10 @@ def sample_create_trial(): 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.aiplatform_v1.types.Trial: @@ -1502,7 +1553,7 @@ def get_trial( 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]]] = (), ) -> study.Trial: r"""Gets a Trial. @@ -1546,8 +1597,10 @@ def sample_get_trial(): 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.aiplatform_v1.types.Trial: @@ -1608,7 +1661,7 @@ def list_trials( 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.ListTrialsPager: r"""Lists the Trials associated with a Study. @@ -1654,8 +1707,10 @@ def sample_list_trials(): 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.aiplatform_v1.services.vizier_service.pagers.ListTrialsPager: @@ -1728,7 +1783,7 @@ def add_trial_measurement( *, 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]]] = (), ) -> study.Trial: r"""Adds a measurement of the objective metrics to a Trial. This measurement is assumed to have been taken @@ -1767,8 +1822,10 @@ def sample_add_trial_measurement(): 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.aiplatform_v1.types.Trial: @@ -1817,7 +1874,7 @@ def complete_trial( *, 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]]] = (), ) -> study.Trial: r"""Marks a Trial as complete. @@ -1854,8 +1911,10 @@ def sample_complete_trial(): 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.aiplatform_v1.types.Trial: @@ -1903,7 +1962,7 @@ def delete_trial( 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 Trial. @@ -1944,8 +2003,10 @@ def sample_delete_trial(): 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 @@ -1995,7 +2056,7 @@ def check_trial_early_stopping_state( *, 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"""Checks whether a Trial should stop or not. Returns a long-running operation. When the operation is successful, it @@ -2039,8 +2100,10 @@ def sample_check_trial_early_stopping_state(): 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: @@ -2098,7 +2161,7 @@ def stop_trial( *, 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]]] = (), ) -> study.Trial: r"""Stops a Trial. @@ -2135,8 +2198,10 @@ def sample_stop_trial(): 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.aiplatform_v1.types.Trial: @@ -2184,7 +2249,7 @@ def list_optimal_trials( 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]]] = (), ) -> vizier_service.ListOptimalTrialsResponse: r"""Lists the pareto-optimal Trials for multi-objective Study or the optimal Trials for single-objective Study. The definition of @@ -2231,8 +2296,10 @@ def sample_list_optimal_trials(): 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.aiplatform_v1.types.ListOptimalTrialsResponse: @@ -2302,7 +2369,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. @@ -2313,8 +2380,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. @@ -2355,7 +2424,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. @@ -2366,8 +2435,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. @@ -2408,7 +2479,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. @@ -2424,8 +2495,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 """ @@ -2462,7 +2535,7 @@ def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -2477,8 +2550,10 @@ def cancel_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 """ @@ -2515,7 +2590,7 @@ def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -2532,8 +2607,10 @@ def wait_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. @@ -2574,7 +2651,7 @@ def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -2587,8 +2664,10 @@ def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -2693,7 +2772,7 @@ def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -2707,8 +2786,10 @@ def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -2813,7 +2894,7 @@ def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -2828,8 +2909,10 @@ def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -2871,7 +2954,7 @@ def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -2882,8 +2965,10 @@ def get_location( 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: ~.location_pb2.Location: Location object. @@ -2924,7 +3009,7 @@ def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -2935,8 +3020,10 @@ def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1/services/vizier_service/pagers.py b/google/cloud/aiplatform_v1/services/vizier_service/pagers.py index cb69c49782..7475380e7f 100644 --- a/google/cloud/aiplatform_v1/services/vizier_service/pagers.py +++ b/google/cloud/aiplatform_v1/services/vizier_service/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 = vizier_service.ListStudiesRequest(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 = vizier_service.ListStudiesRequest(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 = vizier_service.ListTrialsRequest(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 = vizier_service.ListTrialsRequest(request) diff --git a/google/cloud/aiplatform_v1/services/vizier_service/transports/grpc.py b/google/cloud/aiplatform_v1/services/vizier_service/transports/grpc.py index ecb78153e2..d91f70d803 100644 --- a/google/cloud/aiplatform_v1/services/vizier_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1/services/vizier_service/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 import warnings from typing import Callable, Dict, Optional, Sequence, Tuple, Union @@ -22,8 +25,11 @@ import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from google.cloud.aiplatform_v1.types import study from google.cloud.aiplatform_v1.types import study as gca_study @@ -35,6 +41,81 @@ from google.protobuf import empty_pb2 # type: ignore from .base import VizierServiceTransport, DEFAULT_CLIENT_INFO +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.aiplatform.v1.VizierService", + "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.aiplatform.v1.VizierService", + "rpcName": client_call_details.method, + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class VizierServiceGrpcTransport(VizierServiceTransport): """gRPC backend transport for VizierService. @@ -193,7 +274,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,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 @@ -282,7 +370,7 @@ def create_study( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_study" not in self._stubs: - self._stubs["create_study"] = self.grpc_channel.unary_unary( + self._stubs["create_study"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.VizierService/CreateStudy", request_serializer=vizier_service.CreateStudyRequest.serialize, response_deserializer=gca_study.Study.deserialize, @@ -306,7 +394,7 @@ def get_study(self) -> Callable[[vizier_service.GetStudyRequest], study.Study]: # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_study" not in self._stubs: - self._stubs["get_study"] = self.grpc_channel.unary_unary( + self._stubs["get_study"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.VizierService/GetStudy", request_serializer=vizier_service.GetStudyRequest.serialize, response_deserializer=study.Study.deserialize, @@ -335,7 +423,7 @@ def list_studies( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_studies" not in self._stubs: - self._stubs["list_studies"] = self.grpc_channel.unary_unary( + self._stubs["list_studies"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.VizierService/ListStudies", request_serializer=vizier_service.ListStudiesRequest.serialize, response_deserializer=vizier_service.ListStudiesResponse.deserialize, @@ -361,7 +449,7 @@ def delete_study( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_study" not in self._stubs: - self._stubs["delete_study"] = self.grpc_channel.unary_unary( + self._stubs["delete_study"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.VizierService/DeleteStudy", request_serializer=vizier_service.DeleteStudyRequest.serialize, response_deserializer=empty_pb2.Empty.FromString, @@ -388,7 +476,7 @@ def lookup_study( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "lookup_study" not in self._stubs: - self._stubs["lookup_study"] = self.grpc_channel.unary_unary( + self._stubs["lookup_study"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.VizierService/LookupStudy", request_serializer=vizier_service.LookupStudyRequest.serialize, response_deserializer=study.Study.deserialize, @@ -418,7 +506,7 @@ def suggest_trials( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "suggest_trials" not in self._stubs: - self._stubs["suggest_trials"] = self.grpc_channel.unary_unary( + self._stubs["suggest_trials"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.VizierService/SuggestTrials", request_serializer=vizier_service.SuggestTrialsRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -444,7 +532,7 @@ def create_trial( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_trial" not in self._stubs: - self._stubs["create_trial"] = self.grpc_channel.unary_unary( + self._stubs["create_trial"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.VizierService/CreateTrial", request_serializer=vizier_service.CreateTrialRequest.serialize, response_deserializer=study.Trial.deserialize, @@ -468,7 +556,7 @@ def get_trial(self) -> Callable[[vizier_service.GetTrialRequest], study.Trial]: # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_trial" not in self._stubs: - self._stubs["get_trial"] = self.grpc_channel.unary_unary( + self._stubs["get_trial"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.VizierService/GetTrial", request_serializer=vizier_service.GetTrialRequest.serialize, response_deserializer=study.Trial.deserialize, @@ -496,7 +584,7 @@ def list_trials( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_trials" not in self._stubs: - self._stubs["list_trials"] = self.grpc_channel.unary_unary( + self._stubs["list_trials"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.VizierService/ListTrials", request_serializer=vizier_service.ListTrialsRequest.serialize, response_deserializer=vizier_service.ListTrialsResponse.deserialize, @@ -524,7 +612,7 @@ def add_trial_measurement( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "add_trial_measurement" not in self._stubs: - self._stubs["add_trial_measurement"] = self.grpc_channel.unary_unary( + self._stubs["add_trial_measurement"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.VizierService/AddTrialMeasurement", request_serializer=vizier_service.AddTrialMeasurementRequest.serialize, response_deserializer=study.Trial.deserialize, @@ -550,7 +638,7 @@ def complete_trial( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "complete_trial" not in self._stubs: - self._stubs["complete_trial"] = self.grpc_channel.unary_unary( + self._stubs["complete_trial"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.VizierService/CompleteTrial", request_serializer=vizier_service.CompleteTrialRequest.serialize, response_deserializer=study.Trial.deserialize, @@ -576,7 +664,7 @@ def delete_trial( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_trial" not in self._stubs: - self._stubs["delete_trial"] = self.grpc_channel.unary_unary( + self._stubs["delete_trial"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.VizierService/DeleteTrial", request_serializer=vizier_service.DeleteTrialRequest.serialize, response_deserializer=empty_pb2.Empty.FromString, @@ -610,7 +698,7 @@ def check_trial_early_stopping_state( if "check_trial_early_stopping_state" not in self._stubs: self._stubs[ "check_trial_early_stopping_state" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.VizierService/CheckTrialEarlyStoppingState", request_serializer=vizier_service.CheckTrialEarlyStoppingStateRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -634,7 +722,7 @@ def stop_trial(self) -> Callable[[vizier_service.StopTrialRequest], study.Trial] # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "stop_trial" not in self._stubs: - self._stubs["stop_trial"] = self.grpc_channel.unary_unary( + self._stubs["stop_trial"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.VizierService/StopTrial", request_serializer=vizier_service.StopTrialRequest.serialize, response_deserializer=study.Trial.deserialize, @@ -666,7 +754,7 @@ def list_optimal_trials( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_optimal_trials" not in self._stubs: - self._stubs["list_optimal_trials"] = self.grpc_channel.unary_unary( + self._stubs["list_optimal_trials"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.VizierService/ListOptimalTrials", request_serializer=vizier_service.ListOptimalTrialsRequest.serialize, response_deserializer=vizier_service.ListOptimalTrialsResponse.deserialize, @@ -674,7 +762,7 @@ def list_optimal_trials( return self._stubs["list_optimal_trials"] def close(self): - self.grpc_channel.close() + self._logged_channel.close() @property def delete_operation( @@ -686,7 +774,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, @@ -703,7 +791,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -720,7 +808,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -737,7 +825,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, @@ -756,7 +844,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, @@ -775,7 +863,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -792,7 +880,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -817,7 +905,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -843,7 +931,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -872,7 +960,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1/services/vizier_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1/services/vizier_service/transports/grpc_asyncio.py index 60f4e668a8..f329035b1c 100644 --- a/google/cloud/aiplatform_v1/services/vizier_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1/services/vizier_service/transports/grpc_asyncio.py @@ -14,6 +14,9 @@ # limitations under the License. # import inspect +import json +import pickle +import logging as std_logging import warnings from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union @@ -24,8 +27,11 @@ from google.api_core import operations_v1 from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from grpc.experimental import aio # type: ignore from google.cloud.aiplatform_v1.types import study @@ -39,6 +45,82 @@ from .base import VizierServiceTransport, DEFAULT_CLIENT_INFO from .grpc import VizierServiceGrpcTransport +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.aiplatform.v1.VizierService", + "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.aiplatform.v1.VizierService", + "rpcName": str(client_call_details.method), + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class VizierServiceGrpcAsyncIOTransport(VizierServiceTransport): """gRPC AsyncIO backend transport for VizierService. @@ -240,10 +322,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 @@ -266,7 +351,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. @@ -292,7 +377,7 @@ def create_study( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_study" not in self._stubs: - self._stubs["create_study"] = self.grpc_channel.unary_unary( + self._stubs["create_study"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.VizierService/CreateStudy", request_serializer=vizier_service.CreateStudyRequest.serialize, response_deserializer=gca_study.Study.deserialize, @@ -318,7 +403,7 @@ def get_study( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_study" not in self._stubs: - self._stubs["get_study"] = self.grpc_channel.unary_unary( + self._stubs["get_study"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.VizierService/GetStudy", request_serializer=vizier_service.GetStudyRequest.serialize, response_deserializer=study.Study.deserialize, @@ -348,7 +433,7 @@ def list_studies( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_studies" not in self._stubs: - self._stubs["list_studies"] = self.grpc_channel.unary_unary( + self._stubs["list_studies"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.VizierService/ListStudies", request_serializer=vizier_service.ListStudiesRequest.serialize, response_deserializer=vizier_service.ListStudiesResponse.deserialize, @@ -374,7 +459,7 @@ def delete_study( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_study" not in self._stubs: - self._stubs["delete_study"] = self.grpc_channel.unary_unary( + self._stubs["delete_study"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.VizierService/DeleteStudy", request_serializer=vizier_service.DeleteStudyRequest.serialize, response_deserializer=empty_pb2.Empty.FromString, @@ -401,7 +486,7 @@ def lookup_study( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "lookup_study" not in self._stubs: - self._stubs["lookup_study"] = self.grpc_channel.unary_unary( + self._stubs["lookup_study"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.VizierService/LookupStudy", request_serializer=vizier_service.LookupStudyRequest.serialize, response_deserializer=study.Study.deserialize, @@ -433,7 +518,7 @@ def suggest_trials( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "suggest_trials" not in self._stubs: - self._stubs["suggest_trials"] = self.grpc_channel.unary_unary( + self._stubs["suggest_trials"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.VizierService/SuggestTrials", request_serializer=vizier_service.SuggestTrialsRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -459,7 +544,7 @@ def create_trial( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_trial" not in self._stubs: - self._stubs["create_trial"] = self.grpc_channel.unary_unary( + self._stubs["create_trial"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.VizierService/CreateTrial", request_serializer=vizier_service.CreateTrialRequest.serialize, response_deserializer=study.Trial.deserialize, @@ -485,7 +570,7 @@ def get_trial( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_trial" not in self._stubs: - self._stubs["get_trial"] = self.grpc_channel.unary_unary( + self._stubs["get_trial"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.VizierService/GetTrial", request_serializer=vizier_service.GetTrialRequest.serialize, response_deserializer=study.Trial.deserialize, @@ -513,7 +598,7 @@ def list_trials( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_trials" not in self._stubs: - self._stubs["list_trials"] = self.grpc_channel.unary_unary( + self._stubs["list_trials"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.VizierService/ListTrials", request_serializer=vizier_service.ListTrialsRequest.serialize, response_deserializer=vizier_service.ListTrialsResponse.deserialize, @@ -541,7 +626,7 @@ def add_trial_measurement( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "add_trial_measurement" not in self._stubs: - self._stubs["add_trial_measurement"] = self.grpc_channel.unary_unary( + self._stubs["add_trial_measurement"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.VizierService/AddTrialMeasurement", request_serializer=vizier_service.AddTrialMeasurementRequest.serialize, response_deserializer=study.Trial.deserialize, @@ -567,7 +652,7 @@ def complete_trial( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "complete_trial" not in self._stubs: - self._stubs["complete_trial"] = self.grpc_channel.unary_unary( + self._stubs["complete_trial"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.VizierService/CompleteTrial", request_serializer=vizier_service.CompleteTrialRequest.serialize, response_deserializer=study.Trial.deserialize, @@ -593,7 +678,7 @@ def delete_trial( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_trial" not in self._stubs: - self._stubs["delete_trial"] = self.grpc_channel.unary_unary( + self._stubs["delete_trial"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.VizierService/DeleteTrial", request_serializer=vizier_service.DeleteTrialRequest.serialize, response_deserializer=empty_pb2.Empty.FromString, @@ -628,7 +713,7 @@ def check_trial_early_stopping_state( if "check_trial_early_stopping_state" not in self._stubs: self._stubs[ "check_trial_early_stopping_state" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.VizierService/CheckTrialEarlyStoppingState", request_serializer=vizier_service.CheckTrialEarlyStoppingStateRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -654,7 +739,7 @@ def stop_trial( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "stop_trial" not in self._stubs: - self._stubs["stop_trial"] = self.grpc_channel.unary_unary( + self._stubs["stop_trial"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.VizierService/StopTrial", request_serializer=vizier_service.StopTrialRequest.serialize, response_deserializer=study.Trial.deserialize, @@ -686,7 +771,7 @@ def list_optimal_trials( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_optimal_trials" not in self._stubs: - self._stubs["list_optimal_trials"] = self.grpc_channel.unary_unary( + self._stubs["list_optimal_trials"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1.VizierService/ListOptimalTrials", request_serializer=vizier_service.ListOptimalTrialsRequest.serialize, response_deserializer=vizier_service.ListOptimalTrialsResponse.deserialize, @@ -829,7 +914,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: @@ -845,7 +930,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, @@ -862,7 +947,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -879,7 +964,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -896,7 +981,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, @@ -915,7 +1000,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, @@ -934,7 +1019,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -951,7 +1036,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -976,7 +1061,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -1002,7 +1087,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -1031,7 +1116,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1/services/vizier_service/transports/rest.py b/google/cloud/aiplatform_v1/services/vizier_service/transports/rest.py index e42730788b..fae0040827 100644 --- a/google/cloud/aiplatform_v1/services/vizier_service/transports/rest.py +++ b/google/cloud/aiplatform_v1/services/vizier_service/transports/rest.py @@ -13,9 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging +import json # type: ignore from google.auth.transport.requests import AuthorizedSession # type: ignore -import json # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.api_core import exceptions as core_exceptions from google.api_core import retry as retries @@ -50,6 +51,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, @@ -194,8 +203,11 @@ def post_suggest_trials(self, response): def pre_add_trial_measurement( self, request: vizier_service.AddTrialMeasurementRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[vizier_service.AddTrialMeasurementRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + vizier_service.AddTrialMeasurementRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for add_trial_measurement Override in a subclass to manipulate the request or metadata @@ -215,9 +227,10 @@ def post_add_trial_measurement(self, response: study.Trial) -> study.Trial: def pre_check_trial_early_stopping_state( self, request: vizier_service.CheckTrialEarlyStoppingStateRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - vizier_service.CheckTrialEarlyStoppingStateRequest, Sequence[Tuple[str, str]] + vizier_service.CheckTrialEarlyStoppingStateRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for check_trial_early_stopping_state @@ -240,8 +253,10 @@ def post_check_trial_early_stopping_state( def pre_complete_trial( self, request: vizier_service.CompleteTrialRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[vizier_service.CompleteTrialRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + vizier_service.CompleteTrialRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for complete_trial Override in a subclass to manipulate the request or metadata @@ -261,8 +276,10 @@ def post_complete_trial(self, response: study.Trial) -> study.Trial: def pre_create_study( self, request: vizier_service.CreateStudyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[vizier_service.CreateStudyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + vizier_service.CreateStudyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for create_study Override in a subclass to manipulate the request or metadata @@ -282,8 +299,10 @@ def post_create_study(self, response: gca_study.Study) -> gca_study.Study: def pre_create_trial( self, request: vizier_service.CreateTrialRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[vizier_service.CreateTrialRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + vizier_service.CreateTrialRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for create_trial Override in a subclass to manipulate the request or metadata @@ -303,8 +322,10 @@ def post_create_trial(self, response: study.Trial) -> study.Trial: def pre_delete_study( self, request: vizier_service.DeleteStudyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[vizier_service.DeleteStudyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + vizier_service.DeleteStudyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for delete_study Override in a subclass to manipulate the request or metadata @@ -315,8 +336,10 @@ def pre_delete_study( def pre_delete_trial( self, request: vizier_service.DeleteTrialRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[vizier_service.DeleteTrialRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + vizier_service.DeleteTrialRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for delete_trial Override in a subclass to manipulate the request or metadata @@ -327,8 +350,8 @@ def pre_delete_trial( def pre_get_study( self, request: vizier_service.GetStudyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[vizier_service.GetStudyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[vizier_service.GetStudyRequest, Sequence[Tuple[str, Union[str, bytes]]]]: """Pre-rpc interceptor for get_study Override in a subclass to manipulate the request or metadata @@ -348,8 +371,8 @@ def post_get_study(self, response: study.Study) -> study.Study: def pre_get_trial( self, request: vizier_service.GetTrialRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[vizier_service.GetTrialRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[vizier_service.GetTrialRequest, Sequence[Tuple[str, Union[str, bytes]]]]: """Pre-rpc interceptor for get_trial Override in a subclass to manipulate the request or metadata @@ -369,8 +392,10 @@ def post_get_trial(self, response: study.Trial) -> study.Trial: def pre_list_optimal_trials( self, request: vizier_service.ListOptimalTrialsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[vizier_service.ListOptimalTrialsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + vizier_service.ListOptimalTrialsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_optimal_trials Override in a subclass to manipulate the request or metadata @@ -392,8 +417,10 @@ def post_list_optimal_trials( def pre_list_studies( self, request: vizier_service.ListStudiesRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[vizier_service.ListStudiesRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + vizier_service.ListStudiesRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_studies Override in a subclass to manipulate the request or metadata @@ -415,8 +442,10 @@ def post_list_studies( def pre_list_trials( self, request: vizier_service.ListTrialsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[vizier_service.ListTrialsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + vizier_service.ListTrialsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_trials Override in a subclass to manipulate the request or metadata @@ -438,8 +467,10 @@ def post_list_trials( def pre_lookup_study( self, request: vizier_service.LookupStudyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[vizier_service.LookupStudyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + vizier_service.LookupStudyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for lookup_study Override in a subclass to manipulate the request or metadata @@ -459,8 +490,10 @@ def post_lookup_study(self, response: study.Study) -> study.Study: def pre_stop_trial( self, request: vizier_service.StopTrialRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[vizier_service.StopTrialRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + vizier_service.StopTrialRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for stop_trial Override in a subclass to manipulate the request or metadata @@ -480,8 +513,10 @@ def post_stop_trial(self, response: study.Trial) -> study.Trial: def pre_suggest_trials( self, request: vizier_service.SuggestTrialsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[vizier_service.SuggestTrialsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + vizier_service.SuggestTrialsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for suggest_trials Override in a subclass to manipulate the request or metadata @@ -503,8 +538,10 @@ def post_suggest_trials( def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -526,8 +563,10 @@ def post_get_location( def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -549,8 +588,10 @@ def post_list_locations( def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -570,8 +611,10 @@ def post_get_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -591,8 +634,11 @@ def post_set_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -614,8 +660,10 @@ def post_test_iam_permissions( def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -635,8 +683,10 @@ def post_cancel_operation(self, response: None) -> None: 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 @@ -656,8 +706,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 @@ -679,8 +731,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 @@ -702,8 +756,10 @@ def post_list_operations( def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -2728,7 +2784,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]]] = (), ) -> study.Trial: r"""Call the add trial measurement method over HTTP. @@ -2739,8 +2795,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: ~.study.Trial: @@ -2755,6 +2813,7 @@ def __call__( http_options = ( _BaseVizierServiceRestTransport._BaseAddTrialMeasurement._get_http_options() ) + request, metadata = self._interceptor.pre_add_trial_measurement( request, metadata ) @@ -2771,6 +2830,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.aiplatform_v1.VizierServiceClient.AddTrialMeasurement", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VizierService", + "rpcName": "AddTrialMeasurement", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = VizierServiceRestTransport._AddTrialMeasurement._get_response( self._host, @@ -2792,7 +2878,29 @@ def __call__( pb_resp = study.Trial.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_add_trial_measurement(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = study.Trial.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.aiplatform_v1.VizierServiceClient.add_trial_measurement", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VizierService", + "rpcName": "AddTrialMeasurement", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _CheckTrialEarlyStoppingState( @@ -2832,7 +2940,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 trial early stopping state method over HTTP. @@ -2844,8 +2952,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: @@ -2858,6 +2968,7 @@ def __call__( http_options = ( _BaseVizierServiceRestTransport._BaseCheckTrialEarlyStoppingState._get_http_options() ) + request, metadata = self._interceptor.pre_check_trial_early_stopping_state( request, metadata ) @@ -2874,6 +2985,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.aiplatform_v1.VizierServiceClient.CheckTrialEarlyStoppingState", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VizierService", + "rpcName": "CheckTrialEarlyStoppingState", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( VizierServiceRestTransport._CheckTrialEarlyStoppingState._get_response( @@ -2895,7 +3033,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_trial_early_stopping_state(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.aiplatform_v1.VizierServiceClient.check_trial_early_stopping_state", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VizierService", + "rpcName": "CheckTrialEarlyStoppingState", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _CompleteTrial( @@ -2934,7 +3094,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]]] = (), ) -> study.Trial: r"""Call the complete trial method over HTTP. @@ -2945,8 +3105,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: ~.study.Trial: @@ -2961,6 +3123,7 @@ def __call__( http_options = ( _BaseVizierServiceRestTransport._BaseCompleteTrial._get_http_options() ) + request, metadata = self._interceptor.pre_complete_trial(request, metadata) transcoded_request = _BaseVizierServiceRestTransport._BaseCompleteTrial._get_transcoded_request( http_options, request @@ -2975,6 +3138,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.aiplatform_v1.VizierServiceClient.CompleteTrial", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VizierService", + "rpcName": "CompleteTrial", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = VizierServiceRestTransport._CompleteTrial._get_response( self._host, @@ -2996,7 +3186,29 @@ def __call__( pb_resp = study.Trial.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_complete_trial(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = study.Trial.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.aiplatform_v1.VizierServiceClient.complete_trial", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VizierService", + "rpcName": "CompleteTrial", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _CreateStudy( @@ -3035,7 +3247,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]]] = (), ) -> gca_study.Study: r"""Call the create study method over HTTP. @@ -3046,8 +3258,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: ~.gca_study.Study: @@ -3057,6 +3271,7 @@ def __call__( http_options = ( _BaseVizierServiceRestTransport._BaseCreateStudy._get_http_options() ) + request, metadata = self._interceptor.pre_create_study(request, metadata) transcoded_request = _BaseVizierServiceRestTransport._BaseCreateStudy._get_transcoded_request( http_options, request @@ -3075,6 +3290,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 = 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.aiplatform_v1.VizierServiceClient.CreateStudy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VizierService", + "rpcName": "CreateStudy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = VizierServiceRestTransport._CreateStudy._get_response( self._host, @@ -3096,7 +3338,29 @@ def __call__( pb_resp = gca_study.Study.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_create_study(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gca_study.Study.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.aiplatform_v1.VizierServiceClient.create_study", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VizierService", + "rpcName": "CreateStudy", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _CreateTrial( @@ -3135,7 +3399,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]]] = (), ) -> study.Trial: r"""Call the create trial method over HTTP. @@ -3146,8 +3410,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: ~.study.Trial: @@ -3162,6 +3428,7 @@ def __call__( http_options = ( _BaseVizierServiceRestTransport._BaseCreateTrial._get_http_options() ) + request, metadata = self._interceptor.pre_create_trial(request, metadata) transcoded_request = _BaseVizierServiceRestTransport._BaseCreateTrial._get_transcoded_request( http_options, request @@ -3180,6 +3447,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 = 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.aiplatform_v1.VizierServiceClient.CreateTrial", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VizierService", + "rpcName": "CreateTrial", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = VizierServiceRestTransport._CreateTrial._get_response( self._host, @@ -3201,7 +3495,29 @@ def __call__( pb_resp = study.Trial.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_create_trial(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = study.Trial.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.aiplatform_v1.VizierServiceClient.create_trial", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VizierService", + "rpcName": "CreateTrial", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _DeleteStudy( @@ -3239,7 +3555,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 study method over HTTP. @@ -3250,13 +3566,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 = ( _BaseVizierServiceRestTransport._BaseDeleteStudy._get_http_options() ) + request, metadata = self._interceptor.pre_delete_study(request, metadata) transcoded_request = _BaseVizierServiceRestTransport._BaseDeleteStudy._get_transcoded_request( http_options, request @@ -3269,6 +3588,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.aiplatform_v1.VizierServiceClient.DeleteStudy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VizierService", + "rpcName": "DeleteStudy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = VizierServiceRestTransport._DeleteStudy._get_response( self._host, @@ -3319,7 +3665,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 trial method over HTTP. @@ -3330,13 +3676,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 = ( _BaseVizierServiceRestTransport._BaseDeleteTrial._get_http_options() ) + request, metadata = self._interceptor.pre_delete_trial(request, metadata) transcoded_request = _BaseVizierServiceRestTransport._BaseDeleteTrial._get_transcoded_request( http_options, request @@ -3349,6 +3698,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.aiplatform_v1.VizierServiceClient.DeleteTrial", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VizierService", + "rpcName": "DeleteTrial", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = VizierServiceRestTransport._DeleteTrial._get_response( self._host, @@ -3399,7 +3775,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]]] = (), ) -> study.Study: r"""Call the get study method over HTTP. @@ -3410,8 +3786,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: ~.study.Study: @@ -3421,6 +3799,7 @@ def __call__( http_options = ( _BaseVizierServiceRestTransport._BaseGetStudy._get_http_options() ) + request, metadata = self._interceptor.pre_get_study(request, metadata) transcoded_request = ( _BaseVizierServiceRestTransport._BaseGetStudy._get_transcoded_request( @@ -3435,6 +3814,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 = 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.aiplatform_v1.VizierServiceClient.GetStudy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VizierService", + "rpcName": "GetStudy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = VizierServiceRestTransport._GetStudy._get_response( self._host, @@ -3455,7 +3861,29 @@ def __call__( pb_resp = study.Study.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_study(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = study.Study.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.aiplatform_v1.VizierServiceClient.get_study", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VizierService", + "rpcName": "GetStudy", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _GetTrial( @@ -3493,7 +3921,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]]] = (), ) -> study.Trial: r"""Call the get trial method over HTTP. @@ -3504,8 +3932,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: ~.study.Trial: @@ -3520,6 +3950,7 @@ def __call__( http_options = ( _BaseVizierServiceRestTransport._BaseGetTrial._get_http_options() ) + request, metadata = self._interceptor.pre_get_trial(request, metadata) transcoded_request = ( _BaseVizierServiceRestTransport._BaseGetTrial._get_transcoded_request( @@ -3534,6 +3965,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 = 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.aiplatform_v1.VizierServiceClient.GetTrial", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VizierService", + "rpcName": "GetTrial", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = VizierServiceRestTransport._GetTrial._get_response( self._host, @@ -3554,7 +4012,29 @@ def __call__( pb_resp = study.Trial.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_trial(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = study.Trial.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.aiplatform_v1.VizierServiceClient.get_trial", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VizierService", + "rpcName": "GetTrial", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListOptimalTrials( @@ -3593,7 +4073,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]]] = (), ) -> vizier_service.ListOptimalTrialsResponse: r"""Call the list optimal trials method over HTTP. @@ -3604,8 +4084,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: ~.vizier_service.ListOptimalTrialsResponse: @@ -3617,6 +4099,7 @@ def __call__( http_options = ( _BaseVizierServiceRestTransport._BaseListOptimalTrials._get_http_options() ) + request, metadata = self._interceptor.pre_list_optimal_trials( request, metadata ) @@ -3633,6 +4116,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.aiplatform_v1.VizierServiceClient.ListOptimalTrials", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VizierService", + "rpcName": "ListOptimalTrials", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = VizierServiceRestTransport._ListOptimalTrials._get_response( self._host, @@ -3654,7 +4164,31 @@ def __call__( pb_resp = vizier_service.ListOptimalTrialsResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_optimal_trials(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = vizier_service.ListOptimalTrialsResponse.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.aiplatform_v1.VizierServiceClient.list_optimal_trials", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VizierService", + "rpcName": "ListOptimalTrials", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListStudies( @@ -3692,7 +4226,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]]] = (), ) -> vizier_service.ListStudiesResponse: r"""Call the list studies method over HTTP. @@ -3703,8 +4237,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: ~.vizier_service.ListStudiesResponse: @@ -3716,6 +4252,7 @@ def __call__( http_options = ( _BaseVizierServiceRestTransport._BaseListStudies._get_http_options() ) + request, metadata = self._interceptor.pre_list_studies(request, metadata) transcoded_request = _BaseVizierServiceRestTransport._BaseListStudies._get_transcoded_request( http_options, request @@ -3728,6 +4265,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 = 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.aiplatform_v1.VizierServiceClient.ListStudies", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VizierService", + "rpcName": "ListStudies", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = VizierServiceRestTransport._ListStudies._get_response( self._host, @@ -3748,7 +4312,31 @@ def __call__( pb_resp = vizier_service.ListStudiesResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_studies(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = vizier_service.ListStudiesResponse.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.aiplatform_v1.VizierServiceClient.list_studies", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VizierService", + "rpcName": "ListStudies", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListTrials( @@ -3786,7 +4374,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]]] = (), ) -> vizier_service.ListTrialsResponse: r"""Call the list trials method over HTTP. @@ -3797,8 +4385,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: ~.vizier_service.ListTrialsResponse: @@ -3810,6 +4400,7 @@ def __call__( http_options = ( _BaseVizierServiceRestTransport._BaseListTrials._get_http_options() ) + request, metadata = self._interceptor.pre_list_trials(request, metadata) transcoded_request = ( _BaseVizierServiceRestTransport._BaseListTrials._get_transcoded_request( @@ -3824,6 +4415,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 = 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.aiplatform_v1.VizierServiceClient.ListTrials", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VizierService", + "rpcName": "ListTrials", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = VizierServiceRestTransport._ListTrials._get_response( self._host, @@ -3844,7 +4462,31 @@ def __call__( pb_resp = vizier_service.ListTrialsResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_trials(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = vizier_service.ListTrialsResponse.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.aiplatform_v1.VizierServiceClient.list_trials", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VizierService", + "rpcName": "ListTrials", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _LookupStudy( @@ -3883,7 +4525,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]]] = (), ) -> study.Study: r"""Call the lookup study method over HTTP. @@ -3894,8 +4536,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: ~.study.Study: @@ -3905,6 +4549,7 @@ def __call__( http_options = ( _BaseVizierServiceRestTransport._BaseLookupStudy._get_http_options() ) + request, metadata = self._interceptor.pre_lookup_study(request, metadata) transcoded_request = _BaseVizierServiceRestTransport._BaseLookupStudy._get_transcoded_request( http_options, request @@ -3923,6 +4568,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 = 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.aiplatform_v1.VizierServiceClient.LookupStudy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VizierService", + "rpcName": "LookupStudy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = VizierServiceRestTransport._LookupStudy._get_response( self._host, @@ -3944,7 +4616,29 @@ def __call__( pb_resp = study.Study.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_lookup_study(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = study.Study.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.aiplatform_v1.VizierServiceClient.lookup_study", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VizierService", + "rpcName": "LookupStudy", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _StopTrial( @@ -3983,7 +4677,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]]] = (), ) -> study.Trial: r"""Call the stop trial method over HTTP. @@ -3994,8 +4688,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: ~.study.Trial: @@ -4010,6 +4706,7 @@ def __call__( http_options = ( _BaseVizierServiceRestTransport._BaseStopTrial._get_http_options() ) + request, metadata = self._interceptor.pre_stop_trial(request, metadata) transcoded_request = ( _BaseVizierServiceRestTransport._BaseStopTrial._get_transcoded_request( @@ -4030,6 +4727,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 = 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.aiplatform_v1.VizierServiceClient.StopTrial", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VizierService", + "rpcName": "StopTrial", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = VizierServiceRestTransport._StopTrial._get_response( self._host, @@ -4051,7 +4775,29 @@ def __call__( pb_resp = study.Trial.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_stop_trial(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = study.Trial.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.aiplatform_v1.VizierServiceClient.stop_trial", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VizierService", + "rpcName": "StopTrial", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _SuggestTrials( @@ -4090,7 +4836,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 suggest trials method over HTTP. @@ -4101,8 +4847,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: @@ -4115,6 +4863,7 @@ def __call__( http_options = ( _BaseVizierServiceRestTransport._BaseSuggestTrials._get_http_options() ) + request, metadata = self._interceptor.pre_suggest_trials(request, metadata) transcoded_request = _BaseVizierServiceRestTransport._BaseSuggestTrials._get_transcoded_request( http_options, request @@ -4129,6 +4878,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.aiplatform_v1.VizierServiceClient.SuggestTrials", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VizierService", + "rpcName": "SuggestTrials", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = VizierServiceRestTransport._SuggestTrials._get_response( self._host, @@ -4148,7 +4924,29 @@ def __call__( # Return the response resp = operations_pb2.Operation() json_format.Parse(response.content, resp, ignore_unknown_fields=True) + resp = self._interceptor.post_suggest_trials(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.aiplatform_v1.VizierServiceClient.suggest_trials", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VizierService", + "rpcName": "SuggestTrials", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp @property @@ -4313,7 +5111,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]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -4324,8 +5122,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: locations_pb2.Location: Response from GetLocation method. @@ -4334,6 +5134,7 @@ def __call__( http_options = ( _BaseVizierServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = self._interceptor.pre_get_location(request, metadata) transcoded_request = _BaseVizierServiceRestTransport._BaseGetLocation._get_transcoded_request( http_options, request @@ -4346,6 +5147,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.aiplatform_v1.VizierServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VizierService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = VizierServiceRestTransport._GetLocation._get_response( self._host, @@ -4365,6 +5193,27 @@ def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_location(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.aiplatform_v1.VizierServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VizierService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4406,7 +5255,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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -4417,8 +5266,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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -4427,6 +5278,7 @@ def __call__( http_options = ( _BaseVizierServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = self._interceptor.pre_list_locations(request, metadata) transcoded_request = _BaseVizierServiceRestTransport._BaseListLocations._get_transcoded_request( http_options, request @@ -4437,6 +5289,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.aiplatform_v1.VizierServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VizierService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = VizierServiceRestTransport._ListLocations._get_response( self._host, @@ -4456,6 +5335,27 @@ def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_list_locations(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.aiplatform_v1.VizierServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VizierService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4497,7 +5397,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]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -4508,8 +5408,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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -4518,6 +5420,7 @@ def __call__( http_options = ( _BaseVizierServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_get_iam_policy(request, metadata) transcoded_request = _BaseVizierServiceRestTransport._BaseGetIamPolicy._get_transcoded_request( http_options, request @@ -4528,6 +5431,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.aiplatform_v1.VizierServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VizierService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = VizierServiceRestTransport._GetIamPolicy._get_response( self._host, @@ -4547,6 +5477,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_iam_policy(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.aiplatform_v1.VizierServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VizierService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4589,7 +5540,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]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -4600,8 +5551,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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -4610,6 +5563,7 @@ def __call__( http_options = ( _BaseVizierServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_set_iam_policy(request, metadata) transcoded_request = _BaseVizierServiceRestTransport._BaseSetIamPolicy._get_transcoded_request( http_options, request @@ -4624,6 +5578,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.aiplatform_v1.VizierServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VizierService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = VizierServiceRestTransport._SetIamPolicy._get_response( self._host, @@ -4644,6 +5625,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_set_iam_policy(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.aiplatform_v1.VizierServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VizierService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4685,7 +5687,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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -4696,8 +5698,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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -4706,6 +5710,7 @@ def __call__( http_options = ( _BaseVizierServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -4718,6 +5723,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.aiplatform_v1.VizierServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VizierService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = VizierServiceRestTransport._TestIamPermissions._get_response( self._host, @@ -4737,6 +5769,27 @@ def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_test_iam_permissions(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.aiplatform_v1.VizierServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VizierService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4778,7 +5831,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 cancel operation method over HTTP. @@ -4789,13 +5842,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 = ( _BaseVizierServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = self._interceptor.pre_cancel_operation( request, metadata ) @@ -4808,6 +5864,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.aiplatform_v1.VizierServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VizierService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = VizierServiceRestTransport._CancelOperation._get_response( self._host, @@ -4864,7 +5947,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. @@ -4875,13 +5958,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 = ( _BaseVizierServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = self._interceptor.pre_delete_operation( request, metadata ) @@ -4894,6 +5980,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.aiplatform_v1.VizierServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VizierService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = VizierServiceRestTransport._DeleteOperation._get_response( self._host, @@ -4950,7 +6063,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. @@ -4961,8 +6074,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. @@ -4971,6 +6086,7 @@ def __call__( http_options = ( _BaseVizierServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = self._interceptor.pre_get_operation(request, metadata) transcoded_request = _BaseVizierServiceRestTransport._BaseGetOperation._get_transcoded_request( http_options, request @@ -4981,6 +6097,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.aiplatform_v1.VizierServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VizierService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = VizierServiceRestTransport._GetOperation._get_response( self._host, @@ -5000,6 +6143,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.aiplatform_v1.VizierServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VizierService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5041,7 +6205,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. @@ -5052,8 +6216,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. @@ -5062,6 +6228,7 @@ def __call__( http_options = ( _BaseVizierServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = self._interceptor.pre_list_operations(request, metadata) transcoded_request = _BaseVizierServiceRestTransport._BaseListOperations._get_transcoded_request( http_options, request @@ -5072,6 +6239,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.aiplatform_v1.VizierServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VizierService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = VizierServiceRestTransport._ListOperations._get_response( self._host, @@ -5091,6 +6285,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.aiplatform_v1.VizierServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VizierService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5132,7 +6347,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 wait operation method over HTTP. @@ -5143,8 +6358,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 WaitOperation method. @@ -5153,6 +6370,7 @@ def __call__( http_options = ( _BaseVizierServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = self._interceptor.pre_wait_operation(request, metadata) transcoded_request = _BaseVizierServiceRestTransport._BaseWaitOperation._get_transcoded_request( http_options, request @@ -5163,6 +6381,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.aiplatform_v1.VizierServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VizierService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = VizierServiceRestTransport._WaitOperation._get_response( self._host, @@ -5182,6 +6427,27 @@ def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = self._interceptor.post_wait_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.aiplatform_v1.VizierServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VizierService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1/services/vizier_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1/services/vizier_service/transports/rest_asyncio.py index c73ec97afa..204e6fb03e 100644 --- a/google/cloud/aiplatform_v1/services/vizier_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1/services/vizier_service/transports/rest_asyncio.py @@ -61,6 +61,18 @@ from .base import DEFAULT_CLIENT_INFO as BASE_DEFAULT_CLIENT_INFO + +import logging + +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__) + try: OptionalRetry = Union[retries.AsyncRetry, gapic_v1.method._MethodDefault, None] except AttributeError: # pragma: NO COVER @@ -209,8 +221,11 @@ async def post_suggest_trials(self, response): async def pre_add_trial_measurement( self, request: vizier_service.AddTrialMeasurementRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[vizier_service.AddTrialMeasurementRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + vizier_service.AddTrialMeasurementRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for add_trial_measurement Override in a subclass to manipulate the request or metadata @@ -230,9 +245,10 @@ async def post_add_trial_measurement(self, response: study.Trial) -> study.Trial async def pre_check_trial_early_stopping_state( self, request: vizier_service.CheckTrialEarlyStoppingStateRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - vizier_service.CheckTrialEarlyStoppingStateRequest, Sequence[Tuple[str, str]] + vizier_service.CheckTrialEarlyStoppingStateRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for check_trial_early_stopping_state @@ -255,8 +271,10 @@ async def post_check_trial_early_stopping_state( async def pre_complete_trial( self, request: vizier_service.CompleteTrialRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[vizier_service.CompleteTrialRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + vizier_service.CompleteTrialRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for complete_trial Override in a subclass to manipulate the request or metadata @@ -276,8 +294,10 @@ async def post_complete_trial(self, response: study.Trial) -> study.Trial: async def pre_create_study( self, request: vizier_service.CreateStudyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[vizier_service.CreateStudyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + vizier_service.CreateStudyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for create_study Override in a subclass to manipulate the request or metadata @@ -297,8 +317,10 @@ async def post_create_study(self, response: gca_study.Study) -> gca_study.Study: async def pre_create_trial( self, request: vizier_service.CreateTrialRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[vizier_service.CreateTrialRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + vizier_service.CreateTrialRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for create_trial Override in a subclass to manipulate the request or metadata @@ -318,8 +340,10 @@ async def post_create_trial(self, response: study.Trial) -> study.Trial: async def pre_delete_study( self, request: vizier_service.DeleteStudyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[vizier_service.DeleteStudyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + vizier_service.DeleteStudyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for delete_study Override in a subclass to manipulate the request or metadata @@ -330,8 +354,10 @@ async def pre_delete_study( async def pre_delete_trial( self, request: vizier_service.DeleteTrialRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[vizier_service.DeleteTrialRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + vizier_service.DeleteTrialRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for delete_trial Override in a subclass to manipulate the request or metadata @@ -342,8 +368,8 @@ async def pre_delete_trial( async def pre_get_study( self, request: vizier_service.GetStudyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[vizier_service.GetStudyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[vizier_service.GetStudyRequest, Sequence[Tuple[str, Union[str, bytes]]]]: """Pre-rpc interceptor for get_study Override in a subclass to manipulate the request or metadata @@ -363,8 +389,8 @@ async def post_get_study(self, response: study.Study) -> study.Study: async def pre_get_trial( self, request: vizier_service.GetTrialRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[vizier_service.GetTrialRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[vizier_service.GetTrialRequest, Sequence[Tuple[str, Union[str, bytes]]]]: """Pre-rpc interceptor for get_trial Override in a subclass to manipulate the request or metadata @@ -384,8 +410,10 @@ async def post_get_trial(self, response: study.Trial) -> study.Trial: async def pre_list_optimal_trials( self, request: vizier_service.ListOptimalTrialsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[vizier_service.ListOptimalTrialsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + vizier_service.ListOptimalTrialsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_optimal_trials Override in a subclass to manipulate the request or metadata @@ -407,8 +435,10 @@ async def post_list_optimal_trials( async def pre_list_studies( self, request: vizier_service.ListStudiesRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[vizier_service.ListStudiesRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + vizier_service.ListStudiesRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_studies Override in a subclass to manipulate the request or metadata @@ -430,8 +460,10 @@ async def post_list_studies( async def pre_list_trials( self, request: vizier_service.ListTrialsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[vizier_service.ListTrialsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + vizier_service.ListTrialsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_trials Override in a subclass to manipulate the request or metadata @@ -453,8 +485,10 @@ async def post_list_trials( async def pre_lookup_study( self, request: vizier_service.LookupStudyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[vizier_service.LookupStudyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + vizier_service.LookupStudyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for lookup_study Override in a subclass to manipulate the request or metadata @@ -474,8 +508,10 @@ async def post_lookup_study(self, response: study.Study) -> study.Study: async def pre_stop_trial( self, request: vizier_service.StopTrialRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[vizier_service.StopTrialRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + vizier_service.StopTrialRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for stop_trial Override in a subclass to manipulate the request or metadata @@ -495,8 +531,10 @@ async def post_stop_trial(self, response: study.Trial) -> study.Trial: async def pre_suggest_trials( self, request: vizier_service.SuggestTrialsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[vizier_service.SuggestTrialsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + vizier_service.SuggestTrialsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for suggest_trials Override in a subclass to manipulate the request or metadata @@ -518,8 +556,10 @@ async def post_suggest_trials( async def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -541,8 +581,10 @@ async def post_get_location( async def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -564,8 +606,10 @@ async def post_list_locations( async def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -587,8 +631,10 @@ async def post_get_iam_policy( async def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -610,8 +656,11 @@ async def post_set_iam_policy( async def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -633,8 +682,10 @@ async def post_test_iam_permissions( async def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -654,8 +705,10 @@ async def post_cancel_operation(self, response: None) -> None: async 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 @@ -675,8 +728,10 @@ async def post_delete_operation(self, response: None) -> None: async 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 @@ -698,8 +753,10 @@ async def post_get_operation( async 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 @@ -721,8 +778,10 @@ async def post_list_operations( async def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -982,7 +1041,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> study.Trial: r"""Call the add trial measurement method over HTTP. @@ -993,8 +1052,10 @@ async def __call__( 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: ~.study.Trial: @@ -1009,6 +1070,7 @@ async def __call__( http_options = ( _BaseVizierServiceRestTransport._BaseAddTrialMeasurement._get_http_options() ) + request, metadata = await self._interceptor.pre_add_trial_measurement( request, metadata ) @@ -1025,6 +1087,33 @@ async 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.aiplatform_v1.VizierServiceClient.AddTrialMeasurement", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VizierService", + "rpcName": "AddTrialMeasurement", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncVizierServiceRestTransport._AddTrialMeasurement._get_response( self._host, @@ -1053,6 +1142,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_add_trial_measurement(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = study.Trial.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.VizierServiceAsyncClient.add_trial_measurement", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VizierService", + "rpcName": "AddTrialMeasurement", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _CheckTrialEarlyStoppingState( @@ -1092,7 +1203,7 @@ async 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 trial early stopping state method over HTTP. @@ -1104,8 +1215,10 @@ async def __call__( 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: @@ -1118,6 +1231,7 @@ async def __call__( http_options = ( _BaseVizierServiceRestTransport._BaseCheckTrialEarlyStoppingState._get_http_options() ) + ( request, metadata, @@ -1137,6 +1251,33 @@ async 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.aiplatform_v1.VizierServiceClient.CheckTrialEarlyStoppingState", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VizierService", + "rpcName": "CheckTrialEarlyStoppingState", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncVizierServiceRestTransport._CheckTrialEarlyStoppingState._get_response( self._host, @@ -1165,6 +1306,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_check_trial_early_stopping_state(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.VizierServiceAsyncClient.check_trial_early_stopping_state", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VizierService", + "rpcName": "CheckTrialEarlyStoppingState", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _CompleteTrial( @@ -1203,7 +1366,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> study.Trial: r"""Call the complete trial method over HTTP. @@ -1214,8 +1377,10 @@ async def __call__( 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: ~.study.Trial: @@ -1230,6 +1395,7 @@ async def __call__( http_options = ( _BaseVizierServiceRestTransport._BaseCompleteTrial._get_http_options() ) + request, metadata = await self._interceptor.pre_complete_trial( request, metadata ) @@ -1246,6 +1412,33 @@ async 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.aiplatform_v1.VizierServiceClient.CompleteTrial", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VizierService", + "rpcName": "CompleteTrial", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncVizierServiceRestTransport._CompleteTrial._get_response( @@ -1276,6 +1469,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_complete_trial(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = study.Trial.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.VizierServiceAsyncClient.complete_trial", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VizierService", + "rpcName": "CompleteTrial", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _CreateStudy( @@ -1314,7 +1529,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> gca_study.Study: r"""Call the create study method over HTTP. @@ -1325,8 +1540,10 @@ async def __call__( 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: ~.gca_study.Study: @@ -1336,6 +1553,7 @@ async def __call__( http_options = ( _BaseVizierServiceRestTransport._BaseCreateStudy._get_http_options() ) + request, metadata = await self._interceptor.pre_create_study( request, metadata ) @@ -1356,6 +1574,33 @@ async 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 = 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.aiplatform_v1.VizierServiceClient.CreateStudy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VizierService", + "rpcName": "CreateStudy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncVizierServiceRestTransport._CreateStudy._get_response( self._host, @@ -1384,6 +1629,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_create_study(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gca_study.Study.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.VizierServiceAsyncClient.create_study", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VizierService", + "rpcName": "CreateStudy", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _CreateTrial( @@ -1422,7 +1689,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> study.Trial: r"""Call the create trial method over HTTP. @@ -1433,8 +1700,10 @@ async def __call__( 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: ~.study.Trial: @@ -1449,6 +1718,7 @@ async def __call__( http_options = ( _BaseVizierServiceRestTransport._BaseCreateTrial._get_http_options() ) + request, metadata = await self._interceptor.pre_create_trial( request, metadata ) @@ -1469,6 +1739,33 @@ async 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 = 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.aiplatform_v1.VizierServiceClient.CreateTrial", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VizierService", + "rpcName": "CreateTrial", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncVizierServiceRestTransport._CreateTrial._get_response( self._host, @@ -1497,6 +1794,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_create_trial(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = study.Trial.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.VizierServiceAsyncClient.create_trial", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VizierService", + "rpcName": "CreateTrial", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _DeleteStudy( @@ -1534,7 +1853,7 @@ async 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 study method over HTTP. @@ -1545,13 +1864,16 @@ async def __call__( 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`. """ http_options = ( _BaseVizierServiceRestTransport._BaseDeleteStudy._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_study( request, metadata ) @@ -1566,6 +1888,33 @@ async 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.aiplatform_v1.VizierServiceClient.DeleteStudy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VizierService", + "rpcName": "DeleteStudy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncVizierServiceRestTransport._DeleteStudy._get_response( self._host, @@ -1622,7 +1971,7 @@ async 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 trial method over HTTP. @@ -1633,13 +1982,16 @@ async def __call__( 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`. """ http_options = ( _BaseVizierServiceRestTransport._BaseDeleteTrial._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_trial( request, metadata ) @@ -1654,6 +2006,33 @@ async 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.aiplatform_v1.VizierServiceClient.DeleteTrial", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VizierService", + "rpcName": "DeleteTrial", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncVizierServiceRestTransport._DeleteTrial._get_response( self._host, @@ -1710,7 +2089,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> study.Study: r"""Call the get study method over HTTP. @@ -1721,8 +2100,10 @@ async def __call__( 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: ~.study.Study: @@ -1732,6 +2113,7 @@ async def __call__( http_options = ( _BaseVizierServiceRestTransport._BaseGetStudy._get_http_options() ) + request, metadata = await self._interceptor.pre_get_study(request, metadata) transcoded_request = ( _BaseVizierServiceRestTransport._BaseGetStudy._get_transcoded_request( @@ -1746,6 +2128,33 @@ async 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 = 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.aiplatform_v1.VizierServiceClient.GetStudy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VizierService", + "rpcName": "GetStudy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncVizierServiceRestTransport._GetStudy._get_response( self._host, @@ -1773,6 +2182,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_get_study(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = study.Study.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.VizierServiceAsyncClient.get_study", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VizierService", + "rpcName": "GetStudy", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _GetTrial( @@ -1810,7 +2241,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> study.Trial: r"""Call the get trial method over HTTP. @@ -1821,8 +2252,10 @@ async def __call__( 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: ~.study.Trial: @@ -1837,6 +2270,7 @@ async def __call__( http_options = ( _BaseVizierServiceRestTransport._BaseGetTrial._get_http_options() ) + request, metadata = await self._interceptor.pre_get_trial(request, metadata) transcoded_request = ( _BaseVizierServiceRestTransport._BaseGetTrial._get_transcoded_request( @@ -1851,6 +2285,33 @@ async 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 = 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.aiplatform_v1.VizierServiceClient.GetTrial", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VizierService", + "rpcName": "GetTrial", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncVizierServiceRestTransport._GetTrial._get_response( self._host, @@ -1878,6 +2339,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_get_trial(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = study.Trial.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.VizierServiceAsyncClient.get_trial", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VizierService", + "rpcName": "GetTrial", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ListOptimalTrials( @@ -1917,7 +2400,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> vizier_service.ListOptimalTrialsResponse: r"""Call the list optimal trials method over HTTP. @@ -1928,8 +2411,10 @@ async def __call__( 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: ~.vizier_service.ListOptimalTrialsResponse: @@ -1941,6 +2426,7 @@ async def __call__( http_options = ( _BaseVizierServiceRestTransport._BaseListOptimalTrials._get_http_options() ) + request, metadata = await self._interceptor.pre_list_optimal_trials( request, metadata ) @@ -1957,6 +2443,33 @@ async 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.aiplatform_v1.VizierServiceClient.ListOptimalTrials", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VizierService", + "rpcName": "ListOptimalTrials", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncVizierServiceRestTransport._ListOptimalTrials._get_response( @@ -1987,6 +2500,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_list_optimal_trials(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = vizier_service.ListOptimalTrialsResponse.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.VizierServiceAsyncClient.list_optimal_trials", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VizierService", + "rpcName": "ListOptimalTrials", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ListStudies( @@ -2024,7 +2561,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> vizier_service.ListStudiesResponse: r"""Call the list studies method over HTTP. @@ -2035,8 +2572,10 @@ async def __call__( 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: ~.vizier_service.ListStudiesResponse: @@ -2048,6 +2587,7 @@ async def __call__( http_options = ( _BaseVizierServiceRestTransport._BaseListStudies._get_http_options() ) + request, metadata = await self._interceptor.pre_list_studies( request, metadata ) @@ -2062,6 +2602,33 @@ async 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 = 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.aiplatform_v1.VizierServiceClient.ListStudies", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VizierService", + "rpcName": "ListStudies", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncVizierServiceRestTransport._ListStudies._get_response( self._host, @@ -2089,6 +2656,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_list_studies(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = vizier_service.ListStudiesResponse.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.VizierServiceAsyncClient.list_studies", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VizierService", + "rpcName": "ListStudies", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ListTrials( @@ -2126,7 +2717,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> vizier_service.ListTrialsResponse: r"""Call the list trials method over HTTP. @@ -2137,8 +2728,10 @@ async def __call__( 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: ~.vizier_service.ListTrialsResponse: @@ -2150,6 +2743,7 @@ async def __call__( http_options = ( _BaseVizierServiceRestTransport._BaseListTrials._get_http_options() ) + request, metadata = await self._interceptor.pre_list_trials( request, metadata ) @@ -2166,6 +2760,33 @@ async 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 = 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.aiplatform_v1.VizierServiceClient.ListTrials", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VizierService", + "rpcName": "ListTrials", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncVizierServiceRestTransport._ListTrials._get_response( self._host, @@ -2193,6 +2814,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_list_trials(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = vizier_service.ListTrialsResponse.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.VizierServiceAsyncClient.list_trials", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VizierService", + "rpcName": "ListTrials", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _LookupStudy( @@ -2231,7 +2876,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> study.Study: r"""Call the lookup study method over HTTP. @@ -2242,8 +2887,10 @@ async def __call__( 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: ~.study.Study: @@ -2253,6 +2900,7 @@ async def __call__( http_options = ( _BaseVizierServiceRestTransport._BaseLookupStudy._get_http_options() ) + request, metadata = await self._interceptor.pre_lookup_study( request, metadata ) @@ -2273,6 +2921,33 @@ async 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 = 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.aiplatform_v1.VizierServiceClient.LookupStudy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VizierService", + "rpcName": "LookupStudy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncVizierServiceRestTransport._LookupStudy._get_response( self._host, @@ -2301,6 +2976,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_lookup_study(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = study.Study.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.VizierServiceAsyncClient.lookup_study", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VizierService", + "rpcName": "LookupStudy", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _StopTrial( @@ -2339,7 +3036,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> study.Trial: r"""Call the stop trial method over HTTP. @@ -2350,8 +3047,10 @@ async def __call__( 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: ~.study.Trial: @@ -2366,6 +3065,7 @@ async def __call__( http_options = ( _BaseVizierServiceRestTransport._BaseStopTrial._get_http_options() ) + request, metadata = await self._interceptor.pre_stop_trial( request, metadata ) @@ -2388,6 +3088,33 @@ async 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 = 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.aiplatform_v1.VizierServiceClient.StopTrial", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VizierService", + "rpcName": "StopTrial", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncVizierServiceRestTransport._StopTrial._get_response( self._host, @@ -2416,6 +3143,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_stop_trial(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = study.Trial.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.VizierServiceAsyncClient.stop_trial", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VizierService", + "rpcName": "StopTrial", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _SuggestTrials( @@ -2454,7 +3203,7 @@ async 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 suggest trials method over HTTP. @@ -2465,8 +3214,10 @@ async def __call__( 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: @@ -2479,6 +3230,7 @@ async def __call__( http_options = ( _BaseVizierServiceRestTransport._BaseSuggestTrials._get_http_options() ) + request, metadata = await self._interceptor.pre_suggest_trials( request, metadata ) @@ -2495,6 +3247,33 @@ async 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.aiplatform_v1.VizierServiceClient.SuggestTrials", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VizierService", + "rpcName": "SuggestTrials", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncVizierServiceRestTransport._SuggestTrials._get_response( @@ -2525,6 +3304,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_suggest_trials(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1.VizierServiceAsyncClient.suggest_trials", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VizierService", + "rpcName": "SuggestTrials", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp @property @@ -4536,7 +5337,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -4547,8 +5348,10 @@ async def __call__( 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: locations_pb2.Location: Response from GetLocation method. @@ -4557,6 +5360,7 @@ async def __call__( http_options = ( _BaseVizierServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_location( request, metadata ) @@ -4571,6 +5375,33 @@ async 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.aiplatform_v1.VizierServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VizierService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncVizierServiceRestTransport._GetLocation._get_response( self._host, @@ -4596,6 +5427,27 @@ async def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_location(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.aiplatform_v1.VizierServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VizierService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4637,7 +5489,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -4648,8 +5500,10 @@ async def __call__( 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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -4658,6 +5512,7 @@ async def __call__( http_options = ( _BaseVizierServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_locations( request, metadata ) @@ -4670,6 +5525,33 @@ async 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.aiplatform_v1.VizierServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VizierService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncVizierServiceRestTransport._ListLocations._get_response( @@ -4697,6 +5579,27 @@ async def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_list_locations(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.aiplatform_v1.VizierServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VizierService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4738,7 +5641,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -4749,8 +5652,10 @@ async def __call__( 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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -4759,6 +5664,7 @@ async def __call__( http_options = ( _BaseVizierServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_get_iam_policy( request, metadata ) @@ -4771,6 +5677,33 @@ async 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.aiplatform_v1.VizierServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VizierService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncVizierServiceRestTransport._GetIamPolicy._get_response( @@ -4798,6 +5731,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_iam_policy(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.aiplatform_v1.VizierServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VizierService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4840,7 +5794,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -4851,8 +5805,10 @@ async def __call__( 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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -4861,6 +5817,7 @@ async def __call__( http_options = ( _BaseVizierServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_set_iam_policy( request, metadata ) @@ -4877,6 +5834,33 @@ async 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.aiplatform_v1.VizierServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VizierService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncVizierServiceRestTransport._SetIamPolicy._get_response( @@ -4905,6 +5889,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_set_iam_policy(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.aiplatform_v1.VizierServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VizierService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4947,7 +5952,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -4958,8 +5963,10 @@ async def __call__( 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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -4968,6 +5975,7 @@ async def __call__( http_options = ( _BaseVizierServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = await self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -4980,6 +5988,33 @@ async 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.aiplatform_v1.VizierServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VizierService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncVizierServiceRestTransport._TestIamPermissions._get_response( @@ -5007,6 +6042,27 @@ async def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_test_iam_permissions(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.aiplatform_v1.VizierServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VizierService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5048,7 +6104,7 @@ async 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 cancel operation method over HTTP. @@ -5059,13 +6115,16 @@ async def __call__( 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`. """ http_options = ( _BaseVizierServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_cancel_operation( request, metadata ) @@ -5078,6 +6137,33 @@ async 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.aiplatform_v1.VizierServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VizierService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncVizierServiceRestTransport._CancelOperation._get_response( @@ -5142,7 +6228,7 @@ async 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. @@ -5153,13 +6239,16 @@ async def __call__( 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`. """ http_options = ( _BaseVizierServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_operation( request, metadata ) @@ -5172,6 +6261,33 @@ async 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.aiplatform_v1.VizierServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VizierService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncVizierServiceRestTransport._DeleteOperation._get_response( @@ -5236,7 +6352,7 @@ async 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. @@ -5247,8 +6363,10 @@ async def __call__( 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: Response from GetOperation method. @@ -5257,6 +6375,7 @@ async def __call__( http_options = ( _BaseVizierServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_operation( request, metadata ) @@ -5269,6 +6388,33 @@ async 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.aiplatform_v1.VizierServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VizierService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncVizierServiceRestTransport._GetOperation._get_response( @@ -5296,6 +6442,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1.VizierServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VizierService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5337,7 +6504,7 @@ async 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. @@ -5348,8 +6515,10 @@ async def __call__( 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 from ListOperations method. @@ -5358,6 +6527,7 @@ async def __call__( http_options = ( _BaseVizierServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_operations( request, metadata ) @@ -5370,6 +6540,33 @@ async 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.aiplatform_v1.VizierServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VizierService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncVizierServiceRestTransport._ListOperations._get_response( @@ -5397,6 +6594,27 @@ async def __call__( resp = operations_pb2.ListOperationsResponse() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1.VizierServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VizierService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5438,7 +6656,7 @@ async 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 wait operation method over HTTP. @@ -5449,8 +6667,10 @@ async def __call__( 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: Response from WaitOperation method. @@ -5459,6 +6679,7 @@ async def __call__( http_options = ( _BaseVizierServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_wait_operation( request, metadata ) @@ -5471,6 +6692,33 @@ async 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.aiplatform_v1.VizierServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VizierService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncVizierServiceRestTransport._WaitOperation._get_response( @@ -5498,6 +6746,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_wait_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.aiplatform_v1.VizierServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1.VizierService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1/types/accelerator_type.py b/google/cloud/aiplatform_v1/types/accelerator_type.py index bf6749dff9..43a2a6ecf3 100644 --- a/google/cloud/aiplatform_v1/types/accelerator_type.py +++ b/google/cloud/aiplatform_v1/types/accelerator_type.py @@ -55,6 +55,8 @@ class AcceleratorType(proto.Enum): Nvidia L4 GPU. NVIDIA_H100_80GB (13): Nvidia H100 80Gb GPU. + NVIDIA_H100_MEGA_80GB (14): + Nvidia H100 Mega 80Gb GPU. TPU_V2 (6): TPU v2. TPU_V3 (7): @@ -74,6 +76,7 @@ class AcceleratorType(proto.Enum): NVIDIA_A100_80GB = 9 NVIDIA_L4 = 11 NVIDIA_H100_80GB = 13 + NVIDIA_H100_MEGA_80GB = 14 TPU_V2 = 6 TPU_V3 = 7 TPU_V4_POD = 10 diff --git a/google/cloud/aiplatform_v1/types/endpoint.py b/google/cloud/aiplatform_v1/types/endpoint.py index 197b35324b..a383e7b15d 100644 --- a/google/cloud/aiplatform_v1/types/endpoint.py +++ b/google/cloud/aiplatform_v1/types/endpoint.py @@ -378,12 +378,44 @@ class DeployedModel(proto.Message): configured. faster_deployment_config (google.cloud.aiplatform_v1.types.FasterDeploymentConfig): Configuration for faster model deployment. + status (google.cloud.aiplatform_v1.types.DeployedModel.Status): + Output only. Runtime status of the deployed + model. system_labels (MutableMapping[str, str]): System labels to apply to Model Garden deployments. System labels are managed by Google for internal use only. """ + class Status(proto.Message): + r"""Runtime status of the deployed model. + + Attributes: + message (str): + Output only. The latest deployed model's + status message (if any). + last_update_time (google.protobuf.timestamp_pb2.Timestamp): + Output only. The time at which the status was + last updated. + available_replica_count (int): + Output only. The number of available replicas + of the deployed model. + """ + + message: str = proto.Field( + proto.STRING, + number=1, + ) + last_update_time: timestamp_pb2.Timestamp = proto.Field( + proto.MESSAGE, + number=2, + message=timestamp_pb2.Timestamp, + ) + available_replica_count: int = proto.Field( + proto.INT32, + number=3, + ) + dedicated_resources: machine_resources.DedicatedResources = proto.Field( proto.MESSAGE, number=7, @@ -453,6 +485,11 @@ class DeployedModel(proto.Message): number=23, message="FasterDeploymentConfig", ) + status: Status = proto.Field( + proto.MESSAGE, + number=26, + message=Status, + ) system_labels: MutableMapping[str, str] = proto.MapField( proto.STRING, proto.STRING, diff --git a/google/cloud/aiplatform_v1/types/machine_resources.py b/google/cloud/aiplatform_v1/types/machine_resources.py index af3dcfab6d..a8ee284491 100644 --- a/google/cloud/aiplatform_v1/types/machine_resources.py +++ b/google/cloud/aiplatform_v1/types/machine_resources.py @@ -141,6 +141,14 @@ class DedicatedResources(proto.Message): (max_replica_count \* number of cores in the selected machine type) and (max_replica_count \* number of GPUs per replica in the selected machine type). + required_replica_count (int): + Optional. Number of required available replicas for the + deployment to succeed. This field is only needed when + partial model deployment/mutation is desired. If set, the + model deploy/mutate operation will succeed once + available_replica_count reaches required_replica_count, and + the rest of the replicas will be retried. If not set, the + default required_replica_count will be min_replica_count. autoscaling_metric_specs (MutableSequence[google.cloud.aiplatform_v1.types.AutoscalingMetricSpec]): Immutable. The metric specifications that overrides a resource utilization metric (CPU utilization, accelerator's @@ -187,6 +195,10 @@ class DedicatedResources(proto.Message): proto.INT32, number=3, ) + required_replica_count: int = proto.Field( + proto.INT32, + number=9, + ) autoscaling_metric_specs: MutableSequence[ "AutoscalingMetricSpec" ] = proto.RepeatedField( diff --git a/google/cloud/aiplatform_v1/types/notebook_execution_job.py b/google/cloud/aiplatform_v1/types/notebook_execution_job.py index 01f631bf79..62f6fb20cf 100644 --- a/google/cloud/aiplatform_v1/types/notebook_execution_job.py +++ b/google/cloud/aiplatform_v1/types/notebook_execution_job.py @@ -86,6 +86,11 @@ class NotebookExecutionJob(proto.Message): The service account to run the execution as. This field is a member of `oneof`_ ``execution_identity``. + workbench_runtime (google.cloud.aiplatform_v1.types.NotebookExecutionJob.WorkbenchRuntime): + The Workbench runtime configuration to use + for the notebook execution. + + This field is a member of `oneof`_ ``runtime_environment``. name (str): Output only. The resource name of this NotebookExecutionJob. Format: @@ -128,11 +133,14 @@ class NotebookExecutionJob(proto.Message): and examples of labels. System reserved label keys are prefixed with "aiplatform.googleapis.com/" and are immutable. + kernel_name (str): + The name of the kernel to use during notebook + execution. If unset, the default kernel is used. encryption_spec (google.cloud.aiplatform_v1.types.EncryptionSpec): Customer-managed encryption key spec for the notebook execution job. This field is auto-populated if the - [NotebookService.NotebookRuntimeTemplate][] has an - encryption spec. + [NotebookRuntimeTemplate][google.cloud.aiplatform.v1.NotebookRuntimeTemplate] + has an encryption spec. """ class DataformRepositorySource(proto.Message): @@ -224,6 +232,9 @@ class CustomEnvironmentSpec(proto.Message): message=gca_network_spec.NetworkSpec, ) + class WorkbenchRuntime(proto.Message): + r"""Configuration for a Workbench Instances-based environment.""" + dataform_repository_source: DataformRepositorySource = proto.Field( proto.MESSAGE, number=3, @@ -268,6 +279,12 @@ class CustomEnvironmentSpec(proto.Message): number=18, oneof="execution_identity", ) + workbench_runtime: WorkbenchRuntime = proto.Field( + proto.MESSAGE, + number=23, + oneof="runtime_environment", + message=WorkbenchRuntime, + ) name: str = proto.Field( proto.STRING, number=1, @@ -310,6 +327,10 @@ class CustomEnvironmentSpec(proto.Message): proto.STRING, number=19, ) + kernel_name: str = proto.Field( + proto.STRING, + number=20, + ) encryption_spec: gca_encryption_spec.EncryptionSpec = proto.Field( proto.MESSAGE, number=22, diff --git a/google/cloud/aiplatform_v1beta1/__init__.py b/google/cloud/aiplatform_v1beta1/__init__.py index 87130ffc1e..142e2dea79 100644 --- a/google/cloud/aiplatform_v1beta1/__init__.py +++ b/google/cloud/aiplatform_v1beta1/__init__.py @@ -125,12 +125,15 @@ from .types.content import GroundingSupport from .types.content import LogprobsResult from .types.content import Part +from .types.content import PrebuiltVoiceConfig from .types.content import RetrievalMetadata from .types.content import SafetyRating from .types.content import SafetySetting from .types.content import SearchEntryPoint from .types.content import Segment +from .types.content import SpeechConfig from .types.content import VideoMetadata +from .types.content import VoiceConfig from .types.content import HarmCategory from .types.context import Context from .types.custom_job import ContainerSpec @@ -1858,6 +1861,7 @@ "PointwiseMetricResult", "PointwiseMetricSpec", "Port", + "PrebuiltVoiceConfig", "PredefinedSplit", "PredictLongRunningMetadata", "PredictLongRunningResponse", @@ -2007,6 +2011,7 @@ "SmoothGradConfig", "SpecialistPool", "SpecialistPoolServiceClient", + "SpeechConfig", "StartNotebookRuntimeOperationMetadata", "StartNotebookRuntimeRequest", "StartNotebookRuntimeResponse", @@ -2210,6 +2215,7 @@ "VertexRagStore", "VideoMetadata", "VizierServiceClient", + "VoiceConfig", "WorkerPoolSpec", "WriteFeatureValuesPayload", "WriteFeatureValuesRequest", diff --git a/google/cloud/aiplatform_v1beta1/services/dataset_service/async_client.py b/google/cloud/aiplatform_v1beta1/services/dataset_service/async_client.py index 90c6e8c2b9..bb6aef309d 100644 --- a/google/cloud/aiplatform_v1beta1/services/dataset_service/async_client.py +++ b/google/cloud/aiplatform_v1beta1/services/dataset_service/async_client.py @@ -13,6 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging as std_logging from collections import OrderedDict import re from typing import ( @@ -69,6 +70,15 @@ from .transports.grpc_asyncio import DatasetServiceGrpcAsyncIOTransport from .client import DatasetServiceClient +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 DatasetServiceAsyncClient: """The service that manages Vertex AI Dataset and its child @@ -290,6 +300,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.aiplatform_v1beta1.DatasetServiceAsyncClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DatasetService", + "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.aiplatform.v1beta1.DatasetService", + "credentialsType": None, + }, + ) + async def create_dataset( self, request: Optional[Union[dataset_service.CreateDatasetRequest, dict]] = None, @@ -298,7 +330,7 @@ async def create_dataset( dataset: Optional[gca_dataset.Dataset] = 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"""Creates a Dataset. @@ -358,8 +390,10 @@ async def sample_create_dataset(): 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: @@ -433,7 +467,7 @@ async def get_dataset( 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]]] = (), ) -> dataset.Dataset: r"""Gets a Dataset. @@ -477,8 +511,10 @@ async def sample_get_dataset(): 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.aiplatform_v1beta1.types.Dataset: @@ -540,7 +576,7 @@ async def update_dataset( 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]]] = (), ) -> gca_dataset.Dataset: r"""Updates a Dataset. @@ -602,8 +638,10 @@ async def sample_update_dataset(): 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.aiplatform_v1beta1.types.Dataset: @@ -668,7 +706,7 @@ async def list_datasets( 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.ListDatasetsAsyncPager: r"""Lists Datasets in a Location. @@ -713,8 +751,10 @@ async def sample_list_datasets(): 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.aiplatform_v1beta1.services.dataset_service.pagers.ListDatasetsAsyncPager: @@ -789,7 +829,7 @@ async def delete_dataset( 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"""Deletes a Dataset. @@ -838,8 +878,10 @@ async def sample_delete_dataset(): 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: @@ -919,7 +961,7 @@ async def import_data( import_configs: Optional[MutableSequence[dataset.ImportDataConfig]] = 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"""Imports data into a Dataset. @@ -980,8 +1022,10 @@ async def sample_import_data(): 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: @@ -1055,7 +1099,7 @@ async def export_data( export_config: Optional[dataset.ExportDataConfig] = 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"""Exports data from a Dataset. @@ -1114,8 +1158,10 @@ async def sample_export_data(): 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: @@ -1191,7 +1237,7 @@ async def create_dataset_version( dataset_version: Optional[gca_dataset_version.DatasetVersion] = 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 version from a Dataset. @@ -1253,8 +1299,10 @@ async def sample_create_dataset_version(): 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: @@ -1331,7 +1379,7 @@ async def update_dataset_version( 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]]] = (), ) -> gca_dataset_version.DatasetVersion: r"""Updates a DatasetVersion. @@ -1389,8 +1437,10 @@ async def sample_update_dataset_version(): 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.aiplatform_v1beta1.types.DatasetVersion: @@ -1455,7 +1505,7 @@ async def delete_dataset_version( 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"""Deletes a Dataset version. @@ -1504,8 +1554,10 @@ async def sample_delete_dataset_version(): 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: @@ -1584,7 +1636,7 @@ async def get_dataset_version( 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]]] = (), ) -> dataset_version.DatasetVersion: r"""Gets a Dataset version. @@ -1629,8 +1681,10 @@ async def sample_get_dataset_version(): 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.aiplatform_v1beta1.types.DatasetVersion: @@ -1691,7 +1745,7 @@ async def list_dataset_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.ListDatasetVersionsAsyncPager: r"""Lists DatasetVersions in a Dataset. @@ -1737,8 +1791,10 @@ async def sample_list_dataset_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.aiplatform_v1beta1.services.dataset_service.pagers.ListDatasetVersionsAsyncPager: @@ -1815,7 +1871,7 @@ async def restore_dataset_version( 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"""Restores a dataset version. @@ -1864,8 +1920,10 @@ async def sample_restore_dataset_version(): 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: @@ -1937,7 +1995,7 @@ async def list_data_items( 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.ListDataItemsAsyncPager: r"""Lists DataItems in a Dataset. @@ -1983,8 +2041,10 @@ async def sample_list_data_items(): 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.aiplatform_v1beta1.services.dataset_service.pagers.ListDataItemsAsyncPager: @@ -2058,7 +2118,7 @@ async def search_data_items( *, 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.SearchDataItemsAsyncPager: r"""Searches DataItems in a Dataset. @@ -2097,8 +2157,10 @@ async def sample_search_data_items(): 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.aiplatform_v1beta1.services.dataset_service.pagers.SearchDataItemsAsyncPager: @@ -2159,7 +2221,7 @@ async def list_saved_queries( 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.ListSavedQueriesAsyncPager: r"""Lists SavedQueries in a Dataset. @@ -2205,8 +2267,10 @@ async def sample_list_saved_queries(): 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.aiplatform_v1beta1.services.dataset_service.pagers.ListSavedQueriesAsyncPager: @@ -2281,7 +2345,7 @@ async def delete_saved_query( 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"""Deletes a SavedQuery. @@ -2330,8 +2394,10 @@ async def sample_delete_saved_query(): 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: @@ -2410,7 +2476,7 @@ async def get_annotation_spec( 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]]] = (), ) -> annotation_spec.AnnotationSpec: r"""Gets an AnnotationSpec. @@ -2455,8 +2521,10 @@ async def sample_get_annotation_spec(): 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.aiplatform_v1beta1.types.AnnotationSpec: @@ -2517,7 +2585,7 @@ async def list_annotations( 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.ListAnnotationsAsyncPager: r"""Lists Annotations belongs to a dataitem @@ -2563,8 +2631,10 @@ async def sample_list_annotations(): 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.aiplatform_v1beta1.services.dataset_service.pagers.ListAnnotationsAsyncPager: @@ -2638,7 +2708,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. @@ -2649,8 +2719,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. @@ -2691,7 +2763,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. @@ -2702,8 +2774,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. @@ -2744,7 +2818,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. @@ -2760,8 +2834,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 """ @@ -2798,7 +2874,7 @@ async def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -2813,8 +2889,10 @@ async def cancel_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 """ @@ -2851,7 +2929,7 @@ async def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -2868,8 +2946,10 @@ async def wait_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. @@ -2910,7 +2990,7 @@ async def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -2923,8 +3003,10 @@ async def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -3029,7 +3111,7 @@ async def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -3043,8 +3125,10 @@ async def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -3149,7 +3233,7 @@ async def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -3164,8 +3248,10 @@ async def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -3209,7 +3295,7 @@ async def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -3220,8 +3306,10 @@ async def get_location( 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: ~.location_pb2.Location: Location object. @@ -3262,7 +3350,7 @@ async def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -3273,8 +3361,10 @@ async def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1beta1/services/dataset_service/client.py b/google/cloud/aiplatform_v1beta1/services/dataset_service/client.py index 0894c8368d..365df28aec 100644 --- a/google/cloud/aiplatform_v1beta1/services/dataset_service/client.py +++ b/google/cloud/aiplatform_v1beta1/services/dataset_service/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 ( @@ -48,6 +49,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 as gac_operation # type: ignore from google.api_core import operation_async # type: ignore from google.cloud.aiplatform_v1beta1.services.dataset_service import pagers @@ -735,6 +745,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( @@ -825,6 +839,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.aiplatform_v1beta1.DatasetServiceClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DatasetService", + "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.aiplatform.v1beta1.DatasetService", + "credentialsType": None, + }, + ) + def create_dataset( self, request: Optional[Union[dataset_service.CreateDatasetRequest, dict]] = None, @@ -833,7 +870,7 @@ def create_dataset( dataset: Optional[gca_dataset.Dataset] = 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]]] = (), ) -> gac_operation.Operation: r"""Creates a Dataset. @@ -893,8 +930,10 @@ def sample_create_dataset(): 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: @@ -965,7 +1004,7 @@ def get_dataset( 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]]] = (), ) -> dataset.Dataset: r"""Gets a Dataset. @@ -1009,8 +1048,10 @@ def sample_get_dataset(): 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.aiplatform_v1beta1.types.Dataset: @@ -1069,7 +1110,7 @@ def update_dataset( 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]]] = (), ) -> gca_dataset.Dataset: r"""Updates a Dataset. @@ -1131,8 +1172,10 @@ def sample_update_dataset(): 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.aiplatform_v1beta1.types.Dataset: @@ -1194,7 +1237,7 @@ def list_datasets( 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.ListDatasetsPager: r"""Lists Datasets in a Location. @@ -1239,8 +1282,10 @@ def sample_list_datasets(): 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.aiplatform_v1beta1.services.dataset_service.pagers.ListDatasetsPager: @@ -1312,7 +1357,7 @@ def delete_dataset( 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]]] = (), ) -> gac_operation.Operation: r"""Deletes a Dataset. @@ -1361,8 +1406,10 @@ def sample_delete_dataset(): 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: @@ -1439,7 +1486,7 @@ def import_data( import_configs: Optional[MutableSequence[dataset.ImportDataConfig]] = 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]]] = (), ) -> gac_operation.Operation: r"""Imports data into a Dataset. @@ -1500,8 +1547,10 @@ def sample_import_data(): 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: @@ -1572,7 +1621,7 @@ def export_data( export_config: Optional[dataset.ExportDataConfig] = 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]]] = (), ) -> gac_operation.Operation: r"""Exports data from a Dataset. @@ -1631,8 +1680,10 @@ def sample_export_data(): 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: @@ -1705,7 +1756,7 @@ def create_dataset_version( dataset_version: Optional[gca_dataset_version.DatasetVersion] = 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]]] = (), ) -> gac_operation.Operation: r"""Create a version from a Dataset. @@ -1767,8 +1818,10 @@ def sample_create_dataset_version(): 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: @@ -1842,7 +1895,7 @@ def update_dataset_version( 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]]] = (), ) -> gca_dataset_version.DatasetVersion: r"""Updates a DatasetVersion. @@ -1900,8 +1953,10 @@ def sample_update_dataset_version(): 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.aiplatform_v1beta1.types.DatasetVersion: @@ -1963,7 +2018,7 @@ def delete_dataset_version( 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]]] = (), ) -> gac_operation.Operation: r"""Deletes a Dataset version. @@ -2012,8 +2067,10 @@ def sample_delete_dataset_version(): 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: @@ -2089,7 +2146,7 @@ def get_dataset_version( 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]]] = (), ) -> dataset_version.DatasetVersion: r"""Gets a Dataset version. @@ -2134,8 +2191,10 @@ def sample_get_dataset_version(): 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.aiplatform_v1beta1.types.DatasetVersion: @@ -2193,7 +2252,7 @@ def list_dataset_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.ListDatasetVersionsPager: r"""Lists DatasetVersions in a Dataset. @@ -2239,8 +2298,10 @@ def sample_list_dataset_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.aiplatform_v1beta1.services.dataset_service.pagers.ListDatasetVersionsPager: @@ -2314,7 +2375,7 @@ def restore_dataset_version( 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]]] = (), ) -> gac_operation.Operation: r"""Restores a dataset version. @@ -2363,8 +2424,10 @@ def sample_restore_dataset_version(): 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: @@ -2433,7 +2496,7 @@ def list_data_items( 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.ListDataItemsPager: r"""Lists DataItems in a Dataset. @@ -2479,8 +2542,10 @@ def sample_list_data_items(): 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.aiplatform_v1beta1.services.dataset_service.pagers.ListDataItemsPager: @@ -2551,7 +2616,7 @@ def search_data_items( *, 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.SearchDataItemsPager: r"""Searches DataItems in a Dataset. @@ -2590,8 +2655,10 @@ def sample_search_data_items(): 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.aiplatform_v1beta1.services.dataset_service.pagers.SearchDataItemsPager: @@ -2650,7 +2717,7 @@ def list_saved_queries( 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.ListSavedQueriesPager: r"""Lists SavedQueries in a Dataset. @@ -2696,8 +2763,10 @@ def sample_list_saved_queries(): 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.aiplatform_v1beta1.services.dataset_service.pagers.ListSavedQueriesPager: @@ -2769,7 +2838,7 @@ def delete_saved_query( 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]]] = (), ) -> gac_operation.Operation: r"""Deletes a SavedQuery. @@ -2818,8 +2887,10 @@ def sample_delete_saved_query(): 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: @@ -2895,7 +2966,7 @@ def get_annotation_spec( 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]]] = (), ) -> annotation_spec.AnnotationSpec: r"""Gets an AnnotationSpec. @@ -2940,8 +3011,10 @@ def sample_get_annotation_spec(): 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.aiplatform_v1beta1.types.AnnotationSpec: @@ -2999,7 +3072,7 @@ def list_annotations( 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.ListAnnotationsPager: r"""Lists Annotations belongs to a dataitem @@ -3045,8 +3118,10 @@ def sample_list_annotations(): 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.aiplatform_v1beta1.services.dataset_service.pagers.ListAnnotationsPager: @@ -3130,7 +3205,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. @@ -3141,8 +3216,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. @@ -3183,7 +3260,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. @@ -3194,8 +3271,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. @@ -3236,7 +3315,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. @@ -3252,8 +3331,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 """ @@ -3290,7 +3371,7 @@ def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -3305,8 +3386,10 @@ def cancel_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 """ @@ -3343,7 +3426,7 @@ def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -3360,8 +3443,10 @@ def wait_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. @@ -3402,7 +3487,7 @@ def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -3415,8 +3500,10 @@ def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -3521,7 +3608,7 @@ def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -3535,8 +3622,10 @@ def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -3641,7 +3730,7 @@ def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -3656,8 +3745,10 @@ def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -3699,7 +3790,7 @@ def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -3710,8 +3801,10 @@ def get_location( 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: ~.location_pb2.Location: Location object. @@ -3752,7 +3845,7 @@ def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -3763,8 +3856,10 @@ def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1beta1/services/dataset_service/pagers.py b/google/cloud/aiplatform_v1beta1/services/dataset_service/pagers.py index 88fb1099d7..525035e911 100644 --- a/google/cloud/aiplatform_v1beta1/services/dataset_service/pagers.py +++ b/google/cloud/aiplatform_v1beta1/services/dataset_service/pagers.py @@ -71,7 +71,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. @@ -85,8 +85,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 = dataset_service.ListDatasetsRequest(request) @@ -145,7 +147,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. @@ -159,8 +161,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 = dataset_service.ListDatasetsRequest(request) @@ -223,7 +227,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. @@ -237,8 +241,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 = dataset_service.ListDatasetVersionsRequest(request) @@ -297,7 +303,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. @@ -311,8 +317,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 = dataset_service.ListDatasetVersionsRequest(request) @@ -375,7 +383,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. @@ -389,8 +397,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 = dataset_service.ListDataItemsRequest(request) @@ -449,7 +459,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. @@ -463,8 +473,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 = dataset_service.ListDataItemsRequest(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 = dataset_service.SearchDataItemsRequest(request) @@ -601,7 +615,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. @@ -615,8 +629,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 = dataset_service.SearchDataItemsRequest(request) @@ -679,7 +695,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. @@ -693,8 +709,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 = dataset_service.ListSavedQueriesRequest(request) @@ -753,7 +771,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. @@ -767,8 +785,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 = dataset_service.ListSavedQueriesRequest(request) @@ -831,7 +851,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. @@ -845,8 +865,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 = dataset_service.ListAnnotationsRequest(request) @@ -905,7 +927,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. @@ -919,8 +941,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 = dataset_service.ListAnnotationsRequest(request) diff --git a/google/cloud/aiplatform_v1beta1/services/dataset_service/transports/grpc.py b/google/cloud/aiplatform_v1beta1/services/dataset_service/transports/grpc.py index 8f8eb3954c..87b17ad9bb 100644 --- a/google/cloud/aiplatform_v1beta1/services/dataset_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1beta1/services/dataset_service/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 import warnings from typing import Callable, Dict, Optional, Sequence, Tuple, Union @@ -22,8 +25,11 @@ import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from google.cloud.aiplatform_v1beta1.types import annotation_spec from google.cloud.aiplatform_v1beta1.types import dataset @@ -37,6 +43,81 @@ from google.longrunning import operations_pb2 # type: ignore from .base import DatasetServiceTransport, DEFAULT_CLIENT_INFO +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.aiplatform.v1beta1.DatasetService", + "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.aiplatform.v1beta1.DatasetService", + "rpcName": client_call_details.method, + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class DatasetServiceGrpcTransport(DatasetServiceTransport): """gRPC backend transport for DatasetService. @@ -192,7 +273,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 @@ -256,7 +342,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 @@ -280,7 +368,7 @@ def create_dataset( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_dataset" not in self._stubs: - self._stubs["create_dataset"] = self.grpc_channel.unary_unary( + self._stubs["create_dataset"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.DatasetService/CreateDataset", request_serializer=dataset_service.CreateDatasetRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -306,7 +394,7 @@ def get_dataset( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_dataset" not in self._stubs: - self._stubs["get_dataset"] = self.grpc_channel.unary_unary( + self._stubs["get_dataset"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.DatasetService/GetDataset", request_serializer=dataset_service.GetDatasetRequest.serialize, response_deserializer=dataset.Dataset.deserialize, @@ -332,7 +420,7 @@ def update_dataset( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_dataset" not in self._stubs: - self._stubs["update_dataset"] = self.grpc_channel.unary_unary( + self._stubs["update_dataset"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.DatasetService/UpdateDataset", request_serializer=dataset_service.UpdateDatasetRequest.serialize, response_deserializer=gca_dataset.Dataset.deserialize, @@ -360,7 +448,7 @@ def list_datasets( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_datasets" not in self._stubs: - self._stubs["list_datasets"] = self.grpc_channel.unary_unary( + self._stubs["list_datasets"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.DatasetService/ListDatasets", request_serializer=dataset_service.ListDatasetsRequest.serialize, response_deserializer=dataset_service.ListDatasetsResponse.deserialize, @@ -386,7 +474,7 @@ def delete_dataset( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_dataset" not in self._stubs: - self._stubs["delete_dataset"] = self.grpc_channel.unary_unary( + self._stubs["delete_dataset"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.DatasetService/DeleteDataset", request_serializer=dataset_service.DeleteDatasetRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -412,7 +500,7 @@ def import_data( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "import_data" not in self._stubs: - self._stubs["import_data"] = self.grpc_channel.unary_unary( + self._stubs["import_data"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.DatasetService/ImportData", request_serializer=dataset_service.ImportDataRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -438,7 +526,7 @@ def export_data( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "export_data" not in self._stubs: - self._stubs["export_data"] = self.grpc_channel.unary_unary( + self._stubs["export_data"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.DatasetService/ExportData", request_serializer=dataset_service.ExportDataRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -466,7 +554,7 @@ def create_dataset_version( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_dataset_version" not in self._stubs: - self._stubs["create_dataset_version"] = self.grpc_channel.unary_unary( + self._stubs["create_dataset_version"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.DatasetService/CreateDatasetVersion", request_serializer=dataset_service.CreateDatasetVersionRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -495,7 +583,7 @@ def update_dataset_version( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_dataset_version" not in self._stubs: - self._stubs["update_dataset_version"] = self.grpc_channel.unary_unary( + self._stubs["update_dataset_version"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.DatasetService/UpdateDatasetVersion", request_serializer=dataset_service.UpdateDatasetVersionRequest.serialize, response_deserializer=gca_dataset_version.DatasetVersion.deserialize, @@ -523,7 +611,7 @@ def delete_dataset_version( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_dataset_version" not in self._stubs: - self._stubs["delete_dataset_version"] = self.grpc_channel.unary_unary( + self._stubs["delete_dataset_version"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.DatasetService/DeleteDatasetVersion", request_serializer=dataset_service.DeleteDatasetVersionRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -551,7 +639,7 @@ def get_dataset_version( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_dataset_version" not in self._stubs: - self._stubs["get_dataset_version"] = self.grpc_channel.unary_unary( + self._stubs["get_dataset_version"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.DatasetService/GetDatasetVersion", request_serializer=dataset_service.GetDatasetVersionRequest.serialize, response_deserializer=dataset_version.DatasetVersion.deserialize, @@ -580,7 +668,7 @@ def list_dataset_versions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_dataset_versions" not in self._stubs: - self._stubs["list_dataset_versions"] = self.grpc_channel.unary_unary( + self._stubs["list_dataset_versions"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.DatasetService/ListDatasetVersions", request_serializer=dataset_service.ListDatasetVersionsRequest.serialize, response_deserializer=dataset_service.ListDatasetVersionsResponse.deserialize, @@ -608,7 +696,7 @@ def restore_dataset_version( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "restore_dataset_version" not in self._stubs: - self._stubs["restore_dataset_version"] = self.grpc_channel.unary_unary( + self._stubs["restore_dataset_version"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.DatasetService/RestoreDatasetVersion", request_serializer=dataset_service.RestoreDatasetVersionRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -636,7 +724,7 @@ def list_data_items( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_data_items" not in self._stubs: - self._stubs["list_data_items"] = self.grpc_channel.unary_unary( + self._stubs["list_data_items"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.DatasetService/ListDataItems", request_serializer=dataset_service.ListDataItemsRequest.serialize, response_deserializer=dataset_service.ListDataItemsResponse.deserialize, @@ -665,7 +753,7 @@ def search_data_items( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "search_data_items" not in self._stubs: - self._stubs["search_data_items"] = self.grpc_channel.unary_unary( + self._stubs["search_data_items"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.DatasetService/SearchDataItems", request_serializer=dataset_service.SearchDataItemsRequest.serialize, response_deserializer=dataset_service.SearchDataItemsResponse.deserialize, @@ -694,7 +782,7 @@ def list_saved_queries( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_saved_queries" not in self._stubs: - self._stubs["list_saved_queries"] = self.grpc_channel.unary_unary( + self._stubs["list_saved_queries"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.DatasetService/ListSavedQueries", request_serializer=dataset_service.ListSavedQueriesRequest.serialize, response_deserializer=dataset_service.ListSavedQueriesResponse.deserialize, @@ -720,7 +808,7 @@ def delete_saved_query( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_saved_query" not in self._stubs: - self._stubs["delete_saved_query"] = self.grpc_channel.unary_unary( + self._stubs["delete_saved_query"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.DatasetService/DeleteSavedQuery", request_serializer=dataset_service.DeleteSavedQueryRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -748,7 +836,7 @@ def get_annotation_spec( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_annotation_spec" not in self._stubs: - self._stubs["get_annotation_spec"] = self.grpc_channel.unary_unary( + self._stubs["get_annotation_spec"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.DatasetService/GetAnnotationSpec", request_serializer=dataset_service.GetAnnotationSpecRequest.serialize, response_deserializer=annotation_spec.AnnotationSpec.deserialize, @@ -777,7 +865,7 @@ def list_annotations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_annotations" not in self._stubs: - self._stubs["list_annotations"] = self.grpc_channel.unary_unary( + self._stubs["list_annotations"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.DatasetService/ListAnnotations", request_serializer=dataset_service.ListAnnotationsRequest.serialize, response_deserializer=dataset_service.ListAnnotationsResponse.deserialize, @@ -785,7 +873,7 @@ def list_annotations( return self._stubs["list_annotations"] def close(self): - self.grpc_channel.close() + self._logged_channel.close() @property def delete_operation( @@ -797,7 +885,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, @@ -814,7 +902,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -831,7 +919,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -848,7 +936,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, @@ -867,7 +955,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, @@ -886,7 +974,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -903,7 +991,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -928,7 +1016,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -954,7 +1042,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -983,7 +1071,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1beta1/services/dataset_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1beta1/services/dataset_service/transports/grpc_asyncio.py index d8b8386101..2782592ea8 100644 --- a/google/cloud/aiplatform_v1beta1/services/dataset_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/dataset_service/transports/grpc_asyncio.py @@ -14,6 +14,9 @@ # limitations under the License. # import inspect +import json +import pickle +import logging as std_logging import warnings from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union @@ -24,8 +27,11 @@ from google.api_core import operations_v1 from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from grpc.experimental import aio # type: ignore from google.cloud.aiplatform_v1beta1.types import annotation_spec @@ -41,6 +47,82 @@ from .base import DatasetServiceTransport, DEFAULT_CLIENT_INFO from .grpc import DatasetServiceGrpcTransport +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.aiplatform.v1beta1.DatasetService", + "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.aiplatform.v1beta1.DatasetService", + "rpcName": str(client_call_details.method), + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class DatasetServiceGrpcAsyncIOTransport(DatasetServiceTransport): """gRPC AsyncIO backend transport for DatasetService. @@ -239,10 +321,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 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. @@ -292,7 +377,7 @@ def create_dataset( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_dataset" not in self._stubs: - self._stubs["create_dataset"] = self.grpc_channel.unary_unary( + self._stubs["create_dataset"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.DatasetService/CreateDataset", request_serializer=dataset_service.CreateDatasetRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -318,7 +403,7 @@ def get_dataset( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_dataset" not in self._stubs: - self._stubs["get_dataset"] = self.grpc_channel.unary_unary( + self._stubs["get_dataset"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.DatasetService/GetDataset", request_serializer=dataset_service.GetDatasetRequest.serialize, response_deserializer=dataset.Dataset.deserialize, @@ -346,7 +431,7 @@ def update_dataset( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_dataset" not in self._stubs: - self._stubs["update_dataset"] = self.grpc_channel.unary_unary( + self._stubs["update_dataset"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.DatasetService/UpdateDataset", request_serializer=dataset_service.UpdateDatasetRequest.serialize, response_deserializer=gca_dataset.Dataset.deserialize, @@ -375,7 +460,7 @@ def list_datasets( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_datasets" not in self._stubs: - self._stubs["list_datasets"] = self.grpc_channel.unary_unary( + self._stubs["list_datasets"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.DatasetService/ListDatasets", request_serializer=dataset_service.ListDatasetsRequest.serialize, response_deserializer=dataset_service.ListDatasetsResponse.deserialize, @@ -403,7 +488,7 @@ def delete_dataset( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_dataset" not in self._stubs: - self._stubs["delete_dataset"] = self.grpc_channel.unary_unary( + self._stubs["delete_dataset"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.DatasetService/DeleteDataset", request_serializer=dataset_service.DeleteDatasetRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -431,7 +516,7 @@ def import_data( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "import_data" not in self._stubs: - self._stubs["import_data"] = self.grpc_channel.unary_unary( + self._stubs["import_data"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.DatasetService/ImportData", request_serializer=dataset_service.ImportDataRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -459,7 +544,7 @@ def export_data( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "export_data" not in self._stubs: - self._stubs["export_data"] = self.grpc_channel.unary_unary( + self._stubs["export_data"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.DatasetService/ExportData", request_serializer=dataset_service.ExportDataRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -488,7 +573,7 @@ def create_dataset_version( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_dataset_version" not in self._stubs: - self._stubs["create_dataset_version"] = self.grpc_channel.unary_unary( + self._stubs["create_dataset_version"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.DatasetService/CreateDatasetVersion", request_serializer=dataset_service.CreateDatasetVersionRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -517,7 +602,7 @@ def update_dataset_version( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_dataset_version" not in self._stubs: - self._stubs["update_dataset_version"] = self.grpc_channel.unary_unary( + self._stubs["update_dataset_version"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.DatasetService/UpdateDatasetVersion", request_serializer=dataset_service.UpdateDatasetVersionRequest.serialize, response_deserializer=gca_dataset_version.DatasetVersion.deserialize, @@ -546,7 +631,7 @@ def delete_dataset_version( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_dataset_version" not in self._stubs: - self._stubs["delete_dataset_version"] = self.grpc_channel.unary_unary( + self._stubs["delete_dataset_version"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.DatasetService/DeleteDatasetVersion", request_serializer=dataset_service.DeleteDatasetVersionRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -575,7 +660,7 @@ def get_dataset_version( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_dataset_version" not in self._stubs: - self._stubs["get_dataset_version"] = self.grpc_channel.unary_unary( + self._stubs["get_dataset_version"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.DatasetService/GetDatasetVersion", request_serializer=dataset_service.GetDatasetVersionRequest.serialize, response_deserializer=dataset_version.DatasetVersion.deserialize, @@ -604,7 +689,7 @@ def list_dataset_versions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_dataset_versions" not in self._stubs: - self._stubs["list_dataset_versions"] = self.grpc_channel.unary_unary( + self._stubs["list_dataset_versions"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.DatasetService/ListDatasetVersions", request_serializer=dataset_service.ListDatasetVersionsRequest.serialize, response_deserializer=dataset_service.ListDatasetVersionsResponse.deserialize, @@ -633,7 +718,7 @@ def restore_dataset_version( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "restore_dataset_version" not in self._stubs: - self._stubs["restore_dataset_version"] = self.grpc_channel.unary_unary( + self._stubs["restore_dataset_version"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.DatasetService/RestoreDatasetVersion", request_serializer=dataset_service.RestoreDatasetVersionRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -662,7 +747,7 @@ def list_data_items( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_data_items" not in self._stubs: - self._stubs["list_data_items"] = self.grpc_channel.unary_unary( + self._stubs["list_data_items"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.DatasetService/ListDataItems", request_serializer=dataset_service.ListDataItemsRequest.serialize, response_deserializer=dataset_service.ListDataItemsResponse.deserialize, @@ -691,7 +776,7 @@ def search_data_items( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "search_data_items" not in self._stubs: - self._stubs["search_data_items"] = self.grpc_channel.unary_unary( + self._stubs["search_data_items"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.DatasetService/SearchDataItems", request_serializer=dataset_service.SearchDataItemsRequest.serialize, response_deserializer=dataset_service.SearchDataItemsResponse.deserialize, @@ -720,7 +805,7 @@ def list_saved_queries( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_saved_queries" not in self._stubs: - self._stubs["list_saved_queries"] = self.grpc_channel.unary_unary( + self._stubs["list_saved_queries"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.DatasetService/ListSavedQueries", request_serializer=dataset_service.ListSavedQueriesRequest.serialize, response_deserializer=dataset_service.ListSavedQueriesResponse.deserialize, @@ -748,7 +833,7 @@ def delete_saved_query( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_saved_query" not in self._stubs: - self._stubs["delete_saved_query"] = self.grpc_channel.unary_unary( + self._stubs["delete_saved_query"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.DatasetService/DeleteSavedQuery", request_serializer=dataset_service.DeleteSavedQueryRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -777,7 +862,7 @@ def get_annotation_spec( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_annotation_spec" not in self._stubs: - self._stubs["get_annotation_spec"] = self.grpc_channel.unary_unary( + self._stubs["get_annotation_spec"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.DatasetService/GetAnnotationSpec", request_serializer=dataset_service.GetAnnotationSpecRequest.serialize, response_deserializer=annotation_spec.AnnotationSpec.deserialize, @@ -806,7 +891,7 @@ def list_annotations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_annotations" not in self._stubs: - self._stubs["list_annotations"] = self.grpc_channel.unary_unary( + self._stubs["list_annotations"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.DatasetService/ListAnnotations", request_serializer=dataset_service.ListAnnotationsRequest.serialize, response_deserializer=dataset_service.ListAnnotationsResponse.deserialize, @@ -969,7 +1054,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: @@ -985,7 +1070,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, @@ -1002,7 +1087,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -1019,7 +1104,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -1036,7 +1121,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, @@ -1055,7 +1140,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, @@ -1074,7 +1159,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -1091,7 +1176,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -1116,7 +1201,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -1142,7 +1227,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -1171,7 +1256,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1beta1/services/dataset_service/transports/rest.py b/google/cloud/aiplatform_v1beta1/services/dataset_service/transports/rest.py index 9ae4b7ad65..17848c7108 100644 --- a/google/cloud/aiplatform_v1beta1/services/dataset_service/transports/rest.py +++ b/google/cloud/aiplatform_v1beta1/services/dataset_service/transports/rest.py @@ -13,9 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging +import json # type: ignore from google.auth.transport.requests import AuthorizedSession # type: ignore -import json # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.api_core import exceptions as core_exceptions from google.api_core import retry as retries @@ -52,6 +53,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, @@ -236,8 +245,10 @@ def post_update_dataset_version(self, response): def pre_create_dataset( self, request: dataset_service.CreateDatasetRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[dataset_service.CreateDatasetRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + dataset_service.CreateDatasetRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for create_dataset Override in a subclass to manipulate the request or metadata @@ -259,8 +270,11 @@ def post_create_dataset( def pre_create_dataset_version( self, request: dataset_service.CreateDatasetVersionRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[dataset_service.CreateDatasetVersionRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + dataset_service.CreateDatasetVersionRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for create_dataset_version Override in a subclass to manipulate the request or metadata @@ -282,8 +296,10 @@ def post_create_dataset_version( def pre_delete_dataset( self, request: dataset_service.DeleteDatasetRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[dataset_service.DeleteDatasetRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + dataset_service.DeleteDatasetRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for delete_dataset Override in a subclass to manipulate the request or metadata @@ -305,8 +321,11 @@ def post_delete_dataset( def pre_delete_dataset_version( self, request: dataset_service.DeleteDatasetVersionRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[dataset_service.DeleteDatasetVersionRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + dataset_service.DeleteDatasetVersionRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for delete_dataset_version Override in a subclass to manipulate the request or metadata @@ -328,8 +347,10 @@ def post_delete_dataset_version( def pre_delete_saved_query( self, request: dataset_service.DeleteSavedQueryRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[dataset_service.DeleteSavedQueryRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + dataset_service.DeleteSavedQueryRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for delete_saved_query Override in a subclass to manipulate the request or metadata @@ -351,8 +372,10 @@ def post_delete_saved_query( def pre_export_data( self, request: dataset_service.ExportDataRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[dataset_service.ExportDataRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + dataset_service.ExportDataRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for export_data Override in a subclass to manipulate the request or metadata @@ -374,8 +397,11 @@ def post_export_data( def pre_get_annotation_spec( self, request: dataset_service.GetAnnotationSpecRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[dataset_service.GetAnnotationSpecRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + dataset_service.GetAnnotationSpecRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for get_annotation_spec Override in a subclass to manipulate the request or metadata @@ -397,8 +423,10 @@ def post_get_annotation_spec( def pre_get_dataset( self, request: dataset_service.GetDatasetRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[dataset_service.GetDatasetRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + dataset_service.GetDatasetRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_dataset Override in a subclass to manipulate the request or metadata @@ -418,8 +446,11 @@ def post_get_dataset(self, response: dataset.Dataset) -> dataset.Dataset: def pre_get_dataset_version( self, request: dataset_service.GetDatasetVersionRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[dataset_service.GetDatasetVersionRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + dataset_service.GetDatasetVersionRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for get_dataset_version Override in a subclass to manipulate the request or metadata @@ -441,8 +472,10 @@ def post_get_dataset_version( def pre_import_data( self, request: dataset_service.ImportDataRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[dataset_service.ImportDataRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + dataset_service.ImportDataRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for import_data Override in a subclass to manipulate the request or metadata @@ -464,8 +497,10 @@ def post_import_data( def pre_list_annotations( self, request: dataset_service.ListAnnotationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[dataset_service.ListAnnotationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + dataset_service.ListAnnotationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_annotations Override in a subclass to manipulate the request or metadata @@ -487,8 +522,10 @@ def post_list_annotations( def pre_list_data_items( self, request: dataset_service.ListDataItemsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[dataset_service.ListDataItemsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + dataset_service.ListDataItemsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_data_items Override in a subclass to manipulate the request or metadata @@ -510,8 +547,10 @@ def post_list_data_items( def pre_list_datasets( self, request: dataset_service.ListDatasetsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[dataset_service.ListDatasetsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + dataset_service.ListDatasetsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_datasets Override in a subclass to manipulate the request or metadata @@ -533,8 +572,11 @@ def post_list_datasets( def pre_list_dataset_versions( self, request: dataset_service.ListDatasetVersionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[dataset_service.ListDatasetVersionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + dataset_service.ListDatasetVersionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for list_dataset_versions Override in a subclass to manipulate the request or metadata @@ -556,8 +598,10 @@ def post_list_dataset_versions( def pre_list_saved_queries( self, request: dataset_service.ListSavedQueriesRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[dataset_service.ListSavedQueriesRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + dataset_service.ListSavedQueriesRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_saved_queries Override in a subclass to manipulate the request or metadata @@ -579,8 +623,11 @@ def post_list_saved_queries( def pre_restore_dataset_version( self, request: dataset_service.RestoreDatasetVersionRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[dataset_service.RestoreDatasetVersionRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + dataset_service.RestoreDatasetVersionRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for restore_dataset_version Override in a subclass to manipulate the request or metadata @@ -602,8 +649,10 @@ def post_restore_dataset_version( def pre_search_data_items( self, request: dataset_service.SearchDataItemsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[dataset_service.SearchDataItemsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + dataset_service.SearchDataItemsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for search_data_items Override in a subclass to manipulate the request or metadata @@ -625,8 +674,10 @@ def post_search_data_items( def pre_update_dataset( self, request: dataset_service.UpdateDatasetRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[dataset_service.UpdateDatasetRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + dataset_service.UpdateDatasetRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for update_dataset Override in a subclass to manipulate the request or metadata @@ -646,8 +697,11 @@ def post_update_dataset(self, response: gca_dataset.Dataset) -> gca_dataset.Data def pre_update_dataset_version( self, request: dataset_service.UpdateDatasetVersionRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[dataset_service.UpdateDatasetVersionRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + dataset_service.UpdateDatasetVersionRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for update_dataset_version Override in a subclass to manipulate the request or metadata @@ -669,8 +723,10 @@ def post_update_dataset_version( def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -692,8 +748,10 @@ def post_get_location( def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -715,8 +773,10 @@ def post_list_locations( def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -736,8 +796,10 @@ def post_get_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -757,8 +819,11 @@ def post_set_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -780,8 +845,10 @@ def post_test_iam_permissions( def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -801,8 +868,10 @@ def post_cancel_operation(self, response: None) -> None: 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 +891,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 +916,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 @@ -868,8 +941,10 @@ def post_list_operations( def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -1550,6 +1625,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -1766,6 +1845,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -1972,6 +2055,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}", @@ -2188,6 +2275,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, ], "google.longrunning.Operations.ListOperations": [ { @@ -2386,6 +2477,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*}/operations", @@ -2602,6 +2697,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*}/operations", + }, ], "google.longrunning.Operations.WaitOperation": [ { @@ -2800,6 +2899,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "post", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}:wait", @@ -3012,6 +3115,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, ], } @@ -3067,7 +3174,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 dataset method over HTTP. @@ -3078,8 +3185,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: @@ -3092,6 +3201,7 @@ def __call__( http_options = ( _BaseDatasetServiceRestTransport._BaseCreateDataset._get_http_options() ) + request, metadata = self._interceptor.pre_create_dataset(request, metadata) transcoded_request = _BaseDatasetServiceRestTransport._BaseCreateDataset._get_transcoded_request( http_options, request @@ -3106,6 +3216,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.aiplatform_v1beta1.DatasetServiceClient.CreateDataset", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DatasetService", + "rpcName": "CreateDataset", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = DatasetServiceRestTransport._CreateDataset._get_response( self._host, @@ -3125,7 +3262,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_dataset(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.aiplatform_v1beta1.DatasetServiceClient.create_dataset", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DatasetService", + "rpcName": "CreateDataset", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _CreateDatasetVersion( @@ -3165,7 +3324,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 dataset version method over HTTP. @@ -3176,8 +3335,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: @@ -3190,6 +3351,7 @@ def __call__( http_options = ( _BaseDatasetServiceRestTransport._BaseCreateDatasetVersion._get_http_options() ) + request, metadata = self._interceptor.pre_create_dataset_version( request, metadata ) @@ -3206,6 +3368,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.aiplatform_v1beta1.DatasetServiceClient.CreateDatasetVersion", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DatasetService", + "rpcName": "CreateDatasetVersion", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = DatasetServiceRestTransport._CreateDatasetVersion._get_response( self._host, @@ -3225,7 +3414,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_dataset_version(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.aiplatform_v1beta1.DatasetServiceClient.create_dataset_version", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DatasetService", + "rpcName": "CreateDatasetVersion", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _DeleteDataset( @@ -3263,7 +3474,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 dataset method over HTTP. @@ -3274,8 +3485,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: @@ -3288,6 +3501,7 @@ def __call__( http_options = ( _BaseDatasetServiceRestTransport._BaseDeleteDataset._get_http_options() ) + request, metadata = self._interceptor.pre_delete_dataset(request, metadata) transcoded_request = _BaseDatasetServiceRestTransport._BaseDeleteDataset._get_transcoded_request( http_options, request @@ -3298,6 +3512,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.aiplatform_v1beta1.DatasetServiceClient.DeleteDataset", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DatasetService", + "rpcName": "DeleteDataset", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = DatasetServiceRestTransport._DeleteDataset._get_response( self._host, @@ -3316,7 +3557,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_dataset(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.aiplatform_v1beta1.DatasetServiceClient.delete_dataset", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DatasetService", + "rpcName": "DeleteDataset", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _DeleteDatasetVersion( @@ -3355,7 +3618,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 dataset version method over HTTP. @@ -3366,8 +3629,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: @@ -3380,6 +3645,7 @@ def __call__( http_options = ( _BaseDatasetServiceRestTransport._BaseDeleteDatasetVersion._get_http_options() ) + request, metadata = self._interceptor.pre_delete_dataset_version( request, metadata ) @@ -3392,6 +3658,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.aiplatform_v1beta1.DatasetServiceClient.DeleteDatasetVersion", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DatasetService", + "rpcName": "DeleteDatasetVersion", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = DatasetServiceRestTransport._DeleteDatasetVersion._get_response( self._host, @@ -3410,7 +3703,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_dataset_version(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.aiplatform_v1beta1.DatasetServiceClient.delete_dataset_version", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DatasetService", + "rpcName": "DeleteDatasetVersion", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _DeleteSavedQuery( @@ -3448,7 +3763,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 saved query method over HTTP. @@ -3459,8 +3774,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: @@ -3473,6 +3790,7 @@ def __call__( http_options = ( _BaseDatasetServiceRestTransport._BaseDeleteSavedQuery._get_http_options() ) + request, metadata = self._interceptor.pre_delete_saved_query( request, metadata ) @@ -3485,6 +3803,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.aiplatform_v1beta1.DatasetServiceClient.DeleteSavedQuery", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DatasetService", + "rpcName": "DeleteSavedQuery", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = DatasetServiceRestTransport._DeleteSavedQuery._get_response( self._host, @@ -3503,7 +3848,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_saved_query(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.aiplatform_v1beta1.DatasetServiceClient.delete_saved_query", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DatasetService", + "rpcName": "DeleteSavedQuery", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ExportData( @@ -3542,7 +3909,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 export data method over HTTP. @@ -3553,8 +3920,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: @@ -3567,6 +3936,7 @@ def __call__( http_options = ( _BaseDatasetServiceRestTransport._BaseExportData._get_http_options() ) + request, metadata = self._interceptor.pre_export_data(request, metadata) transcoded_request = _BaseDatasetServiceRestTransport._BaseExportData._get_transcoded_request( http_options, request @@ -3585,6 +3955,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.aiplatform_v1beta1.DatasetServiceClient.ExportData", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DatasetService", + "rpcName": "ExportData", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = DatasetServiceRestTransport._ExportData._get_response( self._host, @@ -3604,7 +4001,29 @@ def __call__( # Return the response resp = operations_pb2.Operation() json_format.Parse(response.content, resp, ignore_unknown_fields=True) + resp = self._interceptor.post_export_data(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.aiplatform_v1beta1.DatasetServiceClient.export_data", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DatasetService", + "rpcName": "ExportData", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _GetAnnotationSpec( @@ -3642,7 +4061,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]]] = (), ) -> annotation_spec.AnnotationSpec: r"""Call the get annotation spec method over HTTP. @@ -3653,8 +4072,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: ~.annotation_spec.AnnotationSpec: @@ -3666,6 +4087,7 @@ def __call__( http_options = ( _BaseDatasetServiceRestTransport._BaseGetAnnotationSpec._get_http_options() ) + request, metadata = self._interceptor.pre_get_annotation_spec( request, metadata ) @@ -3678,6 +4100,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.aiplatform_v1beta1.DatasetServiceClient.GetAnnotationSpec", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DatasetService", + "rpcName": "GetAnnotationSpec", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = DatasetServiceRestTransport._GetAnnotationSpec._get_response( self._host, @@ -3698,7 +4147,29 @@ def __call__( pb_resp = annotation_spec.AnnotationSpec.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_annotation_spec(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = annotation_spec.AnnotationSpec.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.aiplatform_v1beta1.DatasetServiceClient.get_annotation_spec", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DatasetService", + "rpcName": "GetAnnotationSpec", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _GetDataset( @@ -3736,7 +4207,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]]] = (), ) -> dataset.Dataset: r"""Call the get dataset method over HTTP. @@ -3747,8 +4218,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: ~.dataset.Dataset: @@ -3760,6 +4233,7 @@ def __call__( http_options = ( _BaseDatasetServiceRestTransport._BaseGetDataset._get_http_options() ) + request, metadata = self._interceptor.pre_get_dataset(request, metadata) transcoded_request = _BaseDatasetServiceRestTransport._BaseGetDataset._get_transcoded_request( http_options, request @@ -3772,6 +4246,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 = 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.aiplatform_v1beta1.DatasetServiceClient.GetDataset", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DatasetService", + "rpcName": "GetDataset", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = DatasetServiceRestTransport._GetDataset._get_response( self._host, @@ -3792,7 +4293,29 @@ def __call__( pb_resp = dataset.Dataset.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_dataset(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = dataset.Dataset.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.aiplatform_v1beta1.DatasetServiceClient.get_dataset", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DatasetService", + "rpcName": "GetDataset", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _GetDatasetVersion( @@ -3830,7 +4353,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]]] = (), ) -> dataset_version.DatasetVersion: r"""Call the get dataset version method over HTTP. @@ -3841,8 +4364,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: ~.dataset_version.DatasetVersion: @@ -3852,6 +4377,7 @@ def __call__( http_options = ( _BaseDatasetServiceRestTransport._BaseGetDatasetVersion._get_http_options() ) + request, metadata = self._interceptor.pre_get_dataset_version( request, metadata ) @@ -3864,6 +4390,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.aiplatform_v1beta1.DatasetServiceClient.GetDatasetVersion", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DatasetService", + "rpcName": "GetDatasetVersion", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = DatasetServiceRestTransport._GetDatasetVersion._get_response( self._host, @@ -3884,7 +4437,29 @@ def __call__( pb_resp = dataset_version.DatasetVersion.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_dataset_version(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = dataset_version.DatasetVersion.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.aiplatform_v1beta1.DatasetServiceClient.get_dataset_version", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DatasetService", + "rpcName": "GetDatasetVersion", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ImportData( @@ -3923,7 +4498,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 import data method over HTTP. @@ -3934,8 +4509,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: @@ -3948,6 +4525,7 @@ def __call__( http_options = ( _BaseDatasetServiceRestTransport._BaseImportData._get_http_options() ) + request, metadata = self._interceptor.pre_import_data(request, metadata) transcoded_request = _BaseDatasetServiceRestTransport._BaseImportData._get_transcoded_request( http_options, request @@ -3966,6 +4544,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.aiplatform_v1beta1.DatasetServiceClient.ImportData", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DatasetService", + "rpcName": "ImportData", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = DatasetServiceRestTransport._ImportData._get_response( self._host, @@ -3985,7 +4590,29 @@ def __call__( # Return the response resp = operations_pb2.Operation() json_format.Parse(response.content, resp, ignore_unknown_fields=True) + resp = self._interceptor.post_import_data(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.aiplatform_v1beta1.DatasetServiceClient.import_data", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DatasetService", + "rpcName": "ImportData", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListAnnotations( @@ -4023,7 +4650,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]]] = (), ) -> dataset_service.ListAnnotationsResponse: r"""Call the list annotations method over HTTP. @@ -4034,8 +4661,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: ~.dataset_service.ListAnnotationsResponse: @@ -4047,6 +4676,7 @@ def __call__( http_options = ( _BaseDatasetServiceRestTransport._BaseListAnnotations._get_http_options() ) + request, metadata = self._interceptor.pre_list_annotations( request, metadata ) @@ -4059,6 +4689,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.aiplatform_v1beta1.DatasetServiceClient.ListAnnotations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DatasetService", + "rpcName": "ListAnnotations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = DatasetServiceRestTransport._ListAnnotations._get_response( self._host, @@ -4079,7 +4736,31 @@ def __call__( pb_resp = dataset_service.ListAnnotationsResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_annotations(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = dataset_service.ListAnnotationsResponse.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.aiplatform_v1beta1.DatasetServiceClient.list_annotations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DatasetService", + "rpcName": "ListAnnotations", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListDataItems( @@ -4117,7 +4798,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]]] = (), ) -> dataset_service.ListDataItemsResponse: r"""Call the list data items method over HTTP. @@ -4128,8 +4809,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: ~.dataset_service.ListDataItemsResponse: @@ -4141,6 +4824,7 @@ def __call__( http_options = ( _BaseDatasetServiceRestTransport._BaseListDataItems._get_http_options() ) + request, metadata = self._interceptor.pre_list_data_items(request, metadata) transcoded_request = _BaseDatasetServiceRestTransport._BaseListDataItems._get_transcoded_request( http_options, request @@ -4151,6 +4835,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.aiplatform_v1beta1.DatasetServiceClient.ListDataItems", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DatasetService", + "rpcName": "ListDataItems", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = DatasetServiceRestTransport._ListDataItems._get_response( self._host, @@ -4171,7 +4882,31 @@ def __call__( pb_resp = dataset_service.ListDataItemsResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_data_items(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = dataset_service.ListDataItemsResponse.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.aiplatform_v1beta1.DatasetServiceClient.list_data_items", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DatasetService", + "rpcName": "ListDataItems", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListDatasets( @@ -4209,7 +4944,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]]] = (), ) -> dataset_service.ListDatasetsResponse: r"""Call the list datasets method over HTTP. @@ -4220,8 +4955,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: ~.dataset_service.ListDatasetsResponse: @@ -4233,6 +4970,7 @@ def __call__( http_options = ( _BaseDatasetServiceRestTransport._BaseListDatasets._get_http_options() ) + request, metadata = self._interceptor.pre_list_datasets(request, metadata) transcoded_request = _BaseDatasetServiceRestTransport._BaseListDatasets._get_transcoded_request( http_options, request @@ -4243,6 +4981,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.aiplatform_v1beta1.DatasetServiceClient.ListDatasets", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DatasetService", + "rpcName": "ListDatasets", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = DatasetServiceRestTransport._ListDatasets._get_response( self._host, @@ -4263,7 +5028,31 @@ def __call__( pb_resp = dataset_service.ListDatasetsResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_datasets(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = dataset_service.ListDatasetsResponse.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.aiplatform_v1beta1.DatasetServiceClient.list_datasets", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DatasetService", + "rpcName": "ListDatasets", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListDatasetVersions( @@ -4302,7 +5091,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]]] = (), ) -> dataset_service.ListDatasetVersionsResponse: r"""Call the list dataset versions method over HTTP. @@ -4313,8 +5102,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: ~.dataset_service.ListDatasetVersionsResponse: @@ -4326,6 +5117,7 @@ def __call__( http_options = ( _BaseDatasetServiceRestTransport._BaseListDatasetVersions._get_http_options() ) + request, metadata = self._interceptor.pre_list_dataset_versions( request, metadata ) @@ -4338,6 +5130,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.aiplatform_v1beta1.DatasetServiceClient.ListDatasetVersions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DatasetService", + "rpcName": "ListDatasetVersions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = DatasetServiceRestTransport._ListDatasetVersions._get_response( self._host, @@ -4358,7 +5177,31 @@ def __call__( pb_resp = dataset_service.ListDatasetVersionsResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_dataset_versions(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + dataset_service.ListDatasetVersionsResponse.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.aiplatform_v1beta1.DatasetServiceClient.list_dataset_versions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DatasetService", + "rpcName": "ListDatasetVersions", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListSavedQueries( @@ -4396,7 +5239,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]]] = (), ) -> dataset_service.ListSavedQueriesResponse: r"""Call the list saved queries method over HTTP. @@ -4407,8 +5250,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: ~.dataset_service.ListSavedQueriesResponse: @@ -4420,6 +5265,7 @@ def __call__( http_options = ( _BaseDatasetServiceRestTransport._BaseListSavedQueries._get_http_options() ) + request, metadata = self._interceptor.pre_list_saved_queries( request, metadata ) @@ -4432,6 +5278,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.aiplatform_v1beta1.DatasetServiceClient.ListSavedQueries", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DatasetService", + "rpcName": "ListSavedQueries", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = DatasetServiceRestTransport._ListSavedQueries._get_response( self._host, @@ -4452,7 +5325,31 @@ def __call__( pb_resp = dataset_service.ListSavedQueriesResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_saved_queries(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = dataset_service.ListSavedQueriesResponse.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.aiplatform_v1beta1.DatasetServiceClient.list_saved_queries", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DatasetService", + "rpcName": "ListSavedQueries", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _RestoreDatasetVersion( @@ -4491,7 +5388,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 restore dataset version method over HTTP. @@ -4502,8 +5399,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: @@ -4516,6 +5415,7 @@ def __call__( http_options = ( _BaseDatasetServiceRestTransport._BaseRestoreDatasetVersion._get_http_options() ) + request, metadata = self._interceptor.pre_restore_dataset_version( request, metadata ) @@ -4528,6 +5428,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.aiplatform_v1beta1.DatasetServiceClient.RestoreDatasetVersion", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DatasetService", + "rpcName": "RestoreDatasetVersion", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = DatasetServiceRestTransport._RestoreDatasetVersion._get_response( self._host, @@ -4546,7 +5473,29 @@ def __call__( # Return the response resp = operations_pb2.Operation() json_format.Parse(response.content, resp, ignore_unknown_fields=True) + resp = self._interceptor.post_restore_dataset_version(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.aiplatform_v1beta1.DatasetServiceClient.restore_dataset_version", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DatasetService", + "rpcName": "RestoreDatasetVersion", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _SearchDataItems( @@ -4584,7 +5533,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]]] = (), ) -> dataset_service.SearchDataItemsResponse: r"""Call the search data items method over HTTP. @@ -4595,8 +5544,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: ~.dataset_service.SearchDataItemsResponse: @@ -4608,6 +5559,7 @@ def __call__( http_options = ( _BaseDatasetServiceRestTransport._BaseSearchDataItems._get_http_options() ) + request, metadata = self._interceptor.pre_search_data_items( request, metadata ) @@ -4620,6 +5572,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.aiplatform_v1beta1.DatasetServiceClient.SearchDataItems", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DatasetService", + "rpcName": "SearchDataItems", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = DatasetServiceRestTransport._SearchDataItems._get_response( self._host, @@ -4640,7 +5619,31 @@ def __call__( pb_resp = dataset_service.SearchDataItemsResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_search_data_items(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = dataset_service.SearchDataItemsResponse.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.aiplatform_v1beta1.DatasetServiceClient.search_data_items", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DatasetService", + "rpcName": "SearchDataItems", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _UpdateDataset( @@ -4679,7 +5682,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]]] = (), ) -> gca_dataset.Dataset: r"""Call the update dataset method over HTTP. @@ -4690,8 +5693,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: ~.gca_dataset.Dataset: @@ -4703,6 +5708,7 @@ def __call__( http_options = ( _BaseDatasetServiceRestTransport._BaseUpdateDataset._get_http_options() ) + request, metadata = self._interceptor.pre_update_dataset(request, metadata) transcoded_request = _BaseDatasetServiceRestTransport._BaseUpdateDataset._get_transcoded_request( http_options, request @@ -4717,6 +5723,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.aiplatform_v1beta1.DatasetServiceClient.UpdateDataset", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DatasetService", + "rpcName": "UpdateDataset", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = DatasetServiceRestTransport._UpdateDataset._get_response( self._host, @@ -4738,7 +5771,29 @@ def __call__( pb_resp = gca_dataset.Dataset.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_update_dataset(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gca_dataset.Dataset.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.aiplatform_v1beta1.DatasetServiceClient.update_dataset", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DatasetService", + "rpcName": "UpdateDataset", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _UpdateDatasetVersion( @@ -4778,7 +5833,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]]] = (), ) -> gca_dataset_version.DatasetVersion: r"""Call the update dataset version method over HTTP. @@ -4789,8 +5844,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: ~.gca_dataset_version.DatasetVersion: @@ -4800,6 +5857,7 @@ def __call__( http_options = ( _BaseDatasetServiceRestTransport._BaseUpdateDatasetVersion._get_http_options() ) + request, metadata = self._interceptor.pre_update_dataset_version( request, metadata ) @@ -4816,6 +5874,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.aiplatform_v1beta1.DatasetServiceClient.UpdateDatasetVersion", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DatasetService", + "rpcName": "UpdateDatasetVersion", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = DatasetServiceRestTransport._UpdateDatasetVersion._get_response( self._host, @@ -4837,7 +5922,31 @@ def __call__( pb_resp = gca_dataset_version.DatasetVersion.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_update_dataset_version(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gca_dataset_version.DatasetVersion.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.aiplatform_v1beta1.DatasetServiceClient.update_dataset_version", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DatasetService", + "rpcName": "UpdateDatasetVersion", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp @property @@ -5060,7 +6169,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]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -5071,8 +6180,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: locations_pb2.Location: Response from GetLocation method. @@ -5081,6 +6192,7 @@ def __call__( http_options = ( _BaseDatasetServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = self._interceptor.pre_get_location(request, metadata) transcoded_request = _BaseDatasetServiceRestTransport._BaseGetLocation._get_transcoded_request( http_options, request @@ -5091,6 +6203,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.aiplatform_v1beta1.DatasetServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DatasetService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = DatasetServiceRestTransport._GetLocation._get_response( self._host, @@ -5110,6 +6249,27 @@ def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_location(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.aiplatform_v1beta1.DatasetServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DatasetService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5151,7 +6311,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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -5162,8 +6322,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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -5172,6 +6334,7 @@ def __call__( http_options = ( _BaseDatasetServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = self._interceptor.pre_list_locations(request, metadata) transcoded_request = _BaseDatasetServiceRestTransport._BaseListLocations._get_transcoded_request( http_options, request @@ -5182,6 +6345,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.aiplatform_v1beta1.DatasetServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DatasetService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = DatasetServiceRestTransport._ListLocations._get_response( self._host, @@ -5201,6 +6391,27 @@ def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_list_locations(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.aiplatform_v1beta1.DatasetServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DatasetService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5243,7 +6454,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]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -5254,8 +6465,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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -5264,6 +6477,7 @@ def __call__( http_options = ( _BaseDatasetServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_get_iam_policy(request, metadata) transcoded_request = _BaseDatasetServiceRestTransport._BaseGetIamPolicy._get_transcoded_request( http_options, request @@ -5278,6 +6492,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.aiplatform_v1beta1.DatasetServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DatasetService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = DatasetServiceRestTransport._GetIamPolicy._get_response( self._host, @@ -5298,6 +6539,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_iam_policy(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.aiplatform_v1beta1.DatasetServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DatasetService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5340,7 +6602,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]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -5351,8 +6613,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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -5361,6 +6625,7 @@ def __call__( http_options = ( _BaseDatasetServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_set_iam_policy(request, metadata) transcoded_request = _BaseDatasetServiceRestTransport._BaseSetIamPolicy._get_transcoded_request( http_options, request @@ -5375,6 +6640,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.aiplatform_v1beta1.DatasetServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DatasetService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = DatasetServiceRestTransport._SetIamPolicy._get_response( self._host, @@ -5395,6 +6687,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_set_iam_policy(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.aiplatform_v1beta1.DatasetServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DatasetService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5437,7 +6750,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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -5448,8 +6761,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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -5458,6 +6773,7 @@ def __call__( http_options = ( _BaseDatasetServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -5474,6 +6790,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.aiplatform_v1beta1.DatasetServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DatasetService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = DatasetServiceRestTransport._TestIamPermissions._get_response( self._host, @@ -5494,6 +6837,27 @@ def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_test_iam_permissions(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.aiplatform_v1beta1.DatasetServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DatasetService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5535,7 +6899,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 cancel operation method over HTTP. @@ -5546,13 +6910,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 = ( _BaseDatasetServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = self._interceptor.pre_cancel_operation( request, metadata ) @@ -5565,6 +6932,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.aiplatform_v1beta1.DatasetServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DatasetService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = DatasetServiceRestTransport._CancelOperation._get_response( self._host, @@ -5621,7 +7015,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. @@ -5632,13 +7026,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 = ( _BaseDatasetServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = self._interceptor.pre_delete_operation( request, metadata ) @@ -5651,6 +7048,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.aiplatform_v1beta1.DatasetServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DatasetService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = DatasetServiceRestTransport._DeleteOperation._get_response( self._host, @@ -5707,7 +7131,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. @@ -5718,8 +7142,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. @@ -5728,6 +7154,7 @@ def __call__( http_options = ( _BaseDatasetServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = self._interceptor.pre_get_operation(request, metadata) transcoded_request = _BaseDatasetServiceRestTransport._BaseGetOperation._get_transcoded_request( http_options, request @@ -5738,6 +7165,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.aiplatform_v1beta1.DatasetServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DatasetService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = DatasetServiceRestTransport._GetOperation._get_response( self._host, @@ -5757,6 +7211,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.aiplatform_v1beta1.DatasetServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DatasetService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5798,7 +7273,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. @@ -5809,8 +7284,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. @@ -5819,6 +7296,7 @@ def __call__( http_options = ( _BaseDatasetServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = self._interceptor.pre_list_operations(request, metadata) transcoded_request = _BaseDatasetServiceRestTransport._BaseListOperations._get_transcoded_request( http_options, request @@ -5829,6 +7307,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.aiplatform_v1beta1.DatasetServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DatasetService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = DatasetServiceRestTransport._ListOperations._get_response( self._host, @@ -5848,6 +7353,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.aiplatform_v1beta1.DatasetServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DatasetService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5889,7 +7415,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 wait operation method over HTTP. @@ -5900,8 +7426,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 WaitOperation method. @@ -5910,6 +7438,7 @@ def __call__( http_options = ( _BaseDatasetServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = self._interceptor.pre_wait_operation(request, metadata) transcoded_request = _BaseDatasetServiceRestTransport._BaseWaitOperation._get_transcoded_request( http_options, request @@ -5920,6 +7449,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.aiplatform_v1beta1.DatasetServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DatasetService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = DatasetServiceRestTransport._WaitOperation._get_response( self._host, @@ -5939,6 +7495,27 @@ def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = self._interceptor.post_wait_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.aiplatform_v1beta1.DatasetServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DatasetService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1beta1/services/dataset_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1beta1/services/dataset_service/transports/rest_asyncio.py index 26970a5148..1a691859d8 100644 --- a/google/cloud/aiplatform_v1beta1/services/dataset_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/dataset_service/transports/rest_asyncio.py @@ -63,6 +63,18 @@ from .base import DEFAULT_CLIENT_INFO as BASE_DEFAULT_CLIENT_INFO + +import logging + +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__) + try: OptionalRetry = Union[retries.AsyncRetry, gapic_v1.method._MethodDefault, None] except AttributeError: # pragma: NO COVER @@ -251,8 +263,10 @@ async def post_update_dataset_version(self, response): async def pre_create_dataset( self, request: dataset_service.CreateDatasetRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[dataset_service.CreateDatasetRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + dataset_service.CreateDatasetRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for create_dataset Override in a subclass to manipulate the request or metadata @@ -274,8 +288,11 @@ async def post_create_dataset( async def pre_create_dataset_version( self, request: dataset_service.CreateDatasetVersionRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[dataset_service.CreateDatasetVersionRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + dataset_service.CreateDatasetVersionRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for create_dataset_version Override in a subclass to manipulate the request or metadata @@ -297,8 +314,10 @@ async def post_create_dataset_version( async def pre_delete_dataset( self, request: dataset_service.DeleteDatasetRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[dataset_service.DeleteDatasetRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + dataset_service.DeleteDatasetRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for delete_dataset Override in a subclass to manipulate the request or metadata @@ -320,8 +339,11 @@ async def post_delete_dataset( async def pre_delete_dataset_version( self, request: dataset_service.DeleteDatasetVersionRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[dataset_service.DeleteDatasetVersionRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + dataset_service.DeleteDatasetVersionRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for delete_dataset_version Override in a subclass to manipulate the request or metadata @@ -343,8 +365,10 @@ async def post_delete_dataset_version( async def pre_delete_saved_query( self, request: dataset_service.DeleteSavedQueryRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[dataset_service.DeleteSavedQueryRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + dataset_service.DeleteSavedQueryRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for delete_saved_query Override in a subclass to manipulate the request or metadata @@ -366,8 +390,10 @@ async def post_delete_saved_query( async def pre_export_data( self, request: dataset_service.ExportDataRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[dataset_service.ExportDataRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + dataset_service.ExportDataRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for export_data Override in a subclass to manipulate the request or metadata @@ -389,8 +415,11 @@ async def post_export_data( async def pre_get_annotation_spec( self, request: dataset_service.GetAnnotationSpecRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[dataset_service.GetAnnotationSpecRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + dataset_service.GetAnnotationSpecRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for get_annotation_spec Override in a subclass to manipulate the request or metadata @@ -412,8 +441,10 @@ async def post_get_annotation_spec( async def pre_get_dataset( self, request: dataset_service.GetDatasetRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[dataset_service.GetDatasetRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + dataset_service.GetDatasetRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_dataset Override in a subclass to manipulate the request or metadata @@ -433,8 +464,11 @@ async def post_get_dataset(self, response: dataset.Dataset) -> dataset.Dataset: async def pre_get_dataset_version( self, request: dataset_service.GetDatasetVersionRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[dataset_service.GetDatasetVersionRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + dataset_service.GetDatasetVersionRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for get_dataset_version Override in a subclass to manipulate the request or metadata @@ -456,8 +490,10 @@ async def post_get_dataset_version( async def pre_import_data( self, request: dataset_service.ImportDataRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[dataset_service.ImportDataRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + dataset_service.ImportDataRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for import_data Override in a subclass to manipulate the request or metadata @@ -479,8 +515,10 @@ async def post_import_data( async def pre_list_annotations( self, request: dataset_service.ListAnnotationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[dataset_service.ListAnnotationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + dataset_service.ListAnnotationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_annotations Override in a subclass to manipulate the request or metadata @@ -502,8 +540,10 @@ async def post_list_annotations( async def pre_list_data_items( self, request: dataset_service.ListDataItemsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[dataset_service.ListDataItemsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + dataset_service.ListDataItemsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_data_items Override in a subclass to manipulate the request or metadata @@ -525,8 +565,10 @@ async def post_list_data_items( async def pre_list_datasets( self, request: dataset_service.ListDatasetsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[dataset_service.ListDatasetsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + dataset_service.ListDatasetsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_datasets Override in a subclass to manipulate the request or metadata @@ -548,8 +590,11 @@ async def post_list_datasets( async def pre_list_dataset_versions( self, request: dataset_service.ListDatasetVersionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[dataset_service.ListDatasetVersionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + dataset_service.ListDatasetVersionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for list_dataset_versions Override in a subclass to manipulate the request or metadata @@ -571,8 +616,10 @@ async def post_list_dataset_versions( async def pre_list_saved_queries( self, request: dataset_service.ListSavedQueriesRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[dataset_service.ListSavedQueriesRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + dataset_service.ListSavedQueriesRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_saved_queries Override in a subclass to manipulate the request or metadata @@ -594,8 +641,11 @@ async def post_list_saved_queries( async def pre_restore_dataset_version( self, request: dataset_service.RestoreDatasetVersionRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[dataset_service.RestoreDatasetVersionRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + dataset_service.RestoreDatasetVersionRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for restore_dataset_version Override in a subclass to manipulate the request or metadata @@ -617,8 +667,10 @@ async def post_restore_dataset_version( async def pre_search_data_items( self, request: dataset_service.SearchDataItemsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[dataset_service.SearchDataItemsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + dataset_service.SearchDataItemsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for search_data_items Override in a subclass to manipulate the request or metadata @@ -640,8 +692,10 @@ async def post_search_data_items( async def pre_update_dataset( self, request: dataset_service.UpdateDatasetRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[dataset_service.UpdateDatasetRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + dataset_service.UpdateDatasetRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for update_dataset Override in a subclass to manipulate the request or metadata @@ -663,8 +717,11 @@ async def post_update_dataset( async def pre_update_dataset_version( self, request: dataset_service.UpdateDatasetVersionRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[dataset_service.UpdateDatasetVersionRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + dataset_service.UpdateDatasetVersionRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for update_dataset_version Override in a subclass to manipulate the request or metadata @@ -686,8 +743,10 @@ async def post_update_dataset_version( async def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -709,8 +768,10 @@ async def post_get_location( async def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -732,8 +793,10 @@ async def post_list_locations( async def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -755,8 +818,10 @@ async def post_get_iam_policy( async def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -778,8 +843,11 @@ async def post_set_iam_policy( async def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -801,8 +869,10 @@ async def post_test_iam_permissions( async def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -822,8 +892,10 @@ async def post_cancel_operation(self, response: None) -> None: async 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 @@ -843,8 +915,10 @@ async def post_delete_operation(self, response: None) -> None: async 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 @@ -866,8 +940,10 @@ async def post_get_operation( async 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 @@ -889,8 +965,10 @@ async def post_list_operations( async def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -1166,7 +1244,7 @@ async 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 dataset method over HTTP. @@ -1177,8 +1255,10 @@ async def __call__( 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: @@ -1191,6 +1271,7 @@ async def __call__( http_options = ( _BaseDatasetServiceRestTransport._BaseCreateDataset._get_http_options() ) + request, metadata = await self._interceptor.pre_create_dataset( request, metadata ) @@ -1207,6 +1288,33 @@ async 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.aiplatform_v1beta1.DatasetServiceClient.CreateDataset", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DatasetService", + "rpcName": "CreateDataset", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncDatasetServiceRestTransport._CreateDataset._get_response( @@ -1237,6 +1345,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_create_dataset(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.DatasetServiceAsyncClient.create_dataset", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DatasetService", + "rpcName": "CreateDataset", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _CreateDatasetVersion( @@ -1276,7 +1406,7 @@ async 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 dataset version method over HTTP. @@ -1287,8 +1417,10 @@ async def __call__( 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: @@ -1301,6 +1433,7 @@ async def __call__( http_options = ( _BaseDatasetServiceRestTransport._BaseCreateDatasetVersion._get_http_options() ) + request, metadata = await self._interceptor.pre_create_dataset_version( request, metadata ) @@ -1317,6 +1450,33 @@ async 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.aiplatform_v1beta1.DatasetServiceClient.CreateDatasetVersion", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DatasetService", + "rpcName": "CreateDatasetVersion", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncDatasetServiceRestTransport._CreateDatasetVersion._get_response( self._host, @@ -1345,6 +1505,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_create_dataset_version(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.DatasetServiceAsyncClient.create_dataset_version", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DatasetService", + "rpcName": "CreateDatasetVersion", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _DeleteDataset( @@ -1382,7 +1564,7 @@ async 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 dataset method over HTTP. @@ -1393,8 +1575,10 @@ async def __call__( 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: @@ -1407,6 +1591,7 @@ async def __call__( http_options = ( _BaseDatasetServiceRestTransport._BaseDeleteDataset._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_dataset( request, metadata ) @@ -1419,6 +1604,33 @@ async 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.aiplatform_v1beta1.DatasetServiceClient.DeleteDataset", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DatasetService", + "rpcName": "DeleteDataset", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncDatasetServiceRestTransport._DeleteDataset._get_response( @@ -1448,6 +1660,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_delete_dataset(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.DatasetServiceAsyncClient.delete_dataset", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DatasetService", + "rpcName": "DeleteDataset", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _DeleteDatasetVersion( @@ -1486,7 +1720,7 @@ async 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 dataset version method over HTTP. @@ -1497,8 +1731,10 @@ async def __call__( 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: @@ -1511,6 +1747,7 @@ async def __call__( http_options = ( _BaseDatasetServiceRestTransport._BaseDeleteDatasetVersion._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_dataset_version( request, metadata ) @@ -1523,6 +1760,33 @@ async 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.aiplatform_v1beta1.DatasetServiceClient.DeleteDatasetVersion", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DatasetService", + "rpcName": "DeleteDatasetVersion", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncDatasetServiceRestTransport._DeleteDatasetVersion._get_response( self._host, @@ -1550,6 +1814,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_delete_dataset_version(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.DatasetServiceAsyncClient.delete_dataset_version", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DatasetService", + "rpcName": "DeleteDatasetVersion", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _DeleteSavedQuery( @@ -1588,7 +1874,7 @@ async 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 saved query method over HTTP. @@ -1599,8 +1885,10 @@ async def __call__( 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: @@ -1613,6 +1901,7 @@ async def __call__( http_options = ( _BaseDatasetServiceRestTransport._BaseDeleteSavedQuery._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_saved_query( request, metadata ) @@ -1625,6 +1914,33 @@ async 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.aiplatform_v1beta1.DatasetServiceClient.DeleteSavedQuery", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DatasetService", + "rpcName": "DeleteSavedQuery", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncDatasetServiceRestTransport._DeleteSavedQuery._get_response( @@ -1654,6 +1970,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_delete_saved_query(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.DatasetServiceAsyncClient.delete_saved_query", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DatasetService", + "rpcName": "DeleteSavedQuery", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ExportData( @@ -1692,7 +2030,7 @@ async 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 export data method over HTTP. @@ -1703,8 +2041,10 @@ async def __call__( 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: @@ -1717,6 +2057,7 @@ async def __call__( http_options = ( _BaseDatasetServiceRestTransport._BaseExportData._get_http_options() ) + request, metadata = await self._interceptor.pre_export_data( request, metadata ) @@ -1737,6 +2078,33 @@ async 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.aiplatform_v1beta1.DatasetServiceClient.ExportData", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DatasetService", + "rpcName": "ExportData", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncDatasetServiceRestTransport._ExportData._get_response( self._host, @@ -1765,6 +2133,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_export_data(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.DatasetServiceAsyncClient.export_data", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DatasetService", + "rpcName": "ExportData", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _GetAnnotationSpec( @@ -1803,7 +2193,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> annotation_spec.AnnotationSpec: r"""Call the get annotation spec method over HTTP. @@ -1814,8 +2204,10 @@ async def __call__( 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: ~.annotation_spec.AnnotationSpec: @@ -1827,6 +2219,7 @@ async def __call__( http_options = ( _BaseDatasetServiceRestTransport._BaseGetAnnotationSpec._get_http_options() ) + request, metadata = await self._interceptor.pre_get_annotation_spec( request, metadata ) @@ -1839,6 +2232,33 @@ async 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.aiplatform_v1beta1.DatasetServiceClient.GetAnnotationSpec", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DatasetService", + "rpcName": "GetAnnotationSpec", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncDatasetServiceRestTransport._GetAnnotationSpec._get_response( @@ -1868,6 +2288,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_get_annotation_spec(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = annotation_spec.AnnotationSpec.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.DatasetServiceAsyncClient.get_annotation_spec", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DatasetService", + "rpcName": "GetAnnotationSpec", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _GetDataset( @@ -1905,7 +2347,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> dataset.Dataset: r"""Call the get dataset method over HTTP. @@ -1916,8 +2358,10 @@ async def __call__( 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: ~.dataset.Dataset: @@ -1929,6 +2373,7 @@ async def __call__( http_options = ( _BaseDatasetServiceRestTransport._BaseGetDataset._get_http_options() ) + request, metadata = await self._interceptor.pre_get_dataset( request, metadata ) @@ -1943,6 +2388,33 @@ async 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 = 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.aiplatform_v1beta1.DatasetServiceClient.GetDataset", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DatasetService", + "rpcName": "GetDataset", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncDatasetServiceRestTransport._GetDataset._get_response( self._host, @@ -1970,6 +2442,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_get_dataset(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = dataset.Dataset.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.DatasetServiceAsyncClient.get_dataset", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DatasetService", + "rpcName": "GetDataset", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _GetDatasetVersion( @@ -2008,7 +2502,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> dataset_version.DatasetVersion: r"""Call the get dataset version method over HTTP. @@ -2019,8 +2513,10 @@ async def __call__( 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: ~.dataset_version.DatasetVersion: @@ -2030,6 +2526,7 @@ async def __call__( http_options = ( _BaseDatasetServiceRestTransport._BaseGetDatasetVersion._get_http_options() ) + request, metadata = await self._interceptor.pre_get_dataset_version( request, metadata ) @@ -2042,6 +2539,33 @@ async 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.aiplatform_v1beta1.DatasetServiceClient.GetDatasetVersion", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DatasetService", + "rpcName": "GetDatasetVersion", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncDatasetServiceRestTransport._GetDatasetVersion._get_response( @@ -2071,6 +2595,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_get_dataset_version(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = dataset_version.DatasetVersion.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.DatasetServiceAsyncClient.get_dataset_version", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DatasetService", + "rpcName": "GetDatasetVersion", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ImportData( @@ -2109,7 +2655,7 @@ async 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 import data method over HTTP. @@ -2120,8 +2666,10 @@ async def __call__( 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: @@ -2134,6 +2682,7 @@ async def __call__( http_options = ( _BaseDatasetServiceRestTransport._BaseImportData._get_http_options() ) + request, metadata = await self._interceptor.pre_import_data( request, metadata ) @@ -2154,6 +2703,33 @@ async 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.aiplatform_v1beta1.DatasetServiceClient.ImportData", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DatasetService", + "rpcName": "ImportData", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncDatasetServiceRestTransport._ImportData._get_response( self._host, @@ -2182,6 +2758,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_import_data(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.DatasetServiceAsyncClient.import_data", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DatasetService", + "rpcName": "ImportData", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ListAnnotations( @@ -2220,7 +2818,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> dataset_service.ListAnnotationsResponse: r"""Call the list annotations method over HTTP. @@ -2231,8 +2829,10 @@ async def __call__( 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: ~.dataset_service.ListAnnotationsResponse: @@ -2244,6 +2844,7 @@ async def __call__( http_options = ( _BaseDatasetServiceRestTransport._BaseListAnnotations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_annotations( request, metadata ) @@ -2256,6 +2857,33 @@ async 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.aiplatform_v1beta1.DatasetServiceClient.ListAnnotations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DatasetService", + "rpcName": "ListAnnotations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncDatasetServiceRestTransport._ListAnnotations._get_response( @@ -2285,6 +2913,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_list_annotations(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = dataset_service.ListAnnotationsResponse.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.DatasetServiceAsyncClient.list_annotations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DatasetService", + "rpcName": "ListAnnotations", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ListDataItems( @@ -2322,7 +2974,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> dataset_service.ListDataItemsResponse: r"""Call the list data items method over HTTP. @@ -2333,8 +2985,10 @@ async def __call__( 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: ~.dataset_service.ListDataItemsResponse: @@ -2346,6 +3000,7 @@ async def __call__( http_options = ( _BaseDatasetServiceRestTransport._BaseListDataItems._get_http_options() ) + request, metadata = await self._interceptor.pre_list_data_items( request, metadata ) @@ -2358,6 +3013,33 @@ async 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.aiplatform_v1beta1.DatasetServiceClient.ListDataItems", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DatasetService", + "rpcName": "ListDataItems", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncDatasetServiceRestTransport._ListDataItems._get_response( @@ -2387,6 +3069,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_list_data_items(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = dataset_service.ListDataItemsResponse.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.DatasetServiceAsyncClient.list_data_items", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DatasetService", + "rpcName": "ListDataItems", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ListDatasets( @@ -2424,7 +3130,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> dataset_service.ListDatasetsResponse: r"""Call the list datasets method over HTTP. @@ -2435,8 +3141,10 @@ async def __call__( 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: ~.dataset_service.ListDatasetsResponse: @@ -2448,6 +3156,7 @@ async def __call__( http_options = ( _BaseDatasetServiceRestTransport._BaseListDatasets._get_http_options() ) + request, metadata = await self._interceptor.pre_list_datasets( request, metadata ) @@ -2460,6 +3169,33 @@ async 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.aiplatform_v1beta1.DatasetServiceClient.ListDatasets", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DatasetService", + "rpcName": "ListDatasets", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncDatasetServiceRestTransport._ListDatasets._get_response( @@ -2489,6 +3225,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_list_datasets(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = dataset_service.ListDatasetsResponse.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.DatasetServiceAsyncClient.list_datasets", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DatasetService", + "rpcName": "ListDatasets", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ListDatasetVersions( @@ -2527,7 +3287,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> dataset_service.ListDatasetVersionsResponse: r"""Call the list dataset versions method over HTTP. @@ -2538,8 +3298,10 @@ async def __call__( 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: ~.dataset_service.ListDatasetVersionsResponse: @@ -2551,6 +3313,7 @@ async def __call__( http_options = ( _BaseDatasetServiceRestTransport._BaseListDatasetVersions._get_http_options() ) + request, metadata = await self._interceptor.pre_list_dataset_versions( request, metadata ) @@ -2563,6 +3326,33 @@ async 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.aiplatform_v1beta1.DatasetServiceClient.ListDatasetVersions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DatasetService", + "rpcName": "ListDatasetVersions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncDatasetServiceRestTransport._ListDatasetVersions._get_response( self._host, @@ -2590,6 +3380,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_list_dataset_versions(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + dataset_service.ListDatasetVersionsResponse.to_json(response) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.DatasetServiceAsyncClient.list_dataset_versions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DatasetService", + "rpcName": "ListDatasetVersions", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ListSavedQueries( @@ -2628,7 +3442,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> dataset_service.ListSavedQueriesResponse: r"""Call the list saved queries method over HTTP. @@ -2639,8 +3453,10 @@ async def __call__( 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: ~.dataset_service.ListSavedQueriesResponse: @@ -2652,6 +3468,7 @@ async def __call__( http_options = ( _BaseDatasetServiceRestTransport._BaseListSavedQueries._get_http_options() ) + request, metadata = await self._interceptor.pre_list_saved_queries( request, metadata ) @@ -2664,6 +3481,33 @@ async 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.aiplatform_v1beta1.DatasetServiceClient.ListSavedQueries", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DatasetService", + "rpcName": "ListSavedQueries", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncDatasetServiceRestTransport._ListSavedQueries._get_response( @@ -2693,6 +3537,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_list_saved_queries(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = dataset_service.ListSavedQueriesResponse.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.DatasetServiceAsyncClient.list_saved_queries", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DatasetService", + "rpcName": "ListSavedQueries", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _RestoreDatasetVersion( @@ -2731,7 +3599,7 @@ async 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 restore dataset version method over HTTP. @@ -2742,8 +3610,10 @@ async def __call__( 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: @@ -2756,6 +3626,7 @@ async def __call__( http_options = ( _BaseDatasetServiceRestTransport._BaseRestoreDatasetVersion._get_http_options() ) + request, metadata = await self._interceptor.pre_restore_dataset_version( request, metadata ) @@ -2768,6 +3639,33 @@ async 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.aiplatform_v1beta1.DatasetServiceClient.RestoreDatasetVersion", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DatasetService", + "rpcName": "RestoreDatasetVersion", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncDatasetServiceRestTransport._RestoreDatasetVersion._get_response( self._host, @@ -2795,6 +3693,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_restore_dataset_version(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.DatasetServiceAsyncClient.restore_dataset_version", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DatasetService", + "rpcName": "RestoreDatasetVersion", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _SearchDataItems( @@ -2833,7 +3753,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> dataset_service.SearchDataItemsResponse: r"""Call the search data items method over HTTP. @@ -2844,8 +3764,10 @@ async def __call__( 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: ~.dataset_service.SearchDataItemsResponse: @@ -2857,6 +3779,7 @@ async def __call__( http_options = ( _BaseDatasetServiceRestTransport._BaseSearchDataItems._get_http_options() ) + request, metadata = await self._interceptor.pre_search_data_items( request, metadata ) @@ -2869,6 +3792,33 @@ async 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.aiplatform_v1beta1.DatasetServiceClient.SearchDataItems", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DatasetService", + "rpcName": "SearchDataItems", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncDatasetServiceRestTransport._SearchDataItems._get_response( @@ -2898,6 +3848,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_search_data_items(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = dataset_service.SearchDataItemsResponse.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.DatasetServiceAsyncClient.search_data_items", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DatasetService", + "rpcName": "SearchDataItems", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _UpdateDataset( @@ -2936,7 +3910,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> gca_dataset.Dataset: r"""Call the update dataset method over HTTP. @@ -2947,8 +3921,10 @@ async def __call__( 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: ~.gca_dataset.Dataset: @@ -2960,6 +3936,7 @@ async def __call__( http_options = ( _BaseDatasetServiceRestTransport._BaseUpdateDataset._get_http_options() ) + request, metadata = await self._interceptor.pre_update_dataset( request, metadata ) @@ -2976,6 +3953,33 @@ async 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.aiplatform_v1beta1.DatasetServiceClient.UpdateDataset", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DatasetService", + "rpcName": "UpdateDataset", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncDatasetServiceRestTransport._UpdateDataset._get_response( @@ -3006,6 +4010,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_update_dataset(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gca_dataset.Dataset.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.DatasetServiceAsyncClient.update_dataset", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DatasetService", + "rpcName": "UpdateDataset", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _UpdateDatasetVersion( @@ -3045,7 +4071,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> gca_dataset_version.DatasetVersion: r"""Call the update dataset version method over HTTP. @@ -3056,8 +4082,10 @@ async def __call__( 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: ~.gca_dataset_version.DatasetVersion: @@ -3067,6 +4095,7 @@ async def __call__( http_options = ( _BaseDatasetServiceRestTransport._BaseUpdateDatasetVersion._get_http_options() ) + request, metadata = await self._interceptor.pre_update_dataset_version( request, metadata ) @@ -3083,6 +4112,33 @@ async 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.aiplatform_v1beta1.DatasetServiceClient.UpdateDatasetVersion", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DatasetService", + "rpcName": "UpdateDatasetVersion", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncDatasetServiceRestTransport._UpdateDatasetVersion._get_response( self._host, @@ -3111,6 +4167,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_update_dataset_version(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gca_dataset_version.DatasetVersion.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.DatasetServiceAsyncClient.update_dataset_version", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DatasetService", + "rpcName": "UpdateDatasetVersion", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp @property @@ -3686,6 +4766,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -3902,6 +4986,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -4108,6 +5196,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}", @@ -4324,6 +5416,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, ], "google.longrunning.Operations.ListOperations": [ { @@ -4522,6 +5618,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*}/operations", @@ -4738,6 +5838,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*}/operations", + }, ], "google.longrunning.Operations.WaitOperation": [ { @@ -4936,6 +6040,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "post", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}:wait", @@ -5148,6 +6256,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, ], } @@ -5348,7 +6460,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -5359,8 +6471,10 @@ async def __call__( 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: locations_pb2.Location: Response from GetLocation method. @@ -5369,6 +6483,7 @@ async def __call__( http_options = ( _BaseDatasetServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_location( request, metadata ) @@ -5381,6 +6496,33 @@ async 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.aiplatform_v1beta1.DatasetServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DatasetService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncDatasetServiceRestTransport._GetLocation._get_response( @@ -5408,6 +6550,27 @@ async def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_location(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.aiplatform_v1beta1.DatasetServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DatasetService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5449,7 +6612,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -5460,8 +6623,10 @@ async def __call__( 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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -5470,6 +6635,7 @@ async def __call__( http_options = ( _BaseDatasetServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_locations( request, metadata ) @@ -5482,6 +6648,33 @@ async 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.aiplatform_v1beta1.DatasetServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DatasetService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncDatasetServiceRestTransport._ListLocations._get_response( @@ -5509,6 +6702,27 @@ async def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_list_locations(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.aiplatform_v1beta1.DatasetServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DatasetService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5551,7 +6765,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -5562,8 +6776,10 @@ async def __call__( 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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -5572,6 +6788,7 @@ async def __call__( http_options = ( _BaseDatasetServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_get_iam_policy( request, metadata ) @@ -5588,6 +6805,33 @@ async 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.aiplatform_v1beta1.DatasetServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DatasetService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncDatasetServiceRestTransport._GetIamPolicy._get_response( @@ -5616,6 +6860,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_iam_policy(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.aiplatform_v1beta1.DatasetServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DatasetService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5658,7 +6923,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -5669,8 +6934,10 @@ async def __call__( 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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -5679,6 +6946,7 @@ async def __call__( http_options = ( _BaseDatasetServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_set_iam_policy( request, metadata ) @@ -5695,6 +6963,33 @@ async 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.aiplatform_v1beta1.DatasetServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DatasetService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncDatasetServiceRestTransport._SetIamPolicy._get_response( @@ -5723,6 +7018,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_set_iam_policy(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.aiplatform_v1beta1.DatasetServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DatasetService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5766,7 +7082,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -5777,8 +7093,10 @@ async def __call__( 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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -5787,6 +7105,7 @@ async def __call__( http_options = ( _BaseDatasetServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = await self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -5803,6 +7122,33 @@ async 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.aiplatform_v1beta1.DatasetServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DatasetService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncDatasetServiceRestTransport._TestIamPermissions._get_response( self._host, @@ -5829,6 +7175,27 @@ async def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_test_iam_permissions(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.aiplatform_v1beta1.DatasetServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DatasetService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5871,7 +7238,7 @@ async 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 cancel operation method over HTTP. @@ -5882,13 +7249,16 @@ async def __call__( 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`. """ http_options = ( _BaseDatasetServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_cancel_operation( request, metadata ) @@ -5901,6 +7271,33 @@ async 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.aiplatform_v1beta1.DatasetServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DatasetService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncDatasetServiceRestTransport._CancelOperation._get_response( @@ -5966,7 +7363,7 @@ async 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. @@ -5977,13 +7374,16 @@ async def __call__( 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`. """ http_options = ( _BaseDatasetServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_operation( request, metadata ) @@ -5996,6 +7396,33 @@ async 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.aiplatform_v1beta1.DatasetServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DatasetService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncDatasetServiceRestTransport._DeleteOperation._get_response( @@ -6060,7 +7487,7 @@ async 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. @@ -6071,8 +7498,10 @@ async def __call__( 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: Response from GetOperation method. @@ -6081,6 +7510,7 @@ async def __call__( http_options = ( _BaseDatasetServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_operation( request, metadata ) @@ -6093,6 +7523,33 @@ async 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.aiplatform_v1beta1.DatasetServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DatasetService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncDatasetServiceRestTransport._GetOperation._get_response( @@ -6120,6 +7577,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1beta1.DatasetServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DatasetService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -6162,7 +7640,7 @@ async 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. @@ -6173,8 +7651,10 @@ async def __call__( 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 from ListOperations method. @@ -6183,6 +7663,7 @@ async def __call__( http_options = ( _BaseDatasetServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_operations( request, metadata ) @@ -6195,6 +7676,33 @@ async 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.aiplatform_v1beta1.DatasetServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DatasetService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncDatasetServiceRestTransport._ListOperations._get_response( @@ -6222,6 +7730,27 @@ async def __call__( resp = operations_pb2.ListOperationsResponse() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1beta1.DatasetServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DatasetService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -6263,7 +7792,7 @@ async 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 wait operation method over HTTP. @@ -6274,8 +7803,10 @@ async def __call__( 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: Response from WaitOperation method. @@ -6284,6 +7815,7 @@ async def __call__( http_options = ( _BaseDatasetServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_wait_operation( request, metadata ) @@ -6296,6 +7828,33 @@ async 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.aiplatform_v1beta1.DatasetServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DatasetService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncDatasetServiceRestTransport._WaitOperation._get_response( @@ -6323,6 +7882,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_wait_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.aiplatform_v1beta1.DatasetServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DatasetService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1beta1/services/dataset_service/transports/rest_base.py b/google/cloud/aiplatform_v1beta1/services/dataset_service/transports/rest_base.py index edc2a09a65..09fa3a1815 100644 --- a/google/cloud/aiplatform_v1beta1/services/dataset_service/transports/rest_base.py +++ b/google/cloud/aiplatform_v1beta1/services/dataset_service/transports/rest_base.py @@ -2019,6 +2019,10 @@ def _get_http_options(): "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -2235,6 +2239,10 @@ def _get_http_options(): "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -2460,6 +2468,10 @@ def _get_http_options(): "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}", @@ -2676,6 +2688,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, ] return http_options @@ -2893,6 +2909,10 @@ def _get_http_options(): "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*}/operations", @@ -3109,6 +3129,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*}/operations", + }, ] return http_options @@ -3326,6 +3350,10 @@ def _get_http_options(): "method": "post", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}:wait", @@ -3538,6 +3566,10 @@ def _get_http_options(): "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, ] return http_options diff --git a/google/cloud/aiplatform_v1beta1/services/deployment_resource_pool_service/async_client.py b/google/cloud/aiplatform_v1beta1/services/deployment_resource_pool_service/async_client.py index 1d3658bddc..1c91ec5440 100644 --- a/google/cloud/aiplatform_v1beta1/services/deployment_resource_pool_service/async_client.py +++ b/google/cloud/aiplatform_v1beta1/services/deployment_resource_pool_service/async_client.py @@ -13,6 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging as std_logging from collections import OrderedDict import re from typing import ( @@ -68,6 +69,15 @@ from .transports.grpc_asyncio import DeploymentResourcePoolServiceGrpcAsyncIOTransport from .client import DeploymentResourcePoolServiceClient +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 DeploymentResourcePoolServiceAsyncClient: """A service that manages the DeploymentResourcePool resource.""" @@ -303,6 +313,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.aiplatform_v1beta1.DeploymentResourcePoolServiceAsyncClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DeploymentResourcePoolService", + "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.aiplatform.v1beta1.DeploymentResourcePoolService", + "credentialsType": None, + }, + ) + async def create_deployment_resource_pool( self, request: Optional[ @@ -319,7 +351,7 @@ async def create_deployment_resource_pool( deployment_resource_pool_id: 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"""Create a DeploymentResourcePool. @@ -391,8 +423,10 @@ async def sample_create_deployment_resource_pool(): 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: @@ -481,7 +515,7 @@ async def get_deployment_resource_pool( 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]]] = (), ) -> deployment_resource_pool.DeploymentResourcePool: r"""Get a DeploymentResourcePool. @@ -526,8 +560,10 @@ async def sample_get_deployment_resource_pool(): 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.aiplatform_v1beta1.types.DeploymentResourcePool: @@ -599,7 +635,7 @@ async def list_deployment_resource_pools( 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.ListDeploymentResourcePoolsAsyncPager: r"""List DeploymentResourcePools in a location. @@ -645,8 +681,10 @@ async def sample_list_deployment_resource_pools(): 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.aiplatform_v1beta1.services.deployment_resource_pool_service.pagers.ListDeploymentResourcePoolsAsyncPager: @@ -735,7 +773,7 @@ async def update_deployment_resource_pool( 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 a DeploymentResourcePool. @@ -796,8 +834,10 @@ async def sample_update_deployment_resource_pool(): 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: @@ -890,7 +930,7 @@ async def delete_deployment_resource_pool( 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 a DeploymentResourcePool. @@ -939,8 +979,10 @@ async def sample_delete_deployment_resource_pool(): 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: @@ -1028,7 +1070,7 @@ async def query_deployed_models( deployment_resource_pool: 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.QueryDeployedModelsAsyncPager: r"""List DeployedModels that have been deployed on this DeploymentResourcePool. @@ -1075,8 +1117,10 @@ async def sample_query_deployed_models(): 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.aiplatform_v1beta1.services.deployment_resource_pool_service.pagers.QueryDeployedModelsAsyncPager: @@ -1156,7 +1200,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. @@ -1167,8 +1211,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. @@ -1209,7 +1255,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. @@ -1220,8 +1266,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. @@ -1262,7 +1310,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. @@ -1278,8 +1326,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 """ @@ -1316,7 +1366,7 @@ async def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -1331,8 +1381,10 @@ async def cancel_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 """ @@ -1369,7 +1421,7 @@ async def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -1386,8 +1438,10 @@ async def wait_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. @@ -1428,7 +1482,7 @@ async def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -1441,8 +1495,10 @@ async def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -1547,7 +1603,7 @@ async def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -1561,8 +1617,10 @@ async def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -1667,7 +1725,7 @@ async def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -1682,8 +1740,10 @@ async def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -1727,7 +1787,7 @@ async def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -1738,8 +1798,10 @@ async def get_location( 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: ~.location_pb2.Location: Location object. @@ -1780,7 +1842,7 @@ async def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -1791,8 +1853,10 @@ async def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1beta1/services/deployment_resource_pool_service/client.py b/google/cloud/aiplatform_v1beta1/services/deployment_resource_pool_service/client.py index f76b1edce2..f36a47e78a 100644 --- a/google/cloud/aiplatform_v1beta1/services/deployment_resource_pool_service/client.py +++ b/google/cloud/aiplatform_v1beta1/services/deployment_resource_pool_service/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 ( @@ -48,6 +49,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 as gac_operation # type: ignore from google.api_core import operation_async # type: ignore from google.cloud.aiplatform_v1beta1.services.deployment_resource_pool_service import ( @@ -692,6 +702,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( @@ -787,6 +801,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.aiplatform_v1beta1.DeploymentResourcePoolServiceClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DeploymentResourcePoolService", + "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.aiplatform.v1beta1.DeploymentResourcePoolService", + "credentialsType": None, + }, + ) + def create_deployment_resource_pool( self, request: Optional[ @@ -803,7 +840,7 @@ def create_deployment_resource_pool( deployment_resource_pool_id: 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]]] = (), ) -> gac_operation.Operation: r"""Create a DeploymentResourcePool. @@ -875,8 +912,10 @@ def sample_create_deployment_resource_pool(): 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: @@ -964,7 +1003,7 @@ def get_deployment_resource_pool( 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]]] = (), ) -> deployment_resource_pool.DeploymentResourcePool: r"""Get a DeploymentResourcePool. @@ -1009,8 +1048,10 @@ def sample_get_deployment_resource_pool(): 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.aiplatform_v1beta1.types.DeploymentResourcePool: @@ -1081,7 +1122,7 @@ def list_deployment_resource_pools( 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.ListDeploymentResourcePoolsPager: r"""List DeploymentResourcePools in a location. @@ -1127,8 +1168,10 @@ def sample_list_deployment_resource_pools(): 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.aiplatform_v1beta1.services.deployment_resource_pool_service.pagers.ListDeploymentResourcePoolsPager: @@ -1216,7 +1259,7 @@ def update_deployment_resource_pool( 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]]] = (), ) -> gac_operation.Operation: r"""Update a DeploymentResourcePool. @@ -1277,8 +1320,10 @@ def sample_update_deployment_resource_pool(): 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: @@ -1370,7 +1415,7 @@ def delete_deployment_resource_pool( 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]]] = (), ) -> gac_operation.Operation: r"""Delete a DeploymentResourcePool. @@ -1419,8 +1464,10 @@ def sample_delete_deployment_resource_pool(): 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: @@ -1507,7 +1554,7 @@ def query_deployed_models( deployment_resource_pool: 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.QueryDeployedModelsPager: r"""List DeployedModels that have been deployed on this DeploymentResourcePool. @@ -1554,8 +1601,10 @@ def sample_query_deployed_models(): 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.aiplatform_v1beta1.services.deployment_resource_pool_service.pagers.QueryDeployedModelsPager: @@ -1645,7 +1694,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. @@ -1656,8 +1705,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. @@ -1698,7 +1749,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. @@ -1709,8 +1760,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. @@ -1751,7 +1804,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. @@ -1767,8 +1820,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 """ @@ -1805,7 +1860,7 @@ def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -1820,8 +1875,10 @@ def cancel_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 """ @@ -1858,7 +1915,7 @@ def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -1875,8 +1932,10 @@ def wait_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. @@ -1917,7 +1976,7 @@ def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -1930,8 +1989,10 @@ def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -2036,7 +2097,7 @@ def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -2050,8 +2111,10 @@ def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -2156,7 +2219,7 @@ def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -2171,8 +2234,10 @@ def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -2214,7 +2279,7 @@ def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -2225,8 +2290,10 @@ def get_location( 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: ~.location_pb2.Location: Location object. @@ -2267,7 +2334,7 @@ def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -2278,8 +2345,10 @@ def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1beta1/services/deployment_resource_pool_service/pagers.py b/google/cloud/aiplatform_v1beta1/services/deployment_resource_pool_service/pagers.py index cac8cf3ff6..5dc254be70 100644 --- a/google/cloud/aiplatform_v1beta1/services/deployment_resource_pool_service/pagers.py +++ b/google/cloud/aiplatform_v1beta1/services/deployment_resource_pool_service/pagers.py @@ -70,7 +70,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. @@ -84,8 +84,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 = ( @@ -153,7 +155,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. @@ -167,8 +169,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 = ( @@ -241,7 +245,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. @@ -255,8 +259,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 = deployment_resource_pool_service.QueryDeployedModelsRequest( @@ -321,7 +327,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. @@ -335,8 +341,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 = deployment_resource_pool_service.QueryDeployedModelsRequest( diff --git a/google/cloud/aiplatform_v1beta1/services/deployment_resource_pool_service/transports/grpc.py b/google/cloud/aiplatform_v1beta1/services/deployment_resource_pool_service/transports/grpc.py index 687f19a770..9984cfb24d 100644 --- a/google/cloud/aiplatform_v1beta1/services/deployment_resource_pool_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1beta1/services/deployment_resource_pool_service/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 import warnings from typing import Callable, Dict, Optional, Sequence, Tuple, Union @@ -22,8 +25,11 @@ import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from google.cloud.aiplatform_v1beta1.types import deployment_resource_pool from google.cloud.aiplatform_v1beta1.types import deployment_resource_pool_service @@ -33,6 +39,81 @@ from google.longrunning import operations_pb2 # type: ignore from .base import DeploymentResourcePoolServiceTransport, DEFAULT_CLIENT_INFO +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.aiplatform.v1beta1.DeploymentResourcePoolService", + "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.aiplatform.v1beta1.DeploymentResourcePoolService", + "rpcName": client_call_details.method, + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class DeploymentResourcePoolServiceGrpcTransport( DeploymentResourcePoolServiceTransport @@ -189,7 +270,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 @@ -253,7 +339,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 @@ -283,7 +371,7 @@ def create_deployment_resource_pool( if "create_deployment_resource_pool" not in self._stubs: self._stubs[ "create_deployment_resource_pool" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.DeploymentResourcePoolService/CreateDeploymentResourcePool", request_serializer=deployment_resource_pool_service.CreateDeploymentResourcePoolRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -312,7 +400,9 @@ def get_deployment_resource_pool( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_deployment_resource_pool" not in self._stubs: - self._stubs["get_deployment_resource_pool"] = self.grpc_channel.unary_unary( + self._stubs[ + "get_deployment_resource_pool" + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.DeploymentResourcePoolService/GetDeploymentResourcePool", request_serializer=deployment_resource_pool_service.GetDeploymentResourcePoolRequest.serialize, response_deserializer=deployment_resource_pool.DeploymentResourcePool.deserialize, @@ -343,7 +433,7 @@ def list_deployment_resource_pools( if "list_deployment_resource_pools" not in self._stubs: self._stubs[ "list_deployment_resource_pools" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.DeploymentResourcePoolService/ListDeploymentResourcePools", request_serializer=deployment_resource_pool_service.ListDeploymentResourcePoolsRequest.serialize, response_deserializer=deployment_resource_pool_service.ListDeploymentResourcePoolsResponse.deserialize, @@ -375,7 +465,7 @@ def update_deployment_resource_pool( if "update_deployment_resource_pool" not in self._stubs: self._stubs[ "update_deployment_resource_pool" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.DeploymentResourcePoolService/UpdateDeploymentResourcePool", request_serializer=deployment_resource_pool_service.UpdateDeploymentResourcePoolRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -407,7 +497,7 @@ def delete_deployment_resource_pool( if "delete_deployment_resource_pool" not in self._stubs: self._stubs[ "delete_deployment_resource_pool" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.DeploymentResourcePoolService/DeleteDeploymentResourcePool", request_serializer=deployment_resource_pool_service.DeleteDeploymentResourcePoolRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -437,7 +527,7 @@ def query_deployed_models( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "query_deployed_models" not in self._stubs: - self._stubs["query_deployed_models"] = self.grpc_channel.unary_unary( + self._stubs["query_deployed_models"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.DeploymentResourcePoolService/QueryDeployedModels", request_serializer=deployment_resource_pool_service.QueryDeployedModelsRequest.serialize, response_deserializer=deployment_resource_pool_service.QueryDeployedModelsResponse.deserialize, @@ -445,7 +535,7 @@ def query_deployed_models( return self._stubs["query_deployed_models"] def close(self): - self.grpc_channel.close() + self._logged_channel.close() @property def delete_operation( @@ -457,7 +547,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, @@ -474,7 +564,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -491,7 +581,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -508,7 +598,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, @@ -527,7 +617,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, @@ -546,7 +636,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -563,7 +653,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -588,7 +678,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -614,7 +704,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -643,7 +733,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1beta1/services/deployment_resource_pool_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1beta1/services/deployment_resource_pool_service/transports/grpc_asyncio.py index 34763a2b40..c0f1006df6 100644 --- a/google/cloud/aiplatform_v1beta1/services/deployment_resource_pool_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/deployment_resource_pool_service/transports/grpc_asyncio.py @@ -14,6 +14,9 @@ # limitations under the License. # import inspect +import json +import pickle +import logging as std_logging import warnings from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union @@ -24,8 +27,11 @@ from google.api_core import operations_v1 from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from grpc.experimental import aio # type: ignore from google.cloud.aiplatform_v1beta1.types import deployment_resource_pool @@ -37,6 +43,82 @@ from .base import DeploymentResourcePoolServiceTransport, DEFAULT_CLIENT_INFO from .grpc import DeploymentResourcePoolServiceGrpcTransport +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.aiplatform.v1beta1.DeploymentResourcePoolService", + "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.aiplatform.v1beta1.DeploymentResourcePoolService", + "rpcName": str(client_call_details.method), + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class DeploymentResourcePoolServiceGrpcAsyncIOTransport( DeploymentResourcePoolServiceTransport @@ -236,10 +318,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 @@ -262,7 +347,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. @@ -293,7 +378,7 @@ def create_deployment_resource_pool( if "create_deployment_resource_pool" not in self._stubs: self._stubs[ "create_deployment_resource_pool" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.DeploymentResourcePoolService/CreateDeploymentResourcePool", request_serializer=deployment_resource_pool_service.CreateDeploymentResourcePoolRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -322,7 +407,9 @@ def get_deployment_resource_pool( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_deployment_resource_pool" not in self._stubs: - self._stubs["get_deployment_resource_pool"] = self.grpc_channel.unary_unary( + self._stubs[ + "get_deployment_resource_pool" + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.DeploymentResourcePoolService/GetDeploymentResourcePool", request_serializer=deployment_resource_pool_service.GetDeploymentResourcePoolRequest.serialize, response_deserializer=deployment_resource_pool.DeploymentResourcePool.deserialize, @@ -353,7 +440,7 @@ def list_deployment_resource_pools( if "list_deployment_resource_pools" not in self._stubs: self._stubs[ "list_deployment_resource_pools" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.DeploymentResourcePoolService/ListDeploymentResourcePools", request_serializer=deployment_resource_pool_service.ListDeploymentResourcePoolsRequest.serialize, response_deserializer=deployment_resource_pool_service.ListDeploymentResourcePoolsResponse.deserialize, @@ -385,7 +472,7 @@ def update_deployment_resource_pool( if "update_deployment_resource_pool" not in self._stubs: self._stubs[ "update_deployment_resource_pool" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.DeploymentResourcePoolService/UpdateDeploymentResourcePool", request_serializer=deployment_resource_pool_service.UpdateDeploymentResourcePoolRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -417,7 +504,7 @@ def delete_deployment_resource_pool( if "delete_deployment_resource_pool" not in self._stubs: self._stubs[ "delete_deployment_resource_pool" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.DeploymentResourcePoolService/DeleteDeploymentResourcePool", request_serializer=deployment_resource_pool_service.DeleteDeploymentResourcePoolRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -447,7 +534,7 @@ def query_deployed_models( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "query_deployed_models" not in self._stubs: - self._stubs["query_deployed_models"] = self.grpc_channel.unary_unary( + self._stubs["query_deployed_models"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.DeploymentResourcePoolService/QueryDeployedModels", request_serializer=deployment_resource_pool_service.QueryDeployedModelsRequest.serialize, response_deserializer=deployment_resource_pool_service.QueryDeployedModelsResponse.deserialize, @@ -545,7 +632,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: @@ -561,7 +648,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, @@ -578,7 +665,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -595,7 +682,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -612,7 +699,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, @@ -631,7 +718,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, @@ -650,7 +737,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -667,7 +754,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -692,7 +779,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -718,7 +805,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -747,7 +834,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1beta1/services/deployment_resource_pool_service/transports/rest.py b/google/cloud/aiplatform_v1beta1/services/deployment_resource_pool_service/transports/rest.py index eaf76766e7..709885e6bd 100644 --- a/google/cloud/aiplatform_v1beta1/services/deployment_resource_pool_service/transports/rest.py +++ b/google/cloud/aiplatform_v1beta1/services/deployment_resource_pool_service/transports/rest.py @@ -13,9 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging +import json # type: ignore from google.auth.transport.requests import AuthorizedSession # type: ignore -import json # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.api_core import exceptions as core_exceptions from google.api_core import retry as retries @@ -48,6 +49,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, @@ -128,10 +137,10 @@ def post_update_deployment_resource_pool(self, response): def pre_create_deployment_resource_pool( self, request: deployment_resource_pool_service.CreateDeploymentResourcePoolRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ deployment_resource_pool_service.CreateDeploymentResourcePoolRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for create_deployment_resource_pool @@ -154,10 +163,10 @@ def post_create_deployment_resource_pool( def pre_delete_deployment_resource_pool( self, request: deployment_resource_pool_service.DeleteDeploymentResourcePoolRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ deployment_resource_pool_service.DeleteDeploymentResourcePoolRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for delete_deployment_resource_pool @@ -180,10 +189,10 @@ def post_delete_deployment_resource_pool( def pre_get_deployment_resource_pool( self, request: deployment_resource_pool_service.GetDeploymentResourcePoolRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ deployment_resource_pool_service.GetDeploymentResourcePoolRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for get_deployment_resource_pool @@ -206,10 +215,10 @@ def post_get_deployment_resource_pool( def pre_list_deployment_resource_pools( self, request: deployment_resource_pool_service.ListDeploymentResourcePoolsRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ deployment_resource_pool_service.ListDeploymentResourcePoolsRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for list_deployment_resource_pools @@ -233,10 +242,10 @@ def post_list_deployment_resource_pools( def pre_query_deployed_models( self, request: deployment_resource_pool_service.QueryDeployedModelsRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ deployment_resource_pool_service.QueryDeployedModelsRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for query_deployed_models @@ -259,10 +268,10 @@ def post_query_deployed_models( def pre_update_deployment_resource_pool( self, request: deployment_resource_pool_service.UpdateDeploymentResourcePoolRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ deployment_resource_pool_service.UpdateDeploymentResourcePoolRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for update_deployment_resource_pool @@ -285,8 +294,10 @@ def post_update_deployment_resource_pool( def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -308,8 +319,10 @@ def post_get_location( def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -331,8 +344,10 @@ def post_list_locations( def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -352,8 +367,10 @@ def post_get_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -373,8 +390,11 @@ def post_set_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -396,8 +416,10 @@ def post_test_iam_permissions( def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -417,8 +439,10 @@ def post_cancel_operation(self, response: None) -> None: 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 @@ -438,8 +462,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 @@ -461,8 +487,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 @@ -484,8 +512,10 @@ def post_list_operations( def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -1169,6 +1199,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -1385,6 +1419,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -1591,6 +1629,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}", @@ -1807,6 +1849,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, ], "google.longrunning.Operations.ListOperations": [ { @@ -2005,6 +2051,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*}/operations", @@ -2221,6 +2271,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*}/operations", + }, ], "google.longrunning.Operations.WaitOperation": [ { @@ -2419,6 +2473,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "post", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}:wait", @@ -2631,6 +2689,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, ], } @@ -2689,7 +2751,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 deployment resource pool method over HTTP. @@ -2701,8 +2763,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: @@ -2715,6 +2779,7 @@ def __call__( http_options = ( _BaseDeploymentResourcePoolServiceRestTransport._BaseCreateDeploymentResourcePool._get_http_options() ) + request, metadata = self._interceptor.pre_create_deployment_resource_pool( request, metadata ) @@ -2731,6 +2796,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.aiplatform_v1beta1.DeploymentResourcePoolServiceClient.CreateDeploymentResourcePool", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DeploymentResourcePoolService", + "rpcName": "CreateDeploymentResourcePool", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = DeploymentResourcePoolServiceRestTransport._CreateDeploymentResourcePool._get_response( self._host, @@ -2750,7 +2842,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_deployment_resource_pool(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.aiplatform_v1beta1.DeploymentResourcePoolServiceClient.create_deployment_resource_pool", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DeploymentResourcePoolService", + "rpcName": "CreateDeploymentResourcePool", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _DeleteDeploymentResourcePool( @@ -2791,7 +2905,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 deployment resource pool method over HTTP. @@ -2803,8 +2917,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: @@ -2817,6 +2933,7 @@ def __call__( http_options = ( _BaseDeploymentResourcePoolServiceRestTransport._BaseDeleteDeploymentResourcePool._get_http_options() ) + request, metadata = self._interceptor.pre_delete_deployment_resource_pool( request, metadata ) @@ -2829,6 +2946,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.aiplatform_v1beta1.DeploymentResourcePoolServiceClient.DeleteDeploymentResourcePool", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DeploymentResourcePoolService", + "rpcName": "DeleteDeploymentResourcePool", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = DeploymentResourcePoolServiceRestTransport._DeleteDeploymentResourcePool._get_response( self._host, @@ -2847,7 +2991,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_deployment_resource_pool(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.aiplatform_v1beta1.DeploymentResourcePoolServiceClient.delete_deployment_resource_pool", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DeploymentResourcePoolService", + "rpcName": "DeleteDeploymentResourcePool", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _GetDeploymentResourcePool( @@ -2888,7 +3054,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]]] = (), ) -> deployment_resource_pool.DeploymentResourcePool: r"""Call the get deployment resource pool method over HTTP. @@ -2900,8 +3066,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: ~.deployment_resource_pool.DeploymentResourcePool: @@ -2915,6 +3083,7 @@ def __call__( http_options = ( _BaseDeploymentResourcePoolServiceRestTransport._BaseGetDeploymentResourcePool._get_http_options() ) + request, metadata = self._interceptor.pre_get_deployment_resource_pool( request, metadata ) @@ -2927,6 +3096,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.aiplatform_v1beta1.DeploymentResourcePoolServiceClient.GetDeploymentResourcePool", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DeploymentResourcePoolService", + "rpcName": "GetDeploymentResourcePool", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = DeploymentResourcePoolServiceRestTransport._GetDeploymentResourcePool._get_response( self._host, @@ -2947,7 +3143,33 @@ def __call__( pb_resp = deployment_resource_pool.DeploymentResourcePool.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_deployment_resource_pool(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + deployment_resource_pool.DeploymentResourcePool.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.aiplatform_v1beta1.DeploymentResourcePoolServiceClient.get_deployment_resource_pool", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DeploymentResourcePoolService", + "rpcName": "GetDeploymentResourcePool", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListDeploymentResourcePools( @@ -2988,7 +3210,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]]] = (), ) -> deployment_resource_pool_service.ListDeploymentResourcePoolsResponse: r"""Call the list deployment resource pools method over HTTP. @@ -3000,8 +3222,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: ~.deployment_resource_pool_service.ListDeploymentResourcePoolsResponse: @@ -3013,6 +3237,7 @@ def __call__( http_options = ( _BaseDeploymentResourcePoolServiceRestTransport._BaseListDeploymentResourcePools._get_http_options() ) + request, metadata = self._interceptor.pre_list_deployment_resource_pools( request, metadata ) @@ -3025,6 +3250,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.aiplatform_v1beta1.DeploymentResourcePoolServiceClient.ListDeploymentResourcePools", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DeploymentResourcePoolService", + "rpcName": "ListDeploymentResourcePools", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = DeploymentResourcePoolServiceRestTransport._ListDeploymentResourcePools._get_response( self._host, @@ -3051,7 +3303,31 @@ def __call__( ) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_deployment_resource_pools(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = deployment_resource_pool_service.ListDeploymentResourcePoolsResponse.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.aiplatform_v1beta1.DeploymentResourcePoolServiceClient.list_deployment_resource_pools", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DeploymentResourcePoolService", + "rpcName": "ListDeploymentResourcePools", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _QueryDeployedModels( @@ -3092,7 +3368,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]]] = (), ) -> deployment_resource_pool_service.QueryDeployedModelsResponse: r"""Call the query deployed models method over HTTP. @@ -3103,8 +3379,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: ~.deployment_resource_pool_service.QueryDeployedModelsResponse: @@ -3116,6 +3394,7 @@ def __call__( http_options = ( _BaseDeploymentResourcePoolServiceRestTransport._BaseQueryDeployedModels._get_http_options() ) + request, metadata = self._interceptor.pre_query_deployed_models( request, metadata ) @@ -3128,6 +3407,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.aiplatform_v1beta1.DeploymentResourcePoolServiceClient.QueryDeployedModels", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DeploymentResourcePoolService", + "rpcName": "QueryDeployedModels", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = DeploymentResourcePoolServiceRestTransport._QueryDeployedModels._get_response( self._host, @@ -3150,7 +3456,31 @@ def __call__( ) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_query_deployed_models(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = deployment_resource_pool_service.QueryDeployedModelsResponse.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.aiplatform_v1beta1.DeploymentResourcePoolServiceClient.query_deployed_models", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DeploymentResourcePoolService", + "rpcName": "QueryDeployedModels", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _UpdateDeploymentResourcePool( @@ -3192,7 +3522,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 deployment resource pool method over HTTP. @@ -3204,8 +3534,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: @@ -3218,6 +3550,7 @@ def __call__( http_options = ( _BaseDeploymentResourcePoolServiceRestTransport._BaseUpdateDeploymentResourcePool._get_http_options() ) + request, metadata = self._interceptor.pre_update_deployment_resource_pool( request, metadata ) @@ -3234,6 +3567,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.aiplatform_v1beta1.DeploymentResourcePoolServiceClient.UpdateDeploymentResourcePool", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DeploymentResourcePoolService", + "rpcName": "UpdateDeploymentResourcePool", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = DeploymentResourcePoolServiceRestTransport._UpdateDeploymentResourcePool._get_response( self._host, @@ -3253,7 +3613,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_deployment_resource_pool(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.aiplatform_v1beta1.DeploymentResourcePoolServiceClient.update_deployment_resource_pool", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DeploymentResourcePoolService", + "rpcName": "UpdateDeploymentResourcePool", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp @property @@ -3362,7 +3744,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]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -3373,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: locations_pb2.Location: Response from GetLocation method. @@ -3383,6 +3767,7 @@ def __call__( http_options = ( _BaseDeploymentResourcePoolServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = self._interceptor.pre_get_location(request, metadata) transcoded_request = _BaseDeploymentResourcePoolServiceRestTransport._BaseGetLocation._get_transcoded_request( http_options, request @@ -3393,6 +3778,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.aiplatform_v1beta1.DeploymentResourcePoolServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DeploymentResourcePoolService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( DeploymentResourcePoolServiceRestTransport._GetLocation._get_response( @@ -3414,6 +3826,27 @@ def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_location(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.aiplatform_v1beta1.DeploymentResourcePoolServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DeploymentResourcePoolService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3456,7 +3889,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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -3467,8 +3900,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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -3477,6 +3912,7 @@ def __call__( http_options = ( _BaseDeploymentResourcePoolServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = self._interceptor.pre_list_locations(request, metadata) transcoded_request = _BaseDeploymentResourcePoolServiceRestTransport._BaseListLocations._get_transcoded_request( http_options, request @@ -3487,6 +3923,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.aiplatform_v1beta1.DeploymentResourcePoolServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DeploymentResourcePoolService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( DeploymentResourcePoolServiceRestTransport._ListLocations._get_response( @@ -3508,6 +3971,27 @@ def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_list_locations(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.aiplatform_v1beta1.DeploymentResourcePoolServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DeploymentResourcePoolService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3551,7 +4035,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]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -3562,8 +4046,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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -3572,6 +4058,7 @@ def __call__( http_options = ( _BaseDeploymentResourcePoolServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_get_iam_policy(request, metadata) transcoded_request = _BaseDeploymentResourcePoolServiceRestTransport._BaseGetIamPolicy._get_transcoded_request( http_options, request @@ -3586,6 +4073,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.aiplatform_v1beta1.DeploymentResourcePoolServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DeploymentResourcePoolService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( DeploymentResourcePoolServiceRestTransport._GetIamPolicy._get_response( @@ -3608,6 +4122,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_iam_policy(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.aiplatform_v1beta1.DeploymentResourcePoolServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DeploymentResourcePoolService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3651,7 +4186,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]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -3662,8 +4197,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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -3672,6 +4209,7 @@ def __call__( http_options = ( _BaseDeploymentResourcePoolServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_set_iam_policy(request, metadata) transcoded_request = _BaseDeploymentResourcePoolServiceRestTransport._BaseSetIamPolicy._get_transcoded_request( http_options, request @@ -3686,6 +4224,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.aiplatform_v1beta1.DeploymentResourcePoolServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DeploymentResourcePoolService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( DeploymentResourcePoolServiceRestTransport._SetIamPolicy._get_response( @@ -3708,6 +4273,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_set_iam_policy(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.aiplatform_v1beta1.DeploymentResourcePoolServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DeploymentResourcePoolService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3751,7 +4337,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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -3762,8 +4348,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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -3772,6 +4360,7 @@ def __call__( http_options = ( _BaseDeploymentResourcePoolServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -3788,6 +4377,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.aiplatform_v1beta1.DeploymentResourcePoolServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DeploymentResourcePoolService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = DeploymentResourcePoolServiceRestTransport._TestIamPermissions._get_response( self._host, @@ -3808,6 +4424,27 @@ def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_test_iam_permissions(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.aiplatform_v1beta1.DeploymentResourcePoolServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DeploymentResourcePoolService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3850,7 +4487,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 cancel operation method over HTTP. @@ -3861,13 +4498,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 = ( _BaseDeploymentResourcePoolServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = self._interceptor.pre_cancel_operation( request, metadata ) @@ -3880,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 = 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.aiplatform_v1beta1.DeploymentResourcePoolServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DeploymentResourcePoolService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = DeploymentResourcePoolServiceRestTransport._CancelOperation._get_response( self._host, @@ -3937,7 +4604,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. @@ -3948,13 +4615,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 = ( _BaseDeploymentResourcePoolServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = self._interceptor.pre_delete_operation( request, metadata ) @@ -3967,6 +4637,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.aiplatform_v1beta1.DeploymentResourcePoolServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DeploymentResourcePoolService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = DeploymentResourcePoolServiceRestTransport._DeleteOperation._get_response( self._host, @@ -4024,7 +4721,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. @@ -4035,8 +4732,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. @@ -4045,6 +4744,7 @@ def __call__( http_options = ( _BaseDeploymentResourcePoolServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = self._interceptor.pre_get_operation(request, metadata) transcoded_request = _BaseDeploymentResourcePoolServiceRestTransport._BaseGetOperation._get_transcoded_request( http_options, request @@ -4055,6 +4755,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.aiplatform_v1beta1.DeploymentResourcePoolServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DeploymentResourcePoolService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( DeploymentResourcePoolServiceRestTransport._GetOperation._get_response( @@ -4076,6 +4803,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.aiplatform_v1beta1.DeploymentResourcePoolServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DeploymentResourcePoolService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4118,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]]] = (), ) -> operations_pb2.ListOperationsResponse: r"""Call the list operations method over HTTP. @@ -4129,8 +4877,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. @@ -4139,6 +4889,7 @@ def __call__( http_options = ( _BaseDeploymentResourcePoolServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = self._interceptor.pre_list_operations(request, metadata) transcoded_request = _BaseDeploymentResourcePoolServiceRestTransport._BaseListOperations._get_transcoded_request( http_options, request @@ -4149,6 +4900,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.aiplatform_v1beta1.DeploymentResourcePoolServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DeploymentResourcePoolService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = DeploymentResourcePoolServiceRestTransport._ListOperations._get_response( self._host, @@ -4168,6 +4946,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.aiplatform_v1beta1.DeploymentResourcePoolServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DeploymentResourcePoolService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4210,7 +5009,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 wait operation method over HTTP. @@ -4221,8 +5020,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 WaitOperation method. @@ -4231,6 +5032,7 @@ def __call__( http_options = ( _BaseDeploymentResourcePoolServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = self._interceptor.pre_wait_operation(request, metadata) transcoded_request = _BaseDeploymentResourcePoolServiceRestTransport._BaseWaitOperation._get_transcoded_request( http_options, request @@ -4241,6 +5043,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.aiplatform_v1beta1.DeploymentResourcePoolServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DeploymentResourcePoolService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( DeploymentResourcePoolServiceRestTransport._WaitOperation._get_response( @@ -4262,6 +5091,27 @@ def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = self._interceptor.post_wait_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.aiplatform_v1beta1.DeploymentResourcePoolServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DeploymentResourcePoolService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1beta1/services/deployment_resource_pool_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1beta1/services/deployment_resource_pool_service/transports/rest_asyncio.py index e54d55ee4d..f3ec7ee9ca 100644 --- a/google/cloud/aiplatform_v1beta1/services/deployment_resource_pool_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/deployment_resource_pool_service/transports/rest_asyncio.py @@ -59,6 +59,18 @@ from .base import DEFAULT_CLIENT_INFO as BASE_DEFAULT_CLIENT_INFO + +import logging + +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__) + try: OptionalRetry = Union[retries.AsyncRetry, gapic_v1.method._MethodDefault, None] except AttributeError: # pragma: NO COVER @@ -143,10 +155,10 @@ async def post_update_deployment_resource_pool(self, response): async def pre_create_deployment_resource_pool( self, request: deployment_resource_pool_service.CreateDeploymentResourcePoolRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ deployment_resource_pool_service.CreateDeploymentResourcePoolRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for create_deployment_resource_pool @@ -169,10 +181,10 @@ async def post_create_deployment_resource_pool( async def pre_delete_deployment_resource_pool( self, request: deployment_resource_pool_service.DeleteDeploymentResourcePoolRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ deployment_resource_pool_service.DeleteDeploymentResourcePoolRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for delete_deployment_resource_pool @@ -195,10 +207,10 @@ async def post_delete_deployment_resource_pool( async def pre_get_deployment_resource_pool( self, request: deployment_resource_pool_service.GetDeploymentResourcePoolRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ deployment_resource_pool_service.GetDeploymentResourcePoolRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for get_deployment_resource_pool @@ -221,10 +233,10 @@ async def post_get_deployment_resource_pool( async def pre_list_deployment_resource_pools( self, request: deployment_resource_pool_service.ListDeploymentResourcePoolsRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ deployment_resource_pool_service.ListDeploymentResourcePoolsRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for list_deployment_resource_pools @@ -248,10 +260,10 @@ async def post_list_deployment_resource_pools( async def pre_query_deployed_models( self, request: deployment_resource_pool_service.QueryDeployedModelsRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ deployment_resource_pool_service.QueryDeployedModelsRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for query_deployed_models @@ -274,10 +286,10 @@ async def post_query_deployed_models( async def pre_update_deployment_resource_pool( self, request: deployment_resource_pool_service.UpdateDeploymentResourcePoolRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ deployment_resource_pool_service.UpdateDeploymentResourcePoolRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for update_deployment_resource_pool @@ -300,8 +312,10 @@ async def post_update_deployment_resource_pool( async def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -323,8 +337,10 @@ async def post_get_location( async def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -346,8 +362,10 @@ async def post_list_locations( async def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -369,8 +387,10 @@ async def post_get_iam_policy( async def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -392,8 +412,11 @@ async def post_set_iam_policy( async def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -415,8 +438,10 @@ async def post_test_iam_permissions( async def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -436,8 +461,10 @@ async def post_cancel_operation(self, response: None) -> None: async 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 @@ -457,8 +484,10 @@ async def post_delete_operation(self, response: None) -> None: async 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 @@ -480,8 +509,10 @@ async def post_get_operation( async 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 @@ -503,8 +534,10 @@ async def post_list_operations( async def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -721,7 +754,7 @@ async 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 deployment resource pool method over HTTP. @@ -733,8 +766,10 @@ async def __call__( 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: @@ -747,6 +782,7 @@ async def __call__( http_options = ( _BaseDeploymentResourcePoolServiceRestTransport._BaseCreateDeploymentResourcePool._get_http_options() ) + ( request, metadata, @@ -766,6 +802,33 @@ async 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.aiplatform_v1beta1.DeploymentResourcePoolServiceClient.CreateDeploymentResourcePool", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DeploymentResourcePoolService", + "rpcName": "CreateDeploymentResourcePool", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncDeploymentResourcePoolServiceRestTransport._CreateDeploymentResourcePool._get_response( self._host, @@ -794,6 +857,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_create_deployment_resource_pool(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.DeploymentResourcePoolServiceAsyncClient.create_deployment_resource_pool", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DeploymentResourcePoolService", + "rpcName": "CreateDeploymentResourcePool", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _DeleteDeploymentResourcePool( @@ -834,7 +919,7 @@ async 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 deployment resource pool method over HTTP. @@ -846,8 +931,10 @@ async def __call__( 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: @@ -860,6 +947,7 @@ async def __call__( http_options = ( _BaseDeploymentResourcePoolServiceRestTransport._BaseDeleteDeploymentResourcePool._get_http_options() ) + ( request, metadata, @@ -875,6 +963,33 @@ async 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.aiplatform_v1beta1.DeploymentResourcePoolServiceClient.DeleteDeploymentResourcePool", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DeploymentResourcePoolService", + "rpcName": "DeleteDeploymentResourcePool", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncDeploymentResourcePoolServiceRestTransport._DeleteDeploymentResourcePool._get_response( self._host, @@ -902,6 +1017,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_delete_deployment_resource_pool(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.DeploymentResourcePoolServiceAsyncClient.delete_deployment_resource_pool", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DeploymentResourcePoolService", + "rpcName": "DeleteDeploymentResourcePool", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _GetDeploymentResourcePool( @@ -942,7 +1079,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> deployment_resource_pool.DeploymentResourcePool: r"""Call the get deployment resource pool method over HTTP. @@ -954,8 +1091,10 @@ async def __call__( 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: ~.deployment_resource_pool.DeploymentResourcePool: @@ -969,6 +1108,7 @@ async def __call__( http_options = ( _BaseDeploymentResourcePoolServiceRestTransport._BaseGetDeploymentResourcePool._get_http_options() ) + ( request, metadata, @@ -984,6 +1124,33 @@ async 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.aiplatform_v1beta1.DeploymentResourcePoolServiceClient.GetDeploymentResourcePool", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DeploymentResourcePoolService", + "rpcName": "GetDeploymentResourcePool", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncDeploymentResourcePoolServiceRestTransport._GetDeploymentResourcePool._get_response( self._host, @@ -1011,6 +1178,32 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_get_deployment_resource_pool(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + deployment_resource_pool.DeploymentResourcePool.to_json( + response + ) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.DeploymentResourcePoolServiceAsyncClient.get_deployment_resource_pool", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DeploymentResourcePoolService", + "rpcName": "GetDeploymentResourcePool", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ListDeploymentResourcePools( @@ -1051,7 +1244,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> deployment_resource_pool_service.ListDeploymentResourcePoolsResponse: r"""Call the list deployment resource pools method over HTTP. @@ -1063,8 +1256,10 @@ async def __call__( 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: ~.deployment_resource_pool_service.ListDeploymentResourcePoolsResponse: @@ -1076,6 +1271,7 @@ async def __call__( http_options = ( _BaseDeploymentResourcePoolServiceRestTransport._BaseListDeploymentResourcePools._get_http_options() ) + ( request, metadata, @@ -1091,6 +1287,33 @@ async 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.aiplatform_v1beta1.DeploymentResourcePoolServiceClient.ListDeploymentResourcePools", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DeploymentResourcePoolService", + "rpcName": "ListDeploymentResourcePools", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncDeploymentResourcePoolServiceRestTransport._ListDeploymentResourcePools._get_response( self._host, @@ -1124,6 +1347,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_list_deployment_resource_pools(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = deployment_resource_pool_service.ListDeploymentResourcePoolsResponse.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.DeploymentResourcePoolServiceAsyncClient.list_deployment_resource_pools", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DeploymentResourcePoolService", + "rpcName": "ListDeploymentResourcePools", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _QueryDeployedModels( @@ -1164,7 +1411,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> deployment_resource_pool_service.QueryDeployedModelsResponse: r"""Call the query deployed models method over HTTP. @@ -1175,8 +1422,10 @@ async def __call__( 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: ~.deployment_resource_pool_service.QueryDeployedModelsResponse: @@ -1188,6 +1437,7 @@ async def __call__( http_options = ( _BaseDeploymentResourcePoolServiceRestTransport._BaseQueryDeployedModels._get_http_options() ) + request, metadata = await self._interceptor.pre_query_deployed_models( request, metadata ) @@ -1200,6 +1450,33 @@ async 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.aiplatform_v1beta1.DeploymentResourcePoolServiceClient.QueryDeployedModels", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DeploymentResourcePoolService", + "rpcName": "QueryDeployedModels", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncDeploymentResourcePoolServiceRestTransport._QueryDeployedModels._get_response( self._host, @@ -1229,6 +1506,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_query_deployed_models(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = deployment_resource_pool_service.QueryDeployedModelsResponse.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.DeploymentResourcePoolServiceAsyncClient.query_deployed_models", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DeploymentResourcePoolService", + "rpcName": "QueryDeployedModels", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _UpdateDeploymentResourcePool( @@ -1270,7 +1571,7 @@ async 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 deployment resource pool method over HTTP. @@ -1282,8 +1583,10 @@ async def __call__( 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: @@ -1296,6 +1599,7 @@ async def __call__( http_options = ( _BaseDeploymentResourcePoolServiceRestTransport._BaseUpdateDeploymentResourcePool._get_http_options() ) + ( request, metadata, @@ -1315,6 +1619,33 @@ async 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.aiplatform_v1beta1.DeploymentResourcePoolServiceClient.UpdateDeploymentResourcePool", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DeploymentResourcePoolService", + "rpcName": "UpdateDeploymentResourcePool", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncDeploymentResourcePoolServiceRestTransport._UpdateDeploymentResourcePool._get_response( self._host, @@ -1343,6 +1674,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_update_deployment_resource_pool(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.DeploymentResourcePoolServiceAsyncClient.update_deployment_resource_pool", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DeploymentResourcePoolService", + "rpcName": "UpdateDeploymentResourcePool", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp @property @@ -1918,6 +2271,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -2134,6 +2491,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -2340,6 +2701,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}", @@ -2556,6 +2921,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, ], "google.longrunning.Operations.ListOperations": [ { @@ -2754,6 +3123,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*}/operations", @@ -2970,6 +3343,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*}/operations", + }, ], "google.longrunning.Operations.WaitOperation": [ { @@ -3168,6 +3545,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "post", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}:wait", @@ -3380,6 +3761,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, ], } @@ -3492,7 +3877,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -3503,8 +3888,10 @@ async def __call__( 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: locations_pb2.Location: Response from GetLocation method. @@ -3513,6 +3900,7 @@ async def __call__( http_options = ( _BaseDeploymentResourcePoolServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_location( request, metadata ) @@ -3525,6 +3913,33 @@ async 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.aiplatform_v1beta1.DeploymentResourcePoolServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DeploymentResourcePoolService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncDeploymentResourcePoolServiceRestTransport._GetLocation._get_response( self._host, @@ -3550,6 +3965,27 @@ async def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_location(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.aiplatform_v1beta1.DeploymentResourcePoolServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DeploymentResourcePoolService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3592,7 +4028,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -3603,8 +4039,10 @@ async def __call__( 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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -3613,6 +4051,7 @@ async def __call__( http_options = ( _BaseDeploymentResourcePoolServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_locations( request, metadata ) @@ -3625,6 +4064,33 @@ async 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.aiplatform_v1beta1.DeploymentResourcePoolServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DeploymentResourcePoolService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncDeploymentResourcePoolServiceRestTransport._ListLocations._get_response( self._host, @@ -3650,6 +4116,27 @@ async def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_list_locations(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.aiplatform_v1beta1.DeploymentResourcePoolServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DeploymentResourcePoolService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3693,7 +4180,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -3704,8 +4191,10 @@ async def __call__( 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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -3714,6 +4203,7 @@ async def __call__( http_options = ( _BaseDeploymentResourcePoolServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_get_iam_policy( request, metadata ) @@ -3730,6 +4220,33 @@ async 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.aiplatform_v1beta1.DeploymentResourcePoolServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DeploymentResourcePoolService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncDeploymentResourcePoolServiceRestTransport._GetIamPolicy._get_response( self._host, @@ -3756,6 +4273,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_iam_policy(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.aiplatform_v1beta1.DeploymentResourcePoolServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DeploymentResourcePoolService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3799,7 +4337,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -3810,8 +4348,10 @@ async def __call__( 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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -3820,6 +4360,7 @@ async def __call__( http_options = ( _BaseDeploymentResourcePoolServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_set_iam_policy( request, metadata ) @@ -3836,6 +4377,33 @@ async 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.aiplatform_v1beta1.DeploymentResourcePoolServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DeploymentResourcePoolService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncDeploymentResourcePoolServiceRestTransport._SetIamPolicy._get_response( self._host, @@ -3862,6 +4430,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_set_iam_policy(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.aiplatform_v1beta1.DeploymentResourcePoolServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DeploymentResourcePoolService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3907,7 +4496,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -3918,8 +4507,10 @@ async def __call__( 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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -3928,6 +4519,7 @@ async def __call__( http_options = ( _BaseDeploymentResourcePoolServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = await self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -3944,6 +4536,33 @@ async 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.aiplatform_v1beta1.DeploymentResourcePoolServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DeploymentResourcePoolService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncDeploymentResourcePoolServiceRestTransport._TestIamPermissions._get_response( self._host, @@ -3970,6 +4589,27 @@ async def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_test_iam_permissions(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.aiplatform_v1beta1.DeploymentResourcePoolServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DeploymentResourcePoolService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4014,7 +4654,7 @@ async 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 cancel operation method over HTTP. @@ -4025,13 +4665,16 @@ async def __call__( 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`. """ http_options = ( _BaseDeploymentResourcePoolServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_cancel_operation( request, metadata ) @@ -4044,6 +4687,33 @@ async 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.aiplatform_v1beta1.DeploymentResourcePoolServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DeploymentResourcePoolService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncDeploymentResourcePoolServiceRestTransport._CancelOperation._get_response( self._host, @@ -4109,7 +4779,7 @@ async 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. @@ -4120,13 +4790,16 @@ async def __call__( 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`. """ http_options = ( _BaseDeploymentResourcePoolServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_operation( request, metadata ) @@ -4139,6 +4812,33 @@ async 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.aiplatform_v1beta1.DeploymentResourcePoolServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DeploymentResourcePoolService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncDeploymentResourcePoolServiceRestTransport._DeleteOperation._get_response( self._host, @@ -4202,7 +4902,7 @@ async 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. @@ -4213,8 +4913,10 @@ async def __call__( 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: Response from GetOperation method. @@ -4223,6 +4925,7 @@ async def __call__( http_options = ( _BaseDeploymentResourcePoolServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_operation( request, metadata ) @@ -4235,6 +4938,33 @@ async 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.aiplatform_v1beta1.DeploymentResourcePoolServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DeploymentResourcePoolService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncDeploymentResourcePoolServiceRestTransport._GetOperation._get_response( self._host, @@ -4260,6 +4990,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1beta1.DeploymentResourcePoolServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DeploymentResourcePoolService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4304,7 +5055,7 @@ async 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. @@ -4315,8 +5066,10 @@ async def __call__( 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 from ListOperations method. @@ -4325,6 +5078,7 @@ async def __call__( http_options = ( _BaseDeploymentResourcePoolServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_operations( request, metadata ) @@ -4337,6 +5091,33 @@ async 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.aiplatform_v1beta1.DeploymentResourcePoolServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DeploymentResourcePoolService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncDeploymentResourcePoolServiceRestTransport._ListOperations._get_response( self._host, @@ -4362,6 +5143,27 @@ async def __call__( resp = operations_pb2.ListOperationsResponse() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1beta1.DeploymentResourcePoolServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DeploymentResourcePoolService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4404,7 +5206,7 @@ async 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 wait operation method over HTTP. @@ -4415,8 +5217,10 @@ async def __call__( 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: Response from WaitOperation method. @@ -4425,6 +5229,7 @@ async def __call__( http_options = ( _BaseDeploymentResourcePoolServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_wait_operation( request, metadata ) @@ -4437,6 +5242,33 @@ async 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.aiplatform_v1beta1.DeploymentResourcePoolServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DeploymentResourcePoolService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncDeploymentResourcePoolServiceRestTransport._WaitOperation._get_response( self._host, @@ -4462,6 +5294,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_wait_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.aiplatform_v1beta1.DeploymentResourcePoolServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.DeploymentResourcePoolService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1beta1/services/deployment_resource_pool_service/transports/rest_base.py b/google/cloud/aiplatform_v1beta1/services/deployment_resource_pool_service/transports/rest_base.py index fee5df68ac..77e21d3c81 100644 --- a/google/cloud/aiplatform_v1beta1/services/deployment_resource_pool_service/transports/rest_base.py +++ b/google/cloud/aiplatform_v1beta1/services/deployment_resource_pool_service/transports/rest_base.py @@ -1338,6 +1338,10 @@ def _get_http_options(): "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -1554,6 +1558,10 @@ def _get_http_options(): "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -1779,6 +1787,10 @@ def _get_http_options(): "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}", @@ -1995,6 +2007,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, ] return http_options @@ -2212,6 +2228,10 @@ def _get_http_options(): "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*}/operations", @@ -2428,6 +2448,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*}/operations", + }, ] return http_options @@ -2645,6 +2669,10 @@ def _get_http_options(): "method": "post", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}:wait", @@ -2857,6 +2885,10 @@ def _get_http_options(): "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, ] return http_options diff --git a/google/cloud/aiplatform_v1beta1/services/endpoint_service/async_client.py b/google/cloud/aiplatform_v1beta1/services/endpoint_service/async_client.py index 7f58285ec4..460ea38633 100644 --- a/google/cloud/aiplatform_v1beta1/services/endpoint_service/async_client.py +++ b/google/cloud/aiplatform_v1beta1/services/endpoint_service/async_client.py @@ -13,6 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging as std_logging from collections import OrderedDict import re from typing import ( @@ -63,6 +64,15 @@ from .transports.grpc_asyncio import EndpointServiceGrpcAsyncIOTransport from .client import EndpointServiceClient +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 EndpointServiceAsyncClient: """A service for managing Vertex AI's Endpoints.""" @@ -288,6 +298,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.aiplatform_v1beta1.EndpointServiceAsyncClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.EndpointService", + "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.aiplatform.v1beta1.EndpointService", + "credentialsType": None, + }, + ) + async def create_endpoint( self, request: Optional[Union[endpoint_service.CreateEndpointRequest, dict]] = None, @@ -297,7 +329,7 @@ async def create_endpoint( endpoint_id: 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"""Creates an Endpoint. @@ -378,8 +410,10 @@ async def sample_create_endpoint(): 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: @@ -454,7 +488,7 @@ async def get_endpoint( 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]]] = (), ) -> endpoint.Endpoint: r"""Gets an Endpoint. @@ -498,8 +532,10 @@ async def sample_get_endpoint(): 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.aiplatform_v1beta1.types.Endpoint: @@ -561,7 +597,7 @@ async def list_endpoints( 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.ListEndpointsAsyncPager: r"""Lists Endpoints in a Location. @@ -607,8 +643,10 @@ async def sample_list_endpoints(): 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.aiplatform_v1beta1.services.endpoint_service.pagers.ListEndpointsAsyncPager: @@ -684,7 +722,7 @@ async def update_endpoint( 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]]] = (), ) -> gca_endpoint.Endpoint: r"""Updates an Endpoint. @@ -738,8 +776,10 @@ async def sample_update_endpoint(): 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.aiplatform_v1beta1.types.Endpoint: @@ -807,7 +847,7 @@ async def update_endpoint_long_running( endpoint: Optional[gca_endpoint.Endpoint] = 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"""Updates an Endpoint with a long running operation. @@ -860,8 +900,10 @@ async def sample_update_endpoint_long_running(): 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: @@ -934,7 +976,7 @@ async def delete_endpoint( 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"""Deletes an Endpoint. @@ -983,8 +1025,10 @@ async def sample_delete_endpoint(): 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: @@ -1065,7 +1109,7 @@ async def deploy_model( traffic_split: Optional[MutableMapping[str, int]] = 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"""Deploys a Model into this Endpoint, creating a DeployedModel within it. @@ -1151,8 +1195,10 @@ async def sample_deploy_model(): 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: @@ -1230,7 +1276,7 @@ async def undeploy_model( traffic_split: Optional[MutableMapping[str, int]] = 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"""Undeploys a Model from an Endpoint, removing a DeployedModel from it, and freeing all resources it's @@ -1303,8 +1349,10 @@ async def sample_undeploy_model(): 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: @@ -1384,7 +1432,7 @@ async def mutate_deployed_model( 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"""Updates an existing deployed model. Updatable fields include ``min_replica_count``, ``max_replica_count``, @@ -1467,8 +1515,10 @@ async def sample_mutate_deployed_model(): 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: @@ -1542,7 +1592,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. @@ -1553,8 +1603,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. @@ -1595,7 +1647,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. @@ -1606,8 +1658,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. @@ -1648,7 +1702,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. @@ -1664,8 +1718,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 """ @@ -1702,7 +1758,7 @@ async def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -1717,8 +1773,10 @@ async def cancel_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 """ @@ -1755,7 +1813,7 @@ async def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -1772,8 +1830,10 @@ async def wait_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. @@ -1814,7 +1874,7 @@ async def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -1827,8 +1887,10 @@ async def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -1933,7 +1995,7 @@ async def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -1947,8 +2009,10 @@ async def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -2053,7 +2117,7 @@ async def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -2068,8 +2132,10 @@ async def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -2113,7 +2179,7 @@ async def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -2124,8 +2190,10 @@ async def get_location( 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: ~.location_pb2.Location: Location object. @@ -2166,7 +2234,7 @@ async def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -2177,8 +2245,10 @@ async def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1beta1/services/endpoint_service/client.py b/google/cloud/aiplatform_v1beta1/services/endpoint_service/client.py index c3b4d41394..2437c6e0cf 100644 --- a/google/cloud/aiplatform_v1beta1/services/endpoint_service/client.py +++ b/google/cloud/aiplatform_v1beta1/services/endpoint_service/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 ( @@ -48,6 +49,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 as gac_operation # type: ignore from google.api_core import operation_async # type: ignore from google.cloud.aiplatform_v1beta1.services.endpoint_service import pagers @@ -714,6 +724,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( @@ -804,6 +818,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.aiplatform_v1beta1.EndpointServiceClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.EndpointService", + "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.aiplatform.v1beta1.EndpointService", + "credentialsType": None, + }, + ) + def create_endpoint( self, request: Optional[Union[endpoint_service.CreateEndpointRequest, dict]] = None, @@ -813,7 +850,7 @@ def create_endpoint( endpoint_id: 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]]] = (), ) -> gac_operation.Operation: r"""Creates an Endpoint. @@ -894,8 +931,10 @@ def sample_create_endpoint(): 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: @@ -967,7 +1006,7 @@ def get_endpoint( 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]]] = (), ) -> endpoint.Endpoint: r"""Gets an Endpoint. @@ -1011,8 +1050,10 @@ def sample_get_endpoint(): 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.aiplatform_v1beta1.types.Endpoint: @@ -1071,7 +1112,7 @@ def list_endpoints( 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.ListEndpointsPager: r"""Lists Endpoints in a Location. @@ -1117,8 +1158,10 @@ def sample_list_endpoints(): 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.aiplatform_v1beta1.services.endpoint_service.pagers.ListEndpointsPager: @@ -1191,7 +1234,7 @@ def update_endpoint( 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]]] = (), ) -> gca_endpoint.Endpoint: r"""Updates an Endpoint. @@ -1245,8 +1288,10 @@ def sample_update_endpoint(): 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.aiplatform_v1beta1.types.Endpoint: @@ -1311,7 +1356,7 @@ def update_endpoint_long_running( endpoint: Optional[gca_endpoint.Endpoint] = 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]]] = (), ) -> gac_operation.Operation: r"""Updates an Endpoint with a long running operation. @@ -1364,8 +1409,10 @@ def sample_update_endpoint_long_running(): 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: @@ -1437,7 +1484,7 @@ def delete_endpoint( 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]]] = (), ) -> gac_operation.Operation: r"""Deletes an Endpoint. @@ -1486,8 +1533,10 @@ def sample_delete_endpoint(): 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: @@ -1565,7 +1614,7 @@ def deploy_model( traffic_split: Optional[MutableMapping[str, int]] = 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]]] = (), ) -> gac_operation.Operation: r"""Deploys a Model into this Endpoint, creating a DeployedModel within it. @@ -1651,8 +1700,10 @@ def sample_deploy_model(): 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: @@ -1726,7 +1777,7 @@ def undeploy_model( traffic_split: Optional[MutableMapping[str, int]] = 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]]] = (), ) -> gac_operation.Operation: r"""Undeploys a Model from an Endpoint, removing a DeployedModel from it, and freeing all resources it's @@ -1799,8 +1850,10 @@ def sample_undeploy_model(): 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: @@ -1876,7 +1929,7 @@ def mutate_deployed_model( 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]]] = (), ) -> gac_operation.Operation: r"""Updates an existing deployed model. Updatable fields include ``min_replica_count``, ``max_replica_count``, @@ -1959,8 +2012,10 @@ def sample_mutate_deployed_model(): 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: @@ -2044,7 +2099,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. @@ -2055,8 +2110,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. @@ -2097,7 +2154,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. @@ -2108,8 +2165,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. @@ -2150,7 +2209,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. @@ -2166,8 +2225,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 """ @@ -2204,7 +2265,7 @@ def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -2219,8 +2280,10 @@ def cancel_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 """ @@ -2257,7 +2320,7 @@ def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -2274,8 +2337,10 @@ def wait_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. @@ -2316,7 +2381,7 @@ def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -2329,8 +2394,10 @@ def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -2435,7 +2502,7 @@ def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -2449,8 +2516,10 @@ def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -2555,7 +2624,7 @@ def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -2570,8 +2639,10 @@ def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -2613,7 +2684,7 @@ def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -2624,8 +2695,10 @@ def get_location( 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: ~.location_pb2.Location: Location object. @@ -2666,7 +2739,7 @@ def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -2677,8 +2750,10 @@ def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1beta1/services/endpoint_service/pagers.py b/google/cloud/aiplatform_v1beta1/services/endpoint_service/pagers.py index d3ee5ef502..5ec3156828 100644 --- a/google/cloud/aiplatform_v1beta1/services/endpoint_service/pagers.py +++ b/google/cloud/aiplatform_v1beta1/services/endpoint_service/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 = endpoint_service.ListEndpointsRequest(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 = endpoint_service.ListEndpointsRequest(request) diff --git a/google/cloud/aiplatform_v1beta1/services/endpoint_service/transports/grpc.py b/google/cloud/aiplatform_v1beta1/services/endpoint_service/transports/grpc.py index 740d0fc97f..2fcc742c4d 100644 --- a/google/cloud/aiplatform_v1beta1/services/endpoint_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1beta1/services/endpoint_service/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 import warnings from typing import Callable, Dict, Optional, Sequence, Tuple, Union @@ -22,8 +25,11 @@ import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from google.cloud.aiplatform_v1beta1.types import endpoint from google.cloud.aiplatform_v1beta1.types import endpoint as gca_endpoint @@ -34,6 +40,81 @@ from google.longrunning import operations_pb2 # type: ignore from .base import EndpointServiceTransport, DEFAULT_CLIENT_INFO +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.aiplatform.v1beta1.EndpointService", + "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.aiplatform.v1beta1.EndpointService", + "rpcName": client_call_details.method, + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class EndpointServiceGrpcTransport(EndpointServiceTransport): """gRPC backend transport for EndpointService. @@ -188,7 +269,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 @@ -252,7 +338,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 @@ -276,7 +364,7 @@ def create_endpoint( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_endpoint" not in self._stubs: - self._stubs["create_endpoint"] = self.grpc_channel.unary_unary( + self._stubs["create_endpoint"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.EndpointService/CreateEndpoint", request_serializer=endpoint_service.CreateEndpointRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -302,7 +390,7 @@ def get_endpoint( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_endpoint" not in self._stubs: - self._stubs["get_endpoint"] = self.grpc_channel.unary_unary( + self._stubs["get_endpoint"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.EndpointService/GetEndpoint", request_serializer=endpoint_service.GetEndpointRequest.serialize, response_deserializer=endpoint.Endpoint.deserialize, @@ -330,7 +418,7 @@ def list_endpoints( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_endpoints" not in self._stubs: - self._stubs["list_endpoints"] = self.grpc_channel.unary_unary( + self._stubs["list_endpoints"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.EndpointService/ListEndpoints", request_serializer=endpoint_service.ListEndpointsRequest.serialize, response_deserializer=endpoint_service.ListEndpointsResponse.deserialize, @@ -356,7 +444,7 @@ def update_endpoint( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_endpoint" not in self._stubs: - self._stubs["update_endpoint"] = self.grpc_channel.unary_unary( + self._stubs["update_endpoint"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.EndpointService/UpdateEndpoint", request_serializer=endpoint_service.UpdateEndpointRequest.serialize, response_deserializer=gca_endpoint.Endpoint.deserialize, @@ -384,7 +472,9 @@ def update_endpoint_long_running( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_endpoint_long_running" not in self._stubs: - self._stubs["update_endpoint_long_running"] = self.grpc_channel.unary_unary( + self._stubs[ + "update_endpoint_long_running" + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.EndpointService/UpdateEndpointLongRunning", request_serializer=endpoint_service.UpdateEndpointLongRunningRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -410,7 +500,7 @@ def delete_endpoint( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_endpoint" not in self._stubs: - self._stubs["delete_endpoint"] = self.grpc_channel.unary_unary( + self._stubs["delete_endpoint"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.EndpointService/DeleteEndpoint", request_serializer=endpoint_service.DeleteEndpointRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -437,7 +527,7 @@ def deploy_model( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "deploy_model" not in self._stubs: - self._stubs["deploy_model"] = self.grpc_channel.unary_unary( + self._stubs["deploy_model"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.EndpointService/DeployModel", request_serializer=endpoint_service.DeployModelRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -465,7 +555,7 @@ def undeploy_model( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "undeploy_model" not in self._stubs: - self._stubs["undeploy_model"] = self.grpc_channel.unary_unary( + self._stubs["undeploy_model"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.EndpointService/UndeployModel", request_serializer=endpoint_service.UndeployModelRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -496,7 +586,7 @@ def mutate_deployed_model( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "mutate_deployed_model" not in self._stubs: - self._stubs["mutate_deployed_model"] = self.grpc_channel.unary_unary( + self._stubs["mutate_deployed_model"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.EndpointService/MutateDeployedModel", request_serializer=endpoint_service.MutateDeployedModelRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -504,7 +594,7 @@ def mutate_deployed_model( return self._stubs["mutate_deployed_model"] def close(self): - self.grpc_channel.close() + self._logged_channel.close() @property def delete_operation( @@ -516,7 +606,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, @@ -533,7 +623,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -550,7 +640,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -567,7 +657,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, @@ -586,7 +676,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, @@ -605,7 +695,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -622,7 +712,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -647,7 +737,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -673,7 +763,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -702,7 +792,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1beta1/services/endpoint_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1beta1/services/endpoint_service/transports/grpc_asyncio.py index 34f8feac7f..3aab0dea91 100644 --- a/google/cloud/aiplatform_v1beta1/services/endpoint_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/endpoint_service/transports/grpc_asyncio.py @@ -14,6 +14,9 @@ # limitations under the License. # import inspect +import json +import pickle +import logging as std_logging import warnings from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union @@ -24,8 +27,11 @@ from google.api_core import operations_v1 from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from grpc.experimental import aio # type: ignore from google.cloud.aiplatform_v1beta1.types import endpoint @@ -38,6 +44,82 @@ from .base import EndpointServiceTransport, DEFAULT_CLIENT_INFO from .grpc import EndpointServiceGrpcTransport +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.aiplatform.v1beta1.EndpointService", + "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.aiplatform.v1beta1.EndpointService", + "rpcName": str(client_call_details.method), + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class EndpointServiceGrpcAsyncIOTransport(EndpointServiceTransport): """gRPC AsyncIO backend transport for EndpointService. @@ -235,10 +317,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 @@ -261,7 +346,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. @@ -288,7 +373,7 @@ def create_endpoint( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_endpoint" not in self._stubs: - self._stubs["create_endpoint"] = self.grpc_channel.unary_unary( + self._stubs["create_endpoint"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.EndpointService/CreateEndpoint", request_serializer=endpoint_service.CreateEndpointRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -314,7 +399,7 @@ def get_endpoint( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_endpoint" not in self._stubs: - self._stubs["get_endpoint"] = self.grpc_channel.unary_unary( + self._stubs["get_endpoint"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.EndpointService/GetEndpoint", request_serializer=endpoint_service.GetEndpointRequest.serialize, response_deserializer=endpoint.Endpoint.deserialize, @@ -343,7 +428,7 @@ def list_endpoints( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_endpoints" not in self._stubs: - self._stubs["list_endpoints"] = self.grpc_channel.unary_unary( + self._stubs["list_endpoints"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.EndpointService/ListEndpoints", request_serializer=endpoint_service.ListEndpointsRequest.serialize, response_deserializer=endpoint_service.ListEndpointsResponse.deserialize, @@ -371,7 +456,7 @@ def update_endpoint( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_endpoint" not in self._stubs: - self._stubs["update_endpoint"] = self.grpc_channel.unary_unary( + self._stubs["update_endpoint"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.EndpointService/UpdateEndpoint", request_serializer=endpoint_service.UpdateEndpointRequest.serialize, response_deserializer=gca_endpoint.Endpoint.deserialize, @@ -400,7 +485,9 @@ def update_endpoint_long_running( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_endpoint_long_running" not in self._stubs: - self._stubs["update_endpoint_long_running"] = self.grpc_channel.unary_unary( + self._stubs[ + "update_endpoint_long_running" + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.EndpointService/UpdateEndpointLongRunning", request_serializer=endpoint_service.UpdateEndpointLongRunningRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -428,7 +515,7 @@ def delete_endpoint( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_endpoint" not in self._stubs: - self._stubs["delete_endpoint"] = self.grpc_channel.unary_unary( + self._stubs["delete_endpoint"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.EndpointService/DeleteEndpoint", request_serializer=endpoint_service.DeleteEndpointRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -457,7 +544,7 @@ def deploy_model( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "deploy_model" not in self._stubs: - self._stubs["deploy_model"] = self.grpc_channel.unary_unary( + self._stubs["deploy_model"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.EndpointService/DeployModel", request_serializer=endpoint_service.DeployModelRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -487,7 +574,7 @@ def undeploy_model( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "undeploy_model" not in self._stubs: - self._stubs["undeploy_model"] = self.grpc_channel.unary_unary( + self._stubs["undeploy_model"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.EndpointService/UndeployModel", request_serializer=endpoint_service.UndeployModelRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -519,7 +606,7 @@ def mutate_deployed_model( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "mutate_deployed_model" not in self._stubs: - self._stubs["mutate_deployed_model"] = self.grpc_channel.unary_unary( + self._stubs["mutate_deployed_model"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.EndpointService/MutateDeployedModel", request_serializer=endpoint_service.MutateDeployedModelRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -632,7 +719,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: @@ -648,7 +735,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, @@ -665,7 +752,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -682,7 +769,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -699,7 +786,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, @@ -718,7 +805,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, @@ -737,7 +824,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -754,7 +841,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -779,7 +866,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -805,7 +892,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -834,7 +921,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1beta1/services/endpoint_service/transports/rest.py b/google/cloud/aiplatform_v1beta1/services/endpoint_service/transports/rest.py index 45507a389b..ad1f48bc98 100644 --- a/google/cloud/aiplatform_v1beta1/services/endpoint_service/transports/rest.py +++ b/google/cloud/aiplatform_v1beta1/services/endpoint_service/transports/rest.py @@ -13,9 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging +import json # type: ignore from google.auth.transport.requests import AuthorizedSession # type: ignore -import json # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.api_core import exceptions as core_exceptions from google.api_core import retry as retries @@ -49,6 +50,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, @@ -153,8 +162,10 @@ def post_update_endpoint_long_running(self, response): def pre_create_endpoint( self, request: endpoint_service.CreateEndpointRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[endpoint_service.CreateEndpointRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + endpoint_service.CreateEndpointRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for create_endpoint Override in a subclass to manipulate the request or metadata @@ -176,8 +187,10 @@ def post_create_endpoint( def pre_delete_endpoint( self, request: endpoint_service.DeleteEndpointRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[endpoint_service.DeleteEndpointRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + endpoint_service.DeleteEndpointRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for delete_endpoint Override in a subclass to manipulate the request or metadata @@ -199,8 +212,10 @@ def post_delete_endpoint( def pre_deploy_model( self, request: endpoint_service.DeployModelRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[endpoint_service.DeployModelRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + endpoint_service.DeployModelRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for deploy_model Override in a subclass to manipulate the request or metadata @@ -222,8 +237,10 @@ def post_deploy_model( def pre_get_endpoint( self, request: endpoint_service.GetEndpointRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[endpoint_service.GetEndpointRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + endpoint_service.GetEndpointRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_endpoint Override in a subclass to manipulate the request or metadata @@ -243,8 +260,10 @@ def post_get_endpoint(self, response: endpoint.Endpoint) -> endpoint.Endpoint: def pre_list_endpoints( self, request: endpoint_service.ListEndpointsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[endpoint_service.ListEndpointsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + endpoint_service.ListEndpointsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_endpoints Override in a subclass to manipulate the request or metadata @@ -266,8 +285,11 @@ def post_list_endpoints( def pre_mutate_deployed_model( self, request: endpoint_service.MutateDeployedModelRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[endpoint_service.MutateDeployedModelRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + endpoint_service.MutateDeployedModelRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for mutate_deployed_model Override in a subclass to manipulate the request or metadata @@ -289,8 +311,10 @@ def post_mutate_deployed_model( def pre_undeploy_model( self, request: endpoint_service.UndeployModelRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[endpoint_service.UndeployModelRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + endpoint_service.UndeployModelRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for undeploy_model Override in a subclass to manipulate the request or metadata @@ -312,8 +336,10 @@ def post_undeploy_model( def pre_update_endpoint( self, request: endpoint_service.UpdateEndpointRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[endpoint_service.UpdateEndpointRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + endpoint_service.UpdateEndpointRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for update_endpoint Override in a subclass to manipulate the request or metadata @@ -335,9 +361,10 @@ def post_update_endpoint( def pre_update_endpoint_long_running( self, request: endpoint_service.UpdateEndpointLongRunningRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - endpoint_service.UpdateEndpointLongRunningRequest, Sequence[Tuple[str, str]] + endpoint_service.UpdateEndpointLongRunningRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for update_endpoint_long_running @@ -360,8 +387,10 @@ def post_update_endpoint_long_running( def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -383,8 +412,10 @@ def post_get_location( def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -406,8 +437,10 @@ def post_list_locations( def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -427,8 +460,10 @@ def post_get_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -448,8 +483,11 @@ def post_set_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -471,8 +509,10 @@ def post_test_iam_permissions( def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -492,8 +532,10 @@ def post_cancel_operation(self, response: None) -> None: 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 @@ -513,8 +555,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 @@ -536,8 +580,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 @@ -559,8 +605,10 @@ def post_list_operations( def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -1240,6 +1288,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -1456,6 +1508,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -1662,6 +1718,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}", @@ -1878,6 +1938,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, ], "google.longrunning.Operations.ListOperations": [ { @@ -2076,6 +2140,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*}/operations", @@ -2292,6 +2360,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*}/operations", + }, ], "google.longrunning.Operations.WaitOperation": [ { @@ -2490,6 +2562,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "post", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}:wait", @@ -2702,6 +2778,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, ], } @@ -2757,7 +2837,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 endpoint method over HTTP. @@ -2768,8 +2848,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: @@ -2782,6 +2864,7 @@ def __call__( http_options = ( _BaseEndpointServiceRestTransport._BaseCreateEndpoint._get_http_options() ) + request, metadata = self._interceptor.pre_create_endpoint(request, metadata) transcoded_request = _BaseEndpointServiceRestTransport._BaseCreateEndpoint._get_transcoded_request( http_options, request @@ -2796,6 +2879,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.aiplatform_v1beta1.EndpointServiceClient.CreateEndpoint", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.EndpointService", + "rpcName": "CreateEndpoint", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = EndpointServiceRestTransport._CreateEndpoint._get_response( self._host, @@ -2815,7 +2925,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_endpoint(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.aiplatform_v1beta1.EndpointServiceClient.create_endpoint", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.EndpointService", + "rpcName": "CreateEndpoint", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _DeleteEndpoint( @@ -2853,7 +2985,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 endpoint method over HTTP. @@ -2864,8 +2996,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: @@ -2878,6 +3012,7 @@ def __call__( http_options = ( _BaseEndpointServiceRestTransport._BaseDeleteEndpoint._get_http_options() ) + request, metadata = self._interceptor.pre_delete_endpoint(request, metadata) transcoded_request = _BaseEndpointServiceRestTransport._BaseDeleteEndpoint._get_transcoded_request( http_options, request @@ -2888,6 +3023,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.aiplatform_v1beta1.EndpointServiceClient.DeleteEndpoint", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.EndpointService", + "rpcName": "DeleteEndpoint", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = EndpointServiceRestTransport._DeleteEndpoint._get_response( self._host, @@ -2906,7 +3068,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_endpoint(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.aiplatform_v1beta1.EndpointServiceClient.delete_endpoint", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.EndpointService", + "rpcName": "DeleteEndpoint", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _DeployModel( @@ -2945,7 +3129,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 deploy model method over HTTP. @@ -2956,8 +3140,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: @@ -2970,6 +3156,7 @@ def __call__( http_options = ( _BaseEndpointServiceRestTransport._BaseDeployModel._get_http_options() ) + request, metadata = self._interceptor.pre_deploy_model(request, metadata) transcoded_request = _BaseEndpointServiceRestTransport._BaseDeployModel._get_transcoded_request( http_options, request @@ -2984,6 +3171,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.aiplatform_v1beta1.EndpointServiceClient.DeployModel", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.EndpointService", + "rpcName": "DeployModel", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = EndpointServiceRestTransport._DeployModel._get_response( self._host, @@ -3003,7 +3217,29 @@ def __call__( # Return the response resp = operations_pb2.Operation() json_format.Parse(response.content, resp, ignore_unknown_fields=True) + resp = self._interceptor.post_deploy_model(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.aiplatform_v1beta1.EndpointServiceClient.deploy_model", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.EndpointService", + "rpcName": "DeployModel", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _GetEndpoint( @@ -3041,7 +3277,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]]] = (), ) -> endpoint.Endpoint: r"""Call the get endpoint method over HTTP. @@ -3052,8 +3288,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: ~.endpoint.Endpoint: @@ -3066,6 +3304,7 @@ def __call__( http_options = ( _BaseEndpointServiceRestTransport._BaseGetEndpoint._get_http_options() ) + request, metadata = self._interceptor.pre_get_endpoint(request, metadata) transcoded_request = _BaseEndpointServiceRestTransport._BaseGetEndpoint._get_transcoded_request( http_options, request @@ -3076,6 +3315,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.aiplatform_v1beta1.EndpointServiceClient.GetEndpoint", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.EndpointService", + "rpcName": "GetEndpoint", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = EndpointServiceRestTransport._GetEndpoint._get_response( self._host, @@ -3096,7 +3362,29 @@ def __call__( pb_resp = endpoint.Endpoint.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_endpoint(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = endpoint.Endpoint.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.aiplatform_v1beta1.EndpointServiceClient.get_endpoint", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.EndpointService", + "rpcName": "GetEndpoint", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListEndpoints( @@ -3134,7 +3422,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]]] = (), ) -> endpoint_service.ListEndpointsResponse: r"""Call the list endpoints method over HTTP. @@ -3145,8 +3433,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: ~.endpoint_service.ListEndpointsResponse: @@ -3158,6 +3448,7 @@ def __call__( http_options = ( _BaseEndpointServiceRestTransport._BaseListEndpoints._get_http_options() ) + request, metadata = self._interceptor.pre_list_endpoints(request, metadata) transcoded_request = _BaseEndpointServiceRestTransport._BaseListEndpoints._get_transcoded_request( http_options, request @@ -3168,6 +3459,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.aiplatform_v1beta1.EndpointServiceClient.ListEndpoints", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.EndpointService", + "rpcName": "ListEndpoints", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = EndpointServiceRestTransport._ListEndpoints._get_response( self._host, @@ -3188,7 +3506,31 @@ def __call__( pb_resp = endpoint_service.ListEndpointsResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_endpoints(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = endpoint_service.ListEndpointsResponse.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.aiplatform_v1beta1.EndpointServiceClient.list_endpoints", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.EndpointService", + "rpcName": "ListEndpoints", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _MutateDeployedModel( @@ -3228,7 +3570,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 mutate deployed model method over HTTP. @@ -3239,8 +3581,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: @@ -3253,6 +3597,7 @@ def __call__( http_options = ( _BaseEndpointServiceRestTransport._BaseMutateDeployedModel._get_http_options() ) + request, metadata = self._interceptor.pre_mutate_deployed_model( request, metadata ) @@ -3269,6 +3614,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.aiplatform_v1beta1.EndpointServiceClient.MutateDeployedModel", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.EndpointService", + "rpcName": "MutateDeployedModel", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = EndpointServiceRestTransport._MutateDeployedModel._get_response( self._host, @@ -3288,7 +3660,29 @@ def __call__( # Return the response resp = operations_pb2.Operation() json_format.Parse(response.content, resp, ignore_unknown_fields=True) + resp = self._interceptor.post_mutate_deployed_model(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.aiplatform_v1beta1.EndpointServiceClient.mutate_deployed_model", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.EndpointService", + "rpcName": "MutateDeployedModel", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _UndeployModel( @@ -3327,7 +3721,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 undeploy model method over HTTP. @@ -3338,8 +3732,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: @@ -3352,6 +3748,7 @@ def __call__( http_options = ( _BaseEndpointServiceRestTransport._BaseUndeployModel._get_http_options() ) + request, metadata = self._interceptor.pre_undeploy_model(request, metadata) transcoded_request = _BaseEndpointServiceRestTransport._BaseUndeployModel._get_transcoded_request( http_options, request @@ -3366,6 +3763,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.aiplatform_v1beta1.EndpointServiceClient.UndeployModel", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.EndpointService", + "rpcName": "UndeployModel", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = EndpointServiceRestTransport._UndeployModel._get_response( self._host, @@ -3385,7 +3809,29 @@ def __call__( # Return the response resp = operations_pb2.Operation() json_format.Parse(response.content, resp, ignore_unknown_fields=True) + resp = self._interceptor.post_undeploy_model(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.aiplatform_v1beta1.EndpointServiceClient.undeploy_model", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.EndpointService", + "rpcName": "UndeployModel", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _UpdateEndpoint( @@ -3424,7 +3870,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]]] = (), ) -> gca_endpoint.Endpoint: r"""Call the update endpoint method over HTTP. @@ -3435,8 +3881,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: ~.gca_endpoint.Endpoint: @@ -3449,6 +3897,7 @@ def __call__( http_options = ( _BaseEndpointServiceRestTransport._BaseUpdateEndpoint._get_http_options() ) + request, metadata = self._interceptor.pre_update_endpoint(request, metadata) transcoded_request = _BaseEndpointServiceRestTransport._BaseUpdateEndpoint._get_transcoded_request( http_options, request @@ -3463,6 +3912,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.aiplatform_v1beta1.EndpointServiceClient.UpdateEndpoint", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.EndpointService", + "rpcName": "UpdateEndpoint", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = EndpointServiceRestTransport._UpdateEndpoint._get_response( self._host, @@ -3484,7 +3960,29 @@ def __call__( pb_resp = gca_endpoint.Endpoint.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_update_endpoint(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gca_endpoint.Endpoint.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.aiplatform_v1beta1.EndpointServiceClient.update_endpoint", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.EndpointService", + "rpcName": "UpdateEndpoint", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _UpdateEndpointLongRunning( @@ -3524,7 +4022,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 endpoint long running method over HTTP. @@ -3536,8 +4034,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: @@ -3550,6 +4050,7 @@ def __call__( http_options = ( _BaseEndpointServiceRestTransport._BaseUpdateEndpointLongRunning._get_http_options() ) + request, metadata = self._interceptor.pre_update_endpoint_long_running( request, metadata ) @@ -3566,6 +4067,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.aiplatform_v1beta1.EndpointServiceClient.UpdateEndpointLongRunning", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.EndpointService", + "rpcName": "UpdateEndpointLongRunning", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( EndpointServiceRestTransport._UpdateEndpointLongRunning._get_response( @@ -3587,7 +4115,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_endpoint_long_running(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.aiplatform_v1beta1.EndpointServiceClient.update_endpoint_long_running", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.EndpointService", + "rpcName": "UpdateEndpointLongRunning", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp @property @@ -3707,7 +4257,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]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -3718,8 +4268,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: locations_pb2.Location: Response from GetLocation method. @@ -3728,6 +4280,7 @@ def __call__( http_options = ( _BaseEndpointServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = self._interceptor.pre_get_location(request, metadata) transcoded_request = _BaseEndpointServiceRestTransport._BaseGetLocation._get_transcoded_request( http_options, request @@ -3738,6 +4291,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.aiplatform_v1beta1.EndpointServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.EndpointService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = EndpointServiceRestTransport._GetLocation._get_response( self._host, @@ -3757,6 +4337,27 @@ def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_location(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.aiplatform_v1beta1.EndpointServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.EndpointService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3798,7 +4399,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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -3809,8 +4410,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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -3819,6 +4422,7 @@ def __call__( http_options = ( _BaseEndpointServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = self._interceptor.pre_list_locations(request, metadata) transcoded_request = _BaseEndpointServiceRestTransport._BaseListLocations._get_transcoded_request( http_options, request @@ -3829,6 +4433,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.aiplatform_v1beta1.EndpointServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.EndpointService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = EndpointServiceRestTransport._ListLocations._get_response( self._host, @@ -3848,6 +4479,27 @@ def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_list_locations(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.aiplatform_v1beta1.EndpointServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.EndpointService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3890,7 +4542,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]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -3901,8 +4553,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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -3911,6 +4565,7 @@ def __call__( http_options = ( _BaseEndpointServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_get_iam_policy(request, metadata) transcoded_request = _BaseEndpointServiceRestTransport._BaseGetIamPolicy._get_transcoded_request( http_options, request @@ -3925,6 +4580,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.aiplatform_v1beta1.EndpointServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.EndpointService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = EndpointServiceRestTransport._GetIamPolicy._get_response( self._host, @@ -3945,6 +4627,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_iam_policy(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.aiplatform_v1beta1.EndpointServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.EndpointService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3987,7 +4690,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]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -3998,8 +4701,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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -4008,6 +4713,7 @@ def __call__( http_options = ( _BaseEndpointServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_set_iam_policy(request, metadata) transcoded_request = _BaseEndpointServiceRestTransport._BaseSetIamPolicy._get_transcoded_request( http_options, request @@ -4022,6 +4728,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.aiplatform_v1beta1.EndpointServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.EndpointService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = EndpointServiceRestTransport._SetIamPolicy._get_response( self._host, @@ -4042,6 +4775,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_set_iam_policy(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.aiplatform_v1beta1.EndpointServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.EndpointService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4085,7 +4839,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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -4096,8 +4850,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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -4106,6 +4862,7 @@ def __call__( http_options = ( _BaseEndpointServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -4122,6 +4879,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.aiplatform_v1beta1.EndpointServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.EndpointService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = EndpointServiceRestTransport._TestIamPermissions._get_response( self._host, @@ -4142,6 +4926,27 @@ def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_test_iam_permissions(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.aiplatform_v1beta1.EndpointServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.EndpointService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4183,7 +4988,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 cancel operation method over HTTP. @@ -4194,13 +4999,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 = ( _BaseEndpointServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = self._interceptor.pre_cancel_operation( request, metadata ) @@ -4213,6 +5021,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.aiplatform_v1beta1.EndpointServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.EndpointService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = EndpointServiceRestTransport._CancelOperation._get_response( self._host, @@ -4269,7 +5104,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. @@ -4280,13 +5115,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 = ( _BaseEndpointServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = self._interceptor.pre_delete_operation( request, metadata ) @@ -4299,6 +5137,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.aiplatform_v1beta1.EndpointServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.EndpointService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = EndpointServiceRestTransport._DeleteOperation._get_response( self._host, @@ -4355,7 +5220,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. @@ -4366,8 +5231,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. @@ -4376,6 +5243,7 @@ def __call__( http_options = ( _BaseEndpointServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = self._interceptor.pre_get_operation(request, metadata) transcoded_request = _BaseEndpointServiceRestTransport._BaseGetOperation._get_transcoded_request( http_options, request @@ -4386,6 +5254,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.aiplatform_v1beta1.EndpointServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.EndpointService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = EndpointServiceRestTransport._GetOperation._get_response( self._host, @@ -4405,6 +5300,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.aiplatform_v1beta1.EndpointServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.EndpointService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4446,7 +5362,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. @@ -4457,8 +5373,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. @@ -4467,6 +5385,7 @@ def __call__( http_options = ( _BaseEndpointServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = self._interceptor.pre_list_operations(request, metadata) transcoded_request = _BaseEndpointServiceRestTransport._BaseListOperations._get_transcoded_request( http_options, request @@ -4477,6 +5396,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.aiplatform_v1beta1.EndpointServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.EndpointService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = EndpointServiceRestTransport._ListOperations._get_response( self._host, @@ -4496,6 +5442,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.aiplatform_v1beta1.EndpointServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.EndpointService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4537,7 +5504,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 wait operation method over HTTP. @@ -4548,8 +5515,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 WaitOperation method. @@ -4558,6 +5527,7 @@ def __call__( http_options = ( _BaseEndpointServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = self._interceptor.pre_wait_operation(request, metadata) transcoded_request = _BaseEndpointServiceRestTransport._BaseWaitOperation._get_transcoded_request( http_options, request @@ -4568,6 +5538,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.aiplatform_v1beta1.EndpointServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.EndpointService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = EndpointServiceRestTransport._WaitOperation._get_response( self._host, @@ -4587,6 +5584,27 @@ def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = self._interceptor.post_wait_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.aiplatform_v1beta1.EndpointServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.EndpointService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1beta1/services/endpoint_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1beta1/services/endpoint_service/transports/rest_asyncio.py index c2e09effc2..f836976a52 100644 --- a/google/cloud/aiplatform_v1beta1/services/endpoint_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/endpoint_service/transports/rest_asyncio.py @@ -60,6 +60,18 @@ from .base import DEFAULT_CLIENT_INFO as BASE_DEFAULT_CLIENT_INFO + +import logging + +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__) + try: OptionalRetry = Union[retries.AsyncRetry, gapic_v1.method._MethodDefault, None] except AttributeError: # pragma: NO COVER @@ -168,8 +180,10 @@ async def post_update_endpoint_long_running(self, response): async def pre_create_endpoint( self, request: endpoint_service.CreateEndpointRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[endpoint_service.CreateEndpointRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + endpoint_service.CreateEndpointRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for create_endpoint Override in a subclass to manipulate the request or metadata @@ -191,8 +205,10 @@ async def post_create_endpoint( async def pre_delete_endpoint( self, request: endpoint_service.DeleteEndpointRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[endpoint_service.DeleteEndpointRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + endpoint_service.DeleteEndpointRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for delete_endpoint Override in a subclass to manipulate the request or metadata @@ -214,8 +230,10 @@ async def post_delete_endpoint( async def pre_deploy_model( self, request: endpoint_service.DeployModelRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[endpoint_service.DeployModelRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + endpoint_service.DeployModelRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for deploy_model Override in a subclass to manipulate the request or metadata @@ -237,8 +255,10 @@ async def post_deploy_model( async def pre_get_endpoint( self, request: endpoint_service.GetEndpointRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[endpoint_service.GetEndpointRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + endpoint_service.GetEndpointRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_endpoint Override in a subclass to manipulate the request or metadata @@ -258,8 +278,10 @@ async def post_get_endpoint(self, response: endpoint.Endpoint) -> endpoint.Endpo async def pre_list_endpoints( self, request: endpoint_service.ListEndpointsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[endpoint_service.ListEndpointsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + endpoint_service.ListEndpointsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_endpoints Override in a subclass to manipulate the request or metadata @@ -281,8 +303,11 @@ async def post_list_endpoints( async def pre_mutate_deployed_model( self, request: endpoint_service.MutateDeployedModelRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[endpoint_service.MutateDeployedModelRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + endpoint_service.MutateDeployedModelRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for mutate_deployed_model Override in a subclass to manipulate the request or metadata @@ -304,8 +329,10 @@ async def post_mutate_deployed_model( async def pre_undeploy_model( self, request: endpoint_service.UndeployModelRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[endpoint_service.UndeployModelRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + endpoint_service.UndeployModelRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for undeploy_model Override in a subclass to manipulate the request or metadata @@ -327,8 +354,10 @@ async def post_undeploy_model( async def pre_update_endpoint( self, request: endpoint_service.UpdateEndpointRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[endpoint_service.UpdateEndpointRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + endpoint_service.UpdateEndpointRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for update_endpoint Override in a subclass to manipulate the request or metadata @@ -350,9 +379,10 @@ async def post_update_endpoint( async def pre_update_endpoint_long_running( self, request: endpoint_service.UpdateEndpointLongRunningRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - endpoint_service.UpdateEndpointLongRunningRequest, Sequence[Tuple[str, str]] + endpoint_service.UpdateEndpointLongRunningRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for update_endpoint_long_running @@ -375,8 +405,10 @@ async def post_update_endpoint_long_running( async def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -398,8 +430,10 @@ async def post_get_location( async def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -421,8 +455,10 @@ async def post_list_locations( async def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -444,8 +480,10 @@ async def post_get_iam_policy( async def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -467,8 +505,11 @@ async def post_set_iam_policy( async def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -490,8 +531,10 @@ async def post_test_iam_permissions( async def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -511,8 +554,10 @@ async def post_cancel_operation(self, response: None) -> None: async 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 @@ -532,8 +577,10 @@ async def post_delete_operation(self, response: None) -> None: async 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 @@ -555,8 +602,10 @@ async def post_get_operation( async 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 @@ -578,8 +627,10 @@ async def post_list_operations( async def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -805,7 +856,7 @@ async 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 endpoint method over HTTP. @@ -816,8 +867,10 @@ async def __call__( 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: @@ -830,6 +883,7 @@ async def __call__( http_options = ( _BaseEndpointServiceRestTransport._BaseCreateEndpoint._get_http_options() ) + request, metadata = await self._interceptor.pre_create_endpoint( request, metadata ) @@ -846,6 +900,33 @@ async 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.aiplatform_v1beta1.EndpointServiceClient.CreateEndpoint", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.EndpointService", + "rpcName": "CreateEndpoint", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncEndpointServiceRestTransport._CreateEndpoint._get_response( @@ -876,6 +957,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_create_endpoint(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.EndpointServiceAsyncClient.create_endpoint", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.EndpointService", + "rpcName": "CreateEndpoint", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _DeleteEndpoint( @@ -914,7 +1017,7 @@ async 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 endpoint method over HTTP. @@ -925,8 +1028,10 @@ async def __call__( 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: @@ -939,6 +1044,7 @@ async def __call__( http_options = ( _BaseEndpointServiceRestTransport._BaseDeleteEndpoint._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_endpoint( request, metadata ) @@ -951,6 +1057,33 @@ async 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.aiplatform_v1beta1.EndpointServiceClient.DeleteEndpoint", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.EndpointService", + "rpcName": "DeleteEndpoint", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncEndpointServiceRestTransport._DeleteEndpoint._get_response( @@ -980,6 +1113,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_delete_endpoint(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.EndpointServiceAsyncClient.delete_endpoint", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.EndpointService", + "rpcName": "DeleteEndpoint", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _DeployModel( @@ -1018,7 +1173,7 @@ async 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 deploy model method over HTTP. @@ -1029,8 +1184,10 @@ async def __call__( 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: @@ -1043,6 +1200,7 @@ async def __call__( http_options = ( _BaseEndpointServiceRestTransport._BaseDeployModel._get_http_options() ) + request, metadata = await self._interceptor.pre_deploy_model( request, metadata ) @@ -1059,6 +1217,33 @@ async 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.aiplatform_v1beta1.EndpointServiceClient.DeployModel", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.EndpointService", + "rpcName": "DeployModel", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncEndpointServiceRestTransport._DeployModel._get_response( @@ -1089,6 +1274,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_deploy_model(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.EndpointServiceAsyncClient.deploy_model", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.EndpointService", + "rpcName": "DeployModel", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _GetEndpoint( @@ -1126,7 +1333,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> endpoint.Endpoint: r"""Call the get endpoint method over HTTP. @@ -1137,8 +1344,10 @@ async def __call__( 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: ~.endpoint.Endpoint: @@ -1151,6 +1360,7 @@ async def __call__( http_options = ( _BaseEndpointServiceRestTransport._BaseGetEndpoint._get_http_options() ) + request, metadata = await self._interceptor.pre_get_endpoint( request, metadata ) @@ -1163,6 +1373,33 @@ async 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.aiplatform_v1beta1.EndpointServiceClient.GetEndpoint", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.EndpointService", + "rpcName": "GetEndpoint", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncEndpointServiceRestTransport._GetEndpoint._get_response( @@ -1192,6 +1429,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_get_endpoint(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = endpoint.Endpoint.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.EndpointServiceAsyncClient.get_endpoint", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.EndpointService", + "rpcName": "GetEndpoint", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ListEndpoints( @@ -1230,7 +1489,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> endpoint_service.ListEndpointsResponse: r"""Call the list endpoints method over HTTP. @@ -1241,8 +1500,10 @@ async def __call__( 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: ~.endpoint_service.ListEndpointsResponse: @@ -1254,6 +1515,7 @@ async def __call__( http_options = ( _BaseEndpointServiceRestTransport._BaseListEndpoints._get_http_options() ) + request, metadata = await self._interceptor.pre_list_endpoints( request, metadata ) @@ -1266,6 +1528,33 @@ async 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.aiplatform_v1beta1.EndpointServiceClient.ListEndpoints", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.EndpointService", + "rpcName": "ListEndpoints", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncEndpointServiceRestTransport._ListEndpoints._get_response( @@ -1295,6 +1584,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_list_endpoints(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = endpoint_service.ListEndpointsResponse.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.EndpointServiceAsyncClient.list_endpoints", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.EndpointService", + "rpcName": "ListEndpoints", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _MutateDeployedModel( @@ -1334,7 +1647,7 @@ async 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 mutate deployed model method over HTTP. @@ -1345,8 +1658,10 @@ async def __call__( 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: @@ -1359,6 +1674,7 @@ async def __call__( http_options = ( _BaseEndpointServiceRestTransport._BaseMutateDeployedModel._get_http_options() ) + request, metadata = await self._interceptor.pre_mutate_deployed_model( request, metadata ) @@ -1375,6 +1691,33 @@ async 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.aiplatform_v1beta1.EndpointServiceClient.MutateDeployedModel", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.EndpointService", + "rpcName": "MutateDeployedModel", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncEndpointServiceRestTransport._MutateDeployedModel._get_response( self._host, @@ -1403,6 +1746,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_mutate_deployed_model(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.EndpointServiceAsyncClient.mutate_deployed_model", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.EndpointService", + "rpcName": "MutateDeployedModel", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _UndeployModel( @@ -1442,7 +1807,7 @@ async 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 undeploy model method over HTTP. @@ -1453,8 +1818,10 @@ async def __call__( 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: @@ -1467,6 +1834,7 @@ async def __call__( http_options = ( _BaseEndpointServiceRestTransport._BaseUndeployModel._get_http_options() ) + request, metadata = await self._interceptor.pre_undeploy_model( request, metadata ) @@ -1483,6 +1851,33 @@ async 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.aiplatform_v1beta1.EndpointServiceClient.UndeployModel", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.EndpointService", + "rpcName": "UndeployModel", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncEndpointServiceRestTransport._UndeployModel._get_response( @@ -1513,6 +1908,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_undeploy_model(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.EndpointServiceAsyncClient.undeploy_model", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.EndpointService", + "rpcName": "UndeployModel", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _UpdateEndpoint( @@ -1552,7 +1969,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> gca_endpoint.Endpoint: r"""Call the update endpoint method over HTTP. @@ -1563,8 +1980,10 @@ async def __call__( 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: ~.gca_endpoint.Endpoint: @@ -1577,6 +1996,7 @@ async def __call__( http_options = ( _BaseEndpointServiceRestTransport._BaseUpdateEndpoint._get_http_options() ) + request, metadata = await self._interceptor.pre_update_endpoint( request, metadata ) @@ -1593,6 +2013,33 @@ async 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.aiplatform_v1beta1.EndpointServiceClient.UpdateEndpoint", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.EndpointService", + "rpcName": "UpdateEndpoint", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncEndpointServiceRestTransport._UpdateEndpoint._get_response( @@ -1623,6 +2070,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_update_endpoint(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gca_endpoint.Endpoint.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.EndpointServiceAsyncClient.update_endpoint", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.EndpointService", + "rpcName": "UpdateEndpoint", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _UpdateEndpointLongRunning( @@ -1662,7 +2131,7 @@ async 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 endpoint long running method over HTTP. @@ -1674,8 +2143,10 @@ async def __call__( 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: @@ -1688,6 +2159,7 @@ async def __call__( http_options = ( _BaseEndpointServiceRestTransport._BaseUpdateEndpointLongRunning._get_http_options() ) + ( request, metadata, @@ -1707,6 +2179,33 @@ async 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.aiplatform_v1beta1.EndpointServiceClient.UpdateEndpointLongRunning", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.EndpointService", + "rpcName": "UpdateEndpointLongRunning", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncEndpointServiceRestTransport._UpdateEndpointLongRunning._get_response( self._host, @@ -1735,6 +2234,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_update_endpoint_long_running(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.EndpointServiceAsyncClient.update_endpoint_long_running", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.EndpointService", + "rpcName": "UpdateEndpointLongRunning", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp @property @@ -2310,6 +2831,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -2526,6 +3051,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -2732,6 +3261,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}", @@ -2948,6 +3481,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, ], "google.longrunning.Operations.ListOperations": [ { @@ -3146,6 +3683,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*}/operations", @@ -3362,6 +3903,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*}/operations", + }, ], "google.longrunning.Operations.WaitOperation": [ { @@ -3560,6 +4105,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "post", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}:wait", @@ -3772,6 +4321,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, ], } @@ -3889,7 +4442,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -3900,8 +4453,10 @@ async def __call__( 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: locations_pb2.Location: Response from GetLocation method. @@ -3910,6 +4465,7 @@ async def __call__( http_options = ( _BaseEndpointServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_location( request, metadata ) @@ -3922,6 +4478,33 @@ async 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.aiplatform_v1beta1.EndpointServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.EndpointService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncEndpointServiceRestTransport._GetLocation._get_response( @@ -3949,6 +4532,27 @@ async def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_location(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.aiplatform_v1beta1.EndpointServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.EndpointService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3991,7 +4595,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -4002,8 +4606,10 @@ async def __call__( 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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -4012,6 +4618,7 @@ async def __call__( http_options = ( _BaseEndpointServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_locations( request, metadata ) @@ -4024,6 +4631,33 @@ async 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.aiplatform_v1beta1.EndpointServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.EndpointService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncEndpointServiceRestTransport._ListLocations._get_response( @@ -4051,6 +4685,27 @@ async def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_list_locations(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.aiplatform_v1beta1.EndpointServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.EndpointService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4094,7 +4749,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -4105,8 +4760,10 @@ async def __call__( 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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -4115,6 +4772,7 @@ async def __call__( http_options = ( _BaseEndpointServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_get_iam_policy( request, metadata ) @@ -4131,6 +4789,33 @@ async 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.aiplatform_v1beta1.EndpointServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.EndpointService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncEndpointServiceRestTransport._GetIamPolicy._get_response( @@ -4159,6 +4844,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_iam_policy(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.aiplatform_v1beta1.EndpointServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.EndpointService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4202,7 +4908,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -4213,8 +4919,10 @@ async def __call__( 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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -4223,6 +4931,7 @@ async def __call__( http_options = ( _BaseEndpointServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_set_iam_policy( request, metadata ) @@ -4239,6 +4948,33 @@ async 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.aiplatform_v1beta1.EndpointServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.EndpointService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncEndpointServiceRestTransport._SetIamPolicy._get_response( @@ -4267,6 +5003,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_set_iam_policy(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.aiplatform_v1beta1.EndpointServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.EndpointService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4310,7 +5067,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -4321,8 +5078,10 @@ async def __call__( 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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -4331,6 +5090,7 @@ async def __call__( http_options = ( _BaseEndpointServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = await self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -4347,6 +5107,33 @@ async 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.aiplatform_v1beta1.EndpointServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.EndpointService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncEndpointServiceRestTransport._TestIamPermissions._get_response( self._host, @@ -4373,6 +5160,27 @@ async def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_test_iam_permissions(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.aiplatform_v1beta1.EndpointServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.EndpointService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4415,7 +5223,7 @@ async 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 cancel operation method over HTTP. @@ -4426,13 +5234,16 @@ async def __call__( 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`. """ http_options = ( _BaseEndpointServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_cancel_operation( request, metadata ) @@ -4445,6 +5256,33 @@ async 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.aiplatform_v1beta1.EndpointServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.EndpointService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncEndpointServiceRestTransport._CancelOperation._get_response( @@ -4510,7 +5348,7 @@ async 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. @@ -4521,13 +5359,16 @@ async def __call__( 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`. """ http_options = ( _BaseEndpointServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_operation( request, metadata ) @@ -4540,6 +5381,33 @@ async 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.aiplatform_v1beta1.EndpointServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.EndpointService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncEndpointServiceRestTransport._DeleteOperation._get_response( @@ -4605,7 +5473,7 @@ async 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. @@ -4616,8 +5484,10 @@ async def __call__( 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: Response from GetOperation method. @@ -4626,6 +5496,7 @@ async def __call__( http_options = ( _BaseEndpointServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_operation( request, metadata ) @@ -4638,6 +5509,33 @@ async 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.aiplatform_v1beta1.EndpointServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.EndpointService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncEndpointServiceRestTransport._GetOperation._get_response( @@ -4665,6 +5563,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1beta1.EndpointServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.EndpointService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4707,7 +5626,7 @@ async 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. @@ -4718,8 +5637,10 @@ async def __call__( 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 from ListOperations method. @@ -4728,6 +5649,7 @@ async def __call__( http_options = ( _BaseEndpointServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_operations( request, metadata ) @@ -4740,6 +5662,33 @@ async 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.aiplatform_v1beta1.EndpointServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.EndpointService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncEndpointServiceRestTransport._ListOperations._get_response( @@ -4767,6 +5716,27 @@ async def __call__( resp = operations_pb2.ListOperationsResponse() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1beta1.EndpointServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.EndpointService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4809,7 +5779,7 @@ async 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 wait operation method over HTTP. @@ -4820,8 +5790,10 @@ async def __call__( 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: Response from WaitOperation method. @@ -4830,6 +5802,7 @@ async def __call__( http_options = ( _BaseEndpointServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_wait_operation( request, metadata ) @@ -4842,6 +5815,33 @@ async 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.aiplatform_v1beta1.EndpointServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.EndpointService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncEndpointServiceRestTransport._WaitOperation._get_response( @@ -4869,6 +5869,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_wait_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.aiplatform_v1beta1.EndpointServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.EndpointService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1beta1/services/endpoint_service/transports/rest_base.py b/google/cloud/aiplatform_v1beta1/services/endpoint_service/transports/rest_base.py index 6784897a02..232a0f9403 100644 --- a/google/cloud/aiplatform_v1beta1/services/endpoint_service/transports/rest_base.py +++ b/google/cloud/aiplatform_v1beta1/services/endpoint_service/transports/rest_base.py @@ -1496,6 +1496,10 @@ def _get_http_options(): "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -1712,6 +1716,10 @@ def _get_http_options(): "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -1937,6 +1945,10 @@ def _get_http_options(): "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}", @@ -2153,6 +2165,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, ] return http_options @@ -2370,6 +2386,10 @@ def _get_http_options(): "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*}/operations", @@ -2586,6 +2606,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*}/operations", + }, ] return http_options @@ -2803,6 +2827,10 @@ def _get_http_options(): "method": "post", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}:wait", @@ -3015,6 +3043,10 @@ def _get_http_options(): "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, ] return http_options diff --git a/google/cloud/aiplatform_v1beta1/services/evaluation_service/async_client.py b/google/cloud/aiplatform_v1beta1/services/evaluation_service/async_client.py index 8c9bc068f7..4c76357e3e 100644 --- a/google/cloud/aiplatform_v1beta1/services/evaluation_service/async_client.py +++ b/google/cloud/aiplatform_v1beta1/services/evaluation_service/async_client.py @@ -13,6 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging as std_logging from collections import OrderedDict import re from typing import ( @@ -52,6 +53,15 @@ from .transports.grpc_asyncio import EvaluationServiceGrpcAsyncIOTransport from .client import EvaluationServiceClient +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 EvaluationServiceAsyncClient: """Vertex AI Online Evaluation Service.""" @@ -259,6 +269,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.aiplatform_v1beta1.EvaluationServiceAsyncClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.EvaluationService", + "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.aiplatform.v1beta1.EvaluationService", + "credentialsType": None, + }, + ) + async def evaluate_instances( self, request: Optional[ @@ -267,7 +299,7 @@ async def evaluate_instances( *, 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]]] = (), ) -> evaluation_service.EvaluateInstancesResponse: r"""Evaluates instances based on a given metric. @@ -304,8 +336,10 @@ async def sample_evaluate_instances(): 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.aiplatform_v1beta1.types.EvaluateInstancesResponse: @@ -351,7 +385,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. @@ -362,8 +396,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. @@ -404,7 +440,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. @@ -415,8 +451,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. @@ -457,7 +495,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. @@ -473,8 +511,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 """ @@ -511,7 +551,7 @@ async def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -526,8 +566,10 @@ async def cancel_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 """ @@ -564,7 +606,7 @@ async def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -581,8 +623,10 @@ async def wait_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. @@ -623,7 +667,7 @@ async def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -636,8 +680,10 @@ async def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -742,7 +788,7 @@ async def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -756,8 +802,10 @@ async def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -862,7 +910,7 @@ async def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -877,8 +925,10 @@ async def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -922,7 +972,7 @@ async def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -933,8 +983,10 @@ async def get_location( 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: ~.location_pb2.Location: Location object. @@ -975,7 +1027,7 @@ async def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -986,8 +1038,10 @@ async def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1beta1/services/evaluation_service/client.py b/google/cloud/aiplatform_v1beta1/services/evaluation_service/client.py index 90adc0e6c6..63cdb7435a 100644 --- a/google/cloud/aiplatform_v1beta1/services/evaluation_service/client.py +++ b/google/cloud/aiplatform_v1beta1/services/evaluation_service/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 ( @@ -48,6 +49,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.cloud.aiplatform_v1beta1.types import evaluation_service from google.cloud.location import locations_pb2 # type: ignore from google.iam.v1 import iam_policy_pb2 # type: ignore @@ -576,6 +586,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( @@ -667,6 +681,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.aiplatform_v1beta1.EvaluationServiceClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.EvaluationService", + "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.aiplatform.v1beta1.EvaluationService", + "credentialsType": None, + }, + ) + def evaluate_instances( self, request: Optional[ @@ -675,7 +712,7 @@ def evaluate_instances( *, 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]]] = (), ) -> evaluation_service.EvaluateInstancesResponse: r"""Evaluates instances based on a given metric. @@ -712,8 +749,10 @@ def sample_evaluate_instances(): 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.aiplatform_v1beta1.types.EvaluateInstancesResponse: @@ -770,7 +809,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. @@ -781,8 +820,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. @@ -823,7 +864,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. @@ -834,8 +875,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. @@ -876,7 +919,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. @@ -892,8 +935,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 """ @@ -930,7 +975,7 @@ def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -945,8 +990,10 @@ def cancel_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 """ @@ -983,7 +1030,7 @@ def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -1000,8 +1047,10 @@ def wait_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. @@ -1042,7 +1091,7 @@ def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -1055,8 +1104,10 @@ def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -1161,7 +1212,7 @@ def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -1175,8 +1226,10 @@ def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -1281,7 +1334,7 @@ def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -1296,8 +1349,10 @@ def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -1339,7 +1394,7 @@ def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -1350,8 +1405,10 @@ def get_location( 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: ~.location_pb2.Location: Location object. @@ -1392,7 +1449,7 @@ def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -1403,8 +1460,10 @@ def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1beta1/services/evaluation_service/transports/grpc.py b/google/cloud/aiplatform_v1beta1/services/evaluation_service/transports/grpc.py index 01afb94511..cb04eaab97 100644 --- a/google/cloud/aiplatform_v1beta1/services/evaluation_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1beta1/services/evaluation_service/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 import warnings from typing import Callable, Dict, Optional, Sequence, Tuple, Union @@ -21,8 +24,11 @@ import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from google.cloud.aiplatform_v1beta1.types import evaluation_service from google.cloud.location import locations_pb2 # type: ignore @@ -31,6 +37,81 @@ from google.longrunning import operations_pb2 # type: ignore from .base import EvaluationServiceTransport, DEFAULT_CLIENT_INFO +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.aiplatform.v1beta1.EvaluationService", + "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.aiplatform.v1beta1.EvaluationService", + "rpcName": client_call_details.method, + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class EvaluationServiceGrpcTransport(EvaluationServiceTransport): """gRPC backend transport for EvaluationService. @@ -184,7 +265,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 @@ -261,7 +347,7 @@ def evaluate_instances( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "evaluate_instances" not in self._stubs: - self._stubs["evaluate_instances"] = self.grpc_channel.unary_unary( + self._stubs["evaluate_instances"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.EvaluationService/EvaluateInstances", request_serializer=evaluation_service.EvaluateInstancesRequest.serialize, response_deserializer=evaluation_service.EvaluateInstancesResponse.deserialize, @@ -269,7 +355,7 @@ def evaluate_instances( return self._stubs["evaluate_instances"] def close(self): - self.grpc_channel.close() + self._logged_channel.close() @property def delete_operation( @@ -281,7 +367,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, @@ -298,7 +384,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -315,7 +401,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -332,7 +418,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, @@ -351,7 +437,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, @@ -370,7 +456,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -387,7 +473,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -412,7 +498,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -438,7 +524,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -467,7 +553,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1beta1/services/evaluation_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1beta1/services/evaluation_service/transports/grpc_asyncio.py index 00fdf4bd1f..0ef1ec438a 100644 --- a/google/cloud/aiplatform_v1beta1/services/evaluation_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/evaluation_service/transports/grpc_asyncio.py @@ -14,6 +14,9 @@ # limitations under the License. # import inspect +import json +import pickle +import logging as std_logging import warnings from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union @@ -23,8 +26,11 @@ from google.api_core import retry_async as retries from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from grpc.experimental import aio # type: ignore from google.cloud.aiplatform_v1beta1.types import evaluation_service @@ -35,6 +41,82 @@ from .base import EvaluationServiceTransport, DEFAULT_CLIENT_INFO from .grpc import EvaluationServiceGrpcTransport +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.aiplatform.v1beta1.EvaluationService", + "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.aiplatform.v1beta1.EvaluationService", + "rpcName": str(client_call_details.method), + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class EvaluationServiceGrpcAsyncIOTransport(EvaluationServiceTransport): """gRPC AsyncIO backend transport for EvaluationService. @@ -231,10 +313,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 @@ -269,7 +354,7 @@ def evaluate_instances( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "evaluate_instances" not in self._stubs: - self._stubs["evaluate_instances"] = self.grpc_channel.unary_unary( + self._stubs["evaluate_instances"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.EvaluationService/EvaluateInstances", request_serializer=evaluation_service.EvaluateInstancesRequest.serialize, response_deserializer=evaluation_service.EvaluateInstancesResponse.deserialize, @@ -342,7 +427,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: @@ -358,7 +443,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, @@ -375,7 +460,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -392,7 +477,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -409,7 +494,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, @@ -428,7 +513,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, @@ -447,7 +532,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -464,7 +549,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -489,7 +574,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -515,7 +600,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -544,7 +629,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1beta1/services/evaluation_service/transports/rest.py b/google/cloud/aiplatform_v1beta1/services/evaluation_service/transports/rest.py index f37325c619..411f22028a 100644 --- a/google/cloud/aiplatform_v1beta1/services/evaluation_service/transports/rest.py +++ b/google/cloud/aiplatform_v1beta1/services/evaluation_service/transports/rest.py @@ -13,9 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging +import json # type: ignore from google.auth.transport.requests import AuthorizedSession # type: ignore -import json # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.api_core import exceptions as core_exceptions from google.api_core import retry as retries @@ -46,6 +47,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, @@ -86,8 +95,11 @@ def post_evaluate_instances(self, response): def pre_evaluate_instances( self, request: evaluation_service.EvaluateInstancesRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[evaluation_service.EvaluateInstancesRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + evaluation_service.EvaluateInstancesRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for evaluate_instances Override in a subclass to manipulate the request or metadata @@ -109,8 +121,10 @@ def post_evaluate_instances( def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -132,8 +146,10 @@ def post_get_location( def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -155,8 +171,10 @@ def post_list_locations( def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -176,8 +194,10 @@ def post_get_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -197,8 +217,11 @@ def post_set_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -220,8 +243,10 @@ def post_test_iam_permissions( def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -241,8 +266,10 @@ def post_cancel_operation(self, response: None) -> None: 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 @@ -262,8 +289,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 @@ -285,8 +314,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 @@ -308,8 +339,10 @@ def post_list_operations( def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -452,7 +485,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]]] = (), ) -> evaluation_service.EvaluateInstancesResponse: r"""Call the evaluate instances method over HTTP. @@ -463,8 +496,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: ~.evaluation_service.EvaluateInstancesResponse: @@ -476,6 +511,7 @@ def __call__( http_options = ( _BaseEvaluationServiceRestTransport._BaseEvaluateInstances._get_http_options() ) + request, metadata = self._interceptor.pre_evaluate_instances( request, metadata ) @@ -492,6 +528,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.aiplatform_v1beta1.EvaluationServiceClient.EvaluateInstances", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.EvaluationService", + "rpcName": "EvaluateInstances", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = EvaluationServiceRestTransport._EvaluateInstances._get_response( self._host, @@ -513,7 +576,31 @@ def __call__( pb_resp = evaluation_service.EvaluateInstancesResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_evaluate_instances(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + evaluation_service.EvaluateInstancesResponse.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.aiplatform_v1beta1.EvaluationServiceClient.evaluate_instances", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.EvaluationService", + "rpcName": "EvaluateInstances", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp @property @@ -566,7 +653,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]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -577,8 +664,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: locations_pb2.Location: Response from GetLocation method. @@ -587,6 +676,7 @@ def __call__( http_options = ( _BaseEvaluationServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = self._interceptor.pre_get_location(request, metadata) transcoded_request = _BaseEvaluationServiceRestTransport._BaseGetLocation._get_transcoded_request( http_options, request @@ -597,6 +687,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.aiplatform_v1beta1.EvaluationServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.EvaluationService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = EvaluationServiceRestTransport._GetLocation._get_response( self._host, @@ -616,6 +733,27 @@ def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_location(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.aiplatform_v1beta1.EvaluationServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.EvaluationService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -658,7 +796,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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -669,8 +807,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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -679,6 +819,7 @@ def __call__( http_options = ( _BaseEvaluationServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = self._interceptor.pre_list_locations(request, metadata) transcoded_request = _BaseEvaluationServiceRestTransport._BaseListLocations._get_transcoded_request( http_options, request @@ -689,6 +830,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.aiplatform_v1beta1.EvaluationServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.EvaluationService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = EvaluationServiceRestTransport._ListLocations._get_response( self._host, @@ -708,6 +876,27 @@ def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_list_locations(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.aiplatform_v1beta1.EvaluationServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.EvaluationService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -750,7 +939,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]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -761,8 +950,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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -771,6 +962,7 @@ def __call__( http_options = ( _BaseEvaluationServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_get_iam_policy(request, metadata) transcoded_request = _BaseEvaluationServiceRestTransport._BaseGetIamPolicy._get_transcoded_request( http_options, request @@ -785,6 +977,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.aiplatform_v1beta1.EvaluationServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.EvaluationService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = EvaluationServiceRestTransport._GetIamPolicy._get_response( self._host, @@ -805,6 +1024,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_iam_policy(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.aiplatform_v1beta1.EvaluationServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.EvaluationService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -847,7 +1087,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]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -858,8 +1098,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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -868,6 +1110,7 @@ def __call__( http_options = ( _BaseEvaluationServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_set_iam_policy(request, metadata) transcoded_request = _BaseEvaluationServiceRestTransport._BaseSetIamPolicy._get_transcoded_request( http_options, request @@ -882,6 +1125,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.aiplatform_v1beta1.EvaluationServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.EvaluationService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = EvaluationServiceRestTransport._SetIamPolicy._get_response( self._host, @@ -902,6 +1172,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_set_iam_policy(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.aiplatform_v1beta1.EvaluationServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.EvaluationService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -945,7 +1236,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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -956,8 +1247,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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -966,6 +1259,7 @@ def __call__( http_options = ( _BaseEvaluationServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -982,6 +1276,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.aiplatform_v1beta1.EvaluationServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.EvaluationService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = EvaluationServiceRestTransport._TestIamPermissions._get_response( self._host, @@ -1002,6 +1323,27 @@ def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_test_iam_permissions(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.aiplatform_v1beta1.EvaluationServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.EvaluationService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1044,7 +1386,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 cancel operation method over HTTP. @@ -1055,13 +1397,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 = ( _BaseEvaluationServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = self._interceptor.pre_cancel_operation( request, metadata ) @@ -1074,6 +1419,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.aiplatform_v1beta1.EvaluationServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.EvaluationService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = EvaluationServiceRestTransport._CancelOperation._get_response( self._host, @@ -1131,7 +1503,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. @@ -1142,13 +1514,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 = ( _BaseEvaluationServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = self._interceptor.pre_delete_operation( request, metadata ) @@ -1161,6 +1536,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.aiplatform_v1beta1.EvaluationServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.EvaluationService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = EvaluationServiceRestTransport._DeleteOperation._get_response( self._host, @@ -1217,7 +1619,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. @@ -1228,8 +1630,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. @@ -1238,6 +1642,7 @@ def __call__( http_options = ( _BaseEvaluationServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = self._interceptor.pre_get_operation(request, metadata) transcoded_request = _BaseEvaluationServiceRestTransport._BaseGetOperation._get_transcoded_request( http_options, request @@ -1248,6 +1653,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.aiplatform_v1beta1.EvaluationServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.EvaluationService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = EvaluationServiceRestTransport._GetOperation._get_response( self._host, @@ -1267,6 +1699,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.aiplatform_v1beta1.EvaluationServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.EvaluationService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1309,7 +1762,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. @@ -1320,8 +1773,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. @@ -1330,6 +1785,7 @@ def __call__( http_options = ( _BaseEvaluationServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = self._interceptor.pre_list_operations(request, metadata) transcoded_request = _BaseEvaluationServiceRestTransport._BaseListOperations._get_transcoded_request( http_options, request @@ -1340,6 +1796,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.aiplatform_v1beta1.EvaluationServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.EvaluationService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = EvaluationServiceRestTransport._ListOperations._get_response( self._host, @@ -1359,6 +1842,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.aiplatform_v1beta1.EvaluationServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.EvaluationService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1401,7 +1905,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 wait operation method over HTTP. @@ -1412,8 +1916,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 WaitOperation method. @@ -1422,6 +1928,7 @@ def __call__( http_options = ( _BaseEvaluationServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = self._interceptor.pre_wait_operation(request, metadata) transcoded_request = _BaseEvaluationServiceRestTransport._BaseWaitOperation._get_transcoded_request( http_options, request @@ -1432,6 +1939,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.aiplatform_v1beta1.EvaluationServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.EvaluationService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = EvaluationServiceRestTransport._WaitOperation._get_response( self._host, @@ -1451,6 +1985,27 @@ def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = self._interceptor.post_wait_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.aiplatform_v1beta1.EvaluationServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.EvaluationService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1beta1/services/evaluation_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1beta1/services/evaluation_service/transports/rest_asyncio.py index c9c6046a9c..e5d868ce52 100644 --- a/google/cloud/aiplatform_v1beta1/services/evaluation_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/evaluation_service/transports/rest_asyncio.py @@ -56,6 +56,18 @@ from .base import DEFAULT_CLIENT_INFO as BASE_DEFAULT_CLIENT_INFO + +import logging + +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__) + try: OptionalRetry = Union[retries.AsyncRetry, gapic_v1.method._MethodDefault, None] except AttributeError: # pragma: NO COVER @@ -100,8 +112,11 @@ async def post_evaluate_instances(self, response): async def pre_evaluate_instances( self, request: evaluation_service.EvaluateInstancesRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[evaluation_service.EvaluateInstancesRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + evaluation_service.EvaluateInstancesRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for evaluate_instances Override in a subclass to manipulate the request or metadata @@ -123,8 +138,10 @@ async def post_evaluate_instances( async def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -146,8 +163,10 @@ async def post_get_location( async def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -169,8 +188,10 @@ async def post_list_locations( async def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -192,8 +213,10 @@ async def post_get_iam_policy( async def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -215,8 +238,11 @@ async def post_set_iam_policy( async def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -238,8 +264,10 @@ async def post_test_iam_permissions( async def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -259,8 +287,10 @@ async def post_cancel_operation(self, response: None) -> None: async 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 @@ -280,8 +310,10 @@ async def post_delete_operation(self, response: None) -> None: async 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 @@ -303,8 +335,10 @@ async def post_get_operation( async 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 @@ -326,8 +360,10 @@ async def post_list_operations( async def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -510,7 +546,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> evaluation_service.EvaluateInstancesResponse: r"""Call the evaluate instances method over HTTP. @@ -521,8 +557,10 @@ async def __call__( 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: ~.evaluation_service.EvaluateInstancesResponse: @@ -534,6 +572,7 @@ async def __call__( http_options = ( _BaseEvaluationServiceRestTransport._BaseEvaluateInstances._get_http_options() ) + request, metadata = await self._interceptor.pre_evaluate_instances( request, metadata ) @@ -550,6 +589,33 @@ async 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.aiplatform_v1beta1.EvaluationServiceClient.EvaluateInstances", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.EvaluationService", + "rpcName": "EvaluateInstances", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncEvaluationServiceRestTransport._EvaluateInstances._get_response( self._host, @@ -578,6 +644,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_evaluate_instances(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + evaluation_service.EvaluateInstancesResponse.to_json(response) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.EvaluationServiceAsyncClient.evaluate_instances", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.EvaluationService", + "rpcName": "EvaluateInstances", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp @property @@ -629,7 +719,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -640,8 +730,10 @@ async def __call__( 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: locations_pb2.Location: Response from GetLocation method. @@ -650,6 +742,7 @@ async def __call__( http_options = ( _BaseEvaluationServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_location( request, metadata ) @@ -662,6 +755,33 @@ async 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.aiplatform_v1beta1.EvaluationServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.EvaluationService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncEvaluationServiceRestTransport._GetLocation._get_response( @@ -689,6 +809,27 @@ async def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_location(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.aiplatform_v1beta1.EvaluationServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.EvaluationService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -731,7 +872,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -742,8 +883,10 @@ async def __call__( 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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -752,6 +895,7 @@ async def __call__( http_options = ( _BaseEvaluationServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_locations( request, metadata ) @@ -764,6 +908,33 @@ async 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.aiplatform_v1beta1.EvaluationServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.EvaluationService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncEvaluationServiceRestTransport._ListLocations._get_response( @@ -791,6 +962,27 @@ async def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_list_locations(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.aiplatform_v1beta1.EvaluationServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.EvaluationService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -834,7 +1026,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -845,8 +1037,10 @@ async def __call__( 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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -855,6 +1049,7 @@ async def __call__( http_options = ( _BaseEvaluationServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_get_iam_policy( request, metadata ) @@ -871,6 +1066,33 @@ async 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.aiplatform_v1beta1.EvaluationServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.EvaluationService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncEvaluationServiceRestTransport._GetIamPolicy._get_response( @@ -899,6 +1121,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_iam_policy(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.aiplatform_v1beta1.EvaluationServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.EvaluationService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -942,7 +1185,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -953,8 +1196,10 @@ async def __call__( 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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -963,6 +1208,7 @@ async def __call__( http_options = ( _BaseEvaluationServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_set_iam_policy( request, metadata ) @@ -979,6 +1225,33 @@ async 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.aiplatform_v1beta1.EvaluationServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.EvaluationService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncEvaluationServiceRestTransport._SetIamPolicy._get_response( @@ -1007,6 +1280,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_set_iam_policy(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.aiplatform_v1beta1.EvaluationServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.EvaluationService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1050,7 +1344,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -1061,8 +1355,10 @@ async def __call__( 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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -1071,6 +1367,7 @@ async def __call__( http_options = ( _BaseEvaluationServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = await self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -1087,6 +1384,33 @@ async 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.aiplatform_v1beta1.EvaluationServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.EvaluationService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncEvaluationServiceRestTransport._TestIamPermissions._get_response( self._host, @@ -1113,6 +1437,27 @@ async def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_test_iam_permissions(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.aiplatform_v1beta1.EvaluationServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.EvaluationService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1155,7 +1500,7 @@ async 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 cancel operation method over HTTP. @@ -1166,13 +1511,16 @@ async def __call__( 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`. """ http_options = ( _BaseEvaluationServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_cancel_operation( request, metadata ) @@ -1185,6 +1533,33 @@ async 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.aiplatform_v1beta1.EvaluationServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.EvaluationService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncEvaluationServiceRestTransport._CancelOperation._get_response( self._host, @@ -1248,7 +1623,7 @@ async 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. @@ -1259,13 +1634,16 @@ async def __call__( 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`. """ http_options = ( _BaseEvaluationServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_operation( request, metadata ) @@ -1278,6 +1656,33 @@ async 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.aiplatform_v1beta1.EvaluationServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.EvaluationService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncEvaluationServiceRestTransport._DeleteOperation._get_response( self._host, @@ -1341,7 +1746,7 @@ async 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. @@ -1352,8 +1757,10 @@ async def __call__( 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: Response from GetOperation method. @@ -1362,6 +1769,7 @@ async def __call__( http_options = ( _BaseEvaluationServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_operation( request, metadata ) @@ -1374,6 +1782,33 @@ async 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.aiplatform_v1beta1.EvaluationServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.EvaluationService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncEvaluationServiceRestTransport._GetOperation._get_response( @@ -1401,6 +1836,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1beta1.EvaluationServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.EvaluationService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1443,7 +1899,7 @@ async 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. @@ -1454,8 +1910,10 @@ async def __call__( 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 from ListOperations method. @@ -1464,6 +1922,7 @@ async def __call__( http_options = ( _BaseEvaluationServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_operations( request, metadata ) @@ -1476,6 +1935,33 @@ async 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.aiplatform_v1beta1.EvaluationServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.EvaluationService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncEvaluationServiceRestTransport._ListOperations._get_response( @@ -1503,6 +1989,27 @@ async def __call__( resp = operations_pb2.ListOperationsResponse() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1beta1.EvaluationServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.EvaluationService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1545,7 +2052,7 @@ async 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 wait operation method over HTTP. @@ -1556,8 +2063,10 @@ async def __call__( 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: Response from WaitOperation method. @@ -1566,6 +2075,7 @@ async def __call__( http_options = ( _BaseEvaluationServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_wait_operation( request, metadata ) @@ -1578,6 +2088,33 @@ async 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.aiplatform_v1beta1.EvaluationServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.EvaluationService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncEvaluationServiceRestTransport._WaitOperation._get_response( @@ -1605,6 +2142,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_wait_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.aiplatform_v1beta1.EvaluationServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.EvaluationService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1beta1/services/evaluation_service/transports/rest_base.py b/google/cloud/aiplatform_v1beta1/services/evaluation_service/transports/rest_base.py index ed5022d6df..2888cf0921 100644 --- a/google/cloud/aiplatform_v1beta1/services/evaluation_service/transports/rest_base.py +++ b/google/cloud/aiplatform_v1beta1/services/evaluation_service/transports/rest_base.py @@ -1066,6 +1066,10 @@ def _get_http_options(): "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -1282,6 +1286,10 @@ def _get_http_options(): "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -1507,6 +1515,10 @@ def _get_http_options(): "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}", @@ -1723,6 +1735,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, ] return http_options @@ -1940,6 +1956,10 @@ def _get_http_options(): "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*}/operations", @@ -2156,6 +2176,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*}/operations", + }, ] return http_options @@ -2373,6 +2397,10 @@ def _get_http_options(): "method": "post", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}:wait", @@ -2585,6 +2613,10 @@ def _get_http_options(): "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, ] return http_options diff --git a/google/cloud/aiplatform_v1beta1/services/extension_execution_service/async_client.py b/google/cloud/aiplatform_v1beta1/services/extension_execution_service/async_client.py index 9c1c11787a..4960271db9 100644 --- a/google/cloud/aiplatform_v1beta1/services/extension_execution_service/async_client.py +++ b/google/cloud/aiplatform_v1beta1/services/extension_execution_service/async_client.py @@ -13,6 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging as std_logging from collections import OrderedDict import re from typing import ( @@ -53,6 +54,15 @@ from .transports.grpc_asyncio import ExtensionExecutionServiceGrpcAsyncIOTransport from .client import ExtensionExecutionServiceClient +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 ExtensionExecutionServiceAsyncClient: """A service for Extension execution.""" @@ -278,6 +288,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.aiplatform_v1beta1.ExtensionExecutionServiceAsyncClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ExtensionExecutionService", + "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.aiplatform.v1beta1.ExtensionExecutionService", + "credentialsType": None, + }, + ) + async def execute_extension( self, request: Optional[ @@ -288,7 +320,7 @@ async def execute_extension( operation_id: 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]]] = (), ) -> extension_execution_service.ExecuteExtensionResponse: r"""Executes the request against a given extension. @@ -341,8 +373,10 @@ async def sample_execute_extension(): 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.aiplatform_v1beta1.types.ExecuteExtensionResponse: @@ -408,7 +442,7 @@ async def query_extension( contents: Optional[MutableSequence[content.Content]] = 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]]] = (), ) -> extension_execution_service.QueryExtensionResponse: r"""Queries an extension with a default controller. @@ -467,8 +501,10 @@ async def sample_query_extension(): 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.aiplatform_v1beta1.types.QueryExtensionResponse: @@ -530,7 +566,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. @@ -541,8 +577,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. @@ -583,7 +621,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. @@ -594,8 +632,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. @@ -636,7 +676,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. @@ -652,8 +692,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 """ @@ -690,7 +732,7 @@ async def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -705,8 +747,10 @@ async def cancel_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 """ @@ -743,7 +787,7 @@ async def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -760,8 +804,10 @@ async def wait_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. @@ -802,7 +848,7 @@ async def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -815,8 +861,10 @@ async def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -921,7 +969,7 @@ async def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -935,8 +983,10 @@ async def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -1041,7 +1091,7 @@ async def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -1056,8 +1106,10 @@ async def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -1101,7 +1153,7 @@ async def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -1112,8 +1164,10 @@ async def get_location( 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: ~.location_pb2.Location: Location object. @@ -1154,7 +1208,7 @@ async def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -1165,8 +1219,10 @@ async def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1beta1/services/extension_execution_service/client.py b/google/cloud/aiplatform_v1beta1/services/extension_execution_service/client.py index cbd4716382..80992c4c26 100644 --- a/google/cloud/aiplatform_v1beta1/services/extension_execution_service/client.py +++ b/google/cloud/aiplatform_v1beta1/services/extension_execution_service/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 ( @@ -48,6 +49,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.cloud.aiplatform_v1beta1.types import content from google.cloud.aiplatform_v1beta1.types import extension_execution_service from google.cloud.location import locations_pb2 # type: ignore @@ -627,6 +637,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( @@ -718,6 +732,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.aiplatform_v1beta1.ExtensionExecutionServiceClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ExtensionExecutionService", + "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.aiplatform.v1beta1.ExtensionExecutionService", + "credentialsType": None, + }, + ) + def execute_extension( self, request: Optional[ @@ -728,7 +765,7 @@ def execute_extension( operation_id: 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]]] = (), ) -> extension_execution_service.ExecuteExtensionResponse: r"""Executes the request against a given extension. @@ -781,8 +818,10 @@ def sample_execute_extension(): 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.aiplatform_v1beta1.types.ExecuteExtensionResponse: @@ -845,7 +884,7 @@ def query_extension( contents: Optional[MutableSequence[content.Content]] = 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]]] = (), ) -> extension_execution_service.QueryExtensionResponse: r"""Queries an extension with a default controller. @@ -904,8 +943,10 @@ def sample_query_extension(): 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.aiplatform_v1beta1.types.QueryExtensionResponse: @@ -977,7 +1018,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. @@ -988,8 +1029,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. @@ -1030,7 +1073,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. @@ -1041,8 +1084,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. @@ -1083,7 +1128,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. @@ -1099,8 +1144,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 """ @@ -1137,7 +1184,7 @@ def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -1152,8 +1199,10 @@ def cancel_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 """ @@ -1190,7 +1239,7 @@ def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -1207,8 +1256,10 @@ def wait_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. @@ -1249,7 +1300,7 @@ def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -1262,8 +1313,10 @@ def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -1368,7 +1421,7 @@ def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -1382,8 +1435,10 @@ def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -1488,7 +1543,7 @@ def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -1503,8 +1558,10 @@ def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -1546,7 +1603,7 @@ def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -1557,8 +1614,10 @@ def get_location( 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: ~.location_pb2.Location: Location object. @@ -1599,7 +1658,7 @@ def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -1610,8 +1669,10 @@ def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1beta1/services/extension_execution_service/transports/grpc.py b/google/cloud/aiplatform_v1beta1/services/extension_execution_service/transports/grpc.py index ba583f6f72..8089005f31 100644 --- a/google/cloud/aiplatform_v1beta1/services/extension_execution_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1beta1/services/extension_execution_service/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 import warnings from typing import Callable, Dict, Optional, Sequence, Tuple, Union @@ -21,8 +24,11 @@ import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from google.cloud.aiplatform_v1beta1.types import extension_execution_service from google.cloud.location import locations_pb2 # type: ignore @@ -31,6 +37,81 @@ from google.longrunning import operations_pb2 # type: ignore from .base import ExtensionExecutionServiceTransport, DEFAULT_CLIENT_INFO +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.aiplatform.v1beta1.ExtensionExecutionService", + "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.aiplatform.v1beta1.ExtensionExecutionService", + "rpcName": client_call_details.method, + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class ExtensionExecutionServiceGrpcTransport(ExtensionExecutionServiceTransport): """gRPC backend transport for ExtensionExecutionService. @@ -184,7 +265,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 @@ -261,7 +347,7 @@ def execute_extension( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "execute_extension" not in self._stubs: - self._stubs["execute_extension"] = self.grpc_channel.unary_unary( + self._stubs["execute_extension"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.ExtensionExecutionService/ExecuteExtension", request_serializer=extension_execution_service.ExecuteExtensionRequest.serialize, response_deserializer=extension_execution_service.ExecuteExtensionResponse.deserialize, @@ -290,7 +376,7 @@ def query_extension( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "query_extension" not in self._stubs: - self._stubs["query_extension"] = self.grpc_channel.unary_unary( + self._stubs["query_extension"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.ExtensionExecutionService/QueryExtension", request_serializer=extension_execution_service.QueryExtensionRequest.serialize, response_deserializer=extension_execution_service.QueryExtensionResponse.deserialize, @@ -298,7 +384,7 @@ def query_extension( return self._stubs["query_extension"] def close(self): - self.grpc_channel.close() + self._logged_channel.close() @property def delete_operation( @@ -310,7 +396,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, @@ -327,7 +413,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -344,7 +430,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -361,7 +447,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, @@ -380,7 +466,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, @@ -399,7 +485,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -416,7 +502,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -441,7 +527,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -467,7 +553,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -496,7 +582,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1beta1/services/extension_execution_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1beta1/services/extension_execution_service/transports/grpc_asyncio.py index f4f76613c3..a03bf898ca 100644 --- a/google/cloud/aiplatform_v1beta1/services/extension_execution_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/extension_execution_service/transports/grpc_asyncio.py @@ -14,6 +14,9 @@ # limitations under the License. # import inspect +import json +import pickle +import logging as std_logging import warnings from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union @@ -23,8 +26,11 @@ from google.api_core import retry_async as retries from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from grpc.experimental import aio # type: ignore from google.cloud.aiplatform_v1beta1.types import extension_execution_service @@ -35,6 +41,82 @@ from .base import ExtensionExecutionServiceTransport, DEFAULT_CLIENT_INFO from .grpc import ExtensionExecutionServiceGrpcTransport +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.aiplatform.v1beta1.ExtensionExecutionService", + "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.aiplatform.v1beta1.ExtensionExecutionService", + "rpcName": str(client_call_details.method), + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class ExtensionExecutionServiceGrpcAsyncIOTransport(ExtensionExecutionServiceTransport): """gRPC AsyncIO backend transport for ExtensionExecutionService. @@ -231,10 +313,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 @@ -269,7 +354,7 @@ def execute_extension( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "execute_extension" not in self._stubs: - self._stubs["execute_extension"] = self.grpc_channel.unary_unary( + self._stubs["execute_extension"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.ExtensionExecutionService/ExecuteExtension", request_serializer=extension_execution_service.ExecuteExtensionRequest.serialize, response_deserializer=extension_execution_service.ExecuteExtensionResponse.deserialize, @@ -298,7 +383,7 @@ def query_extension( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "query_extension" not in self._stubs: - self._stubs["query_extension"] = self.grpc_channel.unary_unary( + self._stubs["query_extension"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.ExtensionExecutionService/QueryExtension", request_serializer=extension_execution_service.QueryExtensionRequest.serialize, response_deserializer=extension_execution_service.QueryExtensionResponse.deserialize, @@ -376,7 +461,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: @@ -392,7 +477,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, @@ -409,7 +494,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -426,7 +511,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -443,7 +528,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, @@ -462,7 +547,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, @@ -481,7 +566,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -498,7 +583,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -523,7 +608,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -549,7 +634,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -578,7 +663,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1beta1/services/extension_execution_service/transports/rest.py b/google/cloud/aiplatform_v1beta1/services/extension_execution_service/transports/rest.py index 50b401743a..6b9c38c56a 100644 --- a/google/cloud/aiplatform_v1beta1/services/extension_execution_service/transports/rest.py +++ b/google/cloud/aiplatform_v1beta1/services/extension_execution_service/transports/rest.py @@ -13,9 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging +import json # type: ignore from google.auth.transport.requests import AuthorizedSession # type: ignore -import json # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.api_core import exceptions as core_exceptions from google.api_core import retry as retries @@ -46,6 +47,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, @@ -94,9 +103,10 @@ def post_query_extension(self, response): def pre_execute_extension( self, request: extension_execution_service.ExecuteExtensionRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - extension_execution_service.ExecuteExtensionRequest, Sequence[Tuple[str, str]] + extension_execution_service.ExecuteExtensionRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for execute_extension @@ -119,9 +129,10 @@ def post_execute_extension( def pre_query_extension( self, request: extension_execution_service.QueryExtensionRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - extension_execution_service.QueryExtensionRequest, Sequence[Tuple[str, str]] + extension_execution_service.QueryExtensionRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for query_extension @@ -144,8 +155,10 @@ def post_query_extension( def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -167,8 +180,10 @@ def post_get_location( def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -190,8 +205,10 @@ def post_list_locations( def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -211,8 +228,10 @@ def post_get_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -232,8 +251,11 @@ def post_set_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -255,8 +277,10 @@ def post_test_iam_permissions( def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -276,8 +300,10 @@ def post_cancel_operation(self, response: None) -> None: 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 @@ -297,8 +323,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 @@ -320,8 +348,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 @@ -343,8 +373,10 @@ def post_list_operations( def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -489,7 +521,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]]] = (), ) -> extension_execution_service.ExecuteExtensionResponse: r"""Call the execute extension method over HTTP. @@ -500,8 +532,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: ~.extension_execution_service.ExecuteExtensionResponse: @@ -513,6 +547,7 @@ def __call__( http_options = ( _BaseExtensionExecutionServiceRestTransport._BaseExecuteExtension._get_http_options() ) + request, metadata = self._interceptor.pre_execute_extension( request, metadata ) @@ -529,6 +564,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.aiplatform_v1beta1.ExtensionExecutionServiceClient.ExecuteExtension", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ExtensionExecutionService", + "rpcName": "ExecuteExtension", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( ExtensionExecutionServiceRestTransport._ExecuteExtension._get_response( @@ -552,7 +614,33 @@ def __call__( pb_resp = extension_execution_service.ExecuteExtensionResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_execute_extension(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + extension_execution_service.ExecuteExtensionResponse.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.aiplatform_v1beta1.ExtensionExecutionServiceClient.execute_extension", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ExtensionExecutionService", + "rpcName": "ExecuteExtension", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _QueryExtension( @@ -592,7 +680,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]]] = (), ) -> extension_execution_service.QueryExtensionResponse: r"""Call the query extension method over HTTP. @@ -603,8 +691,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: ~.extension_execution_service.QueryExtensionResponse: @@ -616,6 +706,7 @@ def __call__( http_options = ( _BaseExtensionExecutionServiceRestTransport._BaseQueryExtension._get_http_options() ) + request, metadata = self._interceptor.pre_query_extension(request, metadata) transcoded_request = _BaseExtensionExecutionServiceRestTransport._BaseQueryExtension._get_transcoded_request( http_options, request @@ -630,6 +721,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.aiplatform_v1beta1.ExtensionExecutionServiceClient.QueryExtension", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ExtensionExecutionService", + "rpcName": "QueryExtension", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( ExtensionExecutionServiceRestTransport._QueryExtension._get_response( @@ -653,7 +771,33 @@ def __call__( pb_resp = extension_execution_service.QueryExtensionResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_query_extension(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + extension_execution_service.QueryExtensionResponse.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.aiplatform_v1beta1.ExtensionExecutionServiceClient.query_extension", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ExtensionExecutionService", + "rpcName": "QueryExtension", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp @property @@ -718,7 +862,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]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -729,8 +873,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: locations_pb2.Location: Response from GetLocation method. @@ -739,6 +885,7 @@ def __call__( http_options = ( _BaseExtensionExecutionServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = self._interceptor.pre_get_location(request, metadata) transcoded_request = _BaseExtensionExecutionServiceRestTransport._BaseGetLocation._get_transcoded_request( http_options, request @@ -749,6 +896,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.aiplatform_v1beta1.ExtensionExecutionServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ExtensionExecutionService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( ExtensionExecutionServiceRestTransport._GetLocation._get_response( @@ -770,6 +944,27 @@ def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_location(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.aiplatform_v1beta1.ExtensionExecutionServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ExtensionExecutionService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -812,7 +1007,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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -823,8 +1018,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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -833,6 +1030,7 @@ def __call__( http_options = ( _BaseExtensionExecutionServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = self._interceptor.pre_list_locations(request, metadata) transcoded_request = _BaseExtensionExecutionServiceRestTransport._BaseListLocations._get_transcoded_request( http_options, request @@ -843,6 +1041,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.aiplatform_v1beta1.ExtensionExecutionServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ExtensionExecutionService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( ExtensionExecutionServiceRestTransport._ListLocations._get_response( @@ -864,6 +1089,27 @@ def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_list_locations(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.aiplatform_v1beta1.ExtensionExecutionServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ExtensionExecutionService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -907,7 +1153,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]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -918,8 +1164,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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -928,6 +1176,7 @@ def __call__( http_options = ( _BaseExtensionExecutionServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_get_iam_policy(request, metadata) transcoded_request = _BaseExtensionExecutionServiceRestTransport._BaseGetIamPolicy._get_transcoded_request( http_options, request @@ -942,6 +1191,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.aiplatform_v1beta1.ExtensionExecutionServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ExtensionExecutionService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( ExtensionExecutionServiceRestTransport._GetIamPolicy._get_response( @@ -964,6 +1240,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_iam_policy(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.aiplatform_v1beta1.ExtensionExecutionServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ExtensionExecutionService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1007,7 +1304,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]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -1018,8 +1315,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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -1028,6 +1327,7 @@ def __call__( http_options = ( _BaseExtensionExecutionServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_set_iam_policy(request, metadata) transcoded_request = _BaseExtensionExecutionServiceRestTransport._BaseSetIamPolicy._get_transcoded_request( http_options, request @@ -1042,6 +1342,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.aiplatform_v1beta1.ExtensionExecutionServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ExtensionExecutionService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( ExtensionExecutionServiceRestTransport._SetIamPolicy._get_response( @@ -1064,6 +1391,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_set_iam_policy(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.aiplatform_v1beta1.ExtensionExecutionServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ExtensionExecutionService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1107,7 +1455,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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -1118,8 +1466,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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -1128,6 +1478,7 @@ def __call__( http_options = ( _BaseExtensionExecutionServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -1144,6 +1495,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.aiplatform_v1beta1.ExtensionExecutionServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ExtensionExecutionService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ExtensionExecutionServiceRestTransport._TestIamPermissions._get_response( self._host, @@ -1164,6 +1542,27 @@ def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_test_iam_permissions(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.aiplatform_v1beta1.ExtensionExecutionServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ExtensionExecutionService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1206,7 +1605,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 cancel operation method over HTTP. @@ -1217,13 +1616,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 = ( _BaseExtensionExecutionServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = self._interceptor.pre_cancel_operation( request, metadata ) @@ -1236,6 +1638,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.aiplatform_v1beta1.ExtensionExecutionServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ExtensionExecutionService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( ExtensionExecutionServiceRestTransport._CancelOperation._get_response( @@ -1295,7 +1724,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. @@ -1306,13 +1735,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 = ( _BaseExtensionExecutionServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = self._interceptor.pre_delete_operation( request, metadata ) @@ -1325,6 +1757,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.aiplatform_v1beta1.ExtensionExecutionServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ExtensionExecutionService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( ExtensionExecutionServiceRestTransport._DeleteOperation._get_response( @@ -1384,7 +1843,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. @@ -1395,8 +1854,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. @@ -1405,6 +1866,7 @@ def __call__( http_options = ( _BaseExtensionExecutionServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = self._interceptor.pre_get_operation(request, metadata) transcoded_request = _BaseExtensionExecutionServiceRestTransport._BaseGetOperation._get_transcoded_request( http_options, request @@ -1415,6 +1877,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.aiplatform_v1beta1.ExtensionExecutionServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ExtensionExecutionService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( ExtensionExecutionServiceRestTransport._GetOperation._get_response( @@ -1436,6 +1925,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.aiplatform_v1beta1.ExtensionExecutionServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ExtensionExecutionService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1478,7 +1988,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. @@ -1489,8 +1999,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. @@ -1499,6 +2011,7 @@ def __call__( http_options = ( _BaseExtensionExecutionServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = self._interceptor.pre_list_operations(request, metadata) transcoded_request = _BaseExtensionExecutionServiceRestTransport._BaseListOperations._get_transcoded_request( http_options, request @@ -1509,6 +2022,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.aiplatform_v1beta1.ExtensionExecutionServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ExtensionExecutionService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( ExtensionExecutionServiceRestTransport._ListOperations._get_response( @@ -1530,6 +2070,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.aiplatform_v1beta1.ExtensionExecutionServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ExtensionExecutionService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1572,7 +2133,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 wait operation method over HTTP. @@ -1583,8 +2144,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 WaitOperation method. @@ -1593,6 +2156,7 @@ def __call__( http_options = ( _BaseExtensionExecutionServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = self._interceptor.pre_wait_operation(request, metadata) transcoded_request = _BaseExtensionExecutionServiceRestTransport._BaseWaitOperation._get_transcoded_request( http_options, request @@ -1603,6 +2167,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.aiplatform_v1beta1.ExtensionExecutionServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ExtensionExecutionService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( ExtensionExecutionServiceRestTransport._WaitOperation._get_response( @@ -1624,6 +2215,27 @@ def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = self._interceptor.post_wait_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.aiplatform_v1beta1.ExtensionExecutionServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ExtensionExecutionService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1beta1/services/extension_execution_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1beta1/services/extension_execution_service/transports/rest_asyncio.py index 3230e1411d..dbbf8fc075 100644 --- a/google/cloud/aiplatform_v1beta1/services/extension_execution_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/extension_execution_service/transports/rest_asyncio.py @@ -56,6 +56,18 @@ from .base import DEFAULT_CLIENT_INFO as BASE_DEFAULT_CLIENT_INFO + +import logging + +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__) + try: OptionalRetry = Union[retries.AsyncRetry, gapic_v1.method._MethodDefault, None] except AttributeError: # pragma: NO COVER @@ -108,9 +120,10 @@ async def post_query_extension(self, response): async def pre_execute_extension( self, request: extension_execution_service.ExecuteExtensionRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - extension_execution_service.ExecuteExtensionRequest, Sequence[Tuple[str, str]] + extension_execution_service.ExecuteExtensionRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for execute_extension @@ -133,9 +146,10 @@ async def post_execute_extension( async def pre_query_extension( self, request: extension_execution_service.QueryExtensionRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - extension_execution_service.QueryExtensionRequest, Sequence[Tuple[str, str]] + extension_execution_service.QueryExtensionRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for query_extension @@ -158,8 +172,10 @@ async def post_query_extension( async def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -181,8 +197,10 @@ async def post_get_location( async def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -204,8 +222,10 @@ async def post_list_locations( async def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -227,8 +247,10 @@ async def post_get_iam_policy( async def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -250,8 +272,11 @@ async def post_set_iam_policy( async def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -273,8 +298,10 @@ async def post_test_iam_permissions( async def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -294,8 +321,10 @@ async def post_cancel_operation(self, response: None) -> None: async 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 @@ -315,8 +344,10 @@ async def post_delete_operation(self, response: None) -> None: async 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 @@ -338,8 +369,10 @@ async def post_get_operation( async 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 @@ -361,8 +394,10 @@ async def post_list_operations( async def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -554,7 +589,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> extension_execution_service.ExecuteExtensionResponse: r"""Call the execute extension method over HTTP. @@ -565,8 +600,10 @@ async def __call__( 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: ~.extension_execution_service.ExecuteExtensionResponse: @@ -578,6 +615,7 @@ async def __call__( http_options = ( _BaseExtensionExecutionServiceRestTransport._BaseExecuteExtension._get_http_options() ) + request, metadata = await self._interceptor.pre_execute_extension( request, metadata ) @@ -594,6 +632,33 @@ async 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.aiplatform_v1beta1.ExtensionExecutionServiceClient.ExecuteExtension", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ExtensionExecutionService", + "rpcName": "ExecuteExtension", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncExtensionExecutionServiceRestTransport._ExecuteExtension._get_response( self._host, @@ -622,6 +687,32 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_execute_extension(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + extension_execution_service.ExecuteExtensionResponse.to_json( + response + ) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.ExtensionExecutionServiceAsyncClient.execute_extension", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ExtensionExecutionService", + "rpcName": "ExecuteExtension", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _QueryExtension( @@ -661,7 +752,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> extension_execution_service.QueryExtensionResponse: r"""Call the query extension method over HTTP. @@ -672,8 +763,10 @@ async def __call__( 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: ~.extension_execution_service.QueryExtensionResponse: @@ -685,6 +778,7 @@ async def __call__( http_options = ( _BaseExtensionExecutionServiceRestTransport._BaseQueryExtension._get_http_options() ) + request, metadata = await self._interceptor.pre_query_extension( request, metadata ) @@ -701,6 +795,33 @@ async 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.aiplatform_v1beta1.ExtensionExecutionServiceClient.QueryExtension", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ExtensionExecutionService", + "rpcName": "QueryExtension", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncExtensionExecutionServiceRestTransport._QueryExtension._get_response( self._host, @@ -729,6 +850,32 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_query_extension(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + extension_execution_service.QueryExtensionResponse.to_json( + response + ) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.ExtensionExecutionServiceAsyncClient.query_extension", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ExtensionExecutionService", + "rpcName": "QueryExtension", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp @property @@ -789,7 +936,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -800,8 +947,10 @@ async def __call__( 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: locations_pb2.Location: Response from GetLocation method. @@ -810,6 +959,7 @@ async def __call__( http_options = ( _BaseExtensionExecutionServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_location( request, metadata ) @@ -822,6 +972,33 @@ async 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.aiplatform_v1beta1.ExtensionExecutionServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ExtensionExecutionService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncExtensionExecutionServiceRestTransport._GetLocation._get_response( self._host, @@ -847,6 +1024,27 @@ async def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_location(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.aiplatform_v1beta1.ExtensionExecutionServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ExtensionExecutionService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -889,7 +1087,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -900,8 +1098,10 @@ async def __call__( 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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -910,6 +1110,7 @@ async def __call__( http_options = ( _BaseExtensionExecutionServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_locations( request, metadata ) @@ -922,6 +1123,33 @@ async 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.aiplatform_v1beta1.ExtensionExecutionServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ExtensionExecutionService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncExtensionExecutionServiceRestTransport._ListLocations._get_response( self._host, @@ -947,6 +1175,27 @@ async def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_list_locations(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.aiplatform_v1beta1.ExtensionExecutionServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ExtensionExecutionService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -990,7 +1239,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -1001,8 +1250,10 @@ async def __call__( 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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -1011,6 +1262,7 @@ async def __call__( http_options = ( _BaseExtensionExecutionServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_get_iam_policy( request, metadata ) @@ -1027,6 +1279,33 @@ async 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.aiplatform_v1beta1.ExtensionExecutionServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ExtensionExecutionService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncExtensionExecutionServiceRestTransport._GetIamPolicy._get_response( self._host, @@ -1053,6 +1332,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_iam_policy(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.aiplatform_v1beta1.ExtensionExecutionServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ExtensionExecutionService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1096,7 +1396,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -1107,8 +1407,10 @@ async def __call__( 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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -1117,6 +1419,7 @@ async def __call__( http_options = ( _BaseExtensionExecutionServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_set_iam_policy( request, metadata ) @@ -1133,6 +1436,33 @@ async 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.aiplatform_v1beta1.ExtensionExecutionServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ExtensionExecutionService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncExtensionExecutionServiceRestTransport._SetIamPolicy._get_response( self._host, @@ -1159,6 +1489,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_set_iam_policy(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.aiplatform_v1beta1.ExtensionExecutionServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ExtensionExecutionService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1204,7 +1555,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -1215,8 +1566,10 @@ async def __call__( 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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -1225,6 +1578,7 @@ async def __call__( http_options = ( _BaseExtensionExecutionServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = await self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -1241,6 +1595,33 @@ async 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.aiplatform_v1beta1.ExtensionExecutionServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ExtensionExecutionService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncExtensionExecutionServiceRestTransport._TestIamPermissions._get_response( self._host, @@ -1267,6 +1648,27 @@ async def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_test_iam_permissions(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.aiplatform_v1beta1.ExtensionExecutionServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ExtensionExecutionService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1309,7 +1711,7 @@ async 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 cancel operation method over HTTP. @@ -1320,13 +1722,16 @@ async def __call__( 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`. """ http_options = ( _BaseExtensionExecutionServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_cancel_operation( request, metadata ) @@ -1339,6 +1744,33 @@ async 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.aiplatform_v1beta1.ExtensionExecutionServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ExtensionExecutionService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncExtensionExecutionServiceRestTransport._CancelOperation._get_response( self._host, @@ -1402,7 +1834,7 @@ async 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. @@ -1413,13 +1845,16 @@ async def __call__( 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`. """ http_options = ( _BaseExtensionExecutionServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_operation( request, metadata ) @@ -1432,6 +1867,33 @@ async 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.aiplatform_v1beta1.ExtensionExecutionServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ExtensionExecutionService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncExtensionExecutionServiceRestTransport._DeleteOperation._get_response( self._host, @@ -1495,7 +1957,7 @@ async 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. @@ -1506,8 +1968,10 @@ async def __call__( 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: Response from GetOperation method. @@ -1516,6 +1980,7 @@ async def __call__( http_options = ( _BaseExtensionExecutionServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_operation( request, metadata ) @@ -1528,6 +1993,33 @@ async 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.aiplatform_v1beta1.ExtensionExecutionServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ExtensionExecutionService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncExtensionExecutionServiceRestTransport._GetOperation._get_response( self._host, @@ -1553,6 +2045,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1beta1.ExtensionExecutionServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ExtensionExecutionService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1595,7 +2108,7 @@ async 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. @@ -1606,8 +2119,10 @@ async def __call__( 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 from ListOperations method. @@ -1616,6 +2131,7 @@ async def __call__( http_options = ( _BaseExtensionExecutionServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_operations( request, metadata ) @@ -1628,6 +2144,33 @@ async 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.aiplatform_v1beta1.ExtensionExecutionServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ExtensionExecutionService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncExtensionExecutionServiceRestTransport._ListOperations._get_response( self._host, @@ -1653,6 +2196,27 @@ async def __call__( resp = operations_pb2.ListOperationsResponse() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1beta1.ExtensionExecutionServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ExtensionExecutionService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1695,7 +2259,7 @@ async 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 wait operation method over HTTP. @@ -1706,8 +2270,10 @@ async def __call__( 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: Response from WaitOperation method. @@ -1716,6 +2282,7 @@ async def __call__( http_options = ( _BaseExtensionExecutionServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_wait_operation( request, metadata ) @@ -1728,6 +2295,33 @@ async 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.aiplatform_v1beta1.ExtensionExecutionServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ExtensionExecutionService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncExtensionExecutionServiceRestTransport._WaitOperation._get_response( self._host, @@ -1753,6 +2347,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_wait_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.aiplatform_v1beta1.ExtensionExecutionServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ExtensionExecutionService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1beta1/services/extension_execution_service/transports/rest_base.py b/google/cloud/aiplatform_v1beta1/services/extension_execution_service/transports/rest_base.py index 64d466182e..8a62d45a28 100644 --- a/google/cloud/aiplatform_v1beta1/services/extension_execution_service/transports/rest_base.py +++ b/google/cloud/aiplatform_v1beta1/services/extension_execution_service/transports/rest_base.py @@ -1123,6 +1123,10 @@ def _get_http_options(): "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -1339,6 +1343,10 @@ def _get_http_options(): "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -1564,6 +1572,10 @@ def _get_http_options(): "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}", @@ -1780,6 +1792,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, ] return http_options @@ -1997,6 +2013,10 @@ def _get_http_options(): "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*}/operations", @@ -2213,6 +2233,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*}/operations", + }, ] return http_options @@ -2430,6 +2454,10 @@ def _get_http_options(): "method": "post", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}:wait", @@ -2642,6 +2670,10 @@ def _get_http_options(): "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, ] return http_options diff --git a/google/cloud/aiplatform_v1beta1/services/extension_registry_service/async_client.py b/google/cloud/aiplatform_v1beta1/services/extension_registry_service/async_client.py index 84a485a7a9..3c3549561e 100644 --- a/google/cloud/aiplatform_v1beta1/services/extension_registry_service/async_client.py +++ b/google/cloud/aiplatform_v1beta1/services/extension_registry_service/async_client.py @@ -13,6 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging as std_logging from collections import OrderedDict import re from typing import ( @@ -62,6 +63,15 @@ from .transports.grpc_asyncio import ExtensionRegistryServiceGrpcAsyncIOTransport from .client import ExtensionRegistryServiceClient +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 ExtensionRegistryServiceAsyncClient: """A service for managing Vertex AI's Extension registry.""" @@ -287,6 +297,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.aiplatform_v1beta1.ExtensionRegistryServiceAsyncClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ExtensionRegistryService", + "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.aiplatform.v1beta1.ExtensionRegistryService", + "credentialsType": None, + }, + ) + async def import_extension( self, request: Optional[ @@ -297,7 +329,7 @@ async def import_extension( extension: Optional[gca_extension.Extension] = 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"""Imports an Extension. @@ -361,8 +393,10 @@ async def sample_import_extension(): 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: @@ -437,7 +471,7 @@ async def get_extension( 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]]] = (), ) -> extension.Extension: r"""Gets an Extension. @@ -481,8 +515,10 @@ async def sample_get_extension(): 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.aiplatform_v1beta1.types.Extension: @@ -546,7 +582,7 @@ async def list_extensions( 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.ListExtensionsAsyncPager: r"""Lists Extensions in a location. @@ -592,8 +628,10 @@ async def sample_list_extensions(): 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.aiplatform_v1beta1.services.extension_registry_service.pagers.ListExtensionsAsyncPager: @@ -671,7 +709,7 @@ async def update_extension( 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]]] = (), ) -> gca_extension.Extension: r"""Updates an Extension. @@ -739,8 +777,10 @@ async def sample_update_extension(): 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.aiplatform_v1beta1.types.Extension: @@ -808,7 +848,7 @@ async def delete_extension( 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"""Deletes an Extension. @@ -857,8 +897,10 @@ async def sample_delete_extension(): 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: @@ -936,7 +978,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. @@ -947,8 +989,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. @@ -989,7 +1033,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. @@ -1000,8 +1044,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. @@ -1042,7 +1088,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. @@ -1058,8 +1104,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 """ @@ -1096,7 +1144,7 @@ async def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -1111,8 +1159,10 @@ async def cancel_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 """ @@ -1149,7 +1199,7 @@ async def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -1166,8 +1216,10 @@ async def wait_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. @@ -1208,7 +1260,7 @@ async def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -1221,8 +1273,10 @@ async def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -1327,7 +1381,7 @@ async def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -1341,8 +1395,10 @@ async def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -1447,7 +1503,7 @@ async def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -1462,8 +1518,10 @@ async def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -1507,7 +1565,7 @@ async def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -1518,8 +1576,10 @@ async def get_location( 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: ~.location_pb2.Location: Location object. @@ -1560,7 +1620,7 @@ async def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -1571,8 +1631,10 @@ async def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1beta1/services/extension_registry_service/client.py b/google/cloud/aiplatform_v1beta1/services/extension_registry_service/client.py index 0f59fcd9bd..3f3056bc6e 100644 --- a/google/cloud/aiplatform_v1beta1/services/extension_registry_service/client.py +++ b/google/cloud/aiplatform_v1beta1/services/extension_registry_service/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 ( @@ -48,6 +49,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 as gac_operation # type: ignore from google.api_core import operation_async # type: ignore from google.cloud.aiplatform_v1beta1.services.extension_registry_service import pagers @@ -658,6 +668,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( @@ -749,6 +763,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.aiplatform_v1beta1.ExtensionRegistryServiceClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ExtensionRegistryService", + "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.aiplatform.v1beta1.ExtensionRegistryService", + "credentialsType": None, + }, + ) + def import_extension( self, request: Optional[ @@ -759,7 +796,7 @@ def import_extension( extension: Optional[gca_extension.Extension] = 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]]] = (), ) -> gac_operation.Operation: r"""Imports an Extension. @@ -823,8 +860,10 @@ def sample_import_extension(): 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: @@ -896,7 +935,7 @@ def get_extension( 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]]] = (), ) -> extension.Extension: r"""Gets an Extension. @@ -940,8 +979,10 @@ def sample_get_extension(): 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.aiplatform_v1beta1.types.Extension: @@ -1002,7 +1043,7 @@ def list_extensions( 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.ListExtensionsPager: r"""Lists Extensions in a location. @@ -1048,8 +1089,10 @@ def sample_list_extensions(): 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.aiplatform_v1beta1.services.extension_registry_service.pagers.ListExtensionsPager: @@ -1124,7 +1167,7 @@ def update_extension( 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]]] = (), ) -> gca_extension.Extension: r"""Updates an Extension. @@ -1192,8 +1235,10 @@ def sample_update_extension(): 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.aiplatform_v1beta1.types.Extension: @@ -1258,7 +1303,7 @@ def delete_extension( 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]]] = (), ) -> gac_operation.Operation: r"""Deletes an Extension. @@ -1307,8 +1352,10 @@ def sample_delete_extension(): 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: @@ -1396,7 +1443,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. @@ -1407,8 +1454,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. @@ -1449,7 +1498,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. @@ -1460,8 +1509,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. @@ -1502,7 +1553,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. @@ -1518,8 +1569,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 """ @@ -1556,7 +1609,7 @@ def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -1571,8 +1624,10 @@ def cancel_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 """ @@ -1609,7 +1664,7 @@ def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -1626,8 +1681,10 @@ def wait_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. @@ -1668,7 +1725,7 @@ def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -1681,8 +1738,10 @@ def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -1787,7 +1846,7 @@ def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -1801,8 +1860,10 @@ def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -1907,7 +1968,7 @@ def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -1922,8 +1983,10 @@ def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -1965,7 +2028,7 @@ def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -1976,8 +2039,10 @@ def get_location( 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: ~.location_pb2.Location: Location object. @@ -2018,7 +2083,7 @@ def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -2029,8 +2094,10 @@ def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1beta1/services/extension_registry_service/pagers.py b/google/cloud/aiplatform_v1beta1/services/extension_registry_service/pagers.py index 10fbd99851..d06d280bfc 100644 --- a/google/cloud/aiplatform_v1beta1/services/extension_registry_service/pagers.py +++ b/google/cloud/aiplatform_v1beta1/services/extension_registry_service/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 = extension_registry_service.ListExtensionsRequest(request) @@ -143,7 +145,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. @@ -157,8 +159,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 = extension_registry_service.ListExtensionsRequest(request) diff --git a/google/cloud/aiplatform_v1beta1/services/extension_registry_service/transports/grpc.py b/google/cloud/aiplatform_v1beta1/services/extension_registry_service/transports/grpc.py index 9fffd3e170..bb4b47d738 100644 --- a/google/cloud/aiplatform_v1beta1/services/extension_registry_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1beta1/services/extension_registry_service/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 import warnings from typing import Callable, Dict, Optional, Sequence, Tuple, Union @@ -22,8 +25,11 @@ import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from google.cloud.aiplatform_v1beta1.types import extension from google.cloud.aiplatform_v1beta1.types import extension as gca_extension @@ -34,6 +40,81 @@ from google.longrunning import operations_pb2 # type: ignore from .base import ExtensionRegistryServiceTransport, DEFAULT_CLIENT_INFO +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.aiplatform.v1beta1.ExtensionRegistryService", + "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.aiplatform.v1beta1.ExtensionRegistryService", + "rpcName": client_call_details.method, + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class ExtensionRegistryServiceGrpcTransport(ExtensionRegistryServiceTransport): """gRPC backend transport for ExtensionRegistryService. @@ -188,7 +269,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 @@ -252,7 +338,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 @@ -278,7 +366,7 @@ def import_extension( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "import_extension" not in self._stubs: - self._stubs["import_extension"] = self.grpc_channel.unary_unary( + self._stubs["import_extension"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.ExtensionRegistryService/ImportExtension", request_serializer=extension_registry_service.ImportExtensionRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -306,7 +394,7 @@ def get_extension( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_extension" not in self._stubs: - self._stubs["get_extension"] = self.grpc_channel.unary_unary( + self._stubs["get_extension"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.ExtensionRegistryService/GetExtension", request_serializer=extension_registry_service.GetExtensionRequest.serialize, response_deserializer=extension.Extension.deserialize, @@ -335,7 +423,7 @@ def list_extensions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_extensions" not in self._stubs: - self._stubs["list_extensions"] = self.grpc_channel.unary_unary( + self._stubs["list_extensions"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.ExtensionRegistryService/ListExtensions", request_serializer=extension_registry_service.ListExtensionsRequest.serialize, response_deserializer=extension_registry_service.ListExtensionsResponse.deserialize, @@ -363,7 +451,7 @@ def update_extension( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_extension" not in self._stubs: - self._stubs["update_extension"] = self.grpc_channel.unary_unary( + self._stubs["update_extension"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.ExtensionRegistryService/UpdateExtension", request_serializer=extension_registry_service.UpdateExtensionRequest.serialize, response_deserializer=gca_extension.Extension.deserialize, @@ -391,7 +479,7 @@ def delete_extension( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_extension" not in self._stubs: - self._stubs["delete_extension"] = self.grpc_channel.unary_unary( + self._stubs["delete_extension"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.ExtensionRegistryService/DeleteExtension", request_serializer=extension_registry_service.DeleteExtensionRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -399,7 +487,7 @@ def delete_extension( return self._stubs["delete_extension"] def close(self): - self.grpc_channel.close() + self._logged_channel.close() @property def delete_operation( @@ -411,7 +499,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, @@ -428,7 +516,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -445,7 +533,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -462,7 +550,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, @@ -481,7 +569,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, @@ -500,7 +588,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -517,7 +605,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -542,7 +630,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -568,7 +656,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -597,7 +685,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1beta1/services/extension_registry_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1beta1/services/extension_registry_service/transports/grpc_asyncio.py index c3ad1f2c1e..c647116113 100644 --- a/google/cloud/aiplatform_v1beta1/services/extension_registry_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/extension_registry_service/transports/grpc_asyncio.py @@ -14,6 +14,9 @@ # limitations under the License. # import inspect +import json +import pickle +import logging as std_logging import warnings from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union @@ -24,8 +27,11 @@ from google.api_core import operations_v1 from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from grpc.experimental import aio # type: ignore from google.cloud.aiplatform_v1beta1.types import extension @@ -38,6 +44,82 @@ from .base import ExtensionRegistryServiceTransport, DEFAULT_CLIENT_INFO from .grpc import ExtensionRegistryServiceGrpcTransport +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.aiplatform.v1beta1.ExtensionRegistryService", + "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.aiplatform.v1beta1.ExtensionRegistryService", + "rpcName": str(client_call_details.method), + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class ExtensionRegistryServiceGrpcAsyncIOTransport(ExtensionRegistryServiceTransport): """gRPC AsyncIO backend transport for ExtensionRegistryService. @@ -235,10 +317,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 @@ -261,7 +346,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. @@ -289,7 +374,7 @@ def import_extension( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "import_extension" not in self._stubs: - self._stubs["import_extension"] = self.grpc_channel.unary_unary( + self._stubs["import_extension"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.ExtensionRegistryService/ImportExtension", request_serializer=extension_registry_service.ImportExtensionRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -317,7 +402,7 @@ def get_extension( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_extension" not in self._stubs: - self._stubs["get_extension"] = self.grpc_channel.unary_unary( + self._stubs["get_extension"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.ExtensionRegistryService/GetExtension", request_serializer=extension_registry_service.GetExtensionRequest.serialize, response_deserializer=extension.Extension.deserialize, @@ -346,7 +431,7 @@ def list_extensions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_extensions" not in self._stubs: - self._stubs["list_extensions"] = self.grpc_channel.unary_unary( + self._stubs["list_extensions"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.ExtensionRegistryService/ListExtensions", request_serializer=extension_registry_service.ListExtensionsRequest.serialize, response_deserializer=extension_registry_service.ListExtensionsResponse.deserialize, @@ -375,7 +460,7 @@ def update_extension( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_extension" not in self._stubs: - self._stubs["update_extension"] = self.grpc_channel.unary_unary( + self._stubs["update_extension"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.ExtensionRegistryService/UpdateExtension", request_serializer=extension_registry_service.UpdateExtensionRequest.serialize, response_deserializer=gca_extension.Extension.deserialize, @@ -404,7 +489,7 @@ def delete_extension( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_extension" not in self._stubs: - self._stubs["delete_extension"] = self.grpc_channel.unary_unary( + self._stubs["delete_extension"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.ExtensionRegistryService/DeleteExtension", request_serializer=extension_registry_service.DeleteExtensionRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -497,7 +582,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: @@ -513,7 +598,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, @@ -530,7 +615,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -547,7 +632,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -564,7 +649,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, @@ -583,7 +668,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, @@ -602,7 +687,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -619,7 +704,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -644,7 +729,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -670,7 +755,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -699,7 +784,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1beta1/services/extension_registry_service/transports/rest.py b/google/cloud/aiplatform_v1beta1/services/extension_registry_service/transports/rest.py index 0016a89b4d..fba8c2138d 100644 --- a/google/cloud/aiplatform_v1beta1/services/extension_registry_service/transports/rest.py +++ b/google/cloud/aiplatform_v1beta1/services/extension_registry_service/transports/rest.py @@ -13,9 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging +import json # type: ignore from google.auth.transport.requests import AuthorizedSession # type: ignore -import json # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.api_core import exceptions as core_exceptions from google.api_core import retry as retries @@ -49,6 +50,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, @@ -121,9 +130,10 @@ def post_update_extension(self, response): def pre_delete_extension( self, request: extension_registry_service.DeleteExtensionRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - extension_registry_service.DeleteExtensionRequest, Sequence[Tuple[str, str]] + extension_registry_service.DeleteExtensionRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for delete_extension @@ -146,9 +156,10 @@ def post_delete_extension( def pre_get_extension( self, request: extension_registry_service.GetExtensionRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - extension_registry_service.GetExtensionRequest, Sequence[Tuple[str, str]] + extension_registry_service.GetExtensionRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for get_extension @@ -169,9 +180,10 @@ def post_get_extension(self, response: extension.Extension) -> extension.Extensi def pre_import_extension( self, request: extension_registry_service.ImportExtensionRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - extension_registry_service.ImportExtensionRequest, Sequence[Tuple[str, str]] + extension_registry_service.ImportExtensionRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for import_extension @@ -194,9 +206,10 @@ def post_import_extension( def pre_list_extensions( self, request: extension_registry_service.ListExtensionsRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - extension_registry_service.ListExtensionsRequest, Sequence[Tuple[str, str]] + extension_registry_service.ListExtensionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for list_extensions @@ -219,9 +232,10 @@ def post_list_extensions( def pre_update_extension( self, request: extension_registry_service.UpdateExtensionRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - extension_registry_service.UpdateExtensionRequest, Sequence[Tuple[str, str]] + extension_registry_service.UpdateExtensionRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for update_extension @@ -244,8 +258,10 @@ def post_update_extension( def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -267,8 +283,10 @@ def post_get_location( def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -290,8 +308,10 @@ def post_list_locations( def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -311,8 +331,10 @@ def post_get_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -332,8 +354,11 @@ def post_set_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -355,8 +380,10 @@ def post_test_iam_permissions( def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -376,8 +403,10 @@ def post_cancel_operation(self, response: None) -> None: 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 @@ -397,8 +426,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 @@ -420,8 +451,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 @@ -443,8 +476,10 @@ def post_list_operations( def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -1124,6 +1159,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -1340,6 +1379,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -1546,6 +1589,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}", @@ -1762,6 +1809,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, ], "google.longrunning.Operations.ListOperations": [ { @@ -1960,6 +2011,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*}/operations", @@ -2176,6 +2231,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*}/operations", + }, ], "google.longrunning.Operations.WaitOperation": [ { @@ -2374,6 +2433,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "post", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}:wait", @@ -2586,6 +2649,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, ], } @@ -2641,7 +2708,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 extension method over HTTP. @@ -2652,8 +2719,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: @@ -2666,6 +2735,7 @@ def __call__( http_options = ( _BaseExtensionRegistryServiceRestTransport._BaseDeleteExtension._get_http_options() ) + request, metadata = self._interceptor.pre_delete_extension( request, metadata ) @@ -2678,6 +2748,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.aiplatform_v1beta1.ExtensionRegistryServiceClient.DeleteExtension", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ExtensionRegistryService", + "rpcName": "DeleteExtension", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( ExtensionRegistryServiceRestTransport._DeleteExtension._get_response( @@ -2698,7 +2795,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_extension(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.aiplatform_v1beta1.ExtensionRegistryServiceClient.delete_extension", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ExtensionRegistryService", + "rpcName": "DeleteExtension", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _GetExtension( @@ -2737,7 +2856,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]]] = (), ) -> extension.Extension: r"""Call the get extension method over HTTP. @@ -2748,8 +2867,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: ~.extension.Extension: @@ -2762,6 +2883,7 @@ def __call__( http_options = ( _BaseExtensionRegistryServiceRestTransport._BaseGetExtension._get_http_options() ) + request, metadata = self._interceptor.pre_get_extension(request, metadata) transcoded_request = _BaseExtensionRegistryServiceRestTransport._BaseGetExtension._get_transcoded_request( http_options, request @@ -2772,6 +2894,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.aiplatform_v1beta1.ExtensionRegistryServiceClient.GetExtension", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ExtensionRegistryService", + "rpcName": "GetExtension", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( ExtensionRegistryServiceRestTransport._GetExtension._get_response( @@ -2794,7 +2943,29 @@ def __call__( pb_resp = extension.Extension.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_extension(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = extension.Extension.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.aiplatform_v1beta1.ExtensionRegistryServiceClient.get_extension", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ExtensionRegistryService", + "rpcName": "GetExtension", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ImportExtension( @@ -2834,7 +3005,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 import extension method over HTTP. @@ -2845,8 +3016,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: @@ -2859,6 +3032,7 @@ def __call__( http_options = ( _BaseExtensionRegistryServiceRestTransport._BaseImportExtension._get_http_options() ) + request, metadata = self._interceptor.pre_import_extension( request, metadata ) @@ -2875,6 +3049,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.aiplatform_v1beta1.ExtensionRegistryServiceClient.ImportExtension", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ExtensionRegistryService", + "rpcName": "ImportExtension", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( ExtensionRegistryServiceRestTransport._ImportExtension._get_response( @@ -2896,7 +3097,29 @@ def __call__( # Return the response resp = operations_pb2.Operation() json_format.Parse(response.content, resp, ignore_unknown_fields=True) + resp = self._interceptor.post_import_extension(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.aiplatform_v1beta1.ExtensionRegistryServiceClient.import_extension", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ExtensionRegistryService", + "rpcName": "ImportExtension", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListExtensions( @@ -2935,7 +3158,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]]] = (), ) -> extension_registry_service.ListExtensionsResponse: r"""Call the list extensions method over HTTP. @@ -2946,8 +3169,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: ~.extension_registry_service.ListExtensionsResponse: @@ -2959,6 +3184,7 @@ def __call__( http_options = ( _BaseExtensionRegistryServiceRestTransport._BaseListExtensions._get_http_options() ) + request, metadata = self._interceptor.pre_list_extensions(request, metadata) transcoded_request = _BaseExtensionRegistryServiceRestTransport._BaseListExtensions._get_transcoded_request( http_options, request @@ -2969,6 +3195,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.aiplatform_v1beta1.ExtensionRegistryServiceClient.ListExtensions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ExtensionRegistryService", + "rpcName": "ListExtensions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( ExtensionRegistryServiceRestTransport._ListExtensions._get_response( @@ -2991,7 +3244,33 @@ def __call__( pb_resp = extension_registry_service.ListExtensionsResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_extensions(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + extension_registry_service.ListExtensionsResponse.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.aiplatform_v1beta1.ExtensionRegistryServiceClient.list_extensions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ExtensionRegistryService", + "rpcName": "ListExtensions", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _UpdateExtension( @@ -3031,7 +3310,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]]] = (), ) -> gca_extension.Extension: r"""Call the update extension method over HTTP. @@ -3042,8 +3321,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: ~.gca_extension.Extension: @@ -3056,6 +3337,7 @@ def __call__( http_options = ( _BaseExtensionRegistryServiceRestTransport._BaseUpdateExtension._get_http_options() ) + request, metadata = self._interceptor.pre_update_extension( request, metadata ) @@ -3072,6 +3354,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.aiplatform_v1beta1.ExtensionRegistryServiceClient.UpdateExtension", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ExtensionRegistryService", + "rpcName": "UpdateExtension", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( ExtensionRegistryServiceRestTransport._UpdateExtension._get_response( @@ -3095,7 +3404,29 @@ def __call__( pb_resp = gca_extension.Extension.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_update_extension(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gca_extension.Extension.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.aiplatform_v1beta1.ExtensionRegistryServiceClient.update_extension", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ExtensionRegistryService", + "rpcName": "UpdateExtension", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp @property @@ -3189,7 +3520,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]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -3200,8 +3531,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: locations_pb2.Location: Response from GetLocation method. @@ -3210,6 +3543,7 @@ def __call__( http_options = ( _BaseExtensionRegistryServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = self._interceptor.pre_get_location(request, metadata) transcoded_request = _BaseExtensionRegistryServiceRestTransport._BaseGetLocation._get_transcoded_request( http_options, request @@ -3220,6 +3554,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.aiplatform_v1beta1.ExtensionRegistryServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ExtensionRegistryService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ExtensionRegistryServiceRestTransport._GetLocation._get_response( self._host, @@ -3239,6 +3600,27 @@ def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_location(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.aiplatform_v1beta1.ExtensionRegistryServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ExtensionRegistryService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3281,7 +3663,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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -3292,8 +3674,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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -3302,6 +3686,7 @@ def __call__( http_options = ( _BaseExtensionRegistryServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = self._interceptor.pre_list_locations(request, metadata) transcoded_request = _BaseExtensionRegistryServiceRestTransport._BaseListLocations._get_transcoded_request( http_options, request @@ -3312,6 +3697,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.aiplatform_v1beta1.ExtensionRegistryServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ExtensionRegistryService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( ExtensionRegistryServiceRestTransport._ListLocations._get_response( @@ -3333,6 +3745,27 @@ def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_list_locations(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.aiplatform_v1beta1.ExtensionRegistryServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ExtensionRegistryService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3376,7 +3809,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]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -3387,8 +3820,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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -3397,6 +3832,7 @@ def __call__( http_options = ( _BaseExtensionRegistryServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_get_iam_policy(request, metadata) transcoded_request = _BaseExtensionRegistryServiceRestTransport._BaseGetIamPolicy._get_transcoded_request( http_options, request @@ -3411,6 +3847,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.aiplatform_v1beta1.ExtensionRegistryServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ExtensionRegistryService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( ExtensionRegistryServiceRestTransport._GetIamPolicy._get_response( @@ -3433,6 +3896,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_iam_policy(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.aiplatform_v1beta1.ExtensionRegistryServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ExtensionRegistryService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3476,7 +3960,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]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -3487,8 +3971,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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -3497,6 +3983,7 @@ def __call__( http_options = ( _BaseExtensionRegistryServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_set_iam_policy(request, metadata) transcoded_request = _BaseExtensionRegistryServiceRestTransport._BaseSetIamPolicy._get_transcoded_request( http_options, request @@ -3511,6 +3998,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.aiplatform_v1beta1.ExtensionRegistryServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ExtensionRegistryService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( ExtensionRegistryServiceRestTransport._SetIamPolicy._get_response( @@ -3533,6 +4047,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_set_iam_policy(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.aiplatform_v1beta1.ExtensionRegistryServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ExtensionRegistryService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3576,7 +4111,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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -3587,8 +4122,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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -3597,6 +4134,7 @@ def __call__( http_options = ( _BaseExtensionRegistryServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -3613,6 +4151,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.aiplatform_v1beta1.ExtensionRegistryServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ExtensionRegistryService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( ExtensionRegistryServiceRestTransport._TestIamPermissions._get_response( @@ -3635,6 +4200,27 @@ def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_test_iam_permissions(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.aiplatform_v1beta1.ExtensionRegistryServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ExtensionRegistryService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3677,7 +4263,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 cancel operation method over HTTP. @@ -3688,13 +4274,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 = ( _BaseExtensionRegistryServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = self._interceptor.pre_cancel_operation( request, metadata ) @@ -3707,6 +4296,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.aiplatform_v1beta1.ExtensionRegistryServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ExtensionRegistryService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( ExtensionRegistryServiceRestTransport._CancelOperation._get_response( @@ -3766,7 +4382,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. @@ -3777,13 +4393,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 = ( _BaseExtensionRegistryServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = self._interceptor.pre_delete_operation( request, metadata ) @@ -3796,6 +4415,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.aiplatform_v1beta1.ExtensionRegistryServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ExtensionRegistryService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( ExtensionRegistryServiceRestTransport._DeleteOperation._get_response( @@ -3855,7 +4501,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. @@ -3866,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: operations_pb2.Operation: Response from GetOperation method. @@ -3876,6 +4524,7 @@ def __call__( http_options = ( _BaseExtensionRegistryServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = self._interceptor.pre_get_operation(request, metadata) transcoded_request = _BaseExtensionRegistryServiceRestTransport._BaseGetOperation._get_transcoded_request( http_options, request @@ -3886,6 +4535,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.aiplatform_v1beta1.ExtensionRegistryServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ExtensionRegistryService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( ExtensionRegistryServiceRestTransport._GetOperation._get_response( @@ -3907,6 +4583,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.aiplatform_v1beta1.ExtensionRegistryServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ExtensionRegistryService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3949,7 +4646,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. @@ -3960,8 +4657,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. @@ -3970,6 +4669,7 @@ def __call__( http_options = ( _BaseExtensionRegistryServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = self._interceptor.pre_list_operations(request, metadata) transcoded_request = _BaseExtensionRegistryServiceRestTransport._BaseListOperations._get_transcoded_request( http_options, request @@ -3980,6 +4680,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.aiplatform_v1beta1.ExtensionRegistryServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ExtensionRegistryService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( ExtensionRegistryServiceRestTransport._ListOperations._get_response( @@ -4001,6 +4728,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.aiplatform_v1beta1.ExtensionRegistryServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ExtensionRegistryService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4043,7 +4791,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 wait operation method over HTTP. @@ -4054,8 +4802,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 WaitOperation method. @@ -4064,6 +4814,7 @@ def __call__( http_options = ( _BaseExtensionRegistryServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = self._interceptor.pre_wait_operation(request, metadata) transcoded_request = _BaseExtensionRegistryServiceRestTransport._BaseWaitOperation._get_transcoded_request( http_options, request @@ -4074,6 +4825,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.aiplatform_v1beta1.ExtensionRegistryServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ExtensionRegistryService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( ExtensionRegistryServiceRestTransport._WaitOperation._get_response( @@ -4095,6 +4873,27 @@ def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = self._interceptor.post_wait_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.aiplatform_v1beta1.ExtensionRegistryServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ExtensionRegistryService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1beta1/services/extension_registry_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1beta1/services/extension_registry_service/transports/rest_asyncio.py index dd862f46a6..90bff0f4b9 100644 --- a/google/cloud/aiplatform_v1beta1/services/extension_registry_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/extension_registry_service/transports/rest_asyncio.py @@ -60,6 +60,18 @@ from .base import DEFAULT_CLIENT_INFO as BASE_DEFAULT_CLIENT_INFO + +import logging + +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__) + try: OptionalRetry = Union[retries.AsyncRetry, gapic_v1.method._MethodDefault, None] except AttributeError: # pragma: NO COVER @@ -136,9 +148,10 @@ async def post_update_extension(self, response): async def pre_delete_extension( self, request: extension_registry_service.DeleteExtensionRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - extension_registry_service.DeleteExtensionRequest, Sequence[Tuple[str, str]] + extension_registry_service.DeleteExtensionRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for delete_extension @@ -161,9 +174,10 @@ async def post_delete_extension( async def pre_get_extension( self, request: extension_registry_service.GetExtensionRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - extension_registry_service.GetExtensionRequest, Sequence[Tuple[str, str]] + extension_registry_service.GetExtensionRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for get_extension @@ -186,9 +200,10 @@ async def post_get_extension( async def pre_import_extension( self, request: extension_registry_service.ImportExtensionRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - extension_registry_service.ImportExtensionRequest, Sequence[Tuple[str, str]] + extension_registry_service.ImportExtensionRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for import_extension @@ -211,9 +226,10 @@ async def post_import_extension( async def pre_list_extensions( self, request: extension_registry_service.ListExtensionsRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - extension_registry_service.ListExtensionsRequest, Sequence[Tuple[str, str]] + extension_registry_service.ListExtensionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for list_extensions @@ -236,9 +252,10 @@ async def post_list_extensions( async def pre_update_extension( self, request: extension_registry_service.UpdateExtensionRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - extension_registry_service.UpdateExtensionRequest, Sequence[Tuple[str, str]] + extension_registry_service.UpdateExtensionRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for update_extension @@ -261,8 +278,10 @@ async def post_update_extension( async def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -284,8 +303,10 @@ async def post_get_location( async def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -307,8 +328,10 @@ async def post_list_locations( async def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -330,8 +353,10 @@ async def post_get_iam_policy( async def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -353,8 +378,11 @@ async def post_set_iam_policy( async def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -376,8 +404,10 @@ async def post_test_iam_permissions( async def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -397,8 +427,10 @@ async def post_cancel_operation(self, response: None) -> None: async 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 @@ -418,8 +450,10 @@ async def post_delete_operation(self, response: None) -> None: async 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 @@ -441,8 +475,10 @@ async def post_get_operation( async 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 @@ -464,8 +500,10 @@ async def post_list_operations( async def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -674,7 +712,7 @@ async 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 extension method over HTTP. @@ -685,8 +723,10 @@ async def __call__( 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: @@ -699,6 +739,7 @@ async def __call__( http_options = ( _BaseExtensionRegistryServiceRestTransport._BaseDeleteExtension._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_extension( request, metadata ) @@ -711,6 +752,33 @@ async 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.aiplatform_v1beta1.ExtensionRegistryServiceClient.DeleteExtension", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ExtensionRegistryService", + "rpcName": "DeleteExtension", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncExtensionRegistryServiceRestTransport._DeleteExtension._get_response( self._host, @@ -738,6 +806,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_delete_extension(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.ExtensionRegistryServiceAsyncClient.delete_extension", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ExtensionRegistryService", + "rpcName": "DeleteExtension", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _GetExtension( @@ -776,7 +866,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> extension.Extension: r"""Call the get extension method over HTTP. @@ -787,8 +877,10 @@ async def __call__( 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: ~.extension.Extension: @@ -801,6 +893,7 @@ async def __call__( http_options = ( _BaseExtensionRegistryServiceRestTransport._BaseGetExtension._get_http_options() ) + request, metadata = await self._interceptor.pre_get_extension( request, metadata ) @@ -813,6 +906,33 @@ async 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.aiplatform_v1beta1.ExtensionRegistryServiceClient.GetExtension", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ExtensionRegistryService", + "rpcName": "GetExtension", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncExtensionRegistryServiceRestTransport._GetExtension._get_response( self._host, @@ -840,6 +960,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_get_extension(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = extension.Extension.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.ExtensionRegistryServiceAsyncClient.get_extension", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ExtensionRegistryService", + "rpcName": "GetExtension", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ImportExtension( @@ -879,7 +1021,7 @@ async 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 import extension method over HTTP. @@ -890,8 +1032,10 @@ async def __call__( 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: @@ -904,6 +1048,7 @@ async def __call__( http_options = ( _BaseExtensionRegistryServiceRestTransport._BaseImportExtension._get_http_options() ) + request, metadata = await self._interceptor.pre_import_extension( request, metadata ) @@ -920,6 +1065,33 @@ async 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.aiplatform_v1beta1.ExtensionRegistryServiceClient.ImportExtension", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ExtensionRegistryService", + "rpcName": "ImportExtension", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncExtensionRegistryServiceRestTransport._ImportExtension._get_response( self._host, @@ -948,6 +1120,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_import_extension(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.ExtensionRegistryServiceAsyncClient.import_extension", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ExtensionRegistryService", + "rpcName": "ImportExtension", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ListExtensions( @@ -986,7 +1180,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> extension_registry_service.ListExtensionsResponse: r"""Call the list extensions method over HTTP. @@ -997,8 +1191,10 @@ async def __call__( 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: ~.extension_registry_service.ListExtensionsResponse: @@ -1010,6 +1206,7 @@ async def __call__( http_options = ( _BaseExtensionRegistryServiceRestTransport._BaseListExtensions._get_http_options() ) + request, metadata = await self._interceptor.pre_list_extensions( request, metadata ) @@ -1022,6 +1219,33 @@ async 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.aiplatform_v1beta1.ExtensionRegistryServiceClient.ListExtensions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ExtensionRegistryService", + "rpcName": "ListExtensions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncExtensionRegistryServiceRestTransport._ListExtensions._get_response( self._host, @@ -1049,6 +1273,32 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_list_extensions(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + extension_registry_service.ListExtensionsResponse.to_json( + response + ) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.ExtensionRegistryServiceAsyncClient.list_extensions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ExtensionRegistryService", + "rpcName": "ListExtensions", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _UpdateExtension( @@ -1088,7 +1338,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> gca_extension.Extension: r"""Call the update extension method over HTTP. @@ -1099,8 +1349,10 @@ async def __call__( 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: ~.gca_extension.Extension: @@ -1113,6 +1365,7 @@ async def __call__( http_options = ( _BaseExtensionRegistryServiceRestTransport._BaseUpdateExtension._get_http_options() ) + request, metadata = await self._interceptor.pre_update_extension( request, metadata ) @@ -1129,6 +1382,33 @@ async 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.aiplatform_v1beta1.ExtensionRegistryServiceClient.UpdateExtension", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ExtensionRegistryService", + "rpcName": "UpdateExtension", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncExtensionRegistryServiceRestTransport._UpdateExtension._get_response( self._host, @@ -1157,6 +1437,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_update_extension(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gca_extension.Extension.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.ExtensionRegistryServiceAsyncClient.update_extension", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ExtensionRegistryService", + "rpcName": "UpdateExtension", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp @property @@ -1732,6 +2034,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -1948,6 +2254,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -2154,6 +2464,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}", @@ -2370,6 +2684,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, ], "google.longrunning.Operations.ListOperations": [ { @@ -2568,6 +2886,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*}/operations", @@ -2784,6 +3106,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*}/operations", + }, ], "google.longrunning.Operations.WaitOperation": [ { @@ -2982,6 +3308,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "post", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}:wait", @@ -3194,6 +3524,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, ], } @@ -3293,7 +3627,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -3304,8 +3638,10 @@ async def __call__( 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: locations_pb2.Location: Response from GetLocation method. @@ -3314,6 +3650,7 @@ async def __call__( http_options = ( _BaseExtensionRegistryServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_location( request, metadata ) @@ -3326,6 +3663,33 @@ async 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.aiplatform_v1beta1.ExtensionRegistryServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ExtensionRegistryService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncExtensionRegistryServiceRestTransport._GetLocation._get_response( self._host, @@ -3351,6 +3715,27 @@ async def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_location(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.aiplatform_v1beta1.ExtensionRegistryServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ExtensionRegistryService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3393,7 +3778,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -3404,8 +3789,10 @@ async def __call__( 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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -3414,6 +3801,7 @@ async def __call__( http_options = ( _BaseExtensionRegistryServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_locations( request, metadata ) @@ -3426,6 +3814,33 @@ async 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.aiplatform_v1beta1.ExtensionRegistryServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ExtensionRegistryService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncExtensionRegistryServiceRestTransport._ListLocations._get_response( self._host, @@ -3451,6 +3866,27 @@ async def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_list_locations(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.aiplatform_v1beta1.ExtensionRegistryServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ExtensionRegistryService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3494,7 +3930,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -3505,8 +3941,10 @@ async def __call__( 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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -3515,6 +3953,7 @@ async def __call__( http_options = ( _BaseExtensionRegistryServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_get_iam_policy( request, metadata ) @@ -3531,6 +3970,33 @@ async 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.aiplatform_v1beta1.ExtensionRegistryServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ExtensionRegistryService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncExtensionRegistryServiceRestTransport._GetIamPolicy._get_response( self._host, @@ -3557,6 +4023,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_iam_policy(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.aiplatform_v1beta1.ExtensionRegistryServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ExtensionRegistryService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3600,7 +4087,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -3611,8 +4098,10 @@ async def __call__( 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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -3621,6 +4110,7 @@ async def __call__( http_options = ( _BaseExtensionRegistryServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_set_iam_policy( request, metadata ) @@ -3637,6 +4127,33 @@ async 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.aiplatform_v1beta1.ExtensionRegistryServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ExtensionRegistryService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncExtensionRegistryServiceRestTransport._SetIamPolicy._get_response( self._host, @@ -3663,6 +4180,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_set_iam_policy(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.aiplatform_v1beta1.ExtensionRegistryServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ExtensionRegistryService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3706,7 +4244,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -3717,8 +4255,10 @@ async def __call__( 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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -3727,6 +4267,7 @@ async def __call__( http_options = ( _BaseExtensionRegistryServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = await self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -3743,6 +4284,33 @@ async 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.aiplatform_v1beta1.ExtensionRegistryServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ExtensionRegistryService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncExtensionRegistryServiceRestTransport._TestIamPermissions._get_response( self._host, @@ -3769,6 +4337,27 @@ async def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_test_iam_permissions(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.aiplatform_v1beta1.ExtensionRegistryServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ExtensionRegistryService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3811,7 +4400,7 @@ async 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 cancel operation method over HTTP. @@ -3822,13 +4411,16 @@ async def __call__( 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`. """ http_options = ( _BaseExtensionRegistryServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_cancel_operation( request, metadata ) @@ -3841,6 +4433,33 @@ async 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.aiplatform_v1beta1.ExtensionRegistryServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ExtensionRegistryService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncExtensionRegistryServiceRestTransport._CancelOperation._get_response( self._host, @@ -3904,7 +4523,7 @@ async 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. @@ -3915,13 +4534,16 @@ async def __call__( 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`. """ http_options = ( _BaseExtensionRegistryServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_operation( request, metadata ) @@ -3934,6 +4556,33 @@ async 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.aiplatform_v1beta1.ExtensionRegistryServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ExtensionRegistryService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncExtensionRegistryServiceRestTransport._DeleteOperation._get_response( self._host, @@ -3997,7 +4646,7 @@ async 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. @@ -4008,8 +4657,10 @@ async def __call__( 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: Response from GetOperation method. @@ -4018,6 +4669,7 @@ async def __call__( http_options = ( _BaseExtensionRegistryServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_operation( request, metadata ) @@ -4030,6 +4682,33 @@ async 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.aiplatform_v1beta1.ExtensionRegistryServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ExtensionRegistryService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncExtensionRegistryServiceRestTransport._GetOperation._get_response( self._host, @@ -4055,6 +4734,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1beta1.ExtensionRegistryServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ExtensionRegistryService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4097,7 +4797,7 @@ async 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. @@ -4108,8 +4808,10 @@ async def __call__( 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 from ListOperations method. @@ -4118,6 +4820,7 @@ async def __call__( http_options = ( _BaseExtensionRegistryServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_operations( request, metadata ) @@ -4130,6 +4833,33 @@ async 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.aiplatform_v1beta1.ExtensionRegistryServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ExtensionRegistryService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncExtensionRegistryServiceRestTransport._ListOperations._get_response( self._host, @@ -4155,6 +4885,27 @@ async def __call__( resp = operations_pb2.ListOperationsResponse() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1beta1.ExtensionRegistryServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ExtensionRegistryService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4197,7 +4948,7 @@ async 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 wait operation method over HTTP. @@ -4208,8 +4959,10 @@ async def __call__( 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: Response from WaitOperation method. @@ -4218,6 +4971,7 @@ async def __call__( http_options = ( _BaseExtensionRegistryServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_wait_operation( request, metadata ) @@ -4230,6 +4984,33 @@ async 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.aiplatform_v1beta1.ExtensionRegistryServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ExtensionRegistryService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncExtensionRegistryServiceRestTransport._WaitOperation._get_response( self._host, @@ -4255,6 +5036,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_wait_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.aiplatform_v1beta1.ExtensionRegistryServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ExtensionRegistryService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1beta1/services/extension_registry_service/transports/rest_base.py b/google/cloud/aiplatform_v1beta1/services/extension_registry_service/transports/rest_base.py index dc97e0c069..9c76ee8a38 100644 --- a/google/cloud/aiplatform_v1beta1/services/extension_registry_service/transports/rest_base.py +++ b/google/cloud/aiplatform_v1beta1/services/extension_registry_service/transports/rest_base.py @@ -1268,6 +1268,10 @@ def _get_http_options(): "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -1484,6 +1488,10 @@ def _get_http_options(): "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -1709,6 +1717,10 @@ def _get_http_options(): "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}", @@ -1925,6 +1937,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, ] return http_options @@ -2142,6 +2158,10 @@ def _get_http_options(): "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*}/operations", @@ -2358,6 +2378,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*}/operations", + }, ] return http_options @@ -2575,6 +2599,10 @@ def _get_http_options(): "method": "post", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}:wait", @@ -2787,6 +2815,10 @@ def _get_http_options(): "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, ] return http_options diff --git a/google/cloud/aiplatform_v1beta1/services/feature_online_store_admin_service/async_client.py b/google/cloud/aiplatform_v1beta1/services/feature_online_store_admin_service/async_client.py index 60159877c9..e6a9f0d7c8 100644 --- a/google/cloud/aiplatform_v1beta1/services/feature_online_store_admin_service/async_client.py +++ b/google/cloud/aiplatform_v1beta1/services/feature_online_store_admin_service/async_client.py @@ -13,6 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging as std_logging from collections import OrderedDict import re from typing import ( @@ -74,6 +75,15 @@ from .transports.grpc_asyncio import FeatureOnlineStoreAdminServiceGrpcAsyncIOTransport from .client import FeatureOnlineStoreAdminServiceClient +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 FeatureOnlineStoreAdminServiceAsyncClient: """The service that handles CRUD and List for resources for @@ -309,6 +319,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.aiplatform_v1beta1.FeatureOnlineStoreAdminServiceAsyncClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreAdminService", + "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.aiplatform.v1beta1.FeatureOnlineStoreAdminService", + "credentialsType": None, + }, + ) + async def create_feature_online_store( self, request: Optional[ @@ -324,7 +356,7 @@ async def create_feature_online_store( feature_online_store_id: 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"""Creates a new FeatureOnlineStore in a given project and location. @@ -402,8 +434,10 @@ async def sample_create_feature_online_store(): 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: @@ -489,7 +523,7 @@ async def get_feature_online_store( 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]]] = (), ) -> feature_online_store.FeatureOnlineStore: r"""Gets details of a single FeatureOnlineStore. @@ -533,8 +567,10 @@ async def sample_get_feature_online_store(): 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.aiplatform_v1beta1.types.FeatureOnlineStore: @@ -606,7 +642,7 @@ async def list_feature_online_stores( 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.ListFeatureOnlineStoresAsyncPager: r"""Lists FeatureOnlineStores in a given project and location. @@ -653,8 +689,10 @@ async def sample_list_feature_online_stores(): 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.aiplatform_v1beta1.services.feature_online_store_admin_service.pagers.ListFeatureOnlineStoresAsyncPager: @@ -740,7 +778,7 @@ async def update_feature_online_store( 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"""Updates the parameters of a single FeatureOnlineStore. @@ -816,8 +854,10 @@ async def sample_update_feature_online_store(): 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: @@ -904,7 +944,7 @@ async def delete_feature_online_store( force: Optional[bool] = 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"""Deletes a single FeatureOnlineStore. The FeatureOnlineStore must not contain any FeatureViews. @@ -964,8 +1004,10 @@ async def sample_delete_feature_online_store(): 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: @@ -1056,7 +1098,7 @@ async def create_feature_view( feature_view_id: 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"""Creates a new FeatureView in a given FeatureOnlineStore. @@ -1131,8 +1173,10 @@ async def sample_create_feature_view(): 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 get_feature_view( 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]]] = (), ) -> feature_view.FeatureView: r"""Gets details of a single FeatureView. @@ -1257,8 +1301,10 @@ async def sample_get_feature_view(): 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.aiplatform_v1beta1.types.FeatureView: @@ -1324,7 +1370,7 @@ async def list_feature_views( 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.ListFeatureViewsAsyncPager: r"""Lists FeatureViews in a given FeatureOnlineStore. @@ -1370,8 +1416,10 @@ async def sample_list_feature_views(): 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.aiplatform_v1beta1.services.feature_online_store_admin_service.pagers.ListFeatureViewsAsyncPager: @@ -1453,7 +1501,7 @@ async def update_feature_view( 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"""Updates the parameters of a single FeatureView. @@ -1531,8 +1579,10 @@ async def sample_update_feature_view(): 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: @@ -1613,7 +1663,7 @@ async def delete_feature_view( 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"""Deletes a single FeatureView. @@ -1662,8 +1712,10 @@ async def sample_delete_feature_view(): 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: @@ -1748,7 +1800,7 @@ async def sync_feature_view( feature_view: 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]]] = (), ) -> feature_online_store_admin_service.SyncFeatureViewResponse: r"""Triggers on-demand sync for the FeatureView. @@ -1792,8 +1844,10 @@ async def sample_sync_feature_view(): 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.aiplatform_v1beta1.types.SyncFeatureViewResponse: @@ -1860,7 +1914,7 @@ async def get_feature_view_sync( 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]]] = (), ) -> feature_view_sync.FeatureViewSync: r"""Gets details of a single FeatureViewSync. @@ -1905,8 +1959,10 @@ async def sample_get_feature_view_sync(): 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.aiplatform_v1beta1.types.FeatureViewSync: @@ -1975,7 +2031,7 @@ async def list_feature_view_syncs( 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.ListFeatureViewSyncsAsyncPager: r"""Lists FeatureViewSyncs in a given FeatureView. @@ -2021,8 +2077,10 @@ async def sample_list_feature_view_syncs(): 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.aiplatform_v1beta1.services.feature_online_store_admin_service.pagers.ListFeatureViewSyncsAsyncPager: @@ -2100,7 +2158,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. @@ -2111,8 +2169,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. @@ -2153,7 +2213,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. @@ -2164,8 +2224,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. @@ -2206,7 +2268,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. @@ -2222,8 +2284,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 """ @@ -2260,7 +2324,7 @@ async def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -2275,8 +2339,10 @@ async def cancel_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 """ @@ -2313,7 +2379,7 @@ async def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -2330,8 +2396,10 @@ async def wait_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. @@ -2372,7 +2440,7 @@ async def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -2385,8 +2453,10 @@ async def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -2491,7 +2561,7 @@ async def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -2505,8 +2575,10 @@ async def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -2611,7 +2683,7 @@ async def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -2626,8 +2698,10 @@ async def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -2671,7 +2745,7 @@ async def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -2682,8 +2756,10 @@ async def get_location( 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: ~.location_pb2.Location: Location object. @@ -2724,7 +2800,7 @@ async def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -2735,8 +2811,10 @@ async def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1beta1/services/feature_online_store_admin_service/client.py b/google/cloud/aiplatform_v1beta1/services/feature_online_store_admin_service/client.py index 4886b8fefb..7969f6ca42 100644 --- a/google/cloud/aiplatform_v1beta1/services/feature_online_store_admin_service/client.py +++ b/google/cloud/aiplatform_v1beta1/services/feature_online_store_admin_service/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 ( @@ -48,6 +49,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 as gac_operation # type: ignore from google.api_core import operation_async # type: ignore from google.cloud.aiplatform_v1beta1.services.feature_online_store_admin_service import ( @@ -684,6 +694,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( @@ -779,6 +793,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.aiplatform_v1beta1.FeatureOnlineStoreAdminServiceClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreAdminService", + "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.aiplatform.v1beta1.FeatureOnlineStoreAdminService", + "credentialsType": None, + }, + ) + def create_feature_online_store( self, request: Optional[ @@ -794,7 +831,7 @@ def create_feature_online_store( feature_online_store_id: 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]]] = (), ) -> gac_operation.Operation: r"""Creates a new FeatureOnlineStore in a given project and location. @@ -872,8 +909,10 @@ def sample_create_feature_online_store(): 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: @@ -958,7 +997,7 @@ def get_feature_online_store( 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]]] = (), ) -> feature_online_store.FeatureOnlineStore: r"""Gets details of a single FeatureOnlineStore. @@ -1002,8 +1041,10 @@ def sample_get_feature_online_store(): 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.aiplatform_v1beta1.types.FeatureOnlineStore: @@ -1072,7 +1113,7 @@ def list_feature_online_stores( 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.ListFeatureOnlineStoresPager: r"""Lists FeatureOnlineStores in a given project and location. @@ -1119,8 +1160,10 @@ def sample_list_feature_online_stores(): 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.aiplatform_v1beta1.services.feature_online_store_admin_service.pagers.ListFeatureOnlineStoresPager: @@ -1205,7 +1248,7 @@ def update_feature_online_store( 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]]] = (), ) -> gac_operation.Operation: r"""Updates the parameters of a single FeatureOnlineStore. @@ -1281,8 +1324,10 @@ def sample_update_feature_online_store(): 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: @@ -1368,7 +1413,7 @@ def delete_feature_online_store( force: Optional[bool] = 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]]] = (), ) -> gac_operation.Operation: r"""Deletes a single FeatureOnlineStore. The FeatureOnlineStore must not contain any FeatureViews. @@ -1428,8 +1473,10 @@ def sample_delete_feature_online_store(): 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: @@ -1519,7 +1566,7 @@ def create_feature_view( feature_view_id: 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]]] = (), ) -> gac_operation.Operation: r"""Creates a new FeatureView in a given FeatureOnlineStore. @@ -1594,8 +1641,10 @@ def sample_create_feature_view(): 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: @@ -1673,7 +1722,7 @@ def get_feature_view( 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]]] = (), ) -> feature_view.FeatureView: r"""Gets details of a single FeatureView. @@ -1717,8 +1766,10 @@ def sample_get_feature_view(): 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.aiplatform_v1beta1.types.FeatureView: @@ -1781,7 +1832,7 @@ def list_feature_views( 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.ListFeatureViewsPager: r"""Lists FeatureViews in a given FeatureOnlineStore. @@ -1827,8 +1878,10 @@ def sample_list_feature_views(): 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.aiplatform_v1beta1.services.feature_online_store_admin_service.pagers.ListFeatureViewsPager: @@ -1907,7 +1960,7 @@ def update_feature_view( 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]]] = (), ) -> gac_operation.Operation: r"""Updates the parameters of a single FeatureView. @@ -1985,8 +2038,10 @@ def sample_update_feature_view(): 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: @@ -2064,7 +2119,7 @@ def delete_feature_view( 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]]] = (), ) -> gac_operation.Operation: r"""Deletes a single FeatureView. @@ -2113,8 +2168,10 @@ def sample_delete_feature_view(): 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: @@ -2196,7 +2253,7 @@ def sync_feature_view( feature_view: 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]]] = (), ) -> feature_online_store_admin_service.SyncFeatureViewResponse: r"""Triggers on-demand sync for the FeatureView. @@ -2240,8 +2297,10 @@ def sample_sync_feature_view(): 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.aiplatform_v1beta1.types.SyncFeatureViewResponse: @@ -2305,7 +2364,7 @@ def get_feature_view_sync( 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]]] = (), ) -> feature_view_sync.FeatureViewSync: r"""Gets details of a single FeatureViewSync. @@ -2350,8 +2409,10 @@ def sample_get_feature_view_sync(): 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.aiplatform_v1beta1.types.FeatureViewSync: @@ -2417,7 +2478,7 @@ def list_feature_view_syncs( 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.ListFeatureViewSyncsPager: r"""Lists FeatureViewSyncs in a given FeatureView. @@ -2463,8 +2524,10 @@ def sample_list_feature_view_syncs(): 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.aiplatform_v1beta1.services.feature_online_store_admin_service.pagers.ListFeatureViewSyncsPager: @@ -2552,7 +2615,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. @@ -2563,8 +2626,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. @@ -2605,7 +2670,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. @@ -2616,8 +2681,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. @@ -2658,7 +2725,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. @@ -2674,8 +2741,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 """ @@ -2712,7 +2781,7 @@ def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -2727,8 +2796,10 @@ def cancel_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 """ @@ -2765,7 +2836,7 @@ def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -2782,8 +2853,10 @@ def wait_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. @@ -2824,7 +2897,7 @@ def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -2837,8 +2910,10 @@ def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -2943,7 +3018,7 @@ def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -2957,8 +3032,10 @@ def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -3063,7 +3140,7 @@ def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -3078,8 +3155,10 @@ def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -3121,7 +3200,7 @@ def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -3132,8 +3211,10 @@ def get_location( 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: ~.location_pb2.Location: Location object. @@ -3174,7 +3255,7 @@ def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -3185,8 +3266,10 @@ def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1beta1/services/feature_online_store_admin_service/pagers.py b/google/cloud/aiplatform_v1beta1/services/feature_online_store_admin_service/pagers.py index 26898d0704..6a045c6fcd 100644 --- a/google/cloud/aiplatform_v1beta1/services/feature_online_store_admin_service/pagers.py +++ b/google/cloud/aiplatform_v1beta1/services/feature_online_store_admin_service/pagers.py @@ -71,7 +71,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. @@ -85,8 +85,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 = ( @@ -154,7 +156,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. @@ -168,8 +170,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 = ( @@ -240,7 +244,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. @@ -254,8 +258,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 = feature_online_store_admin_service.ListFeatureViewsRequest( @@ -320,7 +326,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. @@ -334,8 +340,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 = feature_online_store_admin_service.ListFeatureViewsRequest( @@ -404,7 +412,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. @@ -418,8 +426,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 = feature_online_store_admin_service.ListFeatureViewSyncsRequest( @@ -485,7 +495,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. @@ -499,8 +509,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 = feature_online_store_admin_service.ListFeatureViewSyncsRequest( diff --git a/google/cloud/aiplatform_v1beta1/services/feature_online_store_admin_service/transports/grpc.py b/google/cloud/aiplatform_v1beta1/services/feature_online_store_admin_service/transports/grpc.py index 8acac884de..8db94518e4 100644 --- a/google/cloud/aiplatform_v1beta1/services/feature_online_store_admin_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1beta1/services/feature_online_store_admin_service/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 import warnings from typing import Callable, Dict, Optional, Sequence, Tuple, Union @@ -22,8 +25,11 @@ import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from google.cloud.aiplatform_v1beta1.types import feature_online_store from google.cloud.aiplatform_v1beta1.types import feature_online_store_admin_service @@ -35,6 +41,81 @@ from google.longrunning import operations_pb2 # type: ignore from .base import FeatureOnlineStoreAdminServiceTransport, DEFAULT_CLIENT_INFO +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.aiplatform.v1beta1.FeatureOnlineStoreAdminService", + "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.aiplatform.v1beta1.FeatureOnlineStoreAdminService", + "rpcName": client_call_details.method, + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class FeatureOnlineStoreAdminServiceGrpcTransport( FeatureOnlineStoreAdminServiceTransport @@ -192,7 +273,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 @@ -256,7 +342,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 @@ -284,7 +372,9 @@ def create_feature_online_store( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_feature_online_store" not in self._stubs: - self._stubs["create_feature_online_store"] = self.grpc_channel.unary_unary( + self._stubs[ + "create_feature_online_store" + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.FeatureOnlineStoreAdminService/CreateFeatureOnlineStore", request_serializer=feature_online_store_admin_service.CreateFeatureOnlineStoreRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -313,7 +403,7 @@ def get_feature_online_store( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_feature_online_store" not in self._stubs: - self._stubs["get_feature_online_store"] = self.grpc_channel.unary_unary( + self._stubs["get_feature_online_store"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.FeatureOnlineStoreAdminService/GetFeatureOnlineStore", request_serializer=feature_online_store_admin_service.GetFeatureOnlineStoreRequest.serialize, response_deserializer=feature_online_store.FeatureOnlineStore.deserialize, @@ -343,7 +433,9 @@ def list_feature_online_stores( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_feature_online_stores" not in self._stubs: - self._stubs["list_feature_online_stores"] = self.grpc_channel.unary_unary( + self._stubs[ + "list_feature_online_stores" + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.FeatureOnlineStoreAdminService/ListFeatureOnlineStores", request_serializer=feature_online_store_admin_service.ListFeatureOnlineStoresRequest.serialize, response_deserializer=feature_online_store_admin_service.ListFeatureOnlineStoresResponse.deserialize, @@ -373,7 +465,9 @@ def update_feature_online_store( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_feature_online_store" not in self._stubs: - self._stubs["update_feature_online_store"] = self.grpc_channel.unary_unary( + self._stubs[ + "update_feature_online_store" + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.FeatureOnlineStoreAdminService/UpdateFeatureOnlineStore", request_serializer=feature_online_store_admin_service.UpdateFeatureOnlineStoreRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -403,7 +497,9 @@ def delete_feature_online_store( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_feature_online_store" not in self._stubs: - self._stubs["delete_feature_online_store"] = self.grpc_channel.unary_unary( + self._stubs[ + "delete_feature_online_store" + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.FeatureOnlineStoreAdminService/DeleteFeatureOnlineStore", request_serializer=feature_online_store_admin_service.DeleteFeatureOnlineStoreRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -433,7 +529,7 @@ def create_feature_view( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_feature_view" not in self._stubs: - self._stubs["create_feature_view"] = self.grpc_channel.unary_unary( + self._stubs["create_feature_view"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.FeatureOnlineStoreAdminService/CreateFeatureView", request_serializer=feature_online_store_admin_service.CreateFeatureViewRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -462,7 +558,7 @@ def get_feature_view( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_feature_view" not in self._stubs: - self._stubs["get_feature_view"] = self.grpc_channel.unary_unary( + self._stubs["get_feature_view"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.FeatureOnlineStoreAdminService/GetFeatureView", request_serializer=feature_online_store_admin_service.GetFeatureViewRequest.serialize, response_deserializer=feature_view.FeatureView.deserialize, @@ -491,7 +587,7 @@ def list_feature_views( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_feature_views" not in self._stubs: - self._stubs["list_feature_views"] = self.grpc_channel.unary_unary( + self._stubs["list_feature_views"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.FeatureOnlineStoreAdminService/ListFeatureViews", request_serializer=feature_online_store_admin_service.ListFeatureViewsRequest.serialize, response_deserializer=feature_online_store_admin_service.ListFeatureViewsResponse.deserialize, @@ -520,7 +616,7 @@ def update_feature_view( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_feature_view" not in self._stubs: - self._stubs["update_feature_view"] = self.grpc_channel.unary_unary( + self._stubs["update_feature_view"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.FeatureOnlineStoreAdminService/UpdateFeatureView", request_serializer=feature_online_store_admin_service.UpdateFeatureViewRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -549,7 +645,7 @@ def delete_feature_view( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_feature_view" not in self._stubs: - self._stubs["delete_feature_view"] = self.grpc_channel.unary_unary( + self._stubs["delete_feature_view"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.FeatureOnlineStoreAdminService/DeleteFeatureView", request_serializer=feature_online_store_admin_service.DeleteFeatureViewRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -578,7 +674,7 @@ def sync_feature_view( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "sync_feature_view" not in self._stubs: - self._stubs["sync_feature_view"] = self.grpc_channel.unary_unary( + self._stubs["sync_feature_view"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.FeatureOnlineStoreAdminService/SyncFeatureView", request_serializer=feature_online_store_admin_service.SyncFeatureViewRequest.serialize, response_deserializer=feature_online_store_admin_service.SyncFeatureViewResponse.deserialize, @@ -607,7 +703,7 @@ def get_feature_view_sync( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_feature_view_sync" not in self._stubs: - self._stubs["get_feature_view_sync"] = self.grpc_channel.unary_unary( + self._stubs["get_feature_view_sync"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.FeatureOnlineStoreAdminService/GetFeatureViewSync", request_serializer=feature_online_store_admin_service.GetFeatureViewSyncRequest.serialize, response_deserializer=feature_view_sync.FeatureViewSync.deserialize, @@ -636,7 +732,7 @@ def list_feature_view_syncs( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_feature_view_syncs" not in self._stubs: - self._stubs["list_feature_view_syncs"] = self.grpc_channel.unary_unary( + self._stubs["list_feature_view_syncs"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.FeatureOnlineStoreAdminService/ListFeatureViewSyncs", request_serializer=feature_online_store_admin_service.ListFeatureViewSyncsRequest.serialize, response_deserializer=feature_online_store_admin_service.ListFeatureViewSyncsResponse.deserialize, @@ -644,7 +740,7 @@ def list_feature_view_syncs( return self._stubs["list_feature_view_syncs"] def close(self): - self.grpc_channel.close() + self._logged_channel.close() @property def delete_operation( @@ -656,7 +752,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, @@ -673,7 +769,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -690,7 +786,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -707,7 +803,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, @@ -726,7 +822,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, @@ -745,7 +841,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -762,7 +858,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -787,7 +883,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -813,7 +909,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -842,7 +938,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1beta1/services/feature_online_store_admin_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1beta1/services/feature_online_store_admin_service/transports/grpc_asyncio.py index b4e8d3a360..407c094164 100644 --- a/google/cloud/aiplatform_v1beta1/services/feature_online_store_admin_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/feature_online_store_admin_service/transports/grpc_asyncio.py @@ -14,6 +14,9 @@ # limitations under the License. # import inspect +import json +import pickle +import logging as std_logging import warnings from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union @@ -24,8 +27,11 @@ from google.api_core import operations_v1 from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from grpc.experimental import aio # type: ignore from google.cloud.aiplatform_v1beta1.types import feature_online_store @@ -39,6 +45,82 @@ from .base import FeatureOnlineStoreAdminServiceTransport, DEFAULT_CLIENT_INFO from .grpc import FeatureOnlineStoreAdminServiceGrpcTransport +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.aiplatform.v1beta1.FeatureOnlineStoreAdminService", + "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.aiplatform.v1beta1.FeatureOnlineStoreAdminService", + "rpcName": str(client_call_details.method), + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class FeatureOnlineStoreAdminServiceGrpcAsyncIOTransport( FeatureOnlineStoreAdminServiceTransport @@ -239,10 +321,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 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. @@ -294,7 +379,9 @@ def create_feature_online_store( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_feature_online_store" not in self._stubs: - self._stubs["create_feature_online_store"] = self.grpc_channel.unary_unary( + self._stubs[ + "create_feature_online_store" + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.FeatureOnlineStoreAdminService/CreateFeatureOnlineStore", request_serializer=feature_online_store_admin_service.CreateFeatureOnlineStoreRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -323,7 +410,7 @@ def get_feature_online_store( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_feature_online_store" not in self._stubs: - self._stubs["get_feature_online_store"] = self.grpc_channel.unary_unary( + self._stubs["get_feature_online_store"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.FeatureOnlineStoreAdminService/GetFeatureOnlineStore", request_serializer=feature_online_store_admin_service.GetFeatureOnlineStoreRequest.serialize, response_deserializer=feature_online_store.FeatureOnlineStore.deserialize, @@ -353,7 +440,9 @@ def list_feature_online_stores( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_feature_online_stores" not in self._stubs: - self._stubs["list_feature_online_stores"] = self.grpc_channel.unary_unary( + self._stubs[ + "list_feature_online_stores" + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.FeatureOnlineStoreAdminService/ListFeatureOnlineStores", request_serializer=feature_online_store_admin_service.ListFeatureOnlineStoresRequest.serialize, response_deserializer=feature_online_store_admin_service.ListFeatureOnlineStoresResponse.deserialize, @@ -383,7 +472,9 @@ def update_feature_online_store( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_feature_online_store" not in self._stubs: - self._stubs["update_feature_online_store"] = self.grpc_channel.unary_unary( + self._stubs[ + "update_feature_online_store" + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.FeatureOnlineStoreAdminService/UpdateFeatureOnlineStore", request_serializer=feature_online_store_admin_service.UpdateFeatureOnlineStoreRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -413,7 +504,9 @@ def delete_feature_online_store( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_feature_online_store" not in self._stubs: - self._stubs["delete_feature_online_store"] = self.grpc_channel.unary_unary( + self._stubs[ + "delete_feature_online_store" + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.FeatureOnlineStoreAdminService/DeleteFeatureOnlineStore", request_serializer=feature_online_store_admin_service.DeleteFeatureOnlineStoreRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -443,7 +536,7 @@ def create_feature_view( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_feature_view" not in self._stubs: - self._stubs["create_feature_view"] = self.grpc_channel.unary_unary( + self._stubs["create_feature_view"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.FeatureOnlineStoreAdminService/CreateFeatureView", request_serializer=feature_online_store_admin_service.CreateFeatureViewRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -472,7 +565,7 @@ def get_feature_view( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_feature_view" not in self._stubs: - self._stubs["get_feature_view"] = self.grpc_channel.unary_unary( + self._stubs["get_feature_view"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.FeatureOnlineStoreAdminService/GetFeatureView", request_serializer=feature_online_store_admin_service.GetFeatureViewRequest.serialize, response_deserializer=feature_view.FeatureView.deserialize, @@ -501,7 +594,7 @@ def list_feature_views( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_feature_views" not in self._stubs: - self._stubs["list_feature_views"] = self.grpc_channel.unary_unary( + self._stubs["list_feature_views"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.FeatureOnlineStoreAdminService/ListFeatureViews", request_serializer=feature_online_store_admin_service.ListFeatureViewsRequest.serialize, response_deserializer=feature_online_store_admin_service.ListFeatureViewsResponse.deserialize, @@ -530,7 +623,7 @@ def update_feature_view( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_feature_view" not in self._stubs: - self._stubs["update_feature_view"] = self.grpc_channel.unary_unary( + self._stubs["update_feature_view"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.FeatureOnlineStoreAdminService/UpdateFeatureView", request_serializer=feature_online_store_admin_service.UpdateFeatureViewRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -559,7 +652,7 @@ def delete_feature_view( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_feature_view" not in self._stubs: - self._stubs["delete_feature_view"] = self.grpc_channel.unary_unary( + self._stubs["delete_feature_view"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.FeatureOnlineStoreAdminService/DeleteFeatureView", request_serializer=feature_online_store_admin_service.DeleteFeatureViewRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -588,7 +681,7 @@ def sync_feature_view( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "sync_feature_view" not in self._stubs: - self._stubs["sync_feature_view"] = self.grpc_channel.unary_unary( + self._stubs["sync_feature_view"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.FeatureOnlineStoreAdminService/SyncFeatureView", request_serializer=feature_online_store_admin_service.SyncFeatureViewRequest.serialize, response_deserializer=feature_online_store_admin_service.SyncFeatureViewResponse.deserialize, @@ -617,7 +710,7 @@ def get_feature_view_sync( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_feature_view_sync" not in self._stubs: - self._stubs["get_feature_view_sync"] = self.grpc_channel.unary_unary( + self._stubs["get_feature_view_sync"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.FeatureOnlineStoreAdminService/GetFeatureViewSync", request_serializer=feature_online_store_admin_service.GetFeatureViewSyncRequest.serialize, response_deserializer=feature_view_sync.FeatureViewSync.deserialize, @@ -646,7 +739,7 @@ def list_feature_view_syncs( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_feature_view_syncs" not in self._stubs: - self._stubs["list_feature_view_syncs"] = self.grpc_channel.unary_unary( + self._stubs["list_feature_view_syncs"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.FeatureOnlineStoreAdminService/ListFeatureViewSyncs", request_serializer=feature_online_store_admin_service.ListFeatureViewSyncsRequest.serialize, response_deserializer=feature_online_store_admin_service.ListFeatureViewSyncsResponse.deserialize, @@ -779,7 +872,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: @@ -795,7 +888,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, @@ -812,7 +905,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -829,7 +922,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -846,7 +939,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, @@ -865,7 +958,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, @@ -884,7 +977,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -901,7 +994,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -926,7 +1019,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -952,7 +1045,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -981,7 +1074,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1beta1/services/feature_online_store_admin_service/transports/rest.py b/google/cloud/aiplatform_v1beta1/services/feature_online_store_admin_service/transports/rest.py index 69b690d86e..52f7825304 100644 --- a/google/cloud/aiplatform_v1beta1/services/feature_online_store_admin_service/transports/rest.py +++ b/google/cloud/aiplatform_v1beta1/services/feature_online_store_admin_service/transports/rest.py @@ -13,9 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging +import json # type: ignore from google.auth.transport.requests import AuthorizedSession # type: ignore -import json # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.api_core import exceptions as core_exceptions from google.api_core import retry as retries @@ -50,6 +51,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, @@ -186,10 +195,10 @@ def post_update_feature_view(self, response): def pre_create_feature_online_store( self, request: feature_online_store_admin_service.CreateFeatureOnlineStoreRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ feature_online_store_admin_service.CreateFeatureOnlineStoreRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for create_feature_online_store @@ -212,10 +221,10 @@ def post_create_feature_online_store( def pre_create_feature_view( self, request: feature_online_store_admin_service.CreateFeatureViewRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ feature_online_store_admin_service.CreateFeatureViewRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for create_feature_view @@ -238,10 +247,10 @@ def post_create_feature_view( def pre_delete_feature_online_store( self, request: feature_online_store_admin_service.DeleteFeatureOnlineStoreRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ feature_online_store_admin_service.DeleteFeatureOnlineStoreRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for delete_feature_online_store @@ -264,10 +273,10 @@ def post_delete_feature_online_store( def pre_delete_feature_view( self, request: feature_online_store_admin_service.DeleteFeatureViewRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ feature_online_store_admin_service.DeleteFeatureViewRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for delete_feature_view @@ -290,10 +299,10 @@ def post_delete_feature_view( def pre_get_feature_online_store( self, request: feature_online_store_admin_service.GetFeatureOnlineStoreRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ feature_online_store_admin_service.GetFeatureOnlineStoreRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for get_feature_online_store @@ -316,10 +325,10 @@ def post_get_feature_online_store( def pre_get_feature_view( self, request: feature_online_store_admin_service.GetFeatureViewRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ feature_online_store_admin_service.GetFeatureViewRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for get_feature_view @@ -342,10 +351,10 @@ def post_get_feature_view( def pre_get_feature_view_sync( self, request: feature_online_store_admin_service.GetFeatureViewSyncRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ feature_online_store_admin_service.GetFeatureViewSyncRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for get_feature_view_sync @@ -368,10 +377,10 @@ def post_get_feature_view_sync( def pre_list_feature_online_stores( self, request: feature_online_store_admin_service.ListFeatureOnlineStoresRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ feature_online_store_admin_service.ListFeatureOnlineStoresRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for list_feature_online_stores @@ -395,10 +404,10 @@ def post_list_feature_online_stores( def pre_list_feature_views( self, request: feature_online_store_admin_service.ListFeatureViewsRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ feature_online_store_admin_service.ListFeatureViewsRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for list_feature_views @@ -421,10 +430,10 @@ def post_list_feature_views( def pre_list_feature_view_syncs( self, request: feature_online_store_admin_service.ListFeatureViewSyncsRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ feature_online_store_admin_service.ListFeatureViewSyncsRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for list_feature_view_syncs @@ -447,10 +456,10 @@ def post_list_feature_view_syncs( def pre_sync_feature_view( self, request: feature_online_store_admin_service.SyncFeatureViewRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ feature_online_store_admin_service.SyncFeatureViewRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for sync_feature_view @@ -473,10 +482,10 @@ def post_sync_feature_view( def pre_update_feature_online_store( self, request: feature_online_store_admin_service.UpdateFeatureOnlineStoreRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ feature_online_store_admin_service.UpdateFeatureOnlineStoreRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for update_feature_online_store @@ -499,10 +508,10 @@ def post_update_feature_online_store( def pre_update_feature_view( self, request: feature_online_store_admin_service.UpdateFeatureViewRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ feature_online_store_admin_service.UpdateFeatureViewRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for update_feature_view @@ -525,8 +534,10 @@ def post_update_feature_view( def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -548,8 +559,10 @@ def post_get_location( def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -571,8 +584,10 @@ def post_list_locations( def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -592,8 +607,10 @@ def post_get_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -613,8 +630,11 @@ def post_set_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -636,8 +656,10 @@ def post_test_iam_permissions( def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -657,8 +679,10 @@ def post_cancel_operation(self, response: None) -> None: 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 @@ -678,8 +702,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 @@ -701,8 +727,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 @@ -724,8 +752,10 @@ def post_list_operations( def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -1410,6 +1440,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -1626,6 +1660,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -1832,6 +1870,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}", @@ -2048,6 +2090,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, ], "google.longrunning.Operations.ListOperations": [ { @@ -2246,6 +2292,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*}/operations", @@ -2462,6 +2512,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*}/operations", + }, ], "google.longrunning.Operations.WaitOperation": [ { @@ -2660,6 +2714,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "post", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}:wait", @@ -2872,6 +2930,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, ], } @@ -2930,7 +2992,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 feature online store method over HTTP. @@ -2942,8 +3004,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: @@ -2956,6 +3020,7 @@ def __call__( http_options = ( _BaseFeatureOnlineStoreAdminServiceRestTransport._BaseCreateFeatureOnlineStore._get_http_options() ) + request, metadata = self._interceptor.pre_create_feature_online_store( request, metadata ) @@ -2972,6 +3037,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.aiplatform_v1beta1.FeatureOnlineStoreAdminServiceClient.CreateFeatureOnlineStore", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreAdminService", + "rpcName": "CreateFeatureOnlineStore", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeatureOnlineStoreAdminServiceRestTransport._CreateFeatureOnlineStore._get_response( self._host, @@ -2991,7 +3083,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_feature_online_store(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.aiplatform_v1beta1.FeatureOnlineStoreAdminServiceClient.create_feature_online_store", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreAdminService", + "rpcName": "CreateFeatureOnlineStore", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _CreateFeatureView( @@ -3031,7 +3145,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 feature view method over HTTP. @@ -3042,8 +3156,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: @@ -3056,6 +3172,7 @@ def __call__( http_options = ( _BaseFeatureOnlineStoreAdminServiceRestTransport._BaseCreateFeatureView._get_http_options() ) + request, metadata = self._interceptor.pre_create_feature_view( request, metadata ) @@ -3072,6 +3189,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.aiplatform_v1beta1.FeatureOnlineStoreAdminServiceClient.CreateFeatureView", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreAdminService", + "rpcName": "CreateFeatureView", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeatureOnlineStoreAdminServiceRestTransport._CreateFeatureView._get_response( self._host, @@ -3091,7 +3235,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_feature_view(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.aiplatform_v1beta1.FeatureOnlineStoreAdminServiceClient.create_feature_view", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreAdminService", + "rpcName": "CreateFeatureView", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _DeleteFeatureOnlineStore( @@ -3132,7 +3298,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 feature online store method over HTTP. @@ -3144,8 +3310,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: @@ -3158,6 +3326,7 @@ def __call__( http_options = ( _BaseFeatureOnlineStoreAdminServiceRestTransport._BaseDeleteFeatureOnlineStore._get_http_options() ) + request, metadata = self._interceptor.pre_delete_feature_online_store( request, metadata ) @@ -3170,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 = 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.aiplatform_v1beta1.FeatureOnlineStoreAdminServiceClient.DeleteFeatureOnlineStore", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreAdminService", + "rpcName": "DeleteFeatureOnlineStore", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeatureOnlineStoreAdminServiceRestTransport._DeleteFeatureOnlineStore._get_response( self._host, @@ -3188,7 +3384,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_feature_online_store(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.aiplatform_v1beta1.FeatureOnlineStoreAdminServiceClient.delete_feature_online_store", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreAdminService", + "rpcName": "DeleteFeatureOnlineStore", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _DeleteFeatureView( @@ -3227,7 +3445,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 feature view method over HTTP. @@ -3238,8 +3456,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: @@ -3252,6 +3472,7 @@ def __call__( http_options = ( _BaseFeatureOnlineStoreAdminServiceRestTransport._BaseDeleteFeatureView._get_http_options() ) + request, metadata = self._interceptor.pre_delete_feature_view( request, metadata ) @@ -3264,6 +3485,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.aiplatform_v1beta1.FeatureOnlineStoreAdminServiceClient.DeleteFeatureView", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreAdminService", + "rpcName": "DeleteFeatureView", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeatureOnlineStoreAdminServiceRestTransport._DeleteFeatureView._get_response( self._host, @@ -3282,7 +3530,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_feature_view(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.aiplatform_v1beta1.FeatureOnlineStoreAdminServiceClient.delete_feature_view", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreAdminService", + "rpcName": "DeleteFeatureView", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _GetFeatureOnlineStore( @@ -3323,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]]] = (), ) -> feature_online_store.FeatureOnlineStore: r"""Call the get feature online store method over HTTP. @@ -3334,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: ~.feature_online_store.FeatureOnlineStore: @@ -3350,6 +3622,7 @@ def __call__( http_options = ( _BaseFeatureOnlineStoreAdminServiceRestTransport._BaseGetFeatureOnlineStore._get_http_options() ) + request, metadata = self._interceptor.pre_get_feature_online_store( request, metadata ) @@ -3362,6 +3635,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.aiplatform_v1beta1.FeatureOnlineStoreAdminServiceClient.GetFeatureOnlineStore", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreAdminService", + "rpcName": "GetFeatureOnlineStore", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeatureOnlineStoreAdminServiceRestTransport._GetFeatureOnlineStore._get_response( self._host, @@ -3382,7 +3682,31 @@ def __call__( pb_resp = feature_online_store.FeatureOnlineStore.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_feature_online_store(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = feature_online_store.FeatureOnlineStore.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.aiplatform_v1beta1.FeatureOnlineStoreAdminServiceClient.get_feature_online_store", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreAdminService", + "rpcName": "GetFeatureOnlineStore", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _GetFeatureView( @@ -3421,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]]] = (), ) -> feature_view.FeatureView: r"""Call the get feature view method over HTTP. @@ -3432,8 +3756,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: ~.feature_view.FeatureView: @@ -3446,6 +3772,7 @@ def __call__( http_options = ( _BaseFeatureOnlineStoreAdminServiceRestTransport._BaseGetFeatureView._get_http_options() ) + request, metadata = self._interceptor.pre_get_feature_view( request, metadata ) @@ -3458,6 +3785,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.aiplatform_v1beta1.FeatureOnlineStoreAdminServiceClient.GetFeatureView", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreAdminService", + "rpcName": "GetFeatureView", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeatureOnlineStoreAdminServiceRestTransport._GetFeatureView._get_response( self._host, @@ -3478,7 +3832,29 @@ def __call__( pb_resp = feature_view.FeatureView.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_feature_view(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = feature_view.FeatureView.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.aiplatform_v1beta1.FeatureOnlineStoreAdminServiceClient.get_feature_view", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreAdminService", + "rpcName": "GetFeatureView", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _GetFeatureViewSync( @@ -3519,7 +3895,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]]] = (), ) -> feature_view_sync.FeatureViewSync: r"""Call the get feature view sync method over HTTP. @@ -3530,8 +3906,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: ~.feature_view_sync.FeatureViewSync: @@ -3545,6 +3923,7 @@ def __call__( http_options = ( _BaseFeatureOnlineStoreAdminServiceRestTransport._BaseGetFeatureViewSync._get_http_options() ) + request, metadata = self._interceptor.pre_get_feature_view_sync( request, metadata ) @@ -3557,6 +3936,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.aiplatform_v1beta1.FeatureOnlineStoreAdminServiceClient.GetFeatureViewSync", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreAdminService", + "rpcName": "GetFeatureViewSync", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeatureOnlineStoreAdminServiceRestTransport._GetFeatureViewSync._get_response( self._host, @@ -3577,7 +3983,31 @@ def __call__( pb_resp = feature_view_sync.FeatureViewSync.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_feature_view_sync(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = feature_view_sync.FeatureViewSync.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.aiplatform_v1beta1.FeatureOnlineStoreAdminServiceClient.get_feature_view_sync", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreAdminService", + "rpcName": "GetFeatureViewSync", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListFeatureOnlineStores( @@ -3618,7 +4048,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]]] = (), ) -> feature_online_store_admin_service.ListFeatureOnlineStoresResponse: r"""Call the list feature online stores method over HTTP. @@ -3630,8 +4060,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: ~.feature_online_store_admin_service.ListFeatureOnlineStoresResponse: @@ -3643,6 +4075,7 @@ def __call__( http_options = ( _BaseFeatureOnlineStoreAdminServiceRestTransport._BaseListFeatureOnlineStores._get_http_options() ) + request, metadata = self._interceptor.pre_list_feature_online_stores( request, metadata ) @@ -3655,6 +4088,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.aiplatform_v1beta1.FeatureOnlineStoreAdminServiceClient.ListFeatureOnlineStores", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreAdminService", + "rpcName": "ListFeatureOnlineStores", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeatureOnlineStoreAdminServiceRestTransport._ListFeatureOnlineStores._get_response( self._host, @@ -3679,7 +4139,31 @@ def __call__( ) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_feature_online_stores(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = feature_online_store_admin_service.ListFeatureOnlineStoresResponse.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.aiplatform_v1beta1.FeatureOnlineStoreAdminServiceClient.list_feature_online_stores", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreAdminService", + "rpcName": "ListFeatureOnlineStores", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListFeatureViews( @@ -3718,7 +4202,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]]] = (), ) -> feature_online_store_admin_service.ListFeatureViewsResponse: r"""Call the list feature views method over HTTP. @@ -3729,8 +4213,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: ~.feature_online_store_admin_service.ListFeatureViewsResponse: @@ -3742,6 +4228,7 @@ def __call__( http_options = ( _BaseFeatureOnlineStoreAdminServiceRestTransport._BaseListFeatureViews._get_http_options() ) + request, metadata = self._interceptor.pre_list_feature_views( request, metadata ) @@ -3754,6 +4241,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.aiplatform_v1beta1.FeatureOnlineStoreAdminServiceClient.ListFeatureViews", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreAdminService", + "rpcName": "ListFeatureViews", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeatureOnlineStoreAdminServiceRestTransport._ListFeatureViews._get_response( self._host, @@ -3776,7 +4290,31 @@ def __call__( ) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_feature_views(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = feature_online_store_admin_service.ListFeatureViewsResponse.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.aiplatform_v1beta1.FeatureOnlineStoreAdminServiceClient.list_feature_views", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreAdminService", + "rpcName": "ListFeatureViews", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListFeatureViewSyncs( @@ -3817,7 +4355,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]]] = (), ) -> feature_online_store_admin_service.ListFeatureViewSyncsResponse: r"""Call the list feature view syncs method over HTTP. @@ -3828,8 +4366,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: ~.feature_online_store_admin_service.ListFeatureViewSyncsResponse: @@ -3841,6 +4381,7 @@ def __call__( http_options = ( _BaseFeatureOnlineStoreAdminServiceRestTransport._BaseListFeatureViewSyncs._get_http_options() ) + request, metadata = self._interceptor.pre_list_feature_view_syncs( request, metadata ) @@ -3853,6 +4394,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.aiplatform_v1beta1.FeatureOnlineStoreAdminServiceClient.ListFeatureViewSyncs", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreAdminService", + "rpcName": "ListFeatureViewSyncs", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeatureOnlineStoreAdminServiceRestTransport._ListFeatureViewSyncs._get_response( self._host, @@ -3875,7 +4443,31 @@ def __call__( ) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_feature_view_syncs(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = feature_online_store_admin_service.ListFeatureViewSyncsResponse.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.aiplatform_v1beta1.FeatureOnlineStoreAdminServiceClient.list_feature_view_syncs", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreAdminService", + "rpcName": "ListFeatureViewSyncs", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _SyncFeatureView( @@ -3915,7 +4507,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]]] = (), ) -> feature_online_store_admin_service.SyncFeatureViewResponse: r"""Call the sync feature view method over HTTP. @@ -3926,8 +4518,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: ~.feature_online_store_admin_service.SyncFeatureViewResponse: @@ -3939,6 +4533,7 @@ def __call__( http_options = ( _BaseFeatureOnlineStoreAdminServiceRestTransport._BaseSyncFeatureView._get_http_options() ) + request, metadata = self._interceptor.pre_sync_feature_view( request, metadata ) @@ -3955,6 +4550,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.aiplatform_v1beta1.FeatureOnlineStoreAdminServiceClient.SyncFeatureView", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreAdminService", + "rpcName": "SyncFeatureView", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeatureOnlineStoreAdminServiceRestTransport._SyncFeatureView._get_response( self._host, @@ -3978,7 +4600,31 @@ def __call__( ) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_sync_feature_view(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = feature_online_store_admin_service.SyncFeatureViewResponse.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.aiplatform_v1beta1.FeatureOnlineStoreAdminServiceClient.sync_feature_view", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreAdminService", + "rpcName": "SyncFeatureView", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _UpdateFeatureOnlineStore( @@ -4020,7 +4666,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 feature online store method over HTTP. @@ -4032,8 +4678,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: @@ -4046,6 +4694,7 @@ def __call__( http_options = ( _BaseFeatureOnlineStoreAdminServiceRestTransport._BaseUpdateFeatureOnlineStore._get_http_options() ) + request, metadata = self._interceptor.pre_update_feature_online_store( request, metadata ) @@ -4062,6 +4711,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.aiplatform_v1beta1.FeatureOnlineStoreAdminServiceClient.UpdateFeatureOnlineStore", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreAdminService", + "rpcName": "UpdateFeatureOnlineStore", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeatureOnlineStoreAdminServiceRestTransport._UpdateFeatureOnlineStore._get_response( self._host, @@ -4081,7 +4757,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_feature_online_store(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.aiplatform_v1beta1.FeatureOnlineStoreAdminServiceClient.update_feature_online_store", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreAdminService", + "rpcName": "UpdateFeatureOnlineStore", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _UpdateFeatureView( @@ -4121,7 +4819,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 feature view method over HTTP. @@ -4132,8 +4830,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: @@ -4146,6 +4846,7 @@ def __call__( http_options = ( _BaseFeatureOnlineStoreAdminServiceRestTransport._BaseUpdateFeatureView._get_http_options() ) + request, metadata = self._interceptor.pre_update_feature_view( request, metadata ) @@ -4162,6 +4863,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.aiplatform_v1beta1.FeatureOnlineStoreAdminServiceClient.UpdateFeatureView", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreAdminService", + "rpcName": "UpdateFeatureView", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeatureOnlineStoreAdminServiceRestTransport._UpdateFeatureView._get_response( self._host, @@ -4181,7 +4909,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_feature_view(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.aiplatform_v1beta1.FeatureOnlineStoreAdminServiceClient.update_feature_view", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreAdminService", + "rpcName": "UpdateFeatureView", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp @property @@ -4367,7 +5117,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]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -4378,8 +5128,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: locations_pb2.Location: Response from GetLocation method. @@ -4388,6 +5140,7 @@ def __call__( http_options = ( _BaseFeatureOnlineStoreAdminServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = self._interceptor.pre_get_location(request, metadata) transcoded_request = _BaseFeatureOnlineStoreAdminServiceRestTransport._BaseGetLocation._get_transcoded_request( http_options, request @@ -4398,6 +5151,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.aiplatform_v1beta1.FeatureOnlineStoreAdminServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreAdminService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( FeatureOnlineStoreAdminServiceRestTransport._GetLocation._get_response( @@ -4419,6 +5199,27 @@ def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_location(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.aiplatform_v1beta1.FeatureOnlineStoreAdminServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreAdminService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4461,7 +5262,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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -4472,8 +5273,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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -4482,6 +5285,7 @@ def __call__( http_options = ( _BaseFeatureOnlineStoreAdminServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = self._interceptor.pre_list_locations(request, metadata) transcoded_request = _BaseFeatureOnlineStoreAdminServiceRestTransport._BaseListLocations._get_transcoded_request( http_options, request @@ -4492,6 +5296,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.aiplatform_v1beta1.FeatureOnlineStoreAdminServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreAdminService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeatureOnlineStoreAdminServiceRestTransport._ListLocations._get_response( self._host, @@ -4511,6 +5342,27 @@ def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_list_locations(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.aiplatform_v1beta1.FeatureOnlineStoreAdminServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreAdminService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4554,7 +5406,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]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -4565,8 +5417,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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -4575,6 +5429,7 @@ def __call__( http_options = ( _BaseFeatureOnlineStoreAdminServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_get_iam_policy(request, metadata) transcoded_request = _BaseFeatureOnlineStoreAdminServiceRestTransport._BaseGetIamPolicy._get_transcoded_request( http_options, request @@ -4589,6 +5444,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.aiplatform_v1beta1.FeatureOnlineStoreAdminServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreAdminService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( FeatureOnlineStoreAdminServiceRestTransport._GetIamPolicy._get_response( @@ -4611,6 +5493,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_iam_policy(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.aiplatform_v1beta1.FeatureOnlineStoreAdminServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreAdminService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4654,7 +5557,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]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -4665,8 +5568,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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -4675,6 +5580,7 @@ def __call__( http_options = ( _BaseFeatureOnlineStoreAdminServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_set_iam_policy(request, metadata) transcoded_request = _BaseFeatureOnlineStoreAdminServiceRestTransport._BaseSetIamPolicy._get_transcoded_request( http_options, request @@ -4689,6 +5595,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.aiplatform_v1beta1.FeatureOnlineStoreAdminServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreAdminService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( FeatureOnlineStoreAdminServiceRestTransport._SetIamPolicy._get_response( @@ -4711,6 +5644,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_set_iam_policy(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.aiplatform_v1beta1.FeatureOnlineStoreAdminServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreAdminService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4756,7 +5710,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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -4767,8 +5721,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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -4777,6 +5733,7 @@ def __call__( http_options = ( _BaseFeatureOnlineStoreAdminServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -4793,6 +5750,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.aiplatform_v1beta1.FeatureOnlineStoreAdminServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreAdminService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeatureOnlineStoreAdminServiceRestTransport._TestIamPermissions._get_response( self._host, @@ -4813,6 +5797,27 @@ def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_test_iam_permissions(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.aiplatform_v1beta1.FeatureOnlineStoreAdminServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreAdminService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4855,7 +5860,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 cancel operation method over HTTP. @@ -4866,13 +5871,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 = ( _BaseFeatureOnlineStoreAdminServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = self._interceptor.pre_cancel_operation( request, metadata ) @@ -4885,6 +5893,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.aiplatform_v1beta1.FeatureOnlineStoreAdminServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreAdminService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeatureOnlineStoreAdminServiceRestTransport._CancelOperation._get_response( self._host, @@ -4942,7 +5977,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. @@ -4953,13 +5988,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 = ( _BaseFeatureOnlineStoreAdminServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = self._interceptor.pre_delete_operation( request, metadata ) @@ -4972,6 +6010,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.aiplatform_v1beta1.FeatureOnlineStoreAdminServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreAdminService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeatureOnlineStoreAdminServiceRestTransport._DeleteOperation._get_response( self._host, @@ -5029,7 +6094,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. @@ -5040,8 +6105,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. @@ -5050,6 +6117,7 @@ def __call__( http_options = ( _BaseFeatureOnlineStoreAdminServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = self._interceptor.pre_get_operation(request, metadata) transcoded_request = _BaseFeatureOnlineStoreAdminServiceRestTransport._BaseGetOperation._get_transcoded_request( http_options, request @@ -5060,6 +6128,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.aiplatform_v1beta1.FeatureOnlineStoreAdminServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreAdminService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( FeatureOnlineStoreAdminServiceRestTransport._GetOperation._get_response( @@ -5081,6 +6176,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.aiplatform_v1beta1.FeatureOnlineStoreAdminServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreAdminService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5123,7 +6239,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. @@ -5134,8 +6250,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. @@ -5144,6 +6262,7 @@ def __call__( http_options = ( _BaseFeatureOnlineStoreAdminServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = self._interceptor.pre_list_operations(request, metadata) transcoded_request = _BaseFeatureOnlineStoreAdminServiceRestTransport._BaseListOperations._get_transcoded_request( http_options, request @@ -5154,6 +6273,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.aiplatform_v1beta1.FeatureOnlineStoreAdminServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreAdminService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeatureOnlineStoreAdminServiceRestTransport._ListOperations._get_response( self._host, @@ -5173,6 +6319,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.aiplatform_v1beta1.FeatureOnlineStoreAdminServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreAdminService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5215,7 +6382,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 wait operation method over HTTP. @@ -5226,8 +6393,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 WaitOperation method. @@ -5236,6 +6405,7 @@ def __call__( http_options = ( _BaseFeatureOnlineStoreAdminServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = self._interceptor.pre_wait_operation(request, metadata) transcoded_request = _BaseFeatureOnlineStoreAdminServiceRestTransport._BaseWaitOperation._get_transcoded_request( http_options, request @@ -5246,6 +6416,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.aiplatform_v1beta1.FeatureOnlineStoreAdminServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreAdminService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeatureOnlineStoreAdminServiceRestTransport._WaitOperation._get_response( self._host, @@ -5265,6 +6462,27 @@ def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = self._interceptor.post_wait_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.aiplatform_v1beta1.FeatureOnlineStoreAdminServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreAdminService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1beta1/services/feature_online_store_admin_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1beta1/services/feature_online_store_admin_service/transports/rest_asyncio.py index 61e6e9c7b5..5c95aaccf8 100644 --- a/google/cloud/aiplatform_v1beta1/services/feature_online_store_admin_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/feature_online_store_admin_service/transports/rest_asyncio.py @@ -61,6 +61,18 @@ from .base import DEFAULT_CLIENT_INFO as BASE_DEFAULT_CLIENT_INFO + +import logging + +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__) + try: OptionalRetry = Union[retries.AsyncRetry, gapic_v1.method._MethodDefault, None] except AttributeError: # pragma: NO COVER @@ -201,10 +213,10 @@ async def post_update_feature_view(self, response): async def pre_create_feature_online_store( self, request: feature_online_store_admin_service.CreateFeatureOnlineStoreRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ feature_online_store_admin_service.CreateFeatureOnlineStoreRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for create_feature_online_store @@ -227,10 +239,10 @@ async def post_create_feature_online_store( async def pre_create_feature_view( self, request: feature_online_store_admin_service.CreateFeatureViewRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ feature_online_store_admin_service.CreateFeatureViewRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for create_feature_view @@ -253,10 +265,10 @@ async def post_create_feature_view( async def pre_delete_feature_online_store( self, request: feature_online_store_admin_service.DeleteFeatureOnlineStoreRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ feature_online_store_admin_service.DeleteFeatureOnlineStoreRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for delete_feature_online_store @@ -279,10 +291,10 @@ async def post_delete_feature_online_store( async def pre_delete_feature_view( self, request: feature_online_store_admin_service.DeleteFeatureViewRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ feature_online_store_admin_service.DeleteFeatureViewRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for delete_feature_view @@ -305,10 +317,10 @@ async def post_delete_feature_view( async def pre_get_feature_online_store( self, request: feature_online_store_admin_service.GetFeatureOnlineStoreRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ feature_online_store_admin_service.GetFeatureOnlineStoreRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for get_feature_online_store @@ -331,10 +343,10 @@ async def post_get_feature_online_store( async def pre_get_feature_view( self, request: feature_online_store_admin_service.GetFeatureViewRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ feature_online_store_admin_service.GetFeatureViewRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for get_feature_view @@ -357,10 +369,10 @@ async def post_get_feature_view( async def pre_get_feature_view_sync( self, request: feature_online_store_admin_service.GetFeatureViewSyncRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ feature_online_store_admin_service.GetFeatureViewSyncRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for get_feature_view_sync @@ -383,10 +395,10 @@ async def post_get_feature_view_sync( async def pre_list_feature_online_stores( self, request: feature_online_store_admin_service.ListFeatureOnlineStoresRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ feature_online_store_admin_service.ListFeatureOnlineStoresRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for list_feature_online_stores @@ -410,10 +422,10 @@ async def post_list_feature_online_stores( async def pre_list_feature_views( self, request: feature_online_store_admin_service.ListFeatureViewsRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ feature_online_store_admin_service.ListFeatureViewsRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for list_feature_views @@ -436,10 +448,10 @@ async def post_list_feature_views( async def pre_list_feature_view_syncs( self, request: feature_online_store_admin_service.ListFeatureViewSyncsRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ feature_online_store_admin_service.ListFeatureViewSyncsRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for list_feature_view_syncs @@ -462,10 +474,10 @@ async def post_list_feature_view_syncs( async def pre_sync_feature_view( self, request: feature_online_store_admin_service.SyncFeatureViewRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ feature_online_store_admin_service.SyncFeatureViewRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for sync_feature_view @@ -488,10 +500,10 @@ async def post_sync_feature_view( async def pre_update_feature_online_store( self, request: feature_online_store_admin_service.UpdateFeatureOnlineStoreRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ feature_online_store_admin_service.UpdateFeatureOnlineStoreRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for update_feature_online_store @@ -514,10 +526,10 @@ async def post_update_feature_online_store( async def pre_update_feature_view( self, request: feature_online_store_admin_service.UpdateFeatureViewRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ feature_online_store_admin_service.UpdateFeatureViewRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for update_feature_view @@ -540,8 +552,10 @@ async def post_update_feature_view( async def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -563,8 +577,10 @@ async def post_get_location( async def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -586,8 +602,10 @@ async def post_list_locations( async def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -609,8 +627,10 @@ async def post_get_iam_policy( async def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -632,8 +652,11 @@ async def post_set_iam_policy( async def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -655,8 +678,10 @@ async def post_test_iam_permissions( async def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -676,8 +701,10 @@ async def post_cancel_operation(self, response: None) -> None: async 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 @@ -697,8 +724,10 @@ async def post_delete_operation(self, response: None) -> None: async 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 @@ -720,8 +749,10 @@ async def post_get_operation( async 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 @@ -743,8 +774,10 @@ async def post_list_operations( async def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -999,7 +1032,7 @@ async 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 feature online store method over HTTP. @@ -1011,8 +1044,10 @@ async def __call__( 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: @@ -1025,6 +1060,7 @@ async def __call__( http_options = ( _BaseFeatureOnlineStoreAdminServiceRestTransport._BaseCreateFeatureOnlineStore._get_http_options() ) + request, metadata = await self._interceptor.pre_create_feature_online_store( request, metadata ) @@ -1041,6 +1077,33 @@ async 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.aiplatform_v1beta1.FeatureOnlineStoreAdminServiceClient.CreateFeatureOnlineStore", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreAdminService", + "rpcName": "CreateFeatureOnlineStore", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeatureOnlineStoreAdminServiceRestTransport._CreateFeatureOnlineStore._get_response( self._host, @@ -1069,6 +1132,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_create_feature_online_store(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.FeatureOnlineStoreAdminServiceAsyncClient.create_feature_online_store", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreAdminService", + "rpcName": "CreateFeatureOnlineStore", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _CreateFeatureView( @@ -1110,7 +1195,7 @@ async 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 feature view method over HTTP. @@ -1121,8 +1206,10 @@ async def __call__( 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: @@ -1135,6 +1222,7 @@ async def __call__( http_options = ( _BaseFeatureOnlineStoreAdminServiceRestTransport._BaseCreateFeatureView._get_http_options() ) + request, metadata = await self._interceptor.pre_create_feature_view( request, metadata ) @@ -1151,6 +1239,33 @@ async 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.aiplatform_v1beta1.FeatureOnlineStoreAdminServiceClient.CreateFeatureView", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreAdminService", + "rpcName": "CreateFeatureView", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeatureOnlineStoreAdminServiceRestTransport._CreateFeatureView._get_response( self._host, @@ -1179,6 +1294,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_create_feature_view(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.FeatureOnlineStoreAdminServiceAsyncClient.create_feature_view", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreAdminService", + "rpcName": "CreateFeatureView", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _DeleteFeatureOnlineStore( @@ -1219,7 +1356,7 @@ async 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 feature online store method over HTTP. @@ -1231,8 +1368,10 @@ async def __call__( 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: @@ -1245,6 +1384,7 @@ async def __call__( http_options = ( _BaseFeatureOnlineStoreAdminServiceRestTransport._BaseDeleteFeatureOnlineStore._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_feature_online_store( request, metadata ) @@ -1257,6 +1397,33 @@ async 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.aiplatform_v1beta1.FeatureOnlineStoreAdminServiceClient.DeleteFeatureOnlineStore", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreAdminService", + "rpcName": "DeleteFeatureOnlineStore", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeatureOnlineStoreAdminServiceRestTransport._DeleteFeatureOnlineStore._get_response( self._host, @@ -1284,6 +1451,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_delete_feature_online_store(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.FeatureOnlineStoreAdminServiceAsyncClient.delete_feature_online_store", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreAdminService", + "rpcName": "DeleteFeatureOnlineStore", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _DeleteFeatureView( @@ -1324,7 +1513,7 @@ async 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 feature view method over HTTP. @@ -1335,8 +1524,10 @@ async def __call__( 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: @@ -1349,6 +1540,7 @@ async def __call__( http_options = ( _BaseFeatureOnlineStoreAdminServiceRestTransport._BaseDeleteFeatureView._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_feature_view( request, metadata ) @@ -1361,6 +1553,33 @@ async 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.aiplatform_v1beta1.FeatureOnlineStoreAdminServiceClient.DeleteFeatureView", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreAdminService", + "rpcName": "DeleteFeatureView", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeatureOnlineStoreAdminServiceRestTransport._DeleteFeatureView._get_response( self._host, @@ -1388,6 +1607,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_delete_feature_view(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.FeatureOnlineStoreAdminServiceAsyncClient.delete_feature_view", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreAdminService", + "rpcName": "DeleteFeatureView", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _GetFeatureOnlineStore( @@ -1428,7 +1669,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> feature_online_store.FeatureOnlineStore: r"""Call the get feature online store method over HTTP. @@ -1439,8 +1680,10 @@ async def __call__( 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: ~.feature_online_store.FeatureOnlineStore: @@ -1455,6 +1698,7 @@ async def __call__( http_options = ( _BaseFeatureOnlineStoreAdminServiceRestTransport._BaseGetFeatureOnlineStore._get_http_options() ) + request, metadata = await self._interceptor.pre_get_feature_online_store( request, metadata ) @@ -1467,6 +1711,33 @@ async 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.aiplatform_v1beta1.FeatureOnlineStoreAdminServiceClient.GetFeatureOnlineStore", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreAdminService", + "rpcName": "GetFeatureOnlineStore", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeatureOnlineStoreAdminServiceRestTransport._GetFeatureOnlineStore._get_response( self._host, @@ -1494,6 +1765,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_get_feature_online_store(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = feature_online_store.FeatureOnlineStore.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.FeatureOnlineStoreAdminServiceAsyncClient.get_feature_online_store", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreAdminService", + "rpcName": "GetFeatureOnlineStore", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _GetFeatureView( @@ -1534,7 +1829,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> feature_view.FeatureView: r"""Call the get feature view method over HTTP. @@ -1545,8 +1840,10 @@ async def __call__( 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: ~.feature_view.FeatureView: @@ -1559,6 +1856,7 @@ async def __call__( http_options = ( _BaseFeatureOnlineStoreAdminServiceRestTransport._BaseGetFeatureView._get_http_options() ) + request, metadata = await self._interceptor.pre_get_feature_view( request, metadata ) @@ -1571,6 +1869,33 @@ async 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.aiplatform_v1beta1.FeatureOnlineStoreAdminServiceClient.GetFeatureView", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreAdminService", + "rpcName": "GetFeatureView", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeatureOnlineStoreAdminServiceRestTransport._GetFeatureView._get_response( self._host, @@ -1598,6 +1923,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_get_feature_view(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = feature_view.FeatureView.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.FeatureOnlineStoreAdminServiceAsyncClient.get_feature_view", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreAdminService", + "rpcName": "GetFeatureView", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _GetFeatureViewSync( @@ -1638,7 +1985,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> feature_view_sync.FeatureViewSync: r"""Call the get feature view sync method over HTTP. @@ -1649,8 +1996,10 @@ async def __call__( 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: ~.feature_view_sync.FeatureViewSync: @@ -1664,6 +2013,7 @@ async def __call__( http_options = ( _BaseFeatureOnlineStoreAdminServiceRestTransport._BaseGetFeatureViewSync._get_http_options() ) + request, metadata = await self._interceptor.pre_get_feature_view_sync( request, metadata ) @@ -1676,6 +2026,33 @@ async 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.aiplatform_v1beta1.FeatureOnlineStoreAdminServiceClient.GetFeatureViewSync", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreAdminService", + "rpcName": "GetFeatureViewSync", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeatureOnlineStoreAdminServiceRestTransport._GetFeatureViewSync._get_response( self._host, @@ -1703,6 +2080,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_get_feature_view_sync(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = feature_view_sync.FeatureViewSync.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.FeatureOnlineStoreAdminServiceAsyncClient.get_feature_view_sync", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreAdminService", + "rpcName": "GetFeatureViewSync", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ListFeatureOnlineStores( @@ -1743,7 +2144,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> feature_online_store_admin_service.ListFeatureOnlineStoresResponse: r"""Call the list feature online stores method over HTTP. @@ -1755,8 +2156,10 @@ async def __call__( 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: ~.feature_online_store_admin_service.ListFeatureOnlineStoresResponse: @@ -1768,6 +2171,7 @@ async def __call__( http_options = ( _BaseFeatureOnlineStoreAdminServiceRestTransport._BaseListFeatureOnlineStores._get_http_options() ) + request, metadata = await self._interceptor.pre_list_feature_online_stores( request, metadata ) @@ -1780,6 +2184,33 @@ async 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.aiplatform_v1beta1.FeatureOnlineStoreAdminServiceClient.ListFeatureOnlineStores", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreAdminService", + "rpcName": "ListFeatureOnlineStores", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeatureOnlineStoreAdminServiceRestTransport._ListFeatureOnlineStores._get_response( self._host, @@ -1811,6 +2242,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_list_feature_online_stores(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = feature_online_store_admin_service.ListFeatureOnlineStoresResponse.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.FeatureOnlineStoreAdminServiceAsyncClient.list_feature_online_stores", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreAdminService", + "rpcName": "ListFeatureOnlineStores", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ListFeatureViews( @@ -1851,7 +2306,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> feature_online_store_admin_service.ListFeatureViewsResponse: r"""Call the list feature views method over HTTP. @@ -1862,8 +2317,10 @@ async def __call__( 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: ~.feature_online_store_admin_service.ListFeatureViewsResponse: @@ -1875,6 +2332,7 @@ async def __call__( http_options = ( _BaseFeatureOnlineStoreAdminServiceRestTransport._BaseListFeatureViews._get_http_options() ) + request, metadata = await self._interceptor.pre_list_feature_views( request, metadata ) @@ -1887,6 +2345,33 @@ async 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.aiplatform_v1beta1.FeatureOnlineStoreAdminServiceClient.ListFeatureViews", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreAdminService", + "rpcName": "ListFeatureViews", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeatureOnlineStoreAdminServiceRestTransport._ListFeatureViews._get_response( self._host, @@ -1916,6 +2401,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_list_feature_views(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = feature_online_store_admin_service.ListFeatureViewsResponse.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.FeatureOnlineStoreAdminServiceAsyncClient.list_feature_views", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreAdminService", + "rpcName": "ListFeatureViews", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ListFeatureViewSyncs( @@ -1956,7 +2465,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> feature_online_store_admin_service.ListFeatureViewSyncsResponse: r"""Call the list feature view syncs method over HTTP. @@ -1967,8 +2476,10 @@ async def __call__( 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: ~.feature_online_store_admin_service.ListFeatureViewSyncsResponse: @@ -1980,6 +2491,7 @@ async def __call__( http_options = ( _BaseFeatureOnlineStoreAdminServiceRestTransport._BaseListFeatureViewSyncs._get_http_options() ) + request, metadata = await self._interceptor.pre_list_feature_view_syncs( request, metadata ) @@ -1992,6 +2504,33 @@ async 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.aiplatform_v1beta1.FeatureOnlineStoreAdminServiceClient.ListFeatureViewSyncs", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreAdminService", + "rpcName": "ListFeatureViewSyncs", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeatureOnlineStoreAdminServiceRestTransport._ListFeatureViewSyncs._get_response( self._host, @@ -2021,6 +2560,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_list_feature_view_syncs(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = feature_online_store_admin_service.ListFeatureViewSyncsResponse.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.FeatureOnlineStoreAdminServiceAsyncClient.list_feature_view_syncs", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreAdminService", + "rpcName": "ListFeatureViewSyncs", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _SyncFeatureView( @@ -2062,7 +2625,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> feature_online_store_admin_service.SyncFeatureViewResponse: r"""Call the sync feature view method over HTTP. @@ -2073,8 +2636,10 @@ async def __call__( 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: ~.feature_online_store_admin_service.SyncFeatureViewResponse: @@ -2086,6 +2651,7 @@ async def __call__( http_options = ( _BaseFeatureOnlineStoreAdminServiceRestTransport._BaseSyncFeatureView._get_http_options() ) + request, metadata = await self._interceptor.pre_sync_feature_view( request, metadata ) @@ -2102,6 +2668,33 @@ async 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.aiplatform_v1beta1.FeatureOnlineStoreAdminServiceClient.SyncFeatureView", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreAdminService", + "rpcName": "SyncFeatureView", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeatureOnlineStoreAdminServiceRestTransport._SyncFeatureView._get_response( self._host, @@ -2132,6 +2725,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_sync_feature_view(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = feature_online_store_admin_service.SyncFeatureViewResponse.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.FeatureOnlineStoreAdminServiceAsyncClient.sync_feature_view", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreAdminService", + "rpcName": "SyncFeatureView", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _UpdateFeatureOnlineStore( @@ -2173,7 +2790,7 @@ async 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 feature online store method over HTTP. @@ -2185,8 +2802,10 @@ async def __call__( 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: @@ -2199,6 +2818,7 @@ async def __call__( http_options = ( _BaseFeatureOnlineStoreAdminServiceRestTransport._BaseUpdateFeatureOnlineStore._get_http_options() ) + request, metadata = await self._interceptor.pre_update_feature_online_store( request, metadata ) @@ -2215,6 +2835,33 @@ async 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.aiplatform_v1beta1.FeatureOnlineStoreAdminServiceClient.UpdateFeatureOnlineStore", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreAdminService", + "rpcName": "UpdateFeatureOnlineStore", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeatureOnlineStoreAdminServiceRestTransport._UpdateFeatureOnlineStore._get_response( self._host, @@ -2243,6 +2890,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_update_feature_online_store(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.FeatureOnlineStoreAdminServiceAsyncClient.update_feature_online_store", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreAdminService", + "rpcName": "UpdateFeatureOnlineStore", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _UpdateFeatureView( @@ -2284,7 +2953,7 @@ async 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 feature view method over HTTP. @@ -2295,8 +2964,10 @@ async def __call__( 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: @@ -2309,6 +2980,7 @@ async def __call__( http_options = ( _BaseFeatureOnlineStoreAdminServiceRestTransport._BaseUpdateFeatureView._get_http_options() ) + request, metadata = await self._interceptor.pre_update_feature_view( request, metadata ) @@ -2325,6 +2997,33 @@ async 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.aiplatform_v1beta1.FeatureOnlineStoreAdminServiceClient.UpdateFeatureView", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreAdminService", + "rpcName": "UpdateFeatureView", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeatureOnlineStoreAdminServiceRestTransport._UpdateFeatureView._get_response( self._host, @@ -2353,6 +3052,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_update_feature_view(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.FeatureOnlineStoreAdminServiceAsyncClient.update_feature_view", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreAdminService", + "rpcName": "UpdateFeatureView", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp @property @@ -2928,6 +3649,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -3144,6 +3869,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -3350,6 +4079,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}", @@ -3566,6 +4299,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, ], "google.longrunning.Operations.ListOperations": [ { @@ -3764,6 +4501,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*}/operations", @@ -3980,6 +4721,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*}/operations", + }, ], "google.longrunning.Operations.WaitOperation": [ { @@ -4178,6 +4923,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "post", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}:wait", @@ -4390,6 +5139,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, ], } @@ -4565,7 +5318,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -4576,8 +5329,10 @@ async def __call__( 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: locations_pb2.Location: Response from GetLocation method. @@ -4586,6 +5341,7 @@ async def __call__( http_options = ( _BaseFeatureOnlineStoreAdminServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_location( request, metadata ) @@ -4598,6 +5354,33 @@ async 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.aiplatform_v1beta1.FeatureOnlineStoreAdminServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreAdminService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeatureOnlineStoreAdminServiceRestTransport._GetLocation._get_response( self._host, @@ -4623,6 +5406,27 @@ async def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_location(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.aiplatform_v1beta1.FeatureOnlineStoreAdminServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreAdminService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4667,7 +5471,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -4678,8 +5482,10 @@ async def __call__( 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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -4688,6 +5494,7 @@ async def __call__( http_options = ( _BaseFeatureOnlineStoreAdminServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_locations( request, metadata ) @@ -4700,6 +5507,33 @@ async 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.aiplatform_v1beta1.FeatureOnlineStoreAdminServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreAdminService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeatureOnlineStoreAdminServiceRestTransport._ListLocations._get_response( self._host, @@ -4725,6 +5559,27 @@ async def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_list_locations(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.aiplatform_v1beta1.FeatureOnlineStoreAdminServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreAdminService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4768,7 +5623,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -4779,8 +5634,10 @@ async def __call__( 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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -4789,6 +5646,7 @@ async def __call__( http_options = ( _BaseFeatureOnlineStoreAdminServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_get_iam_policy( request, metadata ) @@ -4805,6 +5663,33 @@ async 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.aiplatform_v1beta1.FeatureOnlineStoreAdminServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreAdminService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeatureOnlineStoreAdminServiceRestTransport._GetIamPolicy._get_response( self._host, @@ -4831,6 +5716,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_iam_policy(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.aiplatform_v1beta1.FeatureOnlineStoreAdminServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreAdminService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4874,7 +5780,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -4885,8 +5791,10 @@ async def __call__( 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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -4895,6 +5803,7 @@ async def __call__( http_options = ( _BaseFeatureOnlineStoreAdminServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_set_iam_policy( request, metadata ) @@ -4911,6 +5820,33 @@ async 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.aiplatform_v1beta1.FeatureOnlineStoreAdminServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreAdminService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeatureOnlineStoreAdminServiceRestTransport._SetIamPolicy._get_response( self._host, @@ -4937,6 +5873,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_set_iam_policy(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.aiplatform_v1beta1.FeatureOnlineStoreAdminServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreAdminService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4982,7 +5939,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -4993,8 +5950,10 @@ async def __call__( 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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -5003,6 +5962,7 @@ async def __call__( http_options = ( _BaseFeatureOnlineStoreAdminServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = await self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -5019,6 +5979,33 @@ async 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.aiplatform_v1beta1.FeatureOnlineStoreAdminServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreAdminService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeatureOnlineStoreAdminServiceRestTransport._TestIamPermissions._get_response( self._host, @@ -5045,6 +6032,27 @@ async def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_test_iam_permissions(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.aiplatform_v1beta1.FeatureOnlineStoreAdminServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreAdminService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5089,7 +6097,7 @@ async 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 cancel operation method over HTTP. @@ -5100,13 +6108,16 @@ async def __call__( 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`. """ http_options = ( _BaseFeatureOnlineStoreAdminServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_cancel_operation( request, metadata ) @@ -5119,6 +6130,33 @@ async 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.aiplatform_v1beta1.FeatureOnlineStoreAdminServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreAdminService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeatureOnlineStoreAdminServiceRestTransport._CancelOperation._get_response( self._host, @@ -5184,7 +6222,7 @@ async 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. @@ -5195,13 +6233,16 @@ async def __call__( 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`. """ http_options = ( _BaseFeatureOnlineStoreAdminServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_operation( request, metadata ) @@ -5214,6 +6255,33 @@ async 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.aiplatform_v1beta1.FeatureOnlineStoreAdminServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreAdminService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeatureOnlineStoreAdminServiceRestTransport._DeleteOperation._get_response( self._host, @@ -5277,7 +6345,7 @@ async 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. @@ -5288,8 +6356,10 @@ async def __call__( 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: Response from GetOperation method. @@ -5298,6 +6368,7 @@ async def __call__( http_options = ( _BaseFeatureOnlineStoreAdminServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_operation( request, metadata ) @@ -5310,6 +6381,33 @@ async 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.aiplatform_v1beta1.FeatureOnlineStoreAdminServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreAdminService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeatureOnlineStoreAdminServiceRestTransport._GetOperation._get_response( self._host, @@ -5335,6 +6433,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1beta1.FeatureOnlineStoreAdminServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreAdminService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5379,7 +6498,7 @@ async 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. @@ -5390,8 +6509,10 @@ async def __call__( 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 from ListOperations method. @@ -5400,6 +6521,7 @@ async def __call__( http_options = ( _BaseFeatureOnlineStoreAdminServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_operations( request, metadata ) @@ -5412,6 +6534,33 @@ async 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.aiplatform_v1beta1.FeatureOnlineStoreAdminServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreAdminService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeatureOnlineStoreAdminServiceRestTransport._ListOperations._get_response( self._host, @@ -5437,6 +6586,27 @@ async def __call__( resp = operations_pb2.ListOperationsResponse() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1beta1.FeatureOnlineStoreAdminServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreAdminService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5481,7 +6651,7 @@ async 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 wait operation method over HTTP. @@ -5492,8 +6662,10 @@ async def __call__( 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: Response from WaitOperation method. @@ -5502,6 +6674,7 @@ async def __call__( http_options = ( _BaseFeatureOnlineStoreAdminServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_wait_operation( request, metadata ) @@ -5514,6 +6687,33 @@ async 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.aiplatform_v1beta1.FeatureOnlineStoreAdminServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreAdminService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeatureOnlineStoreAdminServiceRestTransport._WaitOperation._get_response( self._host, @@ -5539,6 +6739,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_wait_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.aiplatform_v1beta1.FeatureOnlineStoreAdminServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreAdminService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1beta1/services/feature_online_store_admin_service/transports/rest_base.py b/google/cloud/aiplatform_v1beta1/services/feature_online_store_admin_service/transports/rest_base.py index f0858b26d9..93403d86ed 100644 --- a/google/cloud/aiplatform_v1beta1/services/feature_online_store_admin_service/transports/rest_base.py +++ b/google/cloud/aiplatform_v1beta1/services/feature_online_store_admin_service/transports/rest_base.py @@ -1717,6 +1717,10 @@ def _get_http_options(): "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -1933,6 +1937,10 @@ def _get_http_options(): "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -2158,6 +2166,10 @@ def _get_http_options(): "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}", @@ -2374,6 +2386,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, ] return http_options @@ -2591,6 +2607,10 @@ def _get_http_options(): "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*}/operations", @@ -2807,6 +2827,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*}/operations", + }, ] return http_options @@ -3024,6 +3048,10 @@ def _get_http_options(): "method": "post", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}:wait", @@ -3236,6 +3264,10 @@ def _get_http_options(): "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, ] return http_options diff --git a/google/cloud/aiplatform_v1beta1/services/feature_online_store_service/async_client.py b/google/cloud/aiplatform_v1beta1/services/feature_online_store_service/async_client.py index d2044a7efd..7f8d59a6d9 100644 --- a/google/cloud/aiplatform_v1beta1/services/feature_online_store_service/async_client.py +++ b/google/cloud/aiplatform_v1beta1/services/feature_online_store_service/async_client.py @@ -13,6 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging as std_logging from collections import OrderedDict import re from typing import ( @@ -57,6 +58,15 @@ from .transports.grpc_asyncio import FeatureOnlineStoreServiceGrpcAsyncIOTransport from .client import FeatureOnlineStoreServiceClient +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 FeatureOnlineStoreServiceAsyncClient: """A service for fetching feature values from the online store.""" @@ -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.aiplatform_v1beta1.FeatureOnlineStoreServiceAsyncClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreService", + "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.aiplatform.v1beta1.FeatureOnlineStoreService", + "credentialsType": None, + }, + ) + async def fetch_feature_values( self, request: Optional[ @@ -286,7 +318,7 @@ async def fetch_feature_values( data_key: Optional[feature_online_store_service.FeatureViewDataKey] = 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]]] = (), ) -> feature_online_store_service.FetchFeatureValuesResponse: r"""Fetch feature values under a FeatureView. @@ -340,8 +372,10 @@ async def sample_fetch_feature_values(): 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.aiplatform_v1beta1.types.FetchFeatureValuesResponse: @@ -411,7 +445,7 @@ def streaming_fetch_feature_values( *, 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]]] = (), ) -> Awaitable[ AsyncIterable[feature_online_store_service.StreamingFetchFeatureValuesResponse] ]: @@ -466,8 +500,10 @@ def request_generator(): 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: AsyncIterable[google.cloud.aiplatform_v1beta1.types.StreamingFetchFeatureValuesResponse]: @@ -508,7 +544,7 @@ async def search_nearest_entities( *, 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]]] = (), ) -> feature_online_store_service.SearchNearestEntitiesResponse: r"""Search the nearest entities under a FeatureView. Search only works for indexable feature view; if a @@ -552,8 +588,10 @@ async def sample_search_nearest_entities(): 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.aiplatform_v1beta1.types.SearchNearestEntitiesResponse: @@ -603,7 +641,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. @@ -614,8 +652,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. @@ -656,7 +696,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. @@ -667,8 +707,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. @@ -709,7 +751,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. @@ -725,8 +767,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 """ @@ -763,7 +807,7 @@ async def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -778,8 +822,10 @@ async def cancel_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 """ @@ -816,7 +862,7 @@ async def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -833,8 +879,10 @@ async def wait_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. @@ -875,7 +923,7 @@ async def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -888,8 +936,10 @@ async def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -994,7 +1044,7 @@ async def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -1008,8 +1058,10 @@ async def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -1114,7 +1166,7 @@ async def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -1129,8 +1181,10 @@ async def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -1174,7 +1228,7 @@ async def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -1185,8 +1239,10 @@ async def get_location( 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: ~.location_pb2.Location: Location object. @@ -1227,7 +1283,7 @@ async def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -1238,8 +1294,10 @@ async def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1beta1/services/feature_online_store_service/client.py b/google/cloud/aiplatform_v1beta1/services/feature_online_store_service/client.py index 4e45549b7d..663c42eadf 100644 --- a/google/cloud/aiplatform_v1beta1/services/feature_online_store_service/client.py +++ b/google/cloud/aiplatform_v1beta1/services/feature_online_store_service/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.cloud.aiplatform_v1beta1.types import feature_online_store_service from google.cloud.location import locations_pb2 # type: ignore from google.iam.v1 import iam_policy_pb2 # type: ignore @@ -610,6 +620,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( @@ -701,6 +715,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.aiplatform_v1beta1.FeatureOnlineStoreServiceClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreService", + "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.aiplatform.v1beta1.FeatureOnlineStoreService", + "credentialsType": None, + }, + ) + def fetch_feature_values( self, request: Optional[ @@ -711,7 +748,7 @@ def fetch_feature_values( data_key: Optional[feature_online_store_service.FeatureViewDataKey] = 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]]] = (), ) -> feature_online_store_service.FetchFeatureValuesResponse: r"""Fetch feature values under a FeatureView. @@ -765,8 +802,10 @@ def sample_fetch_feature_values(): 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.aiplatform_v1beta1.types.FetchFeatureValuesResponse: @@ -831,7 +870,7 @@ def streaming_fetch_feature_values( *, 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]]] = (), ) -> Iterable[feature_online_store_service.StreamingFetchFeatureValuesResponse]: r"""Bidirectional streaming RPC to fetch feature values under a FeatureView. Requests may not have a one-to-one @@ -884,8 +923,10 @@ def request_generator(): 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: Iterable[google.cloud.aiplatform_v1beta1.types.StreamingFetchFeatureValuesResponse]: @@ -926,7 +967,7 @@ def search_nearest_entities( *, 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]]] = (), ) -> feature_online_store_service.SearchNearestEntitiesResponse: r"""Search the nearest entities under a FeatureView. Search only works for indexable feature view; if a @@ -970,8 +1011,10 @@ def sample_search_nearest_entities(): 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.aiplatform_v1beta1.types.SearchNearestEntitiesResponse: @@ -1032,7 +1075,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. @@ -1043,8 +1086,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. @@ -1085,7 +1130,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. @@ -1096,8 +1141,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. @@ -1138,7 +1185,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. @@ -1154,8 +1201,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 """ @@ -1192,7 +1241,7 @@ def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -1207,8 +1256,10 @@ def cancel_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 """ @@ -1245,7 +1296,7 @@ def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -1262,8 +1313,10 @@ def wait_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. @@ -1304,7 +1357,7 @@ def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -1317,8 +1370,10 @@ def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -1423,7 +1478,7 @@ def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -1437,8 +1492,10 @@ def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -1543,7 +1600,7 @@ def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -1558,8 +1615,10 @@ def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -1601,7 +1660,7 @@ def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -1612,8 +1671,10 @@ def get_location( 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: ~.location_pb2.Location: Location object. @@ -1654,7 +1715,7 @@ def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -1665,8 +1726,10 @@ def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1beta1/services/feature_online_store_service/transports/grpc.py b/google/cloud/aiplatform_v1beta1/services/feature_online_store_service/transports/grpc.py index 575287749a..0ef02012da 100644 --- a/google/cloud/aiplatform_v1beta1/services/feature_online_store_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1beta1/services/feature_online_store_service/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 import warnings from typing import Callable, Dict, Optional, Sequence, Tuple, Union @@ -21,8 +24,11 @@ import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from google.cloud.aiplatform_v1beta1.types import feature_online_store_service from google.cloud.location import locations_pb2 # type: ignore @@ -31,6 +37,81 @@ from google.longrunning import operations_pb2 # type: ignore from .base import FeatureOnlineStoreServiceTransport, DEFAULT_CLIENT_INFO +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.aiplatform.v1beta1.FeatureOnlineStoreService", + "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.aiplatform.v1beta1.FeatureOnlineStoreService", + "rpcName": client_call_details.method, + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class FeatureOnlineStoreServiceGrpcTransport(FeatureOnlineStoreServiceTransport): """gRPC backend transport for FeatureOnlineStoreService. @@ -184,7 +265,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 @@ -261,7 +347,7 @@ def fetch_feature_values( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "fetch_feature_values" not in self._stubs: - self._stubs["fetch_feature_values"] = self.grpc_channel.unary_unary( + self._stubs["fetch_feature_values"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.FeatureOnlineStoreService/FetchFeatureValues", request_serializer=feature_online_store_service.FetchFeatureValuesRequest.serialize, response_deserializer=feature_online_store_service.FetchFeatureValuesResponse.deserialize, @@ -295,7 +381,7 @@ def streaming_fetch_feature_values( if "streaming_fetch_feature_values" not in self._stubs: self._stubs[ "streaming_fetch_feature_values" - ] = self.grpc_channel.stream_stream( + ] = self._logged_channel.stream_stream( "/google.cloud.aiplatform.v1beta1.FeatureOnlineStoreService/StreamingFetchFeatureValues", request_serializer=feature_online_store_service.StreamingFetchFeatureValuesRequest.serialize, response_deserializer=feature_online_store_service.StreamingFetchFeatureValuesResponse.deserialize, @@ -327,7 +413,7 @@ def search_nearest_entities( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "search_nearest_entities" not in self._stubs: - self._stubs["search_nearest_entities"] = self.grpc_channel.unary_unary( + self._stubs["search_nearest_entities"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.FeatureOnlineStoreService/SearchNearestEntities", request_serializer=feature_online_store_service.SearchNearestEntitiesRequest.serialize, response_deserializer=feature_online_store_service.SearchNearestEntitiesResponse.deserialize, @@ -335,7 +421,7 @@ def search_nearest_entities( return self._stubs["search_nearest_entities"] def close(self): - self.grpc_channel.close() + self._logged_channel.close() @property def delete_operation( @@ -347,7 +433,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, @@ -364,7 +450,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -381,7 +467,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -398,7 +484,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, @@ -417,7 +503,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, @@ -436,7 +522,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -453,7 +539,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -478,7 +564,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -504,7 +590,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -533,7 +619,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1beta1/services/feature_online_store_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1beta1/services/feature_online_store_service/transports/grpc_asyncio.py index 5931c944e0..858f39ed3d 100644 --- a/google/cloud/aiplatform_v1beta1/services/feature_online_store_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/feature_online_store_service/transports/grpc_asyncio.py @@ -14,6 +14,9 @@ # limitations under the License. # import inspect +import json +import pickle +import logging as std_logging import warnings from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union @@ -23,8 +26,11 @@ from google.api_core import retry_async as retries from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from grpc.experimental import aio # type: ignore from google.cloud.aiplatform_v1beta1.types import feature_online_store_service @@ -35,6 +41,82 @@ from .base import FeatureOnlineStoreServiceTransport, DEFAULT_CLIENT_INFO from .grpc import FeatureOnlineStoreServiceGrpcTransport +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.aiplatform.v1beta1.FeatureOnlineStoreService", + "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.aiplatform.v1beta1.FeatureOnlineStoreService", + "rpcName": str(client_call_details.method), + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class FeatureOnlineStoreServiceGrpcAsyncIOTransport(FeatureOnlineStoreServiceTransport): """gRPC AsyncIO backend transport for FeatureOnlineStoreService. @@ -231,10 +313,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 @@ -269,7 +354,7 @@ def fetch_feature_values( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "fetch_feature_values" not in self._stubs: - self._stubs["fetch_feature_values"] = self.grpc_channel.unary_unary( + self._stubs["fetch_feature_values"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.FeatureOnlineStoreService/FetchFeatureValues", request_serializer=feature_online_store_service.FetchFeatureValuesRequest.serialize, response_deserializer=feature_online_store_service.FetchFeatureValuesResponse.deserialize, @@ -303,7 +388,7 @@ def streaming_fetch_feature_values( if "streaming_fetch_feature_values" not in self._stubs: self._stubs[ "streaming_fetch_feature_values" - ] = self.grpc_channel.stream_stream( + ] = self._logged_channel.stream_stream( "/google.cloud.aiplatform.v1beta1.FeatureOnlineStoreService/StreamingFetchFeatureValues", request_serializer=feature_online_store_service.StreamingFetchFeatureValuesRequest.serialize, response_deserializer=feature_online_store_service.StreamingFetchFeatureValuesResponse.deserialize, @@ -335,7 +420,7 @@ def search_nearest_entities( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "search_nearest_entities" not in self._stubs: - self._stubs["search_nearest_entities"] = self.grpc_channel.unary_unary( + self._stubs["search_nearest_entities"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.FeatureOnlineStoreService/SearchNearestEntities", request_serializer=feature_online_store_service.SearchNearestEntitiesRequest.serialize, response_deserializer=feature_online_store_service.SearchNearestEntitiesResponse.deserialize, @@ -418,7 +503,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: @@ -434,7 +519,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, @@ -451,7 +536,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -468,7 +553,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -485,7 +570,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, @@ -504,7 +589,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, @@ -523,7 +608,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -540,7 +625,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -565,7 +650,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -591,7 +676,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -620,7 +705,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1beta1/services/feature_online_store_service/transports/rest.py b/google/cloud/aiplatform_v1beta1/services/feature_online_store_service/transports/rest.py index 98f311ed26..c6fa000bbb 100644 --- a/google/cloud/aiplatform_v1beta1/services/feature_online_store_service/transports/rest.py +++ b/google/cloud/aiplatform_v1beta1/services/feature_online_store_service/transports/rest.py @@ -13,9 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging +import json # type: ignore from google.auth.transport.requests import AuthorizedSession # type: ignore -import json # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.api_core import exceptions as core_exceptions from google.api_core import retry as retries @@ -46,6 +47,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, @@ -94,10 +103,10 @@ def post_search_nearest_entities(self, response): def pre_fetch_feature_values( self, request: feature_online_store_service.FetchFeatureValuesRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ feature_online_store_service.FetchFeatureValuesRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for fetch_feature_values @@ -120,10 +129,10 @@ def post_fetch_feature_values( def pre_search_nearest_entities( self, request: feature_online_store_service.SearchNearestEntitiesRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ feature_online_store_service.SearchNearestEntitiesRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for search_nearest_entities @@ -146,8 +155,10 @@ def post_search_nearest_entities( def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -169,8 +180,10 @@ def post_get_location( def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -192,8 +205,10 @@ def post_list_locations( def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -213,8 +228,10 @@ def post_get_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -234,8 +251,11 @@ def post_set_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -257,8 +277,10 @@ def post_test_iam_permissions( def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -278,8 +300,10 @@ def post_cancel_operation(self, response: None) -> None: 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 @@ -299,8 +323,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 @@ -322,8 +348,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 @@ -345,8 +373,10 @@ def post_list_operations( def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -491,7 +521,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]]] = (), ) -> feature_online_store_service.FetchFeatureValuesResponse: r"""Call the fetch feature values method over HTTP. @@ -504,8 +534,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: ~.feature_online_store_service.FetchFeatureValuesResponse: @@ -517,6 +549,7 @@ def __call__( http_options = ( _BaseFeatureOnlineStoreServiceRestTransport._BaseFetchFeatureValues._get_http_options() ) + request, metadata = self._interceptor.pre_fetch_feature_values( request, metadata ) @@ -533,6 +566,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.aiplatform_v1beta1.FeatureOnlineStoreServiceClient.FetchFeatureValues", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreService", + "rpcName": "FetchFeatureValues", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeatureOnlineStoreServiceRestTransport._FetchFeatureValues._get_response( self._host, @@ -554,7 +614,33 @@ def __call__( pb_resp = feature_online_store_service.FetchFeatureValuesResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_fetch_feature_values(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + feature_online_store_service.FetchFeatureValuesResponse.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.aiplatform_v1beta1.FeatureOnlineStoreServiceClient.fetch_feature_values", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreService", + "rpcName": "FetchFeatureValues", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _SearchNearestEntities( @@ -594,7 +680,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]]] = (), ) -> feature_online_store_service.SearchNearestEntitiesResponse: r"""Call the search nearest entities method over HTTP. @@ -605,8 +691,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: ~.feature_online_store_service.SearchNearestEntitiesResponse: @@ -618,6 +706,7 @@ def __call__( http_options = ( _BaseFeatureOnlineStoreServiceRestTransport._BaseSearchNearestEntities._get_http_options() ) + request, metadata = self._interceptor.pre_search_nearest_entities( request, metadata ) @@ -634,6 +723,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.aiplatform_v1beta1.FeatureOnlineStoreServiceClient.SearchNearestEntities", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreService", + "rpcName": "SearchNearestEntities", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeatureOnlineStoreServiceRestTransport._SearchNearestEntities._get_response( self._host, @@ -657,7 +773,31 @@ def __call__( ) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_search_nearest_entities(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = feature_online_store_service.SearchNearestEntitiesResponse.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.aiplatform_v1beta1.FeatureOnlineStoreServiceClient.search_nearest_entities", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreService", + "rpcName": "SearchNearestEntities", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _StreamingFetchFeatureValues( @@ -675,7 +815,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]]] = (), ) -> rest_streaming.ResponseIterator: raise NotImplementedError( "Method StreamingFetchFeatureValues is not available over REST transport" @@ -754,7 +894,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]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -765,8 +905,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: locations_pb2.Location: Response from GetLocation method. @@ -775,6 +917,7 @@ def __call__( http_options = ( _BaseFeatureOnlineStoreServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = self._interceptor.pre_get_location(request, metadata) transcoded_request = _BaseFeatureOnlineStoreServiceRestTransport._BaseGetLocation._get_transcoded_request( http_options, request @@ -785,6 +928,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.aiplatform_v1beta1.FeatureOnlineStoreServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( FeatureOnlineStoreServiceRestTransport._GetLocation._get_response( @@ -806,6 +976,27 @@ def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_location(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.aiplatform_v1beta1.FeatureOnlineStoreServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -848,7 +1039,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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -859,8 +1050,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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -869,6 +1062,7 @@ def __call__( http_options = ( _BaseFeatureOnlineStoreServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = self._interceptor.pre_list_locations(request, metadata) transcoded_request = _BaseFeatureOnlineStoreServiceRestTransport._BaseListLocations._get_transcoded_request( http_options, request @@ -879,6 +1073,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.aiplatform_v1beta1.FeatureOnlineStoreServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( FeatureOnlineStoreServiceRestTransport._ListLocations._get_response( @@ -900,6 +1121,27 @@ def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_list_locations(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.aiplatform_v1beta1.FeatureOnlineStoreServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -943,7 +1185,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]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -954,8 +1196,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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -964,6 +1208,7 @@ def __call__( http_options = ( _BaseFeatureOnlineStoreServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_get_iam_policy(request, metadata) transcoded_request = _BaseFeatureOnlineStoreServiceRestTransport._BaseGetIamPolicy._get_transcoded_request( http_options, request @@ -978,6 +1223,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.aiplatform_v1beta1.FeatureOnlineStoreServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( FeatureOnlineStoreServiceRestTransport._GetIamPolicy._get_response( @@ -1000,6 +1272,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_iam_policy(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.aiplatform_v1beta1.FeatureOnlineStoreServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1043,7 +1336,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]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -1054,8 +1347,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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -1064,6 +1359,7 @@ def __call__( http_options = ( _BaseFeatureOnlineStoreServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_set_iam_policy(request, metadata) transcoded_request = _BaseFeatureOnlineStoreServiceRestTransport._BaseSetIamPolicy._get_transcoded_request( http_options, request @@ -1078,6 +1374,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.aiplatform_v1beta1.FeatureOnlineStoreServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( FeatureOnlineStoreServiceRestTransport._SetIamPolicy._get_response( @@ -1100,6 +1423,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_set_iam_policy(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.aiplatform_v1beta1.FeatureOnlineStoreServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1143,7 +1487,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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -1154,8 +1498,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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -1164,6 +1510,7 @@ def __call__( http_options = ( _BaseFeatureOnlineStoreServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -1180,6 +1527,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.aiplatform_v1beta1.FeatureOnlineStoreServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeatureOnlineStoreServiceRestTransport._TestIamPermissions._get_response( self._host, @@ -1200,6 +1574,27 @@ def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_test_iam_permissions(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.aiplatform_v1beta1.FeatureOnlineStoreServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1242,7 +1637,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 cancel operation method over HTTP. @@ -1253,13 +1648,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 = ( _BaseFeatureOnlineStoreServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = self._interceptor.pre_cancel_operation( request, metadata ) @@ -1272,6 +1670,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.aiplatform_v1beta1.FeatureOnlineStoreServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( FeatureOnlineStoreServiceRestTransport._CancelOperation._get_response( @@ -1331,7 +1756,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. @@ -1342,13 +1767,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 = ( _BaseFeatureOnlineStoreServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = self._interceptor.pre_delete_operation( request, metadata ) @@ -1361,6 +1789,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.aiplatform_v1beta1.FeatureOnlineStoreServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( FeatureOnlineStoreServiceRestTransport._DeleteOperation._get_response( @@ -1420,7 +1875,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. @@ -1431,8 +1886,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. @@ -1441,6 +1898,7 @@ def __call__( http_options = ( _BaseFeatureOnlineStoreServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = self._interceptor.pre_get_operation(request, metadata) transcoded_request = _BaseFeatureOnlineStoreServiceRestTransport._BaseGetOperation._get_transcoded_request( http_options, request @@ -1451,6 +1909,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.aiplatform_v1beta1.FeatureOnlineStoreServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( FeatureOnlineStoreServiceRestTransport._GetOperation._get_response( @@ -1472,6 +1957,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.aiplatform_v1beta1.FeatureOnlineStoreServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1514,7 +2020,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. @@ -1525,8 +2031,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. @@ -1535,6 +2043,7 @@ def __call__( http_options = ( _BaseFeatureOnlineStoreServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = self._interceptor.pre_list_operations(request, metadata) transcoded_request = _BaseFeatureOnlineStoreServiceRestTransport._BaseListOperations._get_transcoded_request( http_options, request @@ -1545,6 +2054,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.aiplatform_v1beta1.FeatureOnlineStoreServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( FeatureOnlineStoreServiceRestTransport._ListOperations._get_response( @@ -1566,6 +2102,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.aiplatform_v1beta1.FeatureOnlineStoreServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1608,7 +2165,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 wait operation method over HTTP. @@ -1619,8 +2176,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 WaitOperation method. @@ -1629,6 +2188,7 @@ def __call__( http_options = ( _BaseFeatureOnlineStoreServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = self._interceptor.pre_wait_operation(request, metadata) transcoded_request = _BaseFeatureOnlineStoreServiceRestTransport._BaseWaitOperation._get_transcoded_request( http_options, request @@ -1639,6 +2199,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.aiplatform_v1beta1.FeatureOnlineStoreServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( FeatureOnlineStoreServiceRestTransport._WaitOperation._get_response( @@ -1660,6 +2247,27 @@ def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = self._interceptor.post_wait_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.aiplatform_v1beta1.FeatureOnlineStoreServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1beta1/services/feature_online_store_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1beta1/services/feature_online_store_service/transports/rest_asyncio.py index 0227eebed7..09c1dd4919 100644 --- a/google/cloud/aiplatform_v1beta1/services/feature_online_store_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/feature_online_store_service/transports/rest_asyncio.py @@ -56,6 +56,18 @@ from .base import DEFAULT_CLIENT_INFO as BASE_DEFAULT_CLIENT_INFO + +import logging + +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__) + try: OptionalRetry = Union[retries.AsyncRetry, gapic_v1.method._MethodDefault, None] except AttributeError: # pragma: NO COVER @@ -108,10 +120,10 @@ async def post_search_nearest_entities(self, response): async def pre_fetch_feature_values( self, request: feature_online_store_service.FetchFeatureValuesRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ feature_online_store_service.FetchFeatureValuesRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for fetch_feature_values @@ -134,10 +146,10 @@ async def post_fetch_feature_values( async def pre_search_nearest_entities( self, request: feature_online_store_service.SearchNearestEntitiesRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ feature_online_store_service.SearchNearestEntitiesRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for search_nearest_entities @@ -160,8 +172,10 @@ async def post_search_nearest_entities( async def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -183,8 +197,10 @@ async def post_get_location( async def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -206,8 +222,10 @@ async def post_list_locations( async def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -229,8 +247,10 @@ async def post_get_iam_policy( async def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -252,8 +272,11 @@ async def post_set_iam_policy( async def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -275,8 +298,10 @@ async def post_test_iam_permissions( async def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -296,8 +321,10 @@ async def post_cancel_operation(self, response: None) -> None: async 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 @@ -317,8 +344,10 @@ async def post_delete_operation(self, response: None) -> None: async 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 @@ -340,8 +369,10 @@ async def post_get_operation( async 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 @@ -363,8 +394,10 @@ async def post_list_operations( async def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -563,7 +596,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> feature_online_store_service.FetchFeatureValuesResponse: r"""Call the fetch feature values method over HTTP. @@ -576,8 +609,10 @@ async def __call__( 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: ~.feature_online_store_service.FetchFeatureValuesResponse: @@ -589,6 +624,7 @@ async def __call__( http_options = ( _BaseFeatureOnlineStoreServiceRestTransport._BaseFetchFeatureValues._get_http_options() ) + request, metadata = await self._interceptor.pre_fetch_feature_values( request, metadata ) @@ -605,6 +641,33 @@ async 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.aiplatform_v1beta1.FeatureOnlineStoreServiceClient.FetchFeatureValues", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreService", + "rpcName": "FetchFeatureValues", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeatureOnlineStoreServiceRestTransport._FetchFeatureValues._get_response( self._host, @@ -633,6 +696,32 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_fetch_feature_values(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + feature_online_store_service.FetchFeatureValuesResponse.to_json( + response + ) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.FeatureOnlineStoreServiceAsyncClient.fetch_feature_values", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreService", + "rpcName": "FetchFeatureValues", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _SearchNearestEntities( @@ -674,7 +763,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> feature_online_store_service.SearchNearestEntitiesResponse: r"""Call the search nearest entities method over HTTP. @@ -685,8 +774,10 @@ async def __call__( 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: ~.feature_online_store_service.SearchNearestEntitiesResponse: @@ -698,6 +789,7 @@ async def __call__( http_options = ( _BaseFeatureOnlineStoreServiceRestTransport._BaseSearchNearestEntities._get_http_options() ) + request, metadata = await self._interceptor.pre_search_nearest_entities( request, metadata ) @@ -714,6 +806,33 @@ async 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.aiplatform_v1beta1.FeatureOnlineStoreServiceClient.SearchNearestEntities", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreService", + "rpcName": "SearchNearestEntities", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeatureOnlineStoreServiceRestTransport._SearchNearestEntities._get_response( self._host, @@ -744,6 +863,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_search_nearest_entities(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = feature_online_store_service.SearchNearestEntitiesResponse.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.FeatureOnlineStoreServiceAsyncClient.search_nearest_entities", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreService", + "rpcName": "SearchNearestEntities", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _StreamingFetchFeatureValues( @@ -761,7 +904,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> rest_streaming_async.AsyncResponseIterator: raise NotImplementedError( "Method StreamingFetchFeatureValues is not available over REST transport" @@ -834,7 +977,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -845,8 +988,10 @@ async def __call__( 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: locations_pb2.Location: Response from GetLocation method. @@ -855,6 +1000,7 @@ async def __call__( http_options = ( _BaseFeatureOnlineStoreServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_location( request, metadata ) @@ -867,6 +1013,33 @@ async 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.aiplatform_v1beta1.FeatureOnlineStoreServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeatureOnlineStoreServiceRestTransport._GetLocation._get_response( self._host, @@ -892,6 +1065,27 @@ async def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_location(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.aiplatform_v1beta1.FeatureOnlineStoreServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -934,7 +1128,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -945,8 +1139,10 @@ async def __call__( 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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -955,6 +1151,7 @@ async def __call__( http_options = ( _BaseFeatureOnlineStoreServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_locations( request, metadata ) @@ -967,6 +1164,33 @@ async 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.aiplatform_v1beta1.FeatureOnlineStoreServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeatureOnlineStoreServiceRestTransport._ListLocations._get_response( self._host, @@ -992,6 +1216,27 @@ async def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_list_locations(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.aiplatform_v1beta1.FeatureOnlineStoreServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1035,7 +1280,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -1046,8 +1291,10 @@ async def __call__( 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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -1056,6 +1303,7 @@ async def __call__( http_options = ( _BaseFeatureOnlineStoreServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_get_iam_policy( request, metadata ) @@ -1072,6 +1320,33 @@ async 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.aiplatform_v1beta1.FeatureOnlineStoreServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeatureOnlineStoreServiceRestTransport._GetIamPolicy._get_response( self._host, @@ -1098,6 +1373,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_iam_policy(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.aiplatform_v1beta1.FeatureOnlineStoreServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1141,7 +1437,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -1152,8 +1448,10 @@ async def __call__( 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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -1162,6 +1460,7 @@ async def __call__( http_options = ( _BaseFeatureOnlineStoreServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_set_iam_policy( request, metadata ) @@ -1178,6 +1477,33 @@ async 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.aiplatform_v1beta1.FeatureOnlineStoreServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeatureOnlineStoreServiceRestTransport._SetIamPolicy._get_response( self._host, @@ -1204,6 +1530,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_set_iam_policy(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.aiplatform_v1beta1.FeatureOnlineStoreServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1249,7 +1596,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -1260,8 +1607,10 @@ async def __call__( 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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -1270,6 +1619,7 @@ async def __call__( http_options = ( _BaseFeatureOnlineStoreServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = await self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -1286,6 +1636,33 @@ async 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.aiplatform_v1beta1.FeatureOnlineStoreServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeatureOnlineStoreServiceRestTransport._TestIamPermissions._get_response( self._host, @@ -1312,6 +1689,27 @@ async def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_test_iam_permissions(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.aiplatform_v1beta1.FeatureOnlineStoreServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1354,7 +1752,7 @@ async 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 cancel operation method over HTTP. @@ -1365,13 +1763,16 @@ async def __call__( 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`. """ http_options = ( _BaseFeatureOnlineStoreServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_cancel_operation( request, metadata ) @@ -1384,6 +1785,33 @@ async 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.aiplatform_v1beta1.FeatureOnlineStoreServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeatureOnlineStoreServiceRestTransport._CancelOperation._get_response( self._host, @@ -1447,7 +1875,7 @@ async 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. @@ -1458,13 +1886,16 @@ async def __call__( 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`. """ http_options = ( _BaseFeatureOnlineStoreServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_operation( request, metadata ) @@ -1477,6 +1908,33 @@ async 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.aiplatform_v1beta1.FeatureOnlineStoreServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeatureOnlineStoreServiceRestTransport._DeleteOperation._get_response( self._host, @@ -1540,7 +1998,7 @@ async 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. @@ -1551,8 +2009,10 @@ async def __call__( 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: Response from GetOperation method. @@ -1561,6 +2021,7 @@ async def __call__( http_options = ( _BaseFeatureOnlineStoreServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_operation( request, metadata ) @@ -1573,6 +2034,33 @@ async 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.aiplatform_v1beta1.FeatureOnlineStoreServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeatureOnlineStoreServiceRestTransport._GetOperation._get_response( self._host, @@ -1598,6 +2086,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1beta1.FeatureOnlineStoreServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1640,7 +2149,7 @@ async 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. @@ -1651,8 +2160,10 @@ async def __call__( 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 from ListOperations method. @@ -1661,6 +2172,7 @@ async def __call__( http_options = ( _BaseFeatureOnlineStoreServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_operations( request, metadata ) @@ -1673,6 +2185,33 @@ async 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.aiplatform_v1beta1.FeatureOnlineStoreServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeatureOnlineStoreServiceRestTransport._ListOperations._get_response( self._host, @@ -1698,6 +2237,27 @@ async def __call__( resp = operations_pb2.ListOperationsResponse() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1beta1.FeatureOnlineStoreServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1740,7 +2300,7 @@ async 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 wait operation method over HTTP. @@ -1751,8 +2311,10 @@ async def __call__( 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: Response from WaitOperation method. @@ -1761,6 +2323,7 @@ async def __call__( http_options = ( _BaseFeatureOnlineStoreServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_wait_operation( request, metadata ) @@ -1773,6 +2336,33 @@ async 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.aiplatform_v1beta1.FeatureOnlineStoreServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeatureOnlineStoreServiceRestTransport._WaitOperation._get_response( self._host, @@ -1798,6 +2388,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_wait_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.aiplatform_v1beta1.FeatureOnlineStoreServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureOnlineStoreService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1beta1/services/feature_online_store_service/transports/rest_base.py b/google/cloud/aiplatform_v1beta1/services/feature_online_store_service/transports/rest_base.py index 69d5ce6b91..2224f8f005 100644 --- a/google/cloud/aiplatform_v1beta1/services/feature_online_store_service/transports/rest_base.py +++ b/google/cloud/aiplatform_v1beta1/services/feature_online_store_service/transports/rest_base.py @@ -1131,6 +1131,10 @@ def _get_http_options(): "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -1347,6 +1351,10 @@ def _get_http_options(): "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -1572,6 +1580,10 @@ def _get_http_options(): "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}", @@ -1788,6 +1800,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, ] return http_options @@ -2005,6 +2021,10 @@ def _get_http_options(): "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*}/operations", @@ -2221,6 +2241,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*}/operations", + }, ] return http_options @@ -2438,6 +2462,10 @@ def _get_http_options(): "method": "post", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}:wait", @@ -2650,6 +2678,10 @@ def _get_http_options(): "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, ] return http_options diff --git a/google/cloud/aiplatform_v1beta1/services/feature_registry_service/async_client.py b/google/cloud/aiplatform_v1beta1/services/feature_registry_service/async_client.py index c7580f241d..d89ded13c6 100644 --- a/google/cloud/aiplatform_v1beta1/services/feature_registry_service/async_client.py +++ b/google/cloud/aiplatform_v1beta1/services/feature_registry_service/async_client.py @@ -13,6 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging as std_logging from collections import OrderedDict import re from typing import ( @@ -73,6 +74,15 @@ from .transports.grpc_asyncio import FeatureRegistryServiceGrpcAsyncIOTransport from .client import FeatureRegistryServiceClient +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 FeatureRegistryServiceAsyncClient: """The service that handles CRUD and List for resources for @@ -302,6 +312,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.aiplatform_v1beta1.FeatureRegistryServiceAsyncClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureRegistryService", + "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.aiplatform.v1beta1.FeatureRegistryService", + "credentialsType": None, + }, + ) + async def create_feature_group( self, request: Optional[ @@ -313,7 +345,7 @@ async def create_feature_group( feature_group_id: 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"""Creates a new FeatureGroup in a given project and location. @@ -388,8 +420,10 @@ async def sample_create_feature_group(): 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: @@ -467,7 +501,7 @@ async def get_feature_group( 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]]] = (), ) -> feature_group.FeatureGroup: r"""Gets details of a single FeatureGroup. @@ -511,8 +545,10 @@ async def sample_get_feature_group(): 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.aiplatform_v1beta1.types.FeatureGroup: @@ -573,7 +609,7 @@ async def list_feature_groups( 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.ListFeatureGroupsAsyncPager: r"""Lists FeatureGroups in a given project and location. @@ -619,8 +655,10 @@ async def sample_list_feature_groups(): 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.aiplatform_v1beta1.services.feature_registry_service.pagers.ListFeatureGroupsAsyncPager: @@ -698,7 +736,7 @@ async def update_feature_group( 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"""Updates the parameters of a single FeatureGroup. @@ -770,8 +808,10 @@ async def sample_update_feature_group(): 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: @@ -850,7 +890,7 @@ async def delete_feature_group( force: Optional[bool] = 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"""Deletes a single FeatureGroup. @@ -908,8 +948,10 @@ async def sample_delete_feature_group(): 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: @@ -994,7 +1036,7 @@ async def create_feature( feature_id: 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"""Creates a new Feature in a given FeatureGroup. @@ -1069,8 +1111,10 @@ async def sample_create_feature(): 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: @@ -1151,7 +1195,7 @@ async def batch_create_features( ] = 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"""Creates a batch of Features in a given FeatureGroup. @@ -1220,8 +1264,10 @@ async def sample_batch_create_features(): 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: @@ -1294,7 +1340,7 @@ async def get_feature( 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]]] = (), ) -> feature.Feature: r"""Gets details of a single Feature. @@ -1343,8 +1389,10 @@ async def sample_get_feature(): 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.aiplatform_v1beta1.types.Feature: @@ -1406,7 +1454,7 @@ async def list_features( 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.ListFeaturesAsyncPager: r"""Lists Features in a given FeatureGroup. @@ -1456,8 +1504,10 @@ async def sample_list_features(): 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.aiplatform_v1beta1.services.feature_registry_service.pagers.ListFeaturesAsyncPager: @@ -1537,7 +1587,7 @@ async def update_feature( 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"""Updates the parameters of a single Feature. @@ -1610,8 +1660,10 @@ async def sample_update_feature(): 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: @@ -1689,7 +1741,7 @@ async def delete_feature( 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"""Deletes a single Feature. @@ -1741,8 +1793,10 @@ async def sample_delete_feature(): 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: @@ -1825,7 +1879,7 @@ async def create_feature_monitor( feature_monitor_id: 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"""Creates a new FeatureMonitor in a given project, location and FeatureGroup. @@ -1895,8 +1949,10 @@ async def sample_create_feature_monitor(): 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: @@ -1976,7 +2032,7 @@ async def get_feature_monitor( 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]]] = (), ) -> feature_monitor.FeatureMonitor: r"""Gets details of a single FeatureMonitor. @@ -2020,8 +2076,10 @@ async def sample_get_feature_monitor(): 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.aiplatform_v1beta1.types.FeatureMonitor: @@ -2082,7 +2140,7 @@ async def list_feature_monitors( 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.ListFeatureMonitorsAsyncPager: r"""Lists FeatureGroups in a given project and location. @@ -2128,8 +2186,10 @@ async def sample_list_feature_monitors(): 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.aiplatform_v1beta1.services.feature_registry_service.pagers.ListFeatureMonitorsAsyncPager: @@ -2206,7 +2266,7 @@ async def delete_feature_monitor( 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"""Deletes a single FeatureMonitor. @@ -2255,8 +2315,10 @@ async def sample_delete_feature_monitor(): 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: @@ -2341,7 +2403,7 @@ async def create_feature_monitor_job( feature_monitor_job_id: Optional[int] = 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]]] = (), ) -> gca_feature_monitor_job.FeatureMonitorJob: r"""Creates a new feature monitor job. @@ -2399,8 +2461,10 @@ async def sample_create_feature_monitor_job(): 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.aiplatform_v1beta1.types.FeatureMonitorJob: @@ -2469,7 +2533,7 @@ async def get_feature_monitor_job( 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]]] = (), ) -> feature_monitor_job.FeatureMonitorJob: r"""Get a feature monitor job. @@ -2514,8 +2578,10 @@ async def sample_get_feature_monitor_job(): 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.aiplatform_v1beta1.types.FeatureMonitorJob: @@ -2578,7 +2644,7 @@ async def list_feature_monitor_jobs( 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.ListFeatureMonitorJobsAsyncPager: r"""List feature monitor jobs. @@ -2624,8 +2690,10 @@ async def sample_list_feature_monitor_jobs(): 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.aiplatform_v1beta1.services.feature_registry_service.pagers.ListFeatureMonitorJobsAsyncPager: @@ -2701,7 +2769,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. @@ -2712,8 +2780,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. @@ -2754,7 +2824,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. @@ -2765,8 +2835,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. @@ -2807,7 +2879,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. @@ -2823,8 +2895,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 """ @@ -2861,7 +2935,7 @@ async def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -2876,8 +2950,10 @@ async def cancel_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 """ @@ -2914,7 +2990,7 @@ async def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -2931,8 +3007,10 @@ async def wait_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. @@ -2973,7 +3051,7 @@ async def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -2986,8 +3064,10 @@ async def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -3092,7 +3172,7 @@ async def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -3106,8 +3186,10 @@ async def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -3212,7 +3294,7 @@ async def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -3227,8 +3309,10 @@ async def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -3272,7 +3356,7 @@ async def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -3283,8 +3367,10 @@ async def get_location( 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: ~.location_pb2.Location: Location object. @@ -3325,7 +3411,7 @@ async def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -3336,8 +3422,10 @@ async def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1beta1/services/feature_registry_service/client.py b/google/cloud/aiplatform_v1beta1/services/feature_registry_service/client.py index b0666fb576..4930c5c92e 100644 --- a/google/cloud/aiplatform_v1beta1/services/feature_registry_service/client.py +++ b/google/cloud/aiplatform_v1beta1/services/feature_registry_service/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 ( @@ -48,6 +49,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 as gac_operation # type: ignore from google.api_core import operation_async # type: ignore from google.cloud.aiplatform_v1beta1.services.feature_registry_service import pagers @@ -699,6 +709,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( @@ -790,6 +804,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.aiplatform_v1beta1.FeatureRegistryServiceClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureRegistryService", + "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.aiplatform.v1beta1.FeatureRegistryService", + "credentialsType": None, + }, + ) + def create_feature_group( self, request: Optional[ @@ -801,7 +838,7 @@ def create_feature_group( feature_group_id: 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]]] = (), ) -> gac_operation.Operation: r"""Creates a new FeatureGroup in a given project and location. @@ -876,8 +913,10 @@ def sample_create_feature_group(): 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: @@ -952,7 +991,7 @@ def get_feature_group( 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]]] = (), ) -> feature_group.FeatureGroup: r"""Gets details of a single FeatureGroup. @@ -996,8 +1035,10 @@ def sample_get_feature_group(): 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.aiplatform_v1beta1.types.FeatureGroup: @@ -1055,7 +1096,7 @@ def list_feature_groups( 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.ListFeatureGroupsPager: r"""Lists FeatureGroups in a given project and location. @@ -1101,8 +1142,10 @@ def sample_list_feature_groups(): 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.aiplatform_v1beta1.services.feature_registry_service.pagers.ListFeatureGroupsPager: @@ -1177,7 +1220,7 @@ def update_feature_group( 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]]] = (), ) -> gac_operation.Operation: r"""Updates the parameters of a single FeatureGroup. @@ -1249,8 +1292,10 @@ def sample_update_feature_group(): 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: @@ -1326,7 +1371,7 @@ def delete_feature_group( force: Optional[bool] = 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]]] = (), ) -> gac_operation.Operation: r"""Deletes a single FeatureGroup. @@ -1384,8 +1429,10 @@ def sample_delete_feature_group(): 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: @@ -1467,7 +1514,7 @@ def create_feature( feature_id: 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]]] = (), ) -> gac_operation.Operation: r"""Creates a new Feature in a given FeatureGroup. @@ -1542,8 +1589,10 @@ def sample_create_feature(): 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: @@ -1621,7 +1670,7 @@ def batch_create_features( ] = 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]]] = (), ) -> gac_operation.Operation: r"""Creates a batch of Features in a given FeatureGroup. @@ -1690,8 +1739,10 @@ def sample_batch_create_features(): 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: @@ -1761,7 +1812,7 @@ def get_feature( 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]]] = (), ) -> feature.Feature: r"""Gets details of a single Feature. @@ -1810,8 +1861,10 @@ def sample_get_feature(): 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.aiplatform_v1beta1.types.Feature: @@ -1870,7 +1923,7 @@ def list_features( 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.ListFeaturesPager: r"""Lists Features in a given FeatureGroup. @@ -1920,8 +1973,10 @@ def sample_list_features(): 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.aiplatform_v1beta1.services.feature_registry_service.pagers.ListFeaturesPager: @@ -1998,7 +2053,7 @@ def update_feature( 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]]] = (), ) -> gac_operation.Operation: r"""Updates the parameters of a single Feature. @@ -2071,8 +2126,10 @@ def sample_update_feature(): 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: @@ -2147,7 +2204,7 @@ def delete_feature( 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]]] = (), ) -> gac_operation.Operation: r"""Deletes a single Feature. @@ -2199,8 +2256,10 @@ def sample_delete_feature(): 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: @@ -2280,7 +2339,7 @@ def create_feature_monitor( feature_monitor_id: 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]]] = (), ) -> gac_operation.Operation: r"""Creates a new FeatureMonitor in a given project, location and FeatureGroup. @@ -2350,8 +2409,10 @@ def sample_create_feature_monitor(): 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: @@ -2428,7 +2489,7 @@ def get_feature_monitor( 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]]] = (), ) -> feature_monitor.FeatureMonitor: r"""Gets details of a single FeatureMonitor. @@ -2472,8 +2533,10 @@ def sample_get_feature_monitor(): 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.aiplatform_v1beta1.types.FeatureMonitor: @@ -2531,7 +2594,7 @@ def list_feature_monitors( 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.ListFeatureMonitorsPager: r"""Lists FeatureGroups in a given project and location. @@ -2577,8 +2640,10 @@ def sample_list_feature_monitors(): 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.aiplatform_v1beta1.services.feature_registry_service.pagers.ListFeatureMonitorsPager: @@ -2652,7 +2717,7 @@ def delete_feature_monitor( 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]]] = (), ) -> gac_operation.Operation: r"""Deletes a single FeatureMonitor. @@ -2701,8 +2766,10 @@ def sample_delete_feature_monitor(): 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: @@ -2784,7 +2851,7 @@ def create_feature_monitor_job( feature_monitor_job_id: Optional[int] = 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]]] = (), ) -> gca_feature_monitor_job.FeatureMonitorJob: r"""Creates a new feature monitor job. @@ -2842,8 +2909,10 @@ def sample_create_feature_monitor_job(): 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.aiplatform_v1beta1.types.FeatureMonitorJob: @@ -2911,7 +2980,7 @@ def get_feature_monitor_job( 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]]] = (), ) -> feature_monitor_job.FeatureMonitorJob: r"""Get a feature monitor job. @@ -2956,8 +3025,10 @@ def sample_get_feature_monitor_job(): 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.aiplatform_v1beta1.types.FeatureMonitorJob: @@ -3017,7 +3088,7 @@ def list_feature_monitor_jobs( 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.ListFeatureMonitorJobsPager: r"""List feature monitor jobs. @@ -3063,8 +3134,10 @@ def sample_list_feature_monitor_jobs(): 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.aiplatform_v1beta1.services.feature_registry_service.pagers.ListFeatureMonitorJobsPager: @@ -3152,7 +3225,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. @@ -3163,8 +3236,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. @@ -3205,7 +3280,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. @@ -3216,8 +3291,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. @@ -3258,7 +3335,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. @@ -3274,8 +3351,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 """ @@ -3312,7 +3391,7 @@ def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -3327,8 +3406,10 @@ def cancel_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 """ @@ -3365,7 +3446,7 @@ def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -3382,8 +3463,10 @@ def wait_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. @@ -3424,7 +3507,7 @@ def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -3437,8 +3520,10 @@ def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -3543,7 +3628,7 @@ def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -3557,8 +3642,10 @@ def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -3663,7 +3750,7 @@ def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -3678,8 +3765,10 @@ def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -3721,7 +3810,7 @@ def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -3732,8 +3821,10 @@ def get_location( 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: ~.location_pb2.Location: Location object. @@ -3774,7 +3865,7 @@ def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -3785,8 +3876,10 @@ def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1beta1/services/feature_registry_service/pagers.py b/google/cloud/aiplatform_v1beta1/services/feature_registry_service/pagers.py index 2558850c75..b9c612fac7 100644 --- a/google/cloud/aiplatform_v1beta1/services/feature_registry_service/pagers.py +++ b/google/cloud/aiplatform_v1beta1/services/feature_registry_service/pagers.py @@ -71,7 +71,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. @@ -85,8 +85,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 = feature_registry_service.ListFeatureGroupsRequest(request) @@ -147,7 +149,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. @@ -161,8 +163,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 = feature_registry_service.ListFeatureGroupsRequest(request) @@ -227,7 +231,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. @@ -241,8 +245,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 = featurestore_service.ListFeaturesRequest(request) @@ -301,7 +307,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. @@ -315,8 +321,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 = featurestore_service.ListFeaturesRequest(request) @@ -379,7 +387,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. @@ -393,8 +401,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 = feature_registry_service.ListFeatureMonitorsRequest(request) @@ -455,7 +465,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. @@ -469,8 +479,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 = feature_registry_service.ListFeatureMonitorsRequest(request) @@ -535,7 +547,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. @@ -549,8 +561,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 = feature_registry_service.ListFeatureMonitorJobsRequest(request) @@ -613,7 +627,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. @@ -627,8 +641,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 = feature_registry_service.ListFeatureMonitorJobsRequest(request) diff --git a/google/cloud/aiplatform_v1beta1/services/feature_registry_service/transports/grpc.py b/google/cloud/aiplatform_v1beta1/services/feature_registry_service/transports/grpc.py index ce8a8890b5..bbd85bb0dd 100644 --- a/google/cloud/aiplatform_v1beta1/services/feature_registry_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1beta1/services/feature_registry_service/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 import warnings from typing import Callable, Dict, Optional, Sequence, Tuple, Union @@ -22,8 +25,11 @@ import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from google.cloud.aiplatform_v1beta1.types import feature from google.cloud.aiplatform_v1beta1.types import feature_group @@ -40,6 +46,81 @@ from google.longrunning import operations_pb2 # type: ignore from .base import FeatureRegistryServiceTransport, DEFAULT_CLIENT_INFO +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.aiplatform.v1beta1.FeatureRegistryService", + "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.aiplatform.v1beta1.FeatureRegistryService", + "rpcName": client_call_details.method, + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class FeatureRegistryServiceGrpcTransport(FeatureRegistryServiceTransport): """gRPC backend transport for FeatureRegistryService. @@ -195,7 +276,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 @@ -259,7 +345,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 @@ -286,7 +374,7 @@ def create_feature_group( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_feature_group" not in self._stubs: - self._stubs["create_feature_group"] = self.grpc_channel.unary_unary( + self._stubs["create_feature_group"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.FeatureRegistryService/CreateFeatureGroup", request_serializer=feature_registry_service.CreateFeatureGroupRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -314,7 +402,7 @@ def get_feature_group( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_feature_group" not in self._stubs: - self._stubs["get_feature_group"] = self.grpc_channel.unary_unary( + self._stubs["get_feature_group"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.FeatureRegistryService/GetFeatureGroup", request_serializer=feature_registry_service.GetFeatureGroupRequest.serialize, response_deserializer=feature_group.FeatureGroup.deserialize, @@ -343,7 +431,7 @@ def list_feature_groups( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_feature_groups" not in self._stubs: - self._stubs["list_feature_groups"] = self.grpc_channel.unary_unary( + self._stubs["list_feature_groups"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.FeatureRegistryService/ListFeatureGroups", request_serializer=feature_registry_service.ListFeatureGroupsRequest.serialize, response_deserializer=feature_registry_service.ListFeatureGroupsResponse.deserialize, @@ -371,7 +459,7 @@ def update_feature_group( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_feature_group" not in self._stubs: - self._stubs["update_feature_group"] = self.grpc_channel.unary_unary( + self._stubs["update_feature_group"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.FeatureRegistryService/UpdateFeatureGroup", request_serializer=feature_registry_service.UpdateFeatureGroupRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -399,7 +487,7 @@ def delete_feature_group( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_feature_group" not in self._stubs: - self._stubs["delete_feature_group"] = self.grpc_channel.unary_unary( + self._stubs["delete_feature_group"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.FeatureRegistryService/DeleteFeatureGroup", request_serializer=feature_registry_service.DeleteFeatureGroupRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -427,7 +515,7 @@ def create_feature( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_feature" not in self._stubs: - self._stubs["create_feature"] = self.grpc_channel.unary_unary( + self._stubs["create_feature"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.FeatureRegistryService/CreateFeature", request_serializer=featurestore_service.CreateFeatureRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -455,7 +543,7 @@ def batch_create_features( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "batch_create_features" not in self._stubs: - self._stubs["batch_create_features"] = self.grpc_channel.unary_unary( + self._stubs["batch_create_features"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.FeatureRegistryService/BatchCreateFeatures", request_serializer=featurestore_service.BatchCreateFeaturesRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -481,7 +569,7 @@ def get_feature( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_feature" not in self._stubs: - self._stubs["get_feature"] = self.grpc_channel.unary_unary( + self._stubs["get_feature"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.FeatureRegistryService/GetFeature", request_serializer=featurestore_service.GetFeatureRequest.serialize, response_deserializer=feature.Feature.deserialize, @@ -510,7 +598,7 @@ def list_features( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_features" not in self._stubs: - self._stubs["list_features"] = self.grpc_channel.unary_unary( + self._stubs["list_features"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.FeatureRegistryService/ListFeatures", request_serializer=featurestore_service.ListFeaturesRequest.serialize, response_deserializer=featurestore_service.ListFeaturesResponse.deserialize, @@ -538,7 +626,7 @@ def update_feature( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_feature" not in self._stubs: - self._stubs["update_feature"] = self.grpc_channel.unary_unary( + self._stubs["update_feature"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.FeatureRegistryService/UpdateFeature", request_serializer=featurestore_service.UpdateFeatureRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -566,7 +654,7 @@ def delete_feature( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_feature" not in self._stubs: - self._stubs["delete_feature"] = self.grpc_channel.unary_unary( + self._stubs["delete_feature"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.FeatureRegistryService/DeleteFeature", request_serializer=featurestore_service.DeleteFeatureRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -595,7 +683,7 @@ def create_feature_monitor( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_feature_monitor" not in self._stubs: - self._stubs["create_feature_monitor"] = self.grpc_channel.unary_unary( + self._stubs["create_feature_monitor"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.FeatureRegistryService/CreateFeatureMonitor", request_serializer=feature_registry_service.CreateFeatureMonitorRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -624,7 +712,7 @@ def get_feature_monitor( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_feature_monitor" not in self._stubs: - self._stubs["get_feature_monitor"] = self.grpc_channel.unary_unary( + self._stubs["get_feature_monitor"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.FeatureRegistryService/GetFeatureMonitor", request_serializer=feature_registry_service.GetFeatureMonitorRequest.serialize, response_deserializer=feature_monitor.FeatureMonitor.deserialize, @@ -653,7 +741,7 @@ def list_feature_monitors( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_feature_monitors" not in self._stubs: - self._stubs["list_feature_monitors"] = self.grpc_channel.unary_unary( + self._stubs["list_feature_monitors"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.FeatureRegistryService/ListFeatureMonitors", request_serializer=feature_registry_service.ListFeatureMonitorsRequest.serialize, response_deserializer=feature_registry_service.ListFeatureMonitorsResponse.deserialize, @@ -681,7 +769,7 @@ def delete_feature_monitor( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_feature_monitor" not in self._stubs: - self._stubs["delete_feature_monitor"] = self.grpc_channel.unary_unary( + self._stubs["delete_feature_monitor"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.FeatureRegistryService/DeleteFeatureMonitor", request_serializer=feature_registry_service.DeleteFeatureMonitorRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -710,7 +798,9 @@ def create_feature_monitor_job( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_feature_monitor_job" not in self._stubs: - self._stubs["create_feature_monitor_job"] = self.grpc_channel.unary_unary( + self._stubs[ + "create_feature_monitor_job" + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.FeatureRegistryService/CreateFeatureMonitorJob", request_serializer=feature_registry_service.CreateFeatureMonitorJobRequest.serialize, response_deserializer=gca_feature_monitor_job.FeatureMonitorJob.deserialize, @@ -739,7 +829,7 @@ def get_feature_monitor_job( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_feature_monitor_job" not in self._stubs: - self._stubs["get_feature_monitor_job"] = self.grpc_channel.unary_unary( + self._stubs["get_feature_monitor_job"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.FeatureRegistryService/GetFeatureMonitorJob", request_serializer=feature_registry_service.GetFeatureMonitorJobRequest.serialize, response_deserializer=feature_monitor_job.FeatureMonitorJob.deserialize, @@ -768,7 +858,7 @@ def list_feature_monitor_jobs( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_feature_monitor_jobs" not in self._stubs: - self._stubs["list_feature_monitor_jobs"] = self.grpc_channel.unary_unary( + self._stubs["list_feature_monitor_jobs"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.FeatureRegistryService/ListFeatureMonitorJobs", request_serializer=feature_registry_service.ListFeatureMonitorJobsRequest.serialize, response_deserializer=feature_registry_service.ListFeatureMonitorJobsResponse.deserialize, @@ -776,7 +866,7 @@ def list_feature_monitor_jobs( return self._stubs["list_feature_monitor_jobs"] def close(self): - self.grpc_channel.close() + self._logged_channel.close() @property def delete_operation( @@ -788,7 +878,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, @@ -805,7 +895,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -822,7 +912,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -839,7 +929,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, @@ -858,7 +948,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, @@ -877,7 +967,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -894,7 +984,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -919,7 +1009,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -945,7 +1035,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -974,7 +1064,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1beta1/services/feature_registry_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1beta1/services/feature_registry_service/transports/grpc_asyncio.py index 25a2d1dde1..73a5ac03a7 100644 --- a/google/cloud/aiplatform_v1beta1/services/feature_registry_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/feature_registry_service/transports/grpc_asyncio.py @@ -14,6 +14,9 @@ # limitations under the License. # import inspect +import json +import pickle +import logging as std_logging import warnings from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union @@ -24,8 +27,11 @@ from google.api_core import operations_v1 from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from grpc.experimental import aio # type: ignore from google.cloud.aiplatform_v1beta1.types import feature @@ -44,6 +50,82 @@ from .base import FeatureRegistryServiceTransport, DEFAULT_CLIENT_INFO from .grpc import FeatureRegistryServiceGrpcTransport +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.aiplatform.v1beta1.FeatureRegistryService", + "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.aiplatform.v1beta1.FeatureRegistryService", + "rpcName": str(client_call_details.method), + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class FeatureRegistryServiceGrpcAsyncIOTransport(FeatureRegistryServiceTransport): """gRPC AsyncIO backend transport for FeatureRegistryService. @@ -242,10 +324,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 @@ -268,7 +353,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. @@ -297,7 +382,7 @@ def create_feature_group( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_feature_group" not in self._stubs: - self._stubs["create_feature_group"] = self.grpc_channel.unary_unary( + self._stubs["create_feature_group"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.FeatureRegistryService/CreateFeatureGroup", request_serializer=feature_registry_service.CreateFeatureGroupRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -326,7 +411,7 @@ def get_feature_group( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_feature_group" not in self._stubs: - self._stubs["get_feature_group"] = self.grpc_channel.unary_unary( + self._stubs["get_feature_group"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.FeatureRegistryService/GetFeatureGroup", request_serializer=feature_registry_service.GetFeatureGroupRequest.serialize, response_deserializer=feature_group.FeatureGroup.deserialize, @@ -355,7 +440,7 @@ def list_feature_groups( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_feature_groups" not in self._stubs: - self._stubs["list_feature_groups"] = self.grpc_channel.unary_unary( + self._stubs["list_feature_groups"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.FeatureRegistryService/ListFeatureGroups", request_serializer=feature_registry_service.ListFeatureGroupsRequest.serialize, response_deserializer=feature_registry_service.ListFeatureGroupsResponse.deserialize, @@ -384,7 +469,7 @@ def update_feature_group( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_feature_group" not in self._stubs: - self._stubs["update_feature_group"] = self.grpc_channel.unary_unary( + self._stubs["update_feature_group"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.FeatureRegistryService/UpdateFeatureGroup", request_serializer=feature_registry_service.UpdateFeatureGroupRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -413,7 +498,7 @@ def delete_feature_group( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_feature_group" not in self._stubs: - self._stubs["delete_feature_group"] = self.grpc_channel.unary_unary( + self._stubs["delete_feature_group"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.FeatureRegistryService/DeleteFeatureGroup", request_serializer=feature_registry_service.DeleteFeatureGroupRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -441,7 +526,7 @@ def create_feature( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_feature" not in self._stubs: - self._stubs["create_feature"] = self.grpc_channel.unary_unary( + self._stubs["create_feature"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.FeatureRegistryService/CreateFeature", request_serializer=featurestore_service.CreateFeatureRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -470,7 +555,7 @@ def batch_create_features( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "batch_create_features" not in self._stubs: - self._stubs["batch_create_features"] = self.grpc_channel.unary_unary( + self._stubs["batch_create_features"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.FeatureRegistryService/BatchCreateFeatures", request_serializer=featurestore_service.BatchCreateFeaturesRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -496,7 +581,7 @@ def get_feature( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_feature" not in self._stubs: - self._stubs["get_feature"] = self.grpc_channel.unary_unary( + self._stubs["get_feature"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.FeatureRegistryService/GetFeature", request_serializer=featurestore_service.GetFeatureRequest.serialize, response_deserializer=feature.Feature.deserialize, @@ -525,7 +610,7 @@ def list_features( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_features" not in self._stubs: - self._stubs["list_features"] = self.grpc_channel.unary_unary( + self._stubs["list_features"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.FeatureRegistryService/ListFeatures", request_serializer=featurestore_service.ListFeaturesRequest.serialize, response_deserializer=featurestore_service.ListFeaturesResponse.deserialize, @@ -553,7 +638,7 @@ def update_feature( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_feature" not in self._stubs: - self._stubs["update_feature"] = self.grpc_channel.unary_unary( + self._stubs["update_feature"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.FeatureRegistryService/UpdateFeature", request_serializer=featurestore_service.UpdateFeatureRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -581,7 +666,7 @@ def delete_feature( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_feature" not in self._stubs: - self._stubs["delete_feature"] = self.grpc_channel.unary_unary( + self._stubs["delete_feature"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.FeatureRegistryService/DeleteFeature", request_serializer=featurestore_service.DeleteFeatureRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -611,7 +696,7 @@ def create_feature_monitor( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_feature_monitor" not in self._stubs: - self._stubs["create_feature_monitor"] = self.grpc_channel.unary_unary( + self._stubs["create_feature_monitor"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.FeatureRegistryService/CreateFeatureMonitor", request_serializer=feature_registry_service.CreateFeatureMonitorRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -640,7 +725,7 @@ def get_feature_monitor( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_feature_monitor" not in self._stubs: - self._stubs["get_feature_monitor"] = self.grpc_channel.unary_unary( + self._stubs["get_feature_monitor"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.FeatureRegistryService/GetFeatureMonitor", request_serializer=feature_registry_service.GetFeatureMonitorRequest.serialize, response_deserializer=feature_monitor.FeatureMonitor.deserialize, @@ -669,7 +754,7 @@ def list_feature_monitors( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_feature_monitors" not in self._stubs: - self._stubs["list_feature_monitors"] = self.grpc_channel.unary_unary( + self._stubs["list_feature_monitors"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.FeatureRegistryService/ListFeatureMonitors", request_serializer=feature_registry_service.ListFeatureMonitorsRequest.serialize, response_deserializer=feature_registry_service.ListFeatureMonitorsResponse.deserialize, @@ -698,7 +783,7 @@ def delete_feature_monitor( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_feature_monitor" not in self._stubs: - self._stubs["delete_feature_monitor"] = self.grpc_channel.unary_unary( + self._stubs["delete_feature_monitor"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.FeatureRegistryService/DeleteFeatureMonitor", request_serializer=feature_registry_service.DeleteFeatureMonitorRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -727,7 +812,9 @@ def create_feature_monitor_job( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_feature_monitor_job" not in self._stubs: - self._stubs["create_feature_monitor_job"] = self.grpc_channel.unary_unary( + self._stubs[ + "create_feature_monitor_job" + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.FeatureRegistryService/CreateFeatureMonitorJob", request_serializer=feature_registry_service.CreateFeatureMonitorJobRequest.serialize, response_deserializer=gca_feature_monitor_job.FeatureMonitorJob.deserialize, @@ -756,7 +843,7 @@ def get_feature_monitor_job( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_feature_monitor_job" not in self._stubs: - self._stubs["get_feature_monitor_job"] = self.grpc_channel.unary_unary( + self._stubs["get_feature_monitor_job"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.FeatureRegistryService/GetFeatureMonitorJob", request_serializer=feature_registry_service.GetFeatureMonitorJobRequest.serialize, response_deserializer=feature_monitor_job.FeatureMonitorJob.deserialize, @@ -785,7 +872,7 @@ def list_feature_monitor_jobs( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_feature_monitor_jobs" not in self._stubs: - self._stubs["list_feature_monitor_jobs"] = self.grpc_channel.unary_unary( + self._stubs["list_feature_monitor_jobs"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.FeatureRegistryService/ListFeatureMonitorJobs", request_serializer=feature_registry_service.ListFeatureMonitorJobsRequest.serialize, response_deserializer=feature_registry_service.ListFeatureMonitorJobsResponse.deserialize, @@ -943,7 +1030,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: @@ -959,7 +1046,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, @@ -976,7 +1063,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -993,7 +1080,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -1010,7 +1097,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, @@ -1029,7 +1116,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, @@ -1048,7 +1135,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -1065,7 +1152,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -1090,7 +1177,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -1116,7 +1203,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -1145,7 +1232,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1beta1/services/feature_registry_service/transports/rest.py b/google/cloud/aiplatform_v1beta1/services/feature_registry_service/transports/rest.py index 73707ad3f6..f4334256bf 100644 --- a/google/cloud/aiplatform_v1beta1/services/feature_registry_service/transports/rest.py +++ b/google/cloud/aiplatform_v1beta1/services/feature_registry_service/transports/rest.py @@ -13,9 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging +import json # type: ignore from google.auth.transport.requests import AuthorizedSession # type: ignore -import json # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.api_core import exceptions as core_exceptions from google.api_core import retry as retries @@ -55,6 +56,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, @@ -231,9 +240,10 @@ def post_update_feature_group(self, response): def pre_batch_create_features( self, request: featurestore_service.BatchCreateFeaturesRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - featurestore_service.BatchCreateFeaturesRequest, Sequence[Tuple[str, str]] + featurestore_service.BatchCreateFeaturesRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for batch_create_features @@ -256,8 +266,11 @@ def post_batch_create_features( def pre_create_feature( self, request: featurestore_service.CreateFeatureRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[featurestore_service.CreateFeatureRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + featurestore_service.CreateFeatureRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for create_feature Override in a subclass to manipulate the request or metadata @@ -279,9 +292,10 @@ def post_create_feature( def pre_create_feature_group( self, request: feature_registry_service.CreateFeatureGroupRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - feature_registry_service.CreateFeatureGroupRequest, Sequence[Tuple[str, str]] + feature_registry_service.CreateFeatureGroupRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for create_feature_group @@ -304,9 +318,10 @@ def post_create_feature_group( def pre_create_feature_monitor( self, request: feature_registry_service.CreateFeatureMonitorRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - feature_registry_service.CreateFeatureMonitorRequest, Sequence[Tuple[str, str]] + feature_registry_service.CreateFeatureMonitorRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for create_feature_monitor @@ -329,10 +344,10 @@ def post_create_feature_monitor( def pre_create_feature_monitor_job( self, request: feature_registry_service.CreateFeatureMonitorJobRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ feature_registry_service.CreateFeatureMonitorJobRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for create_feature_monitor_job @@ -355,8 +370,11 @@ def post_create_feature_monitor_job( def pre_delete_feature( self, request: featurestore_service.DeleteFeatureRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[featurestore_service.DeleteFeatureRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + featurestore_service.DeleteFeatureRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for delete_feature Override in a subclass to manipulate the request or metadata @@ -378,9 +396,10 @@ def post_delete_feature( def pre_delete_feature_group( self, request: feature_registry_service.DeleteFeatureGroupRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - feature_registry_service.DeleteFeatureGroupRequest, Sequence[Tuple[str, str]] + feature_registry_service.DeleteFeatureGroupRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for delete_feature_group @@ -403,9 +422,10 @@ def post_delete_feature_group( def pre_delete_feature_monitor( self, request: feature_registry_service.DeleteFeatureMonitorRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - feature_registry_service.DeleteFeatureMonitorRequest, Sequence[Tuple[str, str]] + feature_registry_service.DeleteFeatureMonitorRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for delete_feature_monitor @@ -428,8 +448,10 @@ def post_delete_feature_monitor( def pre_get_feature( self, request: featurestore_service.GetFeatureRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[featurestore_service.GetFeatureRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + featurestore_service.GetFeatureRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_feature Override in a subclass to manipulate the request or metadata @@ -449,9 +471,10 @@ def post_get_feature(self, response: feature.Feature) -> feature.Feature: def pre_get_feature_group( self, request: feature_registry_service.GetFeatureGroupRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - feature_registry_service.GetFeatureGroupRequest, Sequence[Tuple[str, str]] + feature_registry_service.GetFeatureGroupRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for get_feature_group @@ -474,9 +497,10 @@ def post_get_feature_group( def pre_get_feature_monitor( self, request: feature_registry_service.GetFeatureMonitorRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - feature_registry_service.GetFeatureMonitorRequest, Sequence[Tuple[str, str]] + feature_registry_service.GetFeatureMonitorRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for get_feature_monitor @@ -499,9 +523,10 @@ def post_get_feature_monitor( def pre_get_feature_monitor_job( self, request: feature_registry_service.GetFeatureMonitorJobRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - feature_registry_service.GetFeatureMonitorJobRequest, Sequence[Tuple[str, str]] + feature_registry_service.GetFeatureMonitorJobRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for get_feature_monitor_job @@ -524,9 +549,10 @@ def post_get_feature_monitor_job( def pre_list_feature_groups( self, request: feature_registry_service.ListFeatureGroupsRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - feature_registry_service.ListFeatureGroupsRequest, Sequence[Tuple[str, str]] + feature_registry_service.ListFeatureGroupsRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for list_feature_groups @@ -549,10 +575,10 @@ def post_list_feature_groups( def pre_list_feature_monitor_jobs( self, request: feature_registry_service.ListFeatureMonitorJobsRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ feature_registry_service.ListFeatureMonitorJobsRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for list_feature_monitor_jobs @@ -575,9 +601,10 @@ def post_list_feature_monitor_jobs( def pre_list_feature_monitors( self, request: feature_registry_service.ListFeatureMonitorsRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - feature_registry_service.ListFeatureMonitorsRequest, Sequence[Tuple[str, str]] + feature_registry_service.ListFeatureMonitorsRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for list_feature_monitors @@ -600,8 +627,11 @@ def post_list_feature_monitors( def pre_list_features( self, request: featurestore_service.ListFeaturesRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[featurestore_service.ListFeaturesRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + featurestore_service.ListFeaturesRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for list_features Override in a subclass to manipulate the request or metadata @@ -623,8 +653,11 @@ def post_list_features( def pre_update_feature( self, request: featurestore_service.UpdateFeatureRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[featurestore_service.UpdateFeatureRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + featurestore_service.UpdateFeatureRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for update_feature Override in a subclass to manipulate the request or metadata @@ -646,9 +679,10 @@ def post_update_feature( def pre_update_feature_group( self, request: feature_registry_service.UpdateFeatureGroupRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - feature_registry_service.UpdateFeatureGroupRequest, Sequence[Tuple[str, str]] + feature_registry_service.UpdateFeatureGroupRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for update_feature_group @@ -671,8 +705,10 @@ def post_update_feature_group( def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -694,8 +730,10 @@ def post_get_location( def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -717,8 +755,10 @@ def post_list_locations( def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -738,8 +778,10 @@ def post_get_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -759,8 +801,11 @@ def post_set_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -782,8 +827,10 @@ def post_test_iam_permissions( def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -803,8 +850,10 @@ def post_cancel_operation(self, response: None) -> None: 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 @@ -824,8 +873,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 @@ -847,8 +898,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 @@ -870,8 +923,10 @@ def post_list_operations( def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -1552,6 +1607,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -1768,6 +1827,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -1974,6 +2037,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}", @@ -2190,6 +2257,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, ], "google.longrunning.Operations.ListOperations": [ { @@ -2388,6 +2459,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*}/operations", @@ -2604,6 +2679,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*}/operations", + }, ], "google.longrunning.Operations.WaitOperation": [ { @@ -2802,6 +2881,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "post", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}:wait", @@ -3014,6 +3097,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, ], } @@ -3070,7 +3157,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 batch create features method over HTTP. @@ -3083,8 +3170,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: @@ -3097,6 +3186,7 @@ def __call__( http_options = ( _BaseFeatureRegistryServiceRestTransport._BaseBatchCreateFeatures._get_http_options() ) + request, metadata = self._interceptor.pre_batch_create_features( request, metadata ) @@ -3113,6 +3203,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.aiplatform_v1beta1.FeatureRegistryServiceClient.BatchCreateFeatures", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureRegistryService", + "rpcName": "BatchCreateFeatures", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( FeatureRegistryServiceRestTransport._BatchCreateFeatures._get_response( @@ -3134,7 +3251,29 @@ def __call__( # Return the response resp = operations_pb2.Operation() json_format.Parse(response.content, resp, ignore_unknown_fields=True) + resp = self._interceptor.post_batch_create_features(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.aiplatform_v1beta1.FeatureRegistryServiceClient.batch_create_features", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureRegistryService", + "rpcName": "BatchCreateFeatures", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _CreateFeature( @@ -3174,7 +3313,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 feature method over HTTP. @@ -3187,8 +3326,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: @@ -3201,6 +3342,7 @@ def __call__( http_options = ( _BaseFeatureRegistryServiceRestTransport._BaseCreateFeature._get_http_options() ) + request, metadata = self._interceptor.pre_create_feature(request, metadata) transcoded_request = _BaseFeatureRegistryServiceRestTransport._BaseCreateFeature._get_transcoded_request( http_options, request @@ -3215,6 +3357,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.aiplatform_v1beta1.FeatureRegistryServiceClient.CreateFeature", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureRegistryService", + "rpcName": "CreateFeature", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeatureRegistryServiceRestTransport._CreateFeature._get_response( self._host, @@ -3234,7 +3403,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_feature(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.aiplatform_v1beta1.FeatureRegistryServiceClient.create_feature", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureRegistryService", + "rpcName": "CreateFeature", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _CreateFeatureGroup( @@ -3274,7 +3465,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 feature group method over HTTP. @@ -3285,8 +3476,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: @@ -3299,6 +3492,7 @@ def __call__( http_options = ( _BaseFeatureRegistryServiceRestTransport._BaseCreateFeatureGroup._get_http_options() ) + request, metadata = self._interceptor.pre_create_feature_group( request, metadata ) @@ -3315,6 +3509,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.aiplatform_v1beta1.FeatureRegistryServiceClient.CreateFeatureGroup", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureRegistryService", + "rpcName": "CreateFeatureGroup", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( FeatureRegistryServiceRestTransport._CreateFeatureGroup._get_response( @@ -3336,7 +3557,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_feature_group(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.aiplatform_v1beta1.FeatureRegistryServiceClient.create_feature_group", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureRegistryService", + "rpcName": "CreateFeatureGroup", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _CreateFeatureMonitor( @@ -3376,7 +3619,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 feature monitor method over HTTP. @@ -3387,8 +3630,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: @@ -3401,6 +3646,7 @@ def __call__( http_options = ( _BaseFeatureRegistryServiceRestTransport._BaseCreateFeatureMonitor._get_http_options() ) + request, metadata = self._interceptor.pre_create_feature_monitor( request, metadata ) @@ -3417,6 +3663,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.aiplatform_v1beta1.FeatureRegistryServiceClient.CreateFeatureMonitor", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureRegistryService", + "rpcName": "CreateFeatureMonitor", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( FeatureRegistryServiceRestTransport._CreateFeatureMonitor._get_response( @@ -3438,7 +3711,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_feature_monitor(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.aiplatform_v1beta1.FeatureRegistryServiceClient.create_feature_monitor", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureRegistryService", + "rpcName": "CreateFeatureMonitor", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _CreateFeatureMonitorJob( @@ -3478,7 +3773,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]]] = (), ) -> gca_feature_monitor_job.FeatureMonitorJob: r"""Call the create feature monitor job method over HTTP. @@ -3490,8 +3785,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: ~.gca_feature_monitor_job.FeatureMonitorJob: @@ -3501,6 +3798,7 @@ def __call__( http_options = ( _BaseFeatureRegistryServiceRestTransport._BaseCreateFeatureMonitorJob._get_http_options() ) + request, metadata = self._interceptor.pre_create_feature_monitor_job( request, metadata ) @@ -3517,6 +3815,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.aiplatform_v1beta1.FeatureRegistryServiceClient.CreateFeatureMonitorJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureRegistryService", + "rpcName": "CreateFeatureMonitorJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeatureRegistryServiceRestTransport._CreateFeatureMonitorJob._get_response( self._host, @@ -3538,7 +3863,31 @@ def __call__( pb_resp = gca_feature_monitor_job.FeatureMonitorJob.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_create_feature_monitor_job(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + gca_feature_monitor_job.FeatureMonitorJob.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.aiplatform_v1beta1.FeatureRegistryServiceClient.create_feature_monitor_job", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureRegistryService", + "rpcName": "CreateFeatureMonitorJob", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _DeleteFeature( @@ -3577,7 +3926,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 feature method over HTTP. @@ -3590,8 +3939,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: @@ -3604,6 +3955,7 @@ def __call__( http_options = ( _BaseFeatureRegistryServiceRestTransport._BaseDeleteFeature._get_http_options() ) + request, metadata = self._interceptor.pre_delete_feature(request, metadata) transcoded_request = _BaseFeatureRegistryServiceRestTransport._BaseDeleteFeature._get_transcoded_request( http_options, request @@ -3614,6 +3966,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.aiplatform_v1beta1.FeatureRegistryServiceClient.DeleteFeature", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureRegistryService", + "rpcName": "DeleteFeature", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeatureRegistryServiceRestTransport._DeleteFeature._get_response( self._host, @@ -3632,7 +4011,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_feature(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.aiplatform_v1beta1.FeatureRegistryServiceClient.delete_feature", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureRegistryService", + "rpcName": "DeleteFeature", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _DeleteFeatureGroup( @@ -3671,7 +4072,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 feature group method over HTTP. @@ -3682,8 +4083,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: @@ -3696,6 +4099,7 @@ def __call__( http_options = ( _BaseFeatureRegistryServiceRestTransport._BaseDeleteFeatureGroup._get_http_options() ) + request, metadata = self._interceptor.pre_delete_feature_group( request, metadata ) @@ -3708,6 +4112,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.aiplatform_v1beta1.FeatureRegistryServiceClient.DeleteFeatureGroup", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureRegistryService", + "rpcName": "DeleteFeatureGroup", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( FeatureRegistryServiceRestTransport._DeleteFeatureGroup._get_response( @@ -3728,7 +4159,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_feature_group(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.aiplatform_v1beta1.FeatureRegistryServiceClient.delete_feature_group", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureRegistryService", + "rpcName": "DeleteFeatureGroup", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _DeleteFeatureMonitor( @@ -3767,7 +4220,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 feature monitor method over HTTP. @@ -3778,8 +4231,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: @@ -3792,6 +4247,7 @@ def __call__( http_options = ( _BaseFeatureRegistryServiceRestTransport._BaseDeleteFeatureMonitor._get_http_options() ) + request, metadata = self._interceptor.pre_delete_feature_monitor( request, metadata ) @@ -3804,6 +4260,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.aiplatform_v1beta1.FeatureRegistryServiceClient.DeleteFeatureMonitor", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureRegistryService", + "rpcName": "DeleteFeatureMonitor", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( FeatureRegistryServiceRestTransport._DeleteFeatureMonitor._get_response( @@ -3824,7 +4307,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_feature_monitor(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.aiplatform_v1beta1.FeatureRegistryServiceClient.delete_feature_monitor", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureRegistryService", + "rpcName": "DeleteFeatureMonitor", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _GetFeature( @@ -3863,7 +4368,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]]] = (), ) -> feature.Feature: r"""Call the get feature method over HTTP. @@ -3876,8 +4381,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: ~.feature.Feature: @@ -3890,6 +4397,7 @@ def __call__( http_options = ( _BaseFeatureRegistryServiceRestTransport._BaseGetFeature._get_http_options() ) + request, metadata = self._interceptor.pre_get_feature(request, metadata) transcoded_request = _BaseFeatureRegistryServiceRestTransport._BaseGetFeature._get_transcoded_request( http_options, request @@ -3900,6 +4408,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.aiplatform_v1beta1.FeatureRegistryServiceClient.GetFeature", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureRegistryService", + "rpcName": "GetFeature", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeatureRegistryServiceRestTransport._GetFeature._get_response( self._host, @@ -3920,7 +4455,29 @@ def __call__( pb_resp = feature.Feature.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_feature(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = feature.Feature.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.aiplatform_v1beta1.FeatureRegistryServiceClient.get_feature", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureRegistryService", + "rpcName": "GetFeature", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _GetFeatureGroup( @@ -3959,7 +4516,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]]] = (), ) -> feature_group.FeatureGroup: r"""Call the get feature group method over HTTP. @@ -3970,8 +4527,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: ~.feature_group.FeatureGroup: @@ -3981,6 +4540,7 @@ def __call__( http_options = ( _BaseFeatureRegistryServiceRestTransport._BaseGetFeatureGroup._get_http_options() ) + request, metadata = self._interceptor.pre_get_feature_group( request, metadata ) @@ -3993,6 +4553,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.aiplatform_v1beta1.FeatureRegistryServiceClient.GetFeatureGroup", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureRegistryService", + "rpcName": "GetFeatureGroup", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( FeatureRegistryServiceRestTransport._GetFeatureGroup._get_response( @@ -4015,7 +4602,29 @@ def __call__( pb_resp = feature_group.FeatureGroup.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_feature_group(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = feature_group.FeatureGroup.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.aiplatform_v1beta1.FeatureRegistryServiceClient.get_feature_group", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureRegistryService", + "rpcName": "GetFeatureGroup", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _GetFeatureMonitor( @@ -4054,7 +4663,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]]] = (), ) -> feature_monitor.FeatureMonitor: r"""Call the get feature monitor method over HTTP. @@ -4065,8 +4674,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: ~.feature_monitor.FeatureMonitor: @@ -4076,6 +4687,7 @@ def __call__( http_options = ( _BaseFeatureRegistryServiceRestTransport._BaseGetFeatureMonitor._get_http_options() ) + request, metadata = self._interceptor.pre_get_feature_monitor( request, metadata ) @@ -4088,6 +4700,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.aiplatform_v1beta1.FeatureRegistryServiceClient.GetFeatureMonitor", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureRegistryService", + "rpcName": "GetFeatureMonitor", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( FeatureRegistryServiceRestTransport._GetFeatureMonitor._get_response( @@ -4110,7 +4749,29 @@ def __call__( pb_resp = feature_monitor.FeatureMonitor.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_feature_monitor(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = feature_monitor.FeatureMonitor.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.aiplatform_v1beta1.FeatureRegistryServiceClient.get_feature_monitor", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureRegistryService", + "rpcName": "GetFeatureMonitor", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _GetFeatureMonitorJob( @@ -4149,7 +4810,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]]] = (), ) -> feature_monitor_job.FeatureMonitorJob: r"""Call the get feature monitor job method over HTTP. @@ -4160,8 +4821,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: ~.feature_monitor_job.FeatureMonitorJob: @@ -4171,6 +4834,7 @@ def __call__( http_options = ( _BaseFeatureRegistryServiceRestTransport._BaseGetFeatureMonitorJob._get_http_options() ) + request, metadata = self._interceptor.pre_get_feature_monitor_job( request, metadata ) @@ -4183,6 +4847,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.aiplatform_v1beta1.FeatureRegistryServiceClient.GetFeatureMonitorJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureRegistryService", + "rpcName": "GetFeatureMonitorJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( FeatureRegistryServiceRestTransport._GetFeatureMonitorJob._get_response( @@ -4205,7 +4896,31 @@ def __call__( pb_resp = feature_monitor_job.FeatureMonitorJob.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_feature_monitor_job(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = feature_monitor_job.FeatureMonitorJob.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.aiplatform_v1beta1.FeatureRegistryServiceClient.get_feature_monitor_job", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureRegistryService", + "rpcName": "GetFeatureMonitorJob", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListFeatureGroups( @@ -4244,7 +4959,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]]] = (), ) -> feature_registry_service.ListFeatureGroupsResponse: r"""Call the list feature groups method over HTTP. @@ -4255,8 +4970,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: ~.feature_registry_service.ListFeatureGroupsResponse: @@ -4268,6 +4985,7 @@ def __call__( http_options = ( _BaseFeatureRegistryServiceRestTransport._BaseListFeatureGroups._get_http_options() ) + request, metadata = self._interceptor.pre_list_feature_groups( request, metadata ) @@ -4280,6 +4998,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.aiplatform_v1beta1.FeatureRegistryServiceClient.ListFeatureGroups", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureRegistryService", + "rpcName": "ListFeatureGroups", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( FeatureRegistryServiceRestTransport._ListFeatureGroups._get_response( @@ -4302,7 +5047,33 @@ def __call__( pb_resp = feature_registry_service.ListFeatureGroupsResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_feature_groups(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + feature_registry_service.ListFeatureGroupsResponse.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.aiplatform_v1beta1.FeatureRegistryServiceClient.list_feature_groups", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureRegistryService", + "rpcName": "ListFeatureGroups", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListFeatureMonitorJobs( @@ -4341,7 +5112,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]]] = (), ) -> feature_registry_service.ListFeatureMonitorJobsResponse: r"""Call the list feature monitor jobs method over HTTP. @@ -4352,8 +5123,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: ~.feature_registry_service.ListFeatureMonitorJobsResponse: @@ -4365,6 +5138,7 @@ def __call__( http_options = ( _BaseFeatureRegistryServiceRestTransport._BaseListFeatureMonitorJobs._get_http_options() ) + request, metadata = self._interceptor.pre_list_feature_monitor_jobs( request, metadata ) @@ -4377,6 +5151,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.aiplatform_v1beta1.FeatureRegistryServiceClient.ListFeatureMonitorJobs", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureRegistryService", + "rpcName": "ListFeatureMonitorJobs", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeatureRegistryServiceRestTransport._ListFeatureMonitorJobs._get_response( self._host, @@ -4397,7 +5198,33 @@ def __call__( pb_resp = feature_registry_service.ListFeatureMonitorJobsResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_feature_monitor_jobs(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + feature_registry_service.ListFeatureMonitorJobsResponse.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.aiplatform_v1beta1.FeatureRegistryServiceClient.list_feature_monitor_jobs", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureRegistryService", + "rpcName": "ListFeatureMonitorJobs", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListFeatureMonitors( @@ -4436,7 +5263,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]]] = (), ) -> feature_registry_service.ListFeatureMonitorsResponse: r"""Call the list feature monitors method over HTTP. @@ -4447,8 +5274,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: ~.feature_registry_service.ListFeatureMonitorsResponse: @@ -4460,6 +5289,7 @@ def __call__( http_options = ( _BaseFeatureRegistryServiceRestTransport._BaseListFeatureMonitors._get_http_options() ) + request, metadata = self._interceptor.pre_list_feature_monitors( request, metadata ) @@ -4472,6 +5302,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.aiplatform_v1beta1.FeatureRegistryServiceClient.ListFeatureMonitors", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureRegistryService", + "rpcName": "ListFeatureMonitors", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( FeatureRegistryServiceRestTransport._ListFeatureMonitors._get_response( @@ -4494,7 +5351,33 @@ def __call__( pb_resp = feature_registry_service.ListFeatureMonitorsResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_feature_monitors(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + feature_registry_service.ListFeatureMonitorsResponse.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.aiplatform_v1beta1.FeatureRegistryServiceClient.list_feature_monitors", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureRegistryService", + "rpcName": "ListFeatureMonitors", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListFeatures( @@ -4533,7 +5416,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]]] = (), ) -> featurestore_service.ListFeaturesResponse: r"""Call the list features method over HTTP. @@ -4546,8 +5429,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: ~.featurestore_service.ListFeaturesResponse: @@ -4561,6 +5446,7 @@ def __call__( http_options = ( _BaseFeatureRegistryServiceRestTransport._BaseListFeatures._get_http_options() ) + request, metadata = self._interceptor.pre_list_features(request, metadata) transcoded_request = _BaseFeatureRegistryServiceRestTransport._BaseListFeatures._get_transcoded_request( http_options, request @@ -4571,6 +5457,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.aiplatform_v1beta1.FeatureRegistryServiceClient.ListFeatures", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureRegistryService", + "rpcName": "ListFeatures", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeatureRegistryServiceRestTransport._ListFeatures._get_response( self._host, @@ -4591,7 +5504,31 @@ def __call__( pb_resp = featurestore_service.ListFeaturesResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_features(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + featurestore_service.ListFeaturesResponse.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.aiplatform_v1beta1.FeatureRegistryServiceClient.list_features", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureRegistryService", + "rpcName": "ListFeatures", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _UpdateFeature( @@ -4631,7 +5568,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 feature method over HTTP. @@ -4644,8 +5581,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: @@ -4658,6 +5597,7 @@ def __call__( http_options = ( _BaseFeatureRegistryServiceRestTransport._BaseUpdateFeature._get_http_options() ) + request, metadata = self._interceptor.pre_update_feature(request, metadata) transcoded_request = _BaseFeatureRegistryServiceRestTransport._BaseUpdateFeature._get_transcoded_request( http_options, request @@ -4672,6 +5612,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.aiplatform_v1beta1.FeatureRegistryServiceClient.UpdateFeature", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureRegistryService", + "rpcName": "UpdateFeature", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeatureRegistryServiceRestTransport._UpdateFeature._get_response( self._host, @@ -4691,7 +5658,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_feature(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.aiplatform_v1beta1.FeatureRegistryServiceClient.update_feature", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureRegistryService", + "rpcName": "UpdateFeature", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _UpdateFeatureGroup( @@ -4731,7 +5720,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 feature group method over HTTP. @@ -4742,8 +5731,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: @@ -4756,6 +5747,7 @@ def __call__( http_options = ( _BaseFeatureRegistryServiceRestTransport._BaseUpdateFeatureGroup._get_http_options() ) + request, metadata = self._interceptor.pre_update_feature_group( request, metadata ) @@ -4772,6 +5764,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.aiplatform_v1beta1.FeatureRegistryServiceClient.UpdateFeatureGroup", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureRegistryService", + "rpcName": "UpdateFeatureGroup", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( FeatureRegistryServiceRestTransport._UpdateFeatureGroup._get_response( @@ -4793,7 +5812,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_feature_group(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.aiplatform_v1beta1.FeatureRegistryServiceClient.update_feature_group", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureRegistryService", + "rpcName": "UpdateFeatureGroup", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp @property @@ -5021,7 +6062,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]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -5032,8 +6073,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: locations_pb2.Location: Response from GetLocation method. @@ -5042,6 +6085,7 @@ def __call__( http_options = ( _BaseFeatureRegistryServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = self._interceptor.pre_get_location(request, metadata) transcoded_request = _BaseFeatureRegistryServiceRestTransport._BaseGetLocation._get_transcoded_request( http_options, request @@ -5052,6 +6096,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.aiplatform_v1beta1.FeatureRegistryServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureRegistryService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeatureRegistryServiceRestTransport._GetLocation._get_response( self._host, @@ -5071,6 +6142,27 @@ def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_location(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.aiplatform_v1beta1.FeatureRegistryServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureRegistryService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5113,7 +6205,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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -5124,8 +6216,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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -5134,6 +6228,7 @@ def __call__( http_options = ( _BaseFeatureRegistryServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = self._interceptor.pre_list_locations(request, metadata) transcoded_request = _BaseFeatureRegistryServiceRestTransport._BaseListLocations._get_transcoded_request( http_options, request @@ -5144,6 +6239,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.aiplatform_v1beta1.FeatureRegistryServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureRegistryService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeatureRegistryServiceRestTransport._ListLocations._get_response( self._host, @@ -5163,6 +6285,27 @@ def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_list_locations(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.aiplatform_v1beta1.FeatureRegistryServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureRegistryService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5206,7 +6349,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]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -5217,8 +6360,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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -5227,6 +6372,7 @@ def __call__( http_options = ( _BaseFeatureRegistryServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_get_iam_policy(request, metadata) transcoded_request = _BaseFeatureRegistryServiceRestTransport._BaseGetIamPolicy._get_transcoded_request( http_options, request @@ -5241,6 +6387,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.aiplatform_v1beta1.FeatureRegistryServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureRegistryService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeatureRegistryServiceRestTransport._GetIamPolicy._get_response( self._host, @@ -5261,6 +6434,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_iam_policy(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.aiplatform_v1beta1.FeatureRegistryServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureRegistryService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5304,7 +6498,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]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -5315,8 +6509,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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -5325,6 +6521,7 @@ def __call__( http_options = ( _BaseFeatureRegistryServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_set_iam_policy(request, metadata) transcoded_request = _BaseFeatureRegistryServiceRestTransport._BaseSetIamPolicy._get_transcoded_request( http_options, request @@ -5339,6 +6536,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.aiplatform_v1beta1.FeatureRegistryServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureRegistryService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeatureRegistryServiceRestTransport._SetIamPolicy._get_response( self._host, @@ -5359,6 +6583,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_set_iam_policy(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.aiplatform_v1beta1.FeatureRegistryServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureRegistryService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5402,7 +6647,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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -5413,8 +6658,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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -5423,6 +6670,7 @@ def __call__( http_options = ( _BaseFeatureRegistryServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -5439,6 +6687,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.aiplatform_v1beta1.FeatureRegistryServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureRegistryService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( FeatureRegistryServiceRestTransport._TestIamPermissions._get_response( @@ -5461,6 +6736,27 @@ def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_test_iam_permissions(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.aiplatform_v1beta1.FeatureRegistryServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureRegistryService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5503,7 +6799,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 cancel operation method over HTTP. @@ -5514,13 +6810,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 = ( _BaseFeatureRegistryServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = self._interceptor.pre_cancel_operation( request, metadata ) @@ -5533,6 +6832,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.aiplatform_v1beta1.FeatureRegistryServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureRegistryService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( FeatureRegistryServiceRestTransport._CancelOperation._get_response( @@ -5592,7 +6918,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. @@ -5603,13 +6929,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 = ( _BaseFeatureRegistryServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = self._interceptor.pre_delete_operation( request, metadata ) @@ -5622,6 +6951,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.aiplatform_v1beta1.FeatureRegistryServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureRegistryService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( FeatureRegistryServiceRestTransport._DeleteOperation._get_response( @@ -5681,7 +7037,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. @@ -5692,8 +7048,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. @@ -5702,6 +7060,7 @@ def __call__( http_options = ( _BaseFeatureRegistryServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = self._interceptor.pre_get_operation(request, metadata) transcoded_request = _BaseFeatureRegistryServiceRestTransport._BaseGetOperation._get_transcoded_request( http_options, request @@ -5712,6 +7071,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.aiplatform_v1beta1.FeatureRegistryServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureRegistryService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeatureRegistryServiceRestTransport._GetOperation._get_response( self._host, @@ -5731,6 +7117,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.aiplatform_v1beta1.FeatureRegistryServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureRegistryService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5773,7 +7180,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. @@ -5784,8 +7191,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. @@ -5794,6 +7203,7 @@ def __call__( http_options = ( _BaseFeatureRegistryServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = self._interceptor.pre_list_operations(request, metadata) transcoded_request = _BaseFeatureRegistryServiceRestTransport._BaseListOperations._get_transcoded_request( http_options, request @@ -5804,6 +7214,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.aiplatform_v1beta1.FeatureRegistryServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureRegistryService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( FeatureRegistryServiceRestTransport._ListOperations._get_response( @@ -5825,6 +7262,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.aiplatform_v1beta1.FeatureRegistryServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureRegistryService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5867,7 +7325,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 wait operation method over HTTP. @@ -5878,8 +7336,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 WaitOperation method. @@ -5888,6 +7348,7 @@ def __call__( http_options = ( _BaseFeatureRegistryServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = self._interceptor.pre_wait_operation(request, metadata) transcoded_request = _BaseFeatureRegistryServiceRestTransport._BaseWaitOperation._get_transcoded_request( http_options, request @@ -5898,6 +7359,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.aiplatform_v1beta1.FeatureRegistryServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureRegistryService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeatureRegistryServiceRestTransport._WaitOperation._get_response( self._host, @@ -5917,6 +7405,27 @@ def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = self._interceptor.post_wait_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.aiplatform_v1beta1.FeatureRegistryServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureRegistryService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1beta1/services/feature_registry_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1beta1/services/feature_registry_service/transports/rest_asyncio.py index 82826fd9c8..bcd8db6ca6 100644 --- a/google/cloud/aiplatform_v1beta1/services/feature_registry_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/feature_registry_service/transports/rest_asyncio.py @@ -66,6 +66,18 @@ from .base import DEFAULT_CLIENT_INFO as BASE_DEFAULT_CLIENT_INFO + +import logging + +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__) + try: OptionalRetry = Union[retries.AsyncRetry, gapic_v1.method._MethodDefault, None] except AttributeError: # pragma: NO COVER @@ -246,9 +258,10 @@ async def post_update_feature_group(self, response): async def pre_batch_create_features( self, request: featurestore_service.BatchCreateFeaturesRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - featurestore_service.BatchCreateFeaturesRequest, Sequence[Tuple[str, str]] + featurestore_service.BatchCreateFeaturesRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for batch_create_features @@ -271,8 +284,11 @@ async def post_batch_create_features( async def pre_create_feature( self, request: featurestore_service.CreateFeatureRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[featurestore_service.CreateFeatureRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + featurestore_service.CreateFeatureRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for create_feature Override in a subclass to manipulate the request or metadata @@ -294,9 +310,10 @@ async def post_create_feature( async def pre_create_feature_group( self, request: feature_registry_service.CreateFeatureGroupRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - feature_registry_service.CreateFeatureGroupRequest, Sequence[Tuple[str, str]] + feature_registry_service.CreateFeatureGroupRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for create_feature_group @@ -319,9 +336,10 @@ async def post_create_feature_group( async def pre_create_feature_monitor( self, request: feature_registry_service.CreateFeatureMonitorRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - feature_registry_service.CreateFeatureMonitorRequest, Sequence[Tuple[str, str]] + feature_registry_service.CreateFeatureMonitorRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for create_feature_monitor @@ -344,10 +362,10 @@ async def post_create_feature_monitor( async def pre_create_feature_monitor_job( self, request: feature_registry_service.CreateFeatureMonitorJobRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ feature_registry_service.CreateFeatureMonitorJobRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for create_feature_monitor_job @@ -370,8 +388,11 @@ async def post_create_feature_monitor_job( async def pre_delete_feature( self, request: featurestore_service.DeleteFeatureRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[featurestore_service.DeleteFeatureRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + featurestore_service.DeleteFeatureRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for delete_feature Override in a subclass to manipulate the request or metadata @@ -393,9 +414,10 @@ async def post_delete_feature( async def pre_delete_feature_group( self, request: feature_registry_service.DeleteFeatureGroupRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - feature_registry_service.DeleteFeatureGroupRequest, Sequence[Tuple[str, str]] + feature_registry_service.DeleteFeatureGroupRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for delete_feature_group @@ -418,9 +440,10 @@ async def post_delete_feature_group( async def pre_delete_feature_monitor( self, request: feature_registry_service.DeleteFeatureMonitorRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - feature_registry_service.DeleteFeatureMonitorRequest, Sequence[Tuple[str, str]] + feature_registry_service.DeleteFeatureMonitorRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for delete_feature_monitor @@ -443,8 +466,10 @@ async def post_delete_feature_monitor( async def pre_get_feature( self, request: featurestore_service.GetFeatureRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[featurestore_service.GetFeatureRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + featurestore_service.GetFeatureRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_feature Override in a subclass to manipulate the request or metadata @@ -464,9 +489,10 @@ async def post_get_feature(self, response: feature.Feature) -> feature.Feature: async def pre_get_feature_group( self, request: feature_registry_service.GetFeatureGroupRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - feature_registry_service.GetFeatureGroupRequest, Sequence[Tuple[str, str]] + feature_registry_service.GetFeatureGroupRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for get_feature_group @@ -489,9 +515,10 @@ async def post_get_feature_group( async def pre_get_feature_monitor( self, request: feature_registry_service.GetFeatureMonitorRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - feature_registry_service.GetFeatureMonitorRequest, Sequence[Tuple[str, str]] + feature_registry_service.GetFeatureMonitorRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for get_feature_monitor @@ -514,9 +541,10 @@ async def post_get_feature_monitor( async def pre_get_feature_monitor_job( self, request: feature_registry_service.GetFeatureMonitorJobRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - feature_registry_service.GetFeatureMonitorJobRequest, Sequence[Tuple[str, str]] + feature_registry_service.GetFeatureMonitorJobRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for get_feature_monitor_job @@ -539,9 +567,10 @@ async def post_get_feature_monitor_job( async def pre_list_feature_groups( self, request: feature_registry_service.ListFeatureGroupsRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - feature_registry_service.ListFeatureGroupsRequest, Sequence[Tuple[str, str]] + feature_registry_service.ListFeatureGroupsRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for list_feature_groups @@ -564,10 +593,10 @@ async def post_list_feature_groups( async def pre_list_feature_monitor_jobs( self, request: feature_registry_service.ListFeatureMonitorJobsRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ feature_registry_service.ListFeatureMonitorJobsRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for list_feature_monitor_jobs @@ -590,9 +619,10 @@ async def post_list_feature_monitor_jobs( async def pre_list_feature_monitors( self, request: feature_registry_service.ListFeatureMonitorsRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - feature_registry_service.ListFeatureMonitorsRequest, Sequence[Tuple[str, str]] + feature_registry_service.ListFeatureMonitorsRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for list_feature_monitors @@ -615,8 +645,11 @@ async def post_list_feature_monitors( async def pre_list_features( self, request: featurestore_service.ListFeaturesRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[featurestore_service.ListFeaturesRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + featurestore_service.ListFeaturesRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for list_features Override in a subclass to manipulate the request or metadata @@ -638,8 +671,11 @@ async def post_list_features( async def pre_update_feature( self, request: featurestore_service.UpdateFeatureRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[featurestore_service.UpdateFeatureRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + featurestore_service.UpdateFeatureRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for update_feature Override in a subclass to manipulate the request or metadata @@ -661,9 +697,10 @@ async def post_update_feature( async def pre_update_feature_group( self, request: feature_registry_service.UpdateFeatureGroupRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - feature_registry_service.UpdateFeatureGroupRequest, Sequence[Tuple[str, str]] + feature_registry_service.UpdateFeatureGroupRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for update_feature_group @@ -686,8 +723,10 @@ async def post_update_feature_group( async def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -709,8 +748,10 @@ async def post_get_location( async def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -732,8 +773,10 @@ async def post_list_locations( async def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -755,8 +798,10 @@ async def post_get_iam_policy( async def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -778,8 +823,11 @@ async def post_set_iam_policy( async def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -801,8 +849,10 @@ async def post_test_iam_permissions( async def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -822,8 +872,10 @@ async def post_cancel_operation(self, response: None) -> None: async 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 @@ -843,8 +895,10 @@ async def post_delete_operation(self, response: None) -> None: async 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 @@ -866,8 +920,10 @@ async def post_get_operation( async 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 @@ -889,8 +945,10 @@ async def post_list_operations( async def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -1164,7 +1222,7 @@ async 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 batch create features method over HTTP. @@ -1177,8 +1235,10 @@ async def __call__( 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: @@ -1191,6 +1251,7 @@ async def __call__( http_options = ( _BaseFeatureRegistryServiceRestTransport._BaseBatchCreateFeatures._get_http_options() ) + request, metadata = await self._interceptor.pre_batch_create_features( request, metadata ) @@ -1207,6 +1268,33 @@ async 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.aiplatform_v1beta1.FeatureRegistryServiceClient.BatchCreateFeatures", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureRegistryService", + "rpcName": "BatchCreateFeatures", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeatureRegistryServiceRestTransport._BatchCreateFeatures._get_response( self._host, @@ -1235,6 +1323,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_batch_create_features(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.FeatureRegistryServiceAsyncClient.batch_create_features", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureRegistryService", + "rpcName": "BatchCreateFeatures", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _CreateFeature( @@ -1274,7 +1384,7 @@ async 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 feature method over HTTP. @@ -1287,8 +1397,10 @@ async def __call__( 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: @@ -1301,6 +1413,7 @@ async def __call__( http_options = ( _BaseFeatureRegistryServiceRestTransport._BaseCreateFeature._get_http_options() ) + request, metadata = await self._interceptor.pre_create_feature( request, metadata ) @@ -1317,6 +1430,33 @@ async 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.aiplatform_v1beta1.FeatureRegistryServiceClient.CreateFeature", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureRegistryService", + "rpcName": "CreateFeature", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeatureRegistryServiceRestTransport._CreateFeature._get_response( self._host, @@ -1345,6 +1485,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_create_feature(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.FeatureRegistryServiceAsyncClient.create_feature", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureRegistryService", + "rpcName": "CreateFeature", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _CreateFeatureGroup( @@ -1384,7 +1546,7 @@ async 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 feature group method over HTTP. @@ -1395,8 +1557,10 @@ async def __call__( 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: @@ -1409,6 +1573,7 @@ async def __call__( http_options = ( _BaseFeatureRegistryServiceRestTransport._BaseCreateFeatureGroup._get_http_options() ) + request, metadata = await self._interceptor.pre_create_feature_group( request, metadata ) @@ -1425,6 +1590,33 @@ async 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.aiplatform_v1beta1.FeatureRegistryServiceClient.CreateFeatureGroup", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureRegistryService", + "rpcName": "CreateFeatureGroup", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeatureRegistryServiceRestTransport._CreateFeatureGroup._get_response( self._host, @@ -1453,6 +1645,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_create_feature_group(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.FeatureRegistryServiceAsyncClient.create_feature_group", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureRegistryService", + "rpcName": "CreateFeatureGroup", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _CreateFeatureMonitor( @@ -1492,7 +1706,7 @@ async 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 feature monitor method over HTTP. @@ -1503,8 +1717,10 @@ async def __call__( 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: @@ -1517,6 +1733,7 @@ async def __call__( http_options = ( _BaseFeatureRegistryServiceRestTransport._BaseCreateFeatureMonitor._get_http_options() ) + request, metadata = await self._interceptor.pre_create_feature_monitor( request, metadata ) @@ -1533,6 +1750,33 @@ async 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.aiplatform_v1beta1.FeatureRegistryServiceClient.CreateFeatureMonitor", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureRegistryService", + "rpcName": "CreateFeatureMonitor", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeatureRegistryServiceRestTransport._CreateFeatureMonitor._get_response( self._host, @@ -1561,6 +1805,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_create_feature_monitor(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.FeatureRegistryServiceAsyncClient.create_feature_monitor", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureRegistryService", + "rpcName": "CreateFeatureMonitor", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _CreateFeatureMonitorJob( @@ -1602,7 +1868,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> gca_feature_monitor_job.FeatureMonitorJob: r"""Call the create feature monitor job method over HTTP. @@ -1614,8 +1880,10 @@ async def __call__( 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: ~.gca_feature_monitor_job.FeatureMonitorJob: @@ -1625,6 +1893,7 @@ async def __call__( http_options = ( _BaseFeatureRegistryServiceRestTransport._BaseCreateFeatureMonitorJob._get_http_options() ) + request, metadata = await self._interceptor.pre_create_feature_monitor_job( request, metadata ) @@ -1641,6 +1910,33 @@ async 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.aiplatform_v1beta1.FeatureRegistryServiceClient.CreateFeatureMonitorJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureRegistryService", + "rpcName": "CreateFeatureMonitorJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeatureRegistryServiceRestTransport._CreateFeatureMonitorJob._get_response( self._host, @@ -1669,6 +1965,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_create_feature_monitor_job(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + gca_feature_monitor_job.FeatureMonitorJob.to_json(response) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.FeatureRegistryServiceAsyncClient.create_feature_monitor_job", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureRegistryService", + "rpcName": "CreateFeatureMonitorJob", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _DeleteFeature( @@ -1707,7 +2027,7 @@ async 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 feature method over HTTP. @@ -1720,8 +2040,10 @@ async def __call__( 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: @@ -1734,6 +2056,7 @@ async def __call__( http_options = ( _BaseFeatureRegistryServiceRestTransport._BaseDeleteFeature._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_feature( request, metadata ) @@ -1746,6 +2069,33 @@ async 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.aiplatform_v1beta1.FeatureRegistryServiceClient.DeleteFeature", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureRegistryService", + "rpcName": "DeleteFeature", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeatureRegistryServiceRestTransport._DeleteFeature._get_response( self._host, @@ -1773,6 +2123,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_delete_feature(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.FeatureRegistryServiceAsyncClient.delete_feature", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureRegistryService", + "rpcName": "DeleteFeature", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _DeleteFeatureGroup( @@ -1811,7 +2183,7 @@ async 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 feature group method over HTTP. @@ -1822,8 +2194,10 @@ async def __call__( 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: @@ -1836,6 +2210,7 @@ async def __call__( http_options = ( _BaseFeatureRegistryServiceRestTransport._BaseDeleteFeatureGroup._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_feature_group( request, metadata ) @@ -1848,6 +2223,33 @@ async 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.aiplatform_v1beta1.FeatureRegistryServiceClient.DeleteFeatureGroup", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureRegistryService", + "rpcName": "DeleteFeatureGroup", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeatureRegistryServiceRestTransport._DeleteFeatureGroup._get_response( self._host, @@ -1875,6 +2277,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_delete_feature_group(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.FeatureRegistryServiceAsyncClient.delete_feature_group", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureRegistryService", + "rpcName": "DeleteFeatureGroup", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _DeleteFeatureMonitor( @@ -1913,7 +2337,7 @@ async 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 feature monitor method over HTTP. @@ -1924,8 +2348,10 @@ async def __call__( 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: @@ -1938,6 +2364,7 @@ async def __call__( http_options = ( _BaseFeatureRegistryServiceRestTransport._BaseDeleteFeatureMonitor._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_feature_monitor( request, metadata ) @@ -1950,6 +2377,33 @@ async 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.aiplatform_v1beta1.FeatureRegistryServiceClient.DeleteFeatureMonitor", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureRegistryService", + "rpcName": "DeleteFeatureMonitor", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeatureRegistryServiceRestTransport._DeleteFeatureMonitor._get_response( self._host, @@ -1977,6 +2431,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_delete_feature_monitor(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.FeatureRegistryServiceAsyncClient.delete_feature_monitor", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureRegistryService", + "rpcName": "DeleteFeatureMonitor", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _GetFeature( @@ -2015,7 +2491,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> feature.Feature: r"""Call the get feature method over HTTP. @@ -2028,8 +2504,10 @@ async def __call__( 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: ~.feature.Feature: @@ -2042,6 +2520,7 @@ async def __call__( http_options = ( _BaseFeatureRegistryServiceRestTransport._BaseGetFeature._get_http_options() ) + request, metadata = await self._interceptor.pre_get_feature( request, metadata ) @@ -2054,6 +2533,33 @@ async 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.aiplatform_v1beta1.FeatureRegistryServiceClient.GetFeature", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureRegistryService", + "rpcName": "GetFeature", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeatureRegistryServiceRestTransport._GetFeature._get_response( self._host, @@ -2081,6 +2587,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_get_feature(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = feature.Feature.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.FeatureRegistryServiceAsyncClient.get_feature", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureRegistryService", + "rpcName": "GetFeature", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _GetFeatureGroup( @@ -2119,7 +2647,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> feature_group.FeatureGroup: r"""Call the get feature group method over HTTP. @@ -2130,8 +2658,10 @@ async def __call__( 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: ~.feature_group.FeatureGroup: @@ -2141,6 +2671,7 @@ async def __call__( http_options = ( _BaseFeatureRegistryServiceRestTransport._BaseGetFeatureGroup._get_http_options() ) + request, metadata = await self._interceptor.pre_get_feature_group( request, metadata ) @@ -2153,6 +2684,33 @@ async 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.aiplatform_v1beta1.FeatureRegistryServiceClient.GetFeatureGroup", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureRegistryService", + "rpcName": "GetFeatureGroup", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeatureRegistryServiceRestTransport._GetFeatureGroup._get_response( self._host, @@ -2180,6 +2738,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_get_feature_group(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = feature_group.FeatureGroup.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.FeatureRegistryServiceAsyncClient.get_feature_group", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureRegistryService", + "rpcName": "GetFeatureGroup", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _GetFeatureMonitor( @@ -2218,7 +2798,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> feature_monitor.FeatureMonitor: r"""Call the get feature monitor method over HTTP. @@ -2229,8 +2809,10 @@ async def __call__( 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: ~.feature_monitor.FeatureMonitor: @@ -2240,6 +2822,7 @@ async def __call__( http_options = ( _BaseFeatureRegistryServiceRestTransport._BaseGetFeatureMonitor._get_http_options() ) + request, metadata = await self._interceptor.pre_get_feature_monitor( request, metadata ) @@ -2252,6 +2835,33 @@ async 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.aiplatform_v1beta1.FeatureRegistryServiceClient.GetFeatureMonitor", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureRegistryService", + "rpcName": "GetFeatureMonitor", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeatureRegistryServiceRestTransport._GetFeatureMonitor._get_response( self._host, @@ -2279,6 +2889,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_get_feature_monitor(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = feature_monitor.FeatureMonitor.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.FeatureRegistryServiceAsyncClient.get_feature_monitor", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureRegistryService", + "rpcName": "GetFeatureMonitor", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _GetFeatureMonitorJob( @@ -2317,7 +2949,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> feature_monitor_job.FeatureMonitorJob: r"""Call the get feature monitor job method over HTTP. @@ -2328,8 +2960,10 @@ async def __call__( 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: ~.feature_monitor_job.FeatureMonitorJob: @@ -2339,6 +2973,7 @@ async def __call__( http_options = ( _BaseFeatureRegistryServiceRestTransport._BaseGetFeatureMonitorJob._get_http_options() ) + request, metadata = await self._interceptor.pre_get_feature_monitor_job( request, metadata ) @@ -2351,6 +2986,33 @@ async 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.aiplatform_v1beta1.FeatureRegistryServiceClient.GetFeatureMonitorJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureRegistryService", + "rpcName": "GetFeatureMonitorJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeatureRegistryServiceRestTransport._GetFeatureMonitorJob._get_response( self._host, @@ -2378,6 +3040,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_get_feature_monitor_job(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = feature_monitor_job.FeatureMonitorJob.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.FeatureRegistryServiceAsyncClient.get_feature_monitor_job", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureRegistryService", + "rpcName": "GetFeatureMonitorJob", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ListFeatureGroups( @@ -2416,7 +3102,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> feature_registry_service.ListFeatureGroupsResponse: r"""Call the list feature groups method over HTTP. @@ -2427,8 +3113,10 @@ async def __call__( 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: ~.feature_registry_service.ListFeatureGroupsResponse: @@ -2440,6 +3128,7 @@ async def __call__( http_options = ( _BaseFeatureRegistryServiceRestTransport._BaseListFeatureGroups._get_http_options() ) + request, metadata = await self._interceptor.pre_list_feature_groups( request, metadata ) @@ -2452,6 +3141,33 @@ async 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.aiplatform_v1beta1.FeatureRegistryServiceClient.ListFeatureGroups", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureRegistryService", + "rpcName": "ListFeatureGroups", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeatureRegistryServiceRestTransport._ListFeatureGroups._get_response( self._host, @@ -2479,6 +3195,32 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_list_feature_groups(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + feature_registry_service.ListFeatureGroupsResponse.to_json( + response + ) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.FeatureRegistryServiceAsyncClient.list_feature_groups", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureRegistryService", + "rpcName": "ListFeatureGroups", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ListFeatureMonitorJobs( @@ -2519,7 +3261,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> feature_registry_service.ListFeatureMonitorJobsResponse: r"""Call the list feature monitor jobs method over HTTP. @@ -2530,8 +3272,10 @@ async def __call__( 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: ~.feature_registry_service.ListFeatureMonitorJobsResponse: @@ -2543,6 +3287,7 @@ async def __call__( http_options = ( _BaseFeatureRegistryServiceRestTransport._BaseListFeatureMonitorJobs._get_http_options() ) + request, metadata = await self._interceptor.pre_list_feature_monitor_jobs( request, metadata ) @@ -2555,6 +3300,33 @@ async 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.aiplatform_v1beta1.FeatureRegistryServiceClient.ListFeatureMonitorJobs", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureRegistryService", + "rpcName": "ListFeatureMonitorJobs", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeatureRegistryServiceRestTransport._ListFeatureMonitorJobs._get_response( self._host, @@ -2582,6 +3354,32 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_list_feature_monitor_jobs(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + feature_registry_service.ListFeatureMonitorJobsResponse.to_json( + response + ) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.FeatureRegistryServiceAsyncClient.list_feature_monitor_jobs", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureRegistryService", + "rpcName": "ListFeatureMonitorJobs", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ListFeatureMonitors( @@ -2620,7 +3418,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> feature_registry_service.ListFeatureMonitorsResponse: r"""Call the list feature monitors method over HTTP. @@ -2631,8 +3429,10 @@ async def __call__( 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: ~.feature_registry_service.ListFeatureMonitorsResponse: @@ -2644,6 +3444,7 @@ async def __call__( http_options = ( _BaseFeatureRegistryServiceRestTransport._BaseListFeatureMonitors._get_http_options() ) + request, metadata = await self._interceptor.pre_list_feature_monitors( request, metadata ) @@ -2656,6 +3457,33 @@ async 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.aiplatform_v1beta1.FeatureRegistryServiceClient.ListFeatureMonitors", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureRegistryService", + "rpcName": "ListFeatureMonitors", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeatureRegistryServiceRestTransport._ListFeatureMonitors._get_response( self._host, @@ -2683,6 +3511,32 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_list_feature_monitors(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + feature_registry_service.ListFeatureMonitorsResponse.to_json( + response + ) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.FeatureRegistryServiceAsyncClient.list_feature_monitors", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureRegistryService", + "rpcName": "ListFeatureMonitors", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ListFeatures( @@ -2721,7 +3575,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> featurestore_service.ListFeaturesResponse: r"""Call the list features method over HTTP. @@ -2734,8 +3588,10 @@ async def __call__( 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: ~.featurestore_service.ListFeaturesResponse: @@ -2749,6 +3605,7 @@ async def __call__( http_options = ( _BaseFeatureRegistryServiceRestTransport._BaseListFeatures._get_http_options() ) + request, metadata = await self._interceptor.pre_list_features( request, metadata ) @@ -2761,6 +3618,33 @@ async 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.aiplatform_v1beta1.FeatureRegistryServiceClient.ListFeatures", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureRegistryService", + "rpcName": "ListFeatures", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeatureRegistryServiceRestTransport._ListFeatures._get_response( self._host, @@ -2788,6 +3672,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_list_features(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + featurestore_service.ListFeaturesResponse.to_json(response) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.FeatureRegistryServiceAsyncClient.list_features", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureRegistryService", + "rpcName": "ListFeatures", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _UpdateFeature( @@ -2827,7 +3735,7 @@ async 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 feature method over HTTP. @@ -2840,8 +3748,10 @@ async def __call__( 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: @@ -2854,6 +3764,7 @@ async def __call__( http_options = ( _BaseFeatureRegistryServiceRestTransport._BaseUpdateFeature._get_http_options() ) + request, metadata = await self._interceptor.pre_update_feature( request, metadata ) @@ -2870,6 +3781,33 @@ async 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.aiplatform_v1beta1.FeatureRegistryServiceClient.UpdateFeature", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureRegistryService", + "rpcName": "UpdateFeature", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeatureRegistryServiceRestTransport._UpdateFeature._get_response( self._host, @@ -2898,6 +3836,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_update_feature(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.FeatureRegistryServiceAsyncClient.update_feature", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureRegistryService", + "rpcName": "UpdateFeature", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _UpdateFeatureGroup( @@ -2937,7 +3897,7 @@ async 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 feature group method over HTTP. @@ -2948,8 +3908,10 @@ async def __call__( 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: @@ -2962,6 +3924,7 @@ async def __call__( http_options = ( _BaseFeatureRegistryServiceRestTransport._BaseUpdateFeatureGroup._get_http_options() ) + request, metadata = await self._interceptor.pre_update_feature_group( request, metadata ) @@ -2978,6 +3941,33 @@ async 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.aiplatform_v1beta1.FeatureRegistryServiceClient.UpdateFeatureGroup", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureRegistryService", + "rpcName": "UpdateFeatureGroup", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeatureRegistryServiceRestTransport._UpdateFeatureGroup._get_response( self._host, @@ -3006,6 +3996,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_update_feature_group(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.FeatureRegistryServiceAsyncClient.update_feature_group", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureRegistryService", + "rpcName": "UpdateFeatureGroup", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp @property @@ -3581,6 +4593,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -3797,6 +4813,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -4003,6 +5023,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}", @@ -4219,6 +5243,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, ], "google.longrunning.Operations.ListOperations": [ { @@ -4417,6 +5445,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*}/operations", @@ -4633,6 +5665,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*}/operations", + }, ], "google.longrunning.Operations.WaitOperation": [ { @@ -4831,6 +5867,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "post", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}:wait", @@ -5043,6 +6083,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, ], } @@ -5250,7 +6294,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -5261,8 +6305,10 @@ async def __call__( 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: locations_pb2.Location: Response from GetLocation method. @@ -5271,6 +6317,7 @@ async def __call__( http_options = ( _BaseFeatureRegistryServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_location( request, metadata ) @@ -5283,6 +6330,33 @@ async 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.aiplatform_v1beta1.FeatureRegistryServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureRegistryService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeatureRegistryServiceRestTransport._GetLocation._get_response( self._host, @@ -5308,6 +6382,27 @@ async def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_location(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.aiplatform_v1beta1.FeatureRegistryServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureRegistryService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5350,7 +6445,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -5361,8 +6456,10 @@ async def __call__( 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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -5371,6 +6468,7 @@ async def __call__( http_options = ( _BaseFeatureRegistryServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_locations( request, metadata ) @@ -5383,6 +6481,33 @@ async 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.aiplatform_v1beta1.FeatureRegistryServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureRegistryService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeatureRegistryServiceRestTransport._ListLocations._get_response( self._host, @@ -5408,6 +6533,27 @@ async def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_list_locations(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.aiplatform_v1beta1.FeatureRegistryServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureRegistryService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5451,7 +6597,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -5462,8 +6608,10 @@ async def __call__( 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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -5472,6 +6620,7 @@ async def __call__( http_options = ( _BaseFeatureRegistryServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_get_iam_policy( request, metadata ) @@ -5488,6 +6637,33 @@ async 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.aiplatform_v1beta1.FeatureRegistryServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureRegistryService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeatureRegistryServiceRestTransport._GetIamPolicy._get_response( self._host, @@ -5514,6 +6690,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_iam_policy(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.aiplatform_v1beta1.FeatureRegistryServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureRegistryService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5557,7 +6754,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -5568,8 +6765,10 @@ async def __call__( 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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -5578,6 +6777,7 @@ async def __call__( http_options = ( _BaseFeatureRegistryServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_set_iam_policy( request, metadata ) @@ -5594,6 +6794,33 @@ async 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.aiplatform_v1beta1.FeatureRegistryServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureRegistryService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeatureRegistryServiceRestTransport._SetIamPolicy._get_response( self._host, @@ -5620,6 +6847,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_set_iam_policy(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.aiplatform_v1beta1.FeatureRegistryServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureRegistryService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5663,7 +6911,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -5674,8 +6922,10 @@ async def __call__( 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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -5684,6 +6934,7 @@ async def __call__( http_options = ( _BaseFeatureRegistryServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = await self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -5700,6 +6951,33 @@ async 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.aiplatform_v1beta1.FeatureRegistryServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureRegistryService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeatureRegistryServiceRestTransport._TestIamPermissions._get_response( self._host, @@ -5726,6 +7004,27 @@ async def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_test_iam_permissions(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.aiplatform_v1beta1.FeatureRegistryServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureRegistryService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5768,7 +7067,7 @@ async 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 cancel operation method over HTTP. @@ -5779,13 +7078,16 @@ async def __call__( 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`. """ http_options = ( _BaseFeatureRegistryServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_cancel_operation( request, metadata ) @@ -5798,6 +7100,33 @@ async 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.aiplatform_v1beta1.FeatureRegistryServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureRegistryService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeatureRegistryServiceRestTransport._CancelOperation._get_response( self._host, @@ -5861,7 +7190,7 @@ async 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. @@ -5872,13 +7201,16 @@ async def __call__( 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`. """ http_options = ( _BaseFeatureRegistryServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_operation( request, metadata ) @@ -5891,6 +7223,33 @@ async 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.aiplatform_v1beta1.FeatureRegistryServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureRegistryService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeatureRegistryServiceRestTransport._DeleteOperation._get_response( self._host, @@ -5954,7 +7313,7 @@ async 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. @@ -5965,8 +7324,10 @@ async def __call__( 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: Response from GetOperation method. @@ -5975,6 +7336,7 @@ async def __call__( http_options = ( _BaseFeatureRegistryServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_operation( request, metadata ) @@ -5987,6 +7349,33 @@ async 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.aiplatform_v1beta1.FeatureRegistryServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureRegistryService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeatureRegistryServiceRestTransport._GetOperation._get_response( self._host, @@ -6012,6 +7401,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1beta1.FeatureRegistryServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureRegistryService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -6054,7 +7464,7 @@ async 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. @@ -6065,8 +7475,10 @@ async def __call__( 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 from ListOperations method. @@ -6075,6 +7487,7 @@ async def __call__( http_options = ( _BaseFeatureRegistryServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_operations( request, metadata ) @@ -6087,6 +7500,33 @@ async 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.aiplatform_v1beta1.FeatureRegistryServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureRegistryService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeatureRegistryServiceRestTransport._ListOperations._get_response( self._host, @@ -6112,6 +7552,27 @@ async def __call__( resp = operations_pb2.ListOperationsResponse() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1beta1.FeatureRegistryServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureRegistryService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -6154,7 +7615,7 @@ async 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 wait operation method over HTTP. @@ -6165,8 +7626,10 @@ async def __call__( 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: Response from WaitOperation method. @@ -6175,6 +7638,7 @@ async def __call__( http_options = ( _BaseFeatureRegistryServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_wait_operation( request, metadata ) @@ -6187,6 +7651,33 @@ async 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.aiplatform_v1beta1.FeatureRegistryServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureRegistryService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeatureRegistryServiceRestTransport._WaitOperation._get_response( self._host, @@ -6212,6 +7703,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_wait_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.aiplatform_v1beta1.FeatureRegistryServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeatureRegistryService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1beta1/services/feature_registry_service/transports/rest_base.py b/google/cloud/aiplatform_v1beta1/services/feature_registry_service/transports/rest_base.py index 58f11f18d5..c161246d4b 100644 --- a/google/cloud/aiplatform_v1beta1/services/feature_registry_service/transports/rest_base.py +++ b/google/cloud/aiplatform_v1beta1/services/feature_registry_service/transports/rest_base.py @@ -1949,6 +1949,10 @@ def _get_http_options(): "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -2165,6 +2169,10 @@ def _get_http_options(): "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -2390,6 +2398,10 @@ def _get_http_options(): "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}", @@ -2606,6 +2618,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, ] return http_options @@ -2823,6 +2839,10 @@ def _get_http_options(): "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*}/operations", @@ -3039,6 +3059,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*}/operations", + }, ] return http_options @@ -3256,6 +3280,10 @@ def _get_http_options(): "method": "post", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}:wait", @@ -3468,6 +3496,10 @@ def _get_http_options(): "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, ] return http_options diff --git a/google/cloud/aiplatform_v1beta1/services/featurestore_online_serving_service/async_client.py b/google/cloud/aiplatform_v1beta1/services/featurestore_online_serving_service/async_client.py index 101cedfb84..f404e60763 100644 --- a/google/cloud/aiplatform_v1beta1/services/featurestore_online_serving_service/async_client.py +++ b/google/cloud/aiplatform_v1beta1/services/featurestore_online_serving_service/async_client.py @@ -13,6 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging as std_logging from collections import OrderedDict import re from typing import ( @@ -59,6 +60,15 @@ ) from .client import FeaturestoreOnlineServingServiceClient +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 FeaturestoreOnlineServingServiceAsyncClient: """A service for serving online feature values.""" @@ -280,6 +290,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.aiplatform_v1beta1.FeaturestoreOnlineServingServiceAsyncClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreOnlineServingService", + "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.aiplatform.v1beta1.FeaturestoreOnlineServingService", + "credentialsType": None, + }, + ) + async def read_feature_values( self, request: Optional[ @@ -289,7 +321,7 @@ async def read_feature_values( entity_type: 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]]] = (), ) -> featurestore_online_service.ReadFeatureValuesResponse: r"""Reads Feature values of a specific entity of an EntityType. For reading feature values of multiple @@ -345,8 +377,10 @@ async def sample_read_feature_values(): 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.aiplatform_v1beta1.types.ReadFeatureValuesResponse: @@ -413,7 +447,7 @@ def streaming_read_feature_values( entity_type: 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]]] = (), ) -> Awaitable[ AsyncIterable[featurestore_online_service.ReadFeatureValuesResponse] ]: @@ -471,8 +505,10 @@ async def sample_streaming_read_feature_values(): 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: AsyncIterable[google.cloud.aiplatform_v1beta1.types.ReadFeatureValuesResponse]: @@ -544,7 +580,7 @@ async def write_feature_values( ] = 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]]] = (), ) -> featurestore_online_service.WriteFeatureValuesResponse: r"""Writes Feature values of one or more entities of an EntityType. @@ -607,8 +643,10 @@ async def sample_write_feature_values(): 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.aiplatform_v1beta1.types.WriteFeatureValuesResponse: @@ -674,7 +712,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. @@ -685,8 +723,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. @@ -727,7 +767,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. @@ -738,8 +778,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. @@ -780,7 +822,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. @@ -796,8 +838,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 """ @@ -834,7 +878,7 @@ async def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -849,8 +893,10 @@ async def cancel_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 """ @@ -887,7 +933,7 @@ async def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -904,8 +950,10 @@ async def wait_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. @@ -946,7 +994,7 @@ async def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -959,8 +1007,10 @@ async def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -1065,7 +1115,7 @@ async def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -1079,8 +1129,10 @@ async def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -1185,7 +1237,7 @@ async def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -1200,8 +1252,10 @@ async def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -1245,7 +1299,7 @@ async def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -1256,8 +1310,10 @@ async def get_location( 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: ~.location_pb2.Location: Location object. @@ -1298,7 +1354,7 @@ async def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -1309,8 +1365,10 @@ async def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1beta1/services/featurestore_online_serving_service/client.py b/google/cloud/aiplatform_v1beta1/services/featurestore_online_serving_service/client.py index 27f6fe4e0b..c822680129 100644 --- a/google/cloud/aiplatform_v1beta1/services/featurestore_online_serving_service/client.py +++ b/google/cloud/aiplatform_v1beta1/services/featurestore_online_serving_service/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 ( @@ -49,6 +50,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.cloud.aiplatform_v1beta1.types import featurestore_online_service from google.cloud.location import locations_pb2 # type: ignore from google.iam.v1 import iam_policy_pb2 # type: ignore @@ -618,6 +628,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( @@ -713,6 +727,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.aiplatform_v1beta1.FeaturestoreOnlineServingServiceClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreOnlineServingService", + "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.aiplatform.v1beta1.FeaturestoreOnlineServingService", + "credentialsType": None, + }, + ) + def read_feature_values( self, request: Optional[ @@ -722,7 +759,7 @@ def read_feature_values( entity_type: 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]]] = (), ) -> featurestore_online_service.ReadFeatureValuesResponse: r"""Reads Feature values of a specific entity of an EntityType. For reading feature values of multiple @@ -778,8 +815,10 @@ def sample_read_feature_values(): 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.aiplatform_v1beta1.types.ReadFeatureValuesResponse: @@ -843,7 +882,7 @@ def streaming_read_feature_values( entity_type: 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]]] = (), ) -> Iterable[featurestore_online_service.ReadFeatureValuesResponse]: r"""Reads Feature values for multiple entities. Depending on their size, data for different entities may be broken @@ -899,8 +938,10 @@ def sample_streaming_read_feature_values(): 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: Iterable[google.cloud.aiplatform_v1beta1.types.ReadFeatureValuesResponse]: @@ -971,7 +1012,7 @@ def write_feature_values( ] = 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]]] = (), ) -> featurestore_online_service.WriteFeatureValuesResponse: r"""Writes Feature values of one or more entities of an EntityType. @@ -1034,8 +1075,10 @@ def sample_write_feature_values(): 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.aiplatform_v1beta1.types.WriteFeatureValuesResponse: @@ -1111,7 +1154,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. @@ -1122,8 +1165,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. @@ -1164,7 +1209,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. @@ -1175,8 +1220,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. @@ -1217,7 +1264,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. @@ -1233,8 +1280,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 """ @@ -1271,7 +1320,7 @@ def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -1286,8 +1335,10 @@ def cancel_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 """ @@ -1324,7 +1375,7 @@ def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -1341,8 +1392,10 @@ def wait_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. @@ -1383,7 +1436,7 @@ def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -1396,8 +1449,10 @@ def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -1502,7 +1557,7 @@ def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -1516,8 +1571,10 @@ def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -1622,7 +1679,7 @@ def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -1637,8 +1694,10 @@ def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -1680,7 +1739,7 @@ def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -1691,8 +1750,10 @@ def get_location( 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: ~.location_pb2.Location: Location object. @@ -1733,7 +1794,7 @@ def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -1744,8 +1805,10 @@ def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1beta1/services/featurestore_online_serving_service/transports/grpc.py b/google/cloud/aiplatform_v1beta1/services/featurestore_online_serving_service/transports/grpc.py index a496b1c13b..4db9e2bd50 100644 --- a/google/cloud/aiplatform_v1beta1/services/featurestore_online_serving_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1beta1/services/featurestore_online_serving_service/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 import warnings from typing import Callable, Dict, Optional, Sequence, Tuple, Union @@ -21,8 +24,11 @@ import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from google.cloud.aiplatform_v1beta1.types import featurestore_online_service from google.cloud.location import locations_pb2 # type: ignore @@ -31,6 +37,81 @@ from google.longrunning import operations_pb2 # type: ignore from .base import FeaturestoreOnlineServingServiceTransport, DEFAULT_CLIENT_INFO +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.aiplatform.v1beta1.FeaturestoreOnlineServingService", + "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.aiplatform.v1beta1.FeaturestoreOnlineServingService", + "rpcName": client_call_details.method, + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class FeaturestoreOnlineServingServiceGrpcTransport( FeaturestoreOnlineServingServiceTransport @@ -186,7 +267,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 @@ -266,7 +352,7 @@ def read_feature_values( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "read_feature_values" not in self._stubs: - self._stubs["read_feature_values"] = self.grpc_channel.unary_unary( + self._stubs["read_feature_values"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.FeaturestoreOnlineServingService/ReadFeatureValues", request_serializer=featurestore_online_service.ReadFeatureValuesRequest.serialize, response_deserializer=featurestore_online_service.ReadFeatureValuesResponse.deserialize, @@ -299,7 +385,7 @@ def streaming_read_feature_values( if "streaming_read_feature_values" not in self._stubs: self._stubs[ "streaming_read_feature_values" - ] = self.grpc_channel.unary_stream( + ] = self._logged_channel.unary_stream( "/google.cloud.aiplatform.v1beta1.FeaturestoreOnlineServingService/StreamingReadFeatureValues", request_serializer=featurestore_online_service.StreamingReadFeatureValuesRequest.serialize, response_deserializer=featurestore_online_service.ReadFeatureValuesResponse.deserialize, @@ -332,7 +418,7 @@ def write_feature_values( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "write_feature_values" not in self._stubs: - self._stubs["write_feature_values"] = self.grpc_channel.unary_unary( + self._stubs["write_feature_values"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.FeaturestoreOnlineServingService/WriteFeatureValues", request_serializer=featurestore_online_service.WriteFeatureValuesRequest.serialize, response_deserializer=featurestore_online_service.WriteFeatureValuesResponse.deserialize, @@ -340,7 +426,7 @@ def write_feature_values( return self._stubs["write_feature_values"] def close(self): - self.grpc_channel.close() + self._logged_channel.close() @property def delete_operation( @@ -352,7 +438,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, @@ -369,7 +455,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -386,7 +472,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -403,7 +489,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, @@ -422,7 +508,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, @@ -441,7 +527,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -458,7 +544,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -483,7 +569,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -509,7 +595,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -538,7 +624,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1beta1/services/featurestore_online_serving_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1beta1/services/featurestore_online_serving_service/transports/grpc_asyncio.py index 6f50026b57..0e09d76158 100644 --- a/google/cloud/aiplatform_v1beta1/services/featurestore_online_serving_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/featurestore_online_serving_service/transports/grpc_asyncio.py @@ -14,6 +14,9 @@ # limitations under the License. # import inspect +import json +import pickle +import logging as std_logging import warnings from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union @@ -23,8 +26,11 @@ from google.api_core import retry_async as retries from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from grpc.experimental import aio # type: ignore from google.cloud.aiplatform_v1beta1.types import featurestore_online_service @@ -35,6 +41,82 @@ from .base import FeaturestoreOnlineServingServiceTransport, DEFAULT_CLIENT_INFO from .grpc import FeaturestoreOnlineServingServiceGrpcTransport +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.aiplatform.v1beta1.FeaturestoreOnlineServingService", + "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.aiplatform.v1beta1.FeaturestoreOnlineServingService", + "rpcName": str(client_call_details.method), + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class FeaturestoreOnlineServingServiceGrpcAsyncIOTransport( FeaturestoreOnlineServingServiceTransport @@ -233,10 +315,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 @@ -274,7 +359,7 @@ def read_feature_values( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "read_feature_values" not in self._stubs: - self._stubs["read_feature_values"] = self.grpc_channel.unary_unary( + self._stubs["read_feature_values"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.FeaturestoreOnlineServingService/ReadFeatureValues", request_serializer=featurestore_online_service.ReadFeatureValuesRequest.serialize, response_deserializer=featurestore_online_service.ReadFeatureValuesResponse.deserialize, @@ -307,7 +392,7 @@ def streaming_read_feature_values( if "streaming_read_feature_values" not in self._stubs: self._stubs[ "streaming_read_feature_values" - ] = self.grpc_channel.unary_stream( + ] = self._logged_channel.unary_stream( "/google.cloud.aiplatform.v1beta1.FeaturestoreOnlineServingService/StreamingReadFeatureValues", request_serializer=featurestore_online_service.StreamingReadFeatureValuesRequest.serialize, response_deserializer=featurestore_online_service.ReadFeatureValuesResponse.deserialize, @@ -340,7 +425,7 @@ def write_feature_values( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "write_feature_values" not in self._stubs: - self._stubs["write_feature_values"] = self.grpc_channel.unary_unary( + self._stubs["write_feature_values"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.FeaturestoreOnlineServingService/WriteFeatureValues", request_serializer=featurestore_online_service.WriteFeatureValuesRequest.serialize, response_deserializer=featurestore_online_service.WriteFeatureValuesResponse.deserialize, @@ -423,7 +508,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: @@ -439,7 +524,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, @@ -456,7 +541,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -473,7 +558,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -490,7 +575,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, @@ -509,7 +594,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, @@ -528,7 +613,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -545,7 +630,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -570,7 +655,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -596,7 +681,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -625,7 +710,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1beta1/services/featurestore_online_serving_service/transports/rest.py b/google/cloud/aiplatform_v1beta1/services/featurestore_online_serving_service/transports/rest.py index ad8626f6f1..39b9dd690f 100644 --- a/google/cloud/aiplatform_v1beta1/services/featurestore_online_serving_service/transports/rest.py +++ b/google/cloud/aiplatform_v1beta1/services/featurestore_online_serving_service/transports/rest.py @@ -13,9 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging +import json # type: ignore from google.auth.transport.requests import AuthorizedSession # type: ignore -import json # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.api_core import exceptions as core_exceptions from google.api_core import retry as retries @@ -46,6 +47,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, @@ -102,9 +111,10 @@ def post_write_feature_values(self, response): def pre_read_feature_values( self, request: featurestore_online_service.ReadFeatureValuesRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - featurestore_online_service.ReadFeatureValuesRequest, Sequence[Tuple[str, str]] + featurestore_online_service.ReadFeatureValuesRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for read_feature_values @@ -127,10 +137,10 @@ def post_read_feature_values( def pre_streaming_read_feature_values( self, request: featurestore_online_service.StreamingReadFeatureValuesRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ featurestore_online_service.StreamingReadFeatureValuesRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for streaming_read_feature_values @@ -153,9 +163,10 @@ def post_streaming_read_feature_values( def pre_write_feature_values( self, request: featurestore_online_service.WriteFeatureValuesRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - featurestore_online_service.WriteFeatureValuesRequest, Sequence[Tuple[str, str]] + featurestore_online_service.WriteFeatureValuesRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for write_feature_values @@ -178,8 +189,10 @@ def post_write_feature_values( def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -201,8 +214,10 @@ def post_get_location( def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -224,8 +239,10 @@ def post_list_locations( def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -245,8 +262,10 @@ def post_get_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -266,8 +285,11 @@ def post_set_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -289,8 +311,10 @@ def post_test_iam_permissions( def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -310,8 +334,10 @@ def post_cancel_operation(self, response: None) -> None: 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 @@ -331,8 +357,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 @@ -354,8 +382,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 @@ -377,8 +407,10 @@ def post_list_operations( def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -527,7 +559,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]]] = (), ) -> featurestore_online_service.ReadFeatureValuesResponse: r"""Call the read feature values method over HTTP. @@ -538,8 +570,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: ~.featurestore_online_service.ReadFeatureValuesResponse: @@ -551,6 +585,7 @@ def __call__( http_options = ( _BaseFeaturestoreOnlineServingServiceRestTransport._BaseReadFeatureValues._get_http_options() ) + request, metadata = self._interceptor.pre_read_feature_values( request, metadata ) @@ -567,6 +602,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.aiplatform_v1beta1.FeaturestoreOnlineServingServiceClient.ReadFeatureValues", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreOnlineServingService", + "rpcName": "ReadFeatureValues", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeaturestoreOnlineServingServiceRestTransport._ReadFeatureValues._get_response( self._host, @@ -588,7 +650,33 @@ def __call__( pb_resp = featurestore_online_service.ReadFeatureValuesResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_read_feature_values(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + featurestore_online_service.ReadFeatureValuesResponse.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.aiplatform_v1beta1.FeaturestoreOnlineServingServiceClient.read_feature_values", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreOnlineServingService", + "rpcName": "ReadFeatureValues", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _StreamingReadFeatureValues( @@ -631,7 +719,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]]] = (), ) -> rest_streaming.ResponseIterator: r"""Call the streaming read feature values method over HTTP. @@ -643,8 +731,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: ~.featurestore_online_service.ReadFeatureValuesResponse: @@ -656,6 +746,7 @@ def __call__( http_options = ( _BaseFeaturestoreOnlineServingServiceRestTransport._BaseStreamingReadFeatureValues._get_http_options() ) + request, metadata = self._interceptor.pre_streaming_read_feature_values( request, metadata ) @@ -672,6 +763,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.aiplatform_v1beta1.FeaturestoreOnlineServingServiceClient.StreamingReadFeatureValues", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreOnlineServingService", + "rpcName": "StreamingReadFeatureValues", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeaturestoreOnlineServingServiceRestTransport._StreamingReadFeatureValues._get_response( self._host, @@ -692,6 +810,7 @@ def __call__( resp = rest_streaming.ResponseIterator( response, featurestore_online_service.ReadFeatureValuesResponse ) + resp = self._interceptor.post_streaming_read_feature_values(resp) return resp @@ -734,7 +853,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]]] = (), ) -> featurestore_online_service.WriteFeatureValuesResponse: r"""Call the write feature values method over HTTP. @@ -745,8 +864,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: ~.featurestore_online_service.WriteFeatureValuesResponse: @@ -758,6 +879,7 @@ def __call__( http_options = ( _BaseFeaturestoreOnlineServingServiceRestTransport._BaseWriteFeatureValues._get_http_options() ) + request, metadata = self._interceptor.pre_write_feature_values( request, metadata ) @@ -774,6 +896,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.aiplatform_v1beta1.FeaturestoreOnlineServingServiceClient.WriteFeatureValues", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreOnlineServingService", + "rpcName": "WriteFeatureValues", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeaturestoreOnlineServingServiceRestTransport._WriteFeatureValues._get_response( self._host, @@ -795,7 +944,33 @@ def __call__( pb_resp = featurestore_online_service.WriteFeatureValuesResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_write_feature_values(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + featurestore_online_service.WriteFeatureValuesResponse.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.aiplatform_v1beta1.FeaturestoreOnlineServingServiceClient.write_feature_values", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreOnlineServingService", + "rpcName": "WriteFeatureValues", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp @property @@ -871,7 +1046,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]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -882,8 +1057,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: locations_pb2.Location: Response from GetLocation method. @@ -892,6 +1069,7 @@ def __call__( http_options = ( _BaseFeaturestoreOnlineServingServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = self._interceptor.pre_get_location(request, metadata) transcoded_request = _BaseFeaturestoreOnlineServingServiceRestTransport._BaseGetLocation._get_transcoded_request( http_options, request @@ -902,6 +1080,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.aiplatform_v1beta1.FeaturestoreOnlineServingServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreOnlineServingService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeaturestoreOnlineServingServiceRestTransport._GetLocation._get_response( self._host, @@ -921,6 +1126,27 @@ def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_location(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.aiplatform_v1beta1.FeaturestoreOnlineServingServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreOnlineServingService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -963,7 +1189,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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -974,8 +1200,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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -984,6 +1212,7 @@ def __call__( http_options = ( _BaseFeaturestoreOnlineServingServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = self._interceptor.pre_list_locations(request, metadata) transcoded_request = _BaseFeaturestoreOnlineServingServiceRestTransport._BaseListLocations._get_transcoded_request( http_options, request @@ -994,6 +1223,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.aiplatform_v1beta1.FeaturestoreOnlineServingServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreOnlineServingService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeaturestoreOnlineServingServiceRestTransport._ListLocations._get_response( self._host, @@ -1013,6 +1269,27 @@ def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_list_locations(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.aiplatform_v1beta1.FeaturestoreOnlineServingServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreOnlineServingService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1056,7 +1333,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]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -1067,8 +1344,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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -1077,6 +1356,7 @@ def __call__( http_options = ( _BaseFeaturestoreOnlineServingServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_get_iam_policy(request, metadata) transcoded_request = _BaseFeaturestoreOnlineServingServiceRestTransport._BaseGetIamPolicy._get_transcoded_request( http_options, request @@ -1091,6 +1371,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.aiplatform_v1beta1.FeaturestoreOnlineServingServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreOnlineServingService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeaturestoreOnlineServingServiceRestTransport._GetIamPolicy._get_response( self._host, @@ -1111,6 +1418,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_iam_policy(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.aiplatform_v1beta1.FeaturestoreOnlineServingServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreOnlineServingService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1154,7 +1482,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]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -1165,8 +1493,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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -1175,6 +1505,7 @@ def __call__( http_options = ( _BaseFeaturestoreOnlineServingServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_set_iam_policy(request, metadata) transcoded_request = _BaseFeaturestoreOnlineServingServiceRestTransport._BaseSetIamPolicy._get_transcoded_request( http_options, request @@ -1189,6 +1520,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.aiplatform_v1beta1.FeaturestoreOnlineServingServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreOnlineServingService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeaturestoreOnlineServingServiceRestTransport._SetIamPolicy._get_response( self._host, @@ -1209,6 +1567,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_set_iam_policy(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.aiplatform_v1beta1.FeaturestoreOnlineServingServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreOnlineServingService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1254,7 +1633,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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -1265,8 +1644,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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -1275,6 +1656,7 @@ def __call__( http_options = ( _BaseFeaturestoreOnlineServingServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -1291,6 +1673,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.aiplatform_v1beta1.FeaturestoreOnlineServingServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreOnlineServingService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeaturestoreOnlineServingServiceRestTransport._TestIamPermissions._get_response( self._host, @@ -1311,6 +1720,27 @@ def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_test_iam_permissions(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.aiplatform_v1beta1.FeaturestoreOnlineServingServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreOnlineServingService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1353,7 +1783,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 cancel operation method over HTTP. @@ -1364,13 +1794,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 = ( _BaseFeaturestoreOnlineServingServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = self._interceptor.pre_cancel_operation( request, metadata ) @@ -1383,6 +1816,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.aiplatform_v1beta1.FeaturestoreOnlineServingServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreOnlineServingService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeaturestoreOnlineServingServiceRestTransport._CancelOperation._get_response( self._host, @@ -1440,7 +1900,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. @@ -1451,13 +1911,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 = ( _BaseFeaturestoreOnlineServingServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = self._interceptor.pre_delete_operation( request, metadata ) @@ -1470,6 +1933,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.aiplatform_v1beta1.FeaturestoreOnlineServingServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreOnlineServingService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeaturestoreOnlineServingServiceRestTransport._DeleteOperation._get_response( self._host, @@ -1527,7 +2017,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. @@ -1538,8 +2028,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. @@ -1548,6 +2040,7 @@ def __call__( http_options = ( _BaseFeaturestoreOnlineServingServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = self._interceptor.pre_get_operation(request, metadata) transcoded_request = _BaseFeaturestoreOnlineServingServiceRestTransport._BaseGetOperation._get_transcoded_request( http_options, request @@ -1558,6 +2051,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.aiplatform_v1beta1.FeaturestoreOnlineServingServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreOnlineServingService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeaturestoreOnlineServingServiceRestTransport._GetOperation._get_response( self._host, @@ -1577,6 +2097,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.aiplatform_v1beta1.FeaturestoreOnlineServingServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreOnlineServingService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1619,7 +2160,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. @@ -1630,8 +2171,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. @@ -1640,6 +2183,7 @@ def __call__( http_options = ( _BaseFeaturestoreOnlineServingServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = self._interceptor.pre_list_operations(request, metadata) transcoded_request = _BaseFeaturestoreOnlineServingServiceRestTransport._BaseListOperations._get_transcoded_request( http_options, request @@ -1650,6 +2194,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.aiplatform_v1beta1.FeaturestoreOnlineServingServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreOnlineServingService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeaturestoreOnlineServingServiceRestTransport._ListOperations._get_response( self._host, @@ -1669,6 +2240,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.aiplatform_v1beta1.FeaturestoreOnlineServingServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreOnlineServingService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1711,7 +2303,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 wait operation method over HTTP. @@ -1722,8 +2314,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 WaitOperation method. @@ -1732,6 +2326,7 @@ def __call__( http_options = ( _BaseFeaturestoreOnlineServingServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = self._interceptor.pre_wait_operation(request, metadata) transcoded_request = _BaseFeaturestoreOnlineServingServiceRestTransport._BaseWaitOperation._get_transcoded_request( http_options, request @@ -1742,6 +2337,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.aiplatform_v1beta1.FeaturestoreOnlineServingServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreOnlineServingService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeaturestoreOnlineServingServiceRestTransport._WaitOperation._get_response( self._host, @@ -1761,6 +2383,27 @@ def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = self._interceptor.post_wait_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.aiplatform_v1beta1.FeaturestoreOnlineServingServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreOnlineServingService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1beta1/services/featurestore_online_serving_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1beta1/services/featurestore_online_serving_service/transports/rest_asyncio.py index bee94ed7d0..8ca29054f7 100644 --- a/google/cloud/aiplatform_v1beta1/services/featurestore_online_serving_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/featurestore_online_serving_service/transports/rest_asyncio.py @@ -56,6 +56,18 @@ from .base import DEFAULT_CLIENT_INFO as BASE_DEFAULT_CLIENT_INFO + +import logging + +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__) + try: OptionalRetry = Union[retries.AsyncRetry, gapic_v1.method._MethodDefault, None] except AttributeError: # pragma: NO COVER @@ -116,9 +128,10 @@ async def post_write_feature_values(self, response): async def pre_read_feature_values( self, request: featurestore_online_service.ReadFeatureValuesRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - featurestore_online_service.ReadFeatureValuesRequest, Sequence[Tuple[str, str]] + featurestore_online_service.ReadFeatureValuesRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for read_feature_values @@ -141,10 +154,10 @@ async def post_read_feature_values( async def pre_streaming_read_feature_values( self, request: featurestore_online_service.StreamingReadFeatureValuesRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ featurestore_online_service.StreamingReadFeatureValuesRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for streaming_read_feature_values @@ -167,9 +180,10 @@ async def post_streaming_read_feature_values( async def pre_write_feature_values( self, request: featurestore_online_service.WriteFeatureValuesRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - featurestore_online_service.WriteFeatureValuesRequest, Sequence[Tuple[str, str]] + featurestore_online_service.WriteFeatureValuesRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for write_feature_values @@ -192,8 +206,10 @@ async def post_write_feature_values( async def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -215,8 +231,10 @@ async def post_get_location( async def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -238,8 +256,10 @@ async def post_list_locations( async def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -261,8 +281,10 @@ async def post_get_iam_policy( async def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -284,8 +306,11 @@ async def post_set_iam_policy( async def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -307,8 +332,10 @@ async def post_test_iam_permissions( async def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -328,8 +355,10 @@ async def post_cancel_operation(self, response: None) -> None: async 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 @@ -349,8 +378,10 @@ async def post_delete_operation(self, response: None) -> None: async 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 @@ -372,8 +403,10 @@ async def post_get_operation( async 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 @@ -395,8 +428,10 @@ async def post_list_operations( async def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -597,7 +632,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> featurestore_online_service.ReadFeatureValuesResponse: r"""Call the read feature values method over HTTP. @@ -608,8 +643,10 @@ async def __call__( 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: ~.featurestore_online_service.ReadFeatureValuesResponse: @@ -621,6 +658,7 @@ async def __call__( http_options = ( _BaseFeaturestoreOnlineServingServiceRestTransport._BaseReadFeatureValues._get_http_options() ) + request, metadata = await self._interceptor.pre_read_feature_values( request, metadata ) @@ -637,6 +675,33 @@ async 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.aiplatform_v1beta1.FeaturestoreOnlineServingServiceClient.ReadFeatureValues", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreOnlineServingService", + "rpcName": "ReadFeatureValues", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeaturestoreOnlineServingServiceRestTransport._ReadFeatureValues._get_response( self._host, @@ -665,6 +730,32 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_read_feature_values(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + featurestore_online_service.ReadFeatureValuesResponse.to_json( + response + ) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.FeaturestoreOnlineServingServiceAsyncClient.read_feature_values", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreOnlineServingService", + "rpcName": "ReadFeatureValues", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _StreamingReadFeatureValues( @@ -706,7 +797,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> rest_streaming_async.AsyncResponseIterator: r"""Call the streaming read feature values method over HTTP. @@ -718,8 +809,10 @@ async def __call__( 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: ~.featurestore_online_service.ReadFeatureValuesResponse: @@ -731,6 +824,7 @@ async def __call__( http_options = ( _BaseFeaturestoreOnlineServingServiceRestTransport._BaseStreamingReadFeatureValues._get_http_options() ) + ( request, metadata, @@ -750,6 +844,33 @@ async 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.aiplatform_v1beta1.FeaturestoreOnlineServingServiceClient.StreamingReadFeatureValues", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreOnlineServingService", + "rpcName": "StreamingReadFeatureValues", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeaturestoreOnlineServingServiceRestTransport._StreamingReadFeatureValues._get_response( self._host, @@ -818,7 +939,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> featurestore_online_service.WriteFeatureValuesResponse: r"""Call the write feature values method over HTTP. @@ -829,8 +950,10 @@ async def __call__( 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: ~.featurestore_online_service.WriteFeatureValuesResponse: @@ -842,6 +965,7 @@ async def __call__( http_options = ( _BaseFeaturestoreOnlineServingServiceRestTransport._BaseWriteFeatureValues._get_http_options() ) + request, metadata = await self._interceptor.pre_write_feature_values( request, metadata ) @@ -858,6 +982,33 @@ async 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.aiplatform_v1beta1.FeaturestoreOnlineServingServiceClient.WriteFeatureValues", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreOnlineServingService", + "rpcName": "WriteFeatureValues", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeaturestoreOnlineServingServiceRestTransport._WriteFeatureValues._get_response( self._host, @@ -886,6 +1037,32 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_write_feature_values(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + featurestore_online_service.WriteFeatureValuesResponse.to_json( + response + ) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.FeaturestoreOnlineServingServiceAsyncClient.write_feature_values", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreOnlineServingService", + "rpcName": "WriteFeatureValues", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp @property @@ -957,7 +1134,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -968,8 +1145,10 @@ async def __call__( 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: locations_pb2.Location: Response from GetLocation method. @@ -978,6 +1157,7 @@ async def __call__( http_options = ( _BaseFeaturestoreOnlineServingServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_location( request, metadata ) @@ -990,6 +1170,33 @@ async 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.aiplatform_v1beta1.FeaturestoreOnlineServingServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreOnlineServingService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeaturestoreOnlineServingServiceRestTransport._GetLocation._get_response( self._host, @@ -1015,6 +1222,27 @@ async def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_location(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.aiplatform_v1beta1.FeaturestoreOnlineServingServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreOnlineServingService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1059,7 +1287,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -1070,8 +1298,10 @@ async def __call__( 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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -1080,6 +1310,7 @@ async def __call__( http_options = ( _BaseFeaturestoreOnlineServingServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_locations( request, metadata ) @@ -1092,6 +1323,33 @@ async 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.aiplatform_v1beta1.FeaturestoreOnlineServingServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreOnlineServingService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeaturestoreOnlineServingServiceRestTransport._ListLocations._get_response( self._host, @@ -1117,6 +1375,27 @@ async def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_list_locations(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.aiplatform_v1beta1.FeaturestoreOnlineServingServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreOnlineServingService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1162,7 +1441,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -1173,8 +1452,10 @@ async def __call__( 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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -1183,6 +1464,7 @@ async def __call__( http_options = ( _BaseFeaturestoreOnlineServingServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_get_iam_policy( request, metadata ) @@ -1199,6 +1481,33 @@ async 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.aiplatform_v1beta1.FeaturestoreOnlineServingServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreOnlineServingService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeaturestoreOnlineServingServiceRestTransport._GetIamPolicy._get_response( self._host, @@ -1225,6 +1534,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_iam_policy(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.aiplatform_v1beta1.FeaturestoreOnlineServingServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreOnlineServingService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1270,7 +1600,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -1281,8 +1611,10 @@ async def __call__( 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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -1291,6 +1623,7 @@ async def __call__( http_options = ( _BaseFeaturestoreOnlineServingServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_set_iam_policy( request, metadata ) @@ -1307,6 +1640,33 @@ async 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.aiplatform_v1beta1.FeaturestoreOnlineServingServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreOnlineServingService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeaturestoreOnlineServingServiceRestTransport._SetIamPolicy._get_response( self._host, @@ -1333,6 +1693,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_set_iam_policy(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.aiplatform_v1beta1.FeaturestoreOnlineServingServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreOnlineServingService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1378,7 +1759,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -1389,8 +1770,10 @@ async def __call__( 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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -1399,6 +1782,7 @@ async def __call__( http_options = ( _BaseFeaturestoreOnlineServingServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = await self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -1415,6 +1799,33 @@ async 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.aiplatform_v1beta1.FeaturestoreOnlineServingServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreOnlineServingService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeaturestoreOnlineServingServiceRestTransport._TestIamPermissions._get_response( self._host, @@ -1441,6 +1852,27 @@ async def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_test_iam_permissions(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.aiplatform_v1beta1.FeaturestoreOnlineServingServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreOnlineServingService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1485,7 +1917,7 @@ async 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 cancel operation method over HTTP. @@ -1496,13 +1928,16 @@ async def __call__( 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`. """ http_options = ( _BaseFeaturestoreOnlineServingServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_cancel_operation( request, metadata ) @@ -1515,6 +1950,33 @@ async 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.aiplatform_v1beta1.FeaturestoreOnlineServingServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreOnlineServingService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeaturestoreOnlineServingServiceRestTransport._CancelOperation._get_response( self._host, @@ -1580,7 +2042,7 @@ async 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. @@ -1591,13 +2053,16 @@ async def __call__( 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`. """ http_options = ( _BaseFeaturestoreOnlineServingServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_operation( request, metadata ) @@ -1610,6 +2075,33 @@ async 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.aiplatform_v1beta1.FeaturestoreOnlineServingServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreOnlineServingService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeaturestoreOnlineServingServiceRestTransport._DeleteOperation._get_response( self._host, @@ -1675,7 +2167,7 @@ async 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. @@ -1686,8 +2178,10 @@ async def __call__( 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: Response from GetOperation method. @@ -1696,6 +2190,7 @@ async def __call__( http_options = ( _BaseFeaturestoreOnlineServingServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_operation( request, metadata ) @@ -1708,6 +2203,33 @@ async 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.aiplatform_v1beta1.FeaturestoreOnlineServingServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreOnlineServingService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeaturestoreOnlineServingServiceRestTransport._GetOperation._get_response( self._host, @@ -1733,6 +2255,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1beta1.FeaturestoreOnlineServingServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreOnlineServingService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1777,7 +2320,7 @@ async 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. @@ -1788,8 +2331,10 @@ async def __call__( 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 from ListOperations method. @@ -1798,6 +2343,7 @@ async def __call__( http_options = ( _BaseFeaturestoreOnlineServingServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_operations( request, metadata ) @@ -1810,6 +2356,33 @@ async 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.aiplatform_v1beta1.FeaturestoreOnlineServingServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreOnlineServingService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeaturestoreOnlineServingServiceRestTransport._ListOperations._get_response( self._host, @@ -1835,6 +2408,27 @@ async def __call__( resp = operations_pb2.ListOperationsResponse() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1beta1.FeaturestoreOnlineServingServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreOnlineServingService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1879,7 +2473,7 @@ async 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 wait operation method over HTTP. @@ -1890,8 +2484,10 @@ async def __call__( 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: Response from WaitOperation method. @@ -1900,6 +2496,7 @@ async def __call__( http_options = ( _BaseFeaturestoreOnlineServingServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_wait_operation( request, metadata ) @@ -1912,6 +2509,33 @@ async 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.aiplatform_v1beta1.FeaturestoreOnlineServingServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreOnlineServingService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeaturestoreOnlineServingServiceRestTransport._WaitOperation._get_response( self._host, @@ -1937,6 +2561,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_wait_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.aiplatform_v1beta1.FeaturestoreOnlineServingServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreOnlineServingService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1beta1/services/featurestore_online_serving_service/transports/rest_base.py b/google/cloud/aiplatform_v1beta1/services/featurestore_online_serving_service/transports/rest_base.py index 9d05f61d89..b840208f6b 100644 --- a/google/cloud/aiplatform_v1beta1/services/featurestore_online_serving_service/transports/rest_base.py +++ b/google/cloud/aiplatform_v1beta1/services/featurestore_online_serving_service/transports/rest_base.py @@ -1190,6 +1190,10 @@ def _get_http_options(): "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -1406,6 +1410,10 @@ def _get_http_options(): "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -1631,6 +1639,10 @@ def _get_http_options(): "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}", @@ -1847,6 +1859,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, ] return http_options @@ -2064,6 +2080,10 @@ def _get_http_options(): "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*}/operations", @@ -2280,6 +2300,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*}/operations", + }, ] return http_options @@ -2497,6 +2521,10 @@ def _get_http_options(): "method": "post", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}:wait", @@ -2709,6 +2737,10 @@ def _get_http_options(): "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, ] return http_options diff --git a/google/cloud/aiplatform_v1beta1/services/featurestore_service/async_client.py b/google/cloud/aiplatform_v1beta1/services/featurestore_service/async_client.py index 21a7cc1d85..47aac0fd71 100644 --- a/google/cloud/aiplatform_v1beta1/services/featurestore_service/async_client.py +++ b/google/cloud/aiplatform_v1beta1/services/featurestore_service/async_client.py @@ -13,6 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging as std_logging from collections import OrderedDict import re from typing import ( @@ -69,6 +70,15 @@ from .transports.grpc_asyncio import FeaturestoreServiceGrpcAsyncIOTransport from .client import FeaturestoreServiceClient +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 FeaturestoreServiceAsyncClient: """The service that handles CRUD and List for resources for @@ -288,6 +298,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.aiplatform_v1beta1.FeaturestoreServiceAsyncClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "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.aiplatform.v1beta1.FeaturestoreService", + "credentialsType": None, + }, + ) + async def create_featurestore( self, request: Optional[ @@ -299,7 +331,7 @@ async def create_featurestore( featurestore_id: 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"""Creates a new Featurestore in a given project and location. @@ -370,8 +402,10 @@ async def sample_create_featurestore(): 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: @@ -450,7 +484,7 @@ async def get_featurestore( 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]]] = (), ) -> featurestore.Featurestore: r"""Gets details of a single Featurestore. @@ -494,8 +528,10 @@ async def sample_get_featurestore(): 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.aiplatform_v1beta1.types.Featurestore: @@ -561,7 +597,7 @@ async def list_featurestores( 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.ListFeaturestoresAsyncPager: r"""Lists Featurestores in a given project and location. @@ -607,8 +643,10 @@ async def sample_list_featurestores(): 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.aiplatform_v1beta1.services.featurestore_service.pagers.ListFeaturestoresAsyncPager: @@ -686,7 +724,7 @@ async def update_featurestore( 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"""Updates the parameters of a single Featurestore. @@ -754,8 +792,10 @@ async def sample_update_featurestore(): 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: @@ -835,7 +875,7 @@ async def delete_featurestore( force: Optional[bool] = 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"""Deletes a single Featurestore. The Featurestore must not contain any EntityTypes or ``force`` must be set to true for the request @@ -896,8 +936,10 @@ async def sample_delete_featurestore(): 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: @@ -982,7 +1024,7 @@ async def create_entity_type( entity_type_id: 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"""Creates a new EntityType in a given Featurestore. @@ -1051,8 +1093,10 @@ async def sample_create_entity_type(): 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: @@ -1131,7 +1175,7 @@ async def get_entity_type( 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]]] = (), ) -> entity_type.EntityType: r"""Gets details of a single EntityType. @@ -1175,8 +1219,10 @@ async def sample_get_entity_type(): 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.aiplatform_v1beta1.types.EntityType: @@ -1243,7 +1289,7 @@ async def list_entity_types( 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.ListEntityTypesAsyncPager: r"""Lists EntityTypes in a given Featurestore. @@ -1289,8 +1335,10 @@ async def sample_list_entity_types(): 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.aiplatform_v1beta1.services.featurestore_service.pagers.ListEntityTypesAsyncPager: @@ -1368,7 +1416,7 @@ async def update_entity_type( 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]]] = (), ) -> gca_entity_type.EntityType: r"""Updates the parameters of a single EntityType. @@ -1438,8 +1486,10 @@ async def sample_update_entity_type(): 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.aiplatform_v1beta1.types.EntityType: @@ -1511,7 +1561,7 @@ async def delete_entity_type( force: Optional[bool] = 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"""Deletes a single EntityType. The EntityType must not have any Features or ``force`` must be set to true for the request to @@ -1571,8 +1621,10 @@ async def sample_delete_entity_type(): 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: @@ -1657,7 +1709,7 @@ async def create_feature( feature_id: 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"""Creates a new Feature in a given EntityType. @@ -1732,8 +1784,10 @@ async def sample_create_feature(): 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: @@ -1814,7 +1868,7 @@ async def batch_create_features( ] = 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"""Creates a batch of Features in a given EntityType. @@ -1883,8 +1937,10 @@ async def sample_batch_create_features(): 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: @@ -1957,7 +2013,7 @@ async def get_feature( 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]]] = (), ) -> feature.Feature: r"""Gets details of a single Feature. @@ -2006,8 +2062,10 @@ async def sample_get_feature(): 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.aiplatform_v1beta1.types.Feature: @@ -2069,7 +2127,7 @@ async def list_features( 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.ListFeaturesAsyncPager: r"""Lists Features in a given EntityType. @@ -2119,8 +2177,10 @@ async def sample_list_features(): 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.aiplatform_v1beta1.services.featurestore_service.pagers.ListFeaturesAsyncPager: @@ -2200,7 +2260,7 @@ async def update_feature( 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]]] = (), ) -> gca_feature.Feature: r"""Updates the parameters of a single Feature. @@ -2269,8 +2329,10 @@ async def sample_update_feature(): 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.aiplatform_v1beta1.types.Feature: @@ -2338,7 +2400,7 @@ async def delete_feature( 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"""Deletes a single Feature. @@ -2390,8 +2452,10 @@ async def sample_delete_feature(): 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: @@ -2472,7 +2536,7 @@ async def import_feature_values( entity_type: 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"""Imports Feature values into the Featurestore from a source storage. @@ -2555,8 +2619,10 @@ async def sample_import_feature_values(): 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: @@ -2631,7 +2697,7 @@ async def batch_read_feature_values( featurestore: 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"""Batch reads Feature values from a Featurestore. @@ -2699,8 +2765,10 @@ async def sample_batch_read_feature_values(): 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: @@ -2775,7 +2843,7 @@ async def export_feature_values( entity_type: 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"""Exports Feature values from all the entities of a target EntityType. @@ -2833,8 +2901,10 @@ async def sample_export_feature_values(): 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: @@ -2909,7 +2979,7 @@ async def delete_feature_values( entity_type: 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 Feature values from Featurestore. @@ -2975,8 +3045,10 @@ async def sample_delete_feature_values(): 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: @@ -3052,7 +3124,7 @@ async def search_features( query: 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.SearchFeaturesAsyncPager: r"""Searches Features matching a query in a given project. @@ -3174,8 +3246,10 @@ async def sample_search_features(): 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.aiplatform_v1beta1.services.featurestore_service.pagers.SearchFeaturesAsyncPager: @@ -3251,7 +3325,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. @@ -3262,8 +3336,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. @@ -3304,7 +3380,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. @@ -3315,8 +3391,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. @@ -3357,7 +3435,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. @@ -3373,8 +3451,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 """ @@ -3411,7 +3491,7 @@ async def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -3426,8 +3506,10 @@ async def cancel_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 """ @@ -3464,7 +3546,7 @@ async def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -3481,8 +3563,10 @@ async def wait_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. @@ -3523,7 +3607,7 @@ async def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -3536,8 +3620,10 @@ async def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -3642,7 +3728,7 @@ async def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -3656,8 +3742,10 @@ async def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -3762,7 +3850,7 @@ async def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -3777,8 +3865,10 @@ async def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -3822,7 +3912,7 @@ async def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -3833,8 +3923,10 @@ async def get_location( 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: ~.location_pb2.Location: Location object. @@ -3875,7 +3967,7 @@ async def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -3886,8 +3978,10 @@ async def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1beta1/services/featurestore_service/client.py b/google/cloud/aiplatform_v1beta1/services/featurestore_service/client.py index e3948c4600..eb21ddee64 100644 --- a/google/cloud/aiplatform_v1beta1/services/featurestore_service/client.py +++ b/google/cloud/aiplatform_v1beta1/services/featurestore_service/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 ( @@ -48,6 +49,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 as gac_operation # type: ignore from google.api_core import operation_async # type: ignore from google.cloud.aiplatform_v1beta1.services.featurestore_service import pagers @@ -667,6 +677,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( @@ -758,6 +772,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.aiplatform_v1beta1.FeaturestoreServiceClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "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.aiplatform.v1beta1.FeaturestoreService", + "credentialsType": None, + }, + ) + def create_featurestore( self, request: Optional[ @@ -769,7 +806,7 @@ def create_featurestore( featurestore_id: 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]]] = (), ) -> gac_operation.Operation: r"""Creates a new Featurestore in a given project and location. @@ -840,8 +877,10 @@ def sample_create_featurestore(): 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: @@ -917,7 +956,7 @@ def get_featurestore( 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]]] = (), ) -> featurestore.Featurestore: r"""Gets details of a single Featurestore. @@ -961,8 +1000,10 @@ def sample_get_featurestore(): 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.aiplatform_v1beta1.types.Featurestore: @@ -1025,7 +1066,7 @@ def list_featurestores( 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.ListFeaturestoresPager: r"""Lists Featurestores in a given project and location. @@ -1071,8 +1112,10 @@ def sample_list_featurestores(): 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.aiplatform_v1beta1.services.featurestore_service.pagers.ListFeaturestoresPager: @@ -1147,7 +1190,7 @@ def update_featurestore( 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]]] = (), ) -> gac_operation.Operation: r"""Updates the parameters of a single Featurestore. @@ -1215,8 +1258,10 @@ def sample_update_featurestore(): 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: @@ -1293,7 +1338,7 @@ def delete_featurestore( force: Optional[bool] = 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]]] = (), ) -> gac_operation.Operation: r"""Deletes a single Featurestore. The Featurestore must not contain any EntityTypes or ``force`` must be set to true for the request @@ -1354,8 +1399,10 @@ def sample_delete_featurestore(): 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: @@ -1437,7 +1484,7 @@ def create_entity_type( entity_type_id: 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]]] = (), ) -> gac_operation.Operation: r"""Creates a new EntityType in a given Featurestore. @@ -1506,8 +1553,10 @@ def sample_create_entity_type(): 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: @@ -1583,7 +1632,7 @@ def get_entity_type( 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]]] = (), ) -> entity_type.EntityType: r"""Gets details of a single EntityType. @@ -1627,8 +1676,10 @@ def sample_get_entity_type(): 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.aiplatform_v1beta1.types.EntityType: @@ -1692,7 +1743,7 @@ def list_entity_types( 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.ListEntityTypesPager: r"""Lists EntityTypes in a given Featurestore. @@ -1738,8 +1789,10 @@ def sample_list_entity_types(): 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.aiplatform_v1beta1.services.featurestore_service.pagers.ListEntityTypesPager: @@ -1814,7 +1867,7 @@ def update_entity_type( 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]]] = (), ) -> gca_entity_type.EntityType: r"""Updates the parameters of a single EntityType. @@ -1884,8 +1937,10 @@ def sample_update_entity_type(): 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.aiplatform_v1beta1.types.EntityType: @@ -1954,7 +2009,7 @@ def delete_entity_type( force: Optional[bool] = 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]]] = (), ) -> gac_operation.Operation: r"""Deletes a single EntityType. The EntityType must not have any Features or ``force`` must be set to true for the request to @@ -2014,8 +2069,10 @@ def sample_delete_entity_type(): 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: @@ -2097,7 +2154,7 @@ def create_feature( feature_id: 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]]] = (), ) -> gac_operation.Operation: r"""Creates a new Feature in a given EntityType. @@ -2172,8 +2229,10 @@ def sample_create_feature(): 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: @@ -2251,7 +2310,7 @@ def batch_create_features( ] = 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]]] = (), ) -> gac_operation.Operation: r"""Creates a batch of Features in a given EntityType. @@ -2320,8 +2379,10 @@ def sample_batch_create_features(): 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: @@ -2391,7 +2452,7 @@ def get_feature( 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]]] = (), ) -> feature.Feature: r"""Gets details of a single Feature. @@ -2440,8 +2501,10 @@ def sample_get_feature(): 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.aiplatform_v1beta1.types.Feature: @@ -2500,7 +2563,7 @@ def list_features( 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.ListFeaturesPager: r"""Lists Features in a given EntityType. @@ -2550,8 +2613,10 @@ def sample_list_features(): 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.aiplatform_v1beta1.services.featurestore_service.pagers.ListFeaturesPager: @@ -2628,7 +2693,7 @@ def update_feature( 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]]] = (), ) -> gca_feature.Feature: r"""Updates the parameters of a single Feature. @@ -2697,8 +2762,10 @@ def sample_update_feature(): 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.aiplatform_v1beta1.types.Feature: @@ -2763,7 +2830,7 @@ def delete_feature( 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]]] = (), ) -> gac_operation.Operation: r"""Deletes a single Feature. @@ -2815,8 +2882,10 @@ def sample_delete_feature(): 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: @@ -2894,7 +2963,7 @@ def import_feature_values( entity_type: 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]]] = (), ) -> gac_operation.Operation: r"""Imports Feature values into the Featurestore from a source storage. @@ -2977,8 +3046,10 @@ def sample_import_feature_values(): 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: @@ -3050,7 +3121,7 @@ def batch_read_feature_values( featurestore: 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]]] = (), ) -> gac_operation.Operation: r"""Batch reads Feature values from a Featurestore. @@ -3118,8 +3189,10 @@ def sample_batch_read_feature_values(): 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: @@ -3193,7 +3266,7 @@ def export_feature_values( entity_type: 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]]] = (), ) -> gac_operation.Operation: r"""Exports Feature values from all the entities of a target EntityType. @@ -3251,8 +3324,10 @@ def sample_export_feature_values(): 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: @@ -3324,7 +3399,7 @@ def delete_feature_values( entity_type: 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]]] = (), ) -> gac_operation.Operation: r"""Delete Feature values from Featurestore. @@ -3390,8 +3465,10 @@ def sample_delete_feature_values(): 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: @@ -3464,7 +3541,7 @@ def search_features( query: 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.SearchFeaturesPager: r"""Searches Features matching a query in a given project. @@ -3586,8 +3663,10 @@ def sample_search_features(): 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.aiplatform_v1beta1.services.featurestore_service.pagers.SearchFeaturesPager: @@ -3673,7 +3752,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. @@ -3684,8 +3763,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. @@ -3726,7 +3807,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. @@ -3737,8 +3818,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. @@ -3779,7 +3862,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. @@ -3795,8 +3878,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 """ @@ -3833,7 +3918,7 @@ def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -3848,8 +3933,10 @@ def cancel_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 """ @@ -3886,7 +3973,7 @@ def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -3903,8 +3990,10 @@ def wait_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. @@ -3945,7 +4034,7 @@ def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -3958,8 +4047,10 @@ def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -4064,7 +4155,7 @@ def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -4078,8 +4169,10 @@ def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -4184,7 +4277,7 @@ def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -4199,8 +4292,10 @@ def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -4242,7 +4337,7 @@ def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -4253,8 +4348,10 @@ def get_location( 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: ~.location_pb2.Location: Location object. @@ -4295,7 +4392,7 @@ def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -4306,8 +4403,10 @@ def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1beta1/services/featurestore_service/pagers.py b/google/cloud/aiplatform_v1beta1/services/featurestore_service/pagers.py index 4e41316417..14b9db8b80 100644 --- a/google/cloud/aiplatform_v1beta1/services/featurestore_service/pagers.py +++ b/google/cloud/aiplatform_v1beta1/services/featurestore_service/pagers.py @@ -69,7 +69,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. @@ -83,8 +83,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 = featurestore_service.ListFeaturestoresRequest(request) @@ -145,7 +147,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. @@ -159,8 +161,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 = featurestore_service.ListFeaturestoresRequest(request) @@ -225,7 +229,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. @@ -239,8 +243,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 = featurestore_service.ListEntityTypesRequest(request) @@ -299,7 +305,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. @@ -313,8 +319,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 = featurestore_service.ListEntityTypesRequest(request) @@ -379,7 +387,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. @@ -393,8 +401,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 = featurestore_service.ListFeaturesRequest(request) @@ -453,7 +463,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. @@ -467,8 +477,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 = featurestore_service.ListFeaturesRequest(request) @@ -531,7 +543,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. @@ -545,8 +557,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 = featurestore_service.SearchFeaturesRequest(request) @@ -605,7 +619,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. @@ -619,8 +633,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 = featurestore_service.SearchFeaturesRequest(request) diff --git a/google/cloud/aiplatform_v1beta1/services/featurestore_service/transports/grpc.py b/google/cloud/aiplatform_v1beta1/services/featurestore_service/transports/grpc.py index 3f87db1e18..b85a4fb572 100644 --- a/google/cloud/aiplatform_v1beta1/services/featurestore_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1beta1/services/featurestore_service/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 import warnings from typing import Callable, Dict, Optional, Sequence, Tuple, Union @@ -22,8 +25,11 @@ import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from google.cloud.aiplatform_v1beta1.types import entity_type from google.cloud.aiplatform_v1beta1.types import entity_type as gca_entity_type @@ -37,6 +43,81 @@ from google.longrunning import operations_pb2 # type: ignore from .base import FeaturestoreServiceTransport, DEFAULT_CLIENT_INFO +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.aiplatform.v1beta1.FeaturestoreService", + "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.aiplatform.v1beta1.FeaturestoreService", + "rpcName": client_call_details.method, + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class FeaturestoreServiceGrpcTransport(FeaturestoreServiceTransport): """gRPC backend transport for FeaturestoreService. @@ -192,7 +273,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 @@ -256,7 +342,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 @@ -283,7 +371,7 @@ def create_featurestore( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_featurestore" not in self._stubs: - self._stubs["create_featurestore"] = self.grpc_channel.unary_unary( + self._stubs["create_featurestore"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.FeaturestoreService/CreateFeaturestore", request_serializer=featurestore_service.CreateFeaturestoreRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -311,7 +399,7 @@ def get_featurestore( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_featurestore" not in self._stubs: - self._stubs["get_featurestore"] = self.grpc_channel.unary_unary( + self._stubs["get_featurestore"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.FeaturestoreService/GetFeaturestore", request_serializer=featurestore_service.GetFeaturestoreRequest.serialize, response_deserializer=featurestore.Featurestore.deserialize, @@ -340,7 +428,7 @@ def list_featurestores( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_featurestores" not in self._stubs: - self._stubs["list_featurestores"] = self.grpc_channel.unary_unary( + self._stubs["list_featurestores"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.FeaturestoreService/ListFeaturestores", request_serializer=featurestore_service.ListFeaturestoresRequest.serialize, response_deserializer=featurestore_service.ListFeaturestoresResponse.deserialize, @@ -368,7 +456,7 @@ def update_featurestore( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_featurestore" not in self._stubs: - self._stubs["update_featurestore"] = self.grpc_channel.unary_unary( + self._stubs["update_featurestore"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.FeaturestoreService/UpdateFeaturestore", request_serializer=featurestore_service.UpdateFeaturestoreRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -398,7 +486,7 @@ def delete_featurestore( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_featurestore" not in self._stubs: - self._stubs["delete_featurestore"] = self.grpc_channel.unary_unary( + self._stubs["delete_featurestore"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.FeaturestoreService/DeleteFeaturestore", request_serializer=featurestore_service.DeleteFeaturestoreRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -426,7 +514,7 @@ def create_entity_type( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_entity_type" not in self._stubs: - self._stubs["create_entity_type"] = self.grpc_channel.unary_unary( + self._stubs["create_entity_type"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.FeaturestoreService/CreateEntityType", request_serializer=featurestore_service.CreateEntityTypeRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -452,7 +540,7 @@ def get_entity_type( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_entity_type" not in self._stubs: - self._stubs["get_entity_type"] = self.grpc_channel.unary_unary( + self._stubs["get_entity_type"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.FeaturestoreService/GetEntityType", request_serializer=featurestore_service.GetEntityTypeRequest.serialize, response_deserializer=entity_type.EntityType.deserialize, @@ -481,7 +569,7 @@ def list_entity_types( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_entity_types" not in self._stubs: - self._stubs["list_entity_types"] = self.grpc_channel.unary_unary( + self._stubs["list_entity_types"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.FeaturestoreService/ListEntityTypes", request_serializer=featurestore_service.ListEntityTypesRequest.serialize, response_deserializer=featurestore_service.ListEntityTypesResponse.deserialize, @@ -509,7 +597,7 @@ def update_entity_type( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_entity_type" not in self._stubs: - self._stubs["update_entity_type"] = self.grpc_channel.unary_unary( + self._stubs["update_entity_type"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.FeaturestoreService/UpdateEntityType", request_serializer=featurestore_service.UpdateEntityTypeRequest.serialize, response_deserializer=gca_entity_type.EntityType.deserialize, @@ -539,7 +627,7 @@ def delete_entity_type( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_entity_type" not in self._stubs: - self._stubs["delete_entity_type"] = self.grpc_channel.unary_unary( + self._stubs["delete_entity_type"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.FeaturestoreService/DeleteEntityType", request_serializer=featurestore_service.DeleteEntityTypeRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -567,7 +655,7 @@ def create_feature( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_feature" not in self._stubs: - self._stubs["create_feature"] = self.grpc_channel.unary_unary( + self._stubs["create_feature"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.FeaturestoreService/CreateFeature", request_serializer=featurestore_service.CreateFeatureRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -595,7 +683,7 @@ def batch_create_features( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "batch_create_features" not in self._stubs: - self._stubs["batch_create_features"] = self.grpc_channel.unary_unary( + self._stubs["batch_create_features"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.FeaturestoreService/BatchCreateFeatures", request_serializer=featurestore_service.BatchCreateFeaturesRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -621,7 +709,7 @@ def get_feature( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_feature" not in self._stubs: - self._stubs["get_feature"] = self.grpc_channel.unary_unary( + self._stubs["get_feature"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.FeaturestoreService/GetFeature", request_serializer=featurestore_service.GetFeatureRequest.serialize, response_deserializer=feature.Feature.deserialize, @@ -650,7 +738,7 @@ def list_features( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_features" not in self._stubs: - self._stubs["list_features"] = self.grpc_channel.unary_unary( + self._stubs["list_features"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.FeaturestoreService/ListFeatures", request_serializer=featurestore_service.ListFeaturesRequest.serialize, response_deserializer=featurestore_service.ListFeaturesResponse.deserialize, @@ -676,7 +764,7 @@ def update_feature( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_feature" not in self._stubs: - self._stubs["update_feature"] = self.grpc_channel.unary_unary( + self._stubs["update_feature"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.FeaturestoreService/UpdateFeature", request_serializer=featurestore_service.UpdateFeatureRequest.serialize, response_deserializer=gca_feature.Feature.deserialize, @@ -704,7 +792,7 @@ def delete_feature( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_feature" not in self._stubs: - self._stubs["delete_feature"] = self.grpc_channel.unary_unary( + self._stubs["delete_feature"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.FeaturestoreService/DeleteFeature", request_serializer=featurestore_service.DeleteFeatureRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -756,7 +844,7 @@ def import_feature_values( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "import_feature_values" not in self._stubs: - self._stubs["import_feature_values"] = self.grpc_channel.unary_unary( + self._stubs["import_feature_values"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.FeaturestoreService/ImportFeatureValues", request_serializer=featurestore_service.ImportFeatureValuesRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -790,7 +878,7 @@ def batch_read_feature_values( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "batch_read_feature_values" not in self._stubs: - self._stubs["batch_read_feature_values"] = self.grpc_channel.unary_unary( + self._stubs["batch_read_feature_values"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.FeaturestoreService/BatchReadFeatureValues", request_serializer=featurestore_service.BatchReadFeatureValuesRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -819,7 +907,7 @@ def export_feature_values( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "export_feature_values" not in self._stubs: - self._stubs["export_feature_values"] = self.grpc_channel.unary_unary( + self._stubs["export_feature_values"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.FeaturestoreService/ExportFeatureValues", request_serializer=featurestore_service.ExportFeatureValuesRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -859,7 +947,7 @@ def delete_feature_values( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_feature_values" not in self._stubs: - self._stubs["delete_feature_values"] = self.grpc_channel.unary_unary( + self._stubs["delete_feature_values"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.FeaturestoreService/DeleteFeatureValues", request_serializer=featurestore_service.DeleteFeatureValuesRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -889,7 +977,7 @@ def search_features( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "search_features" not in self._stubs: - self._stubs["search_features"] = self.grpc_channel.unary_unary( + self._stubs["search_features"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.FeaturestoreService/SearchFeatures", request_serializer=featurestore_service.SearchFeaturesRequest.serialize, response_deserializer=featurestore_service.SearchFeaturesResponse.deserialize, @@ -897,7 +985,7 @@ def search_features( return self._stubs["search_features"] def close(self): - self.grpc_channel.close() + self._logged_channel.close() @property def delete_operation( @@ -909,7 +997,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, @@ -926,7 +1014,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -943,7 +1031,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -960,7 +1048,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, @@ -979,7 +1067,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, @@ -998,7 +1086,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -1015,7 +1103,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -1040,7 +1128,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -1066,7 +1154,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -1095,7 +1183,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1beta1/services/featurestore_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1beta1/services/featurestore_service/transports/grpc_asyncio.py index 9787250231..64554ed4a3 100644 --- a/google/cloud/aiplatform_v1beta1/services/featurestore_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/featurestore_service/transports/grpc_asyncio.py @@ -14,6 +14,9 @@ # limitations under the License. # import inspect +import json +import pickle +import logging as std_logging import warnings from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union @@ -24,8 +27,11 @@ from google.api_core import operations_v1 from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from grpc.experimental import aio # type: ignore from google.cloud.aiplatform_v1beta1.types import entity_type @@ -41,6 +47,82 @@ from .base import FeaturestoreServiceTransport, DEFAULT_CLIENT_INFO from .grpc import FeaturestoreServiceGrpcTransport +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.aiplatform.v1beta1.FeaturestoreService", + "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.aiplatform.v1beta1.FeaturestoreService", + "rpcName": str(client_call_details.method), + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class FeaturestoreServiceGrpcAsyncIOTransport(FeaturestoreServiceTransport): """gRPC AsyncIO backend transport for FeaturestoreService. @@ -239,10 +321,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 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. @@ -294,7 +379,7 @@ def create_featurestore( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_featurestore" not in self._stubs: - self._stubs["create_featurestore"] = self.grpc_channel.unary_unary( + self._stubs["create_featurestore"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.FeaturestoreService/CreateFeaturestore", request_serializer=featurestore_service.CreateFeaturestoreRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -323,7 +408,7 @@ def get_featurestore( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_featurestore" not in self._stubs: - self._stubs["get_featurestore"] = self.grpc_channel.unary_unary( + self._stubs["get_featurestore"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.FeaturestoreService/GetFeaturestore", request_serializer=featurestore_service.GetFeaturestoreRequest.serialize, response_deserializer=featurestore.Featurestore.deserialize, @@ -352,7 +437,7 @@ def list_featurestores( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_featurestores" not in self._stubs: - self._stubs["list_featurestores"] = self.grpc_channel.unary_unary( + self._stubs["list_featurestores"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.FeaturestoreService/ListFeaturestores", request_serializer=featurestore_service.ListFeaturestoresRequest.serialize, response_deserializer=featurestore_service.ListFeaturestoresResponse.deserialize, @@ -381,7 +466,7 @@ def update_featurestore( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_featurestore" not in self._stubs: - self._stubs["update_featurestore"] = self.grpc_channel.unary_unary( + self._stubs["update_featurestore"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.FeaturestoreService/UpdateFeaturestore", request_serializer=featurestore_service.UpdateFeaturestoreRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -412,7 +497,7 @@ def delete_featurestore( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_featurestore" not in self._stubs: - self._stubs["delete_featurestore"] = self.grpc_channel.unary_unary( + self._stubs["delete_featurestore"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.FeaturestoreService/DeleteFeaturestore", request_serializer=featurestore_service.DeleteFeaturestoreRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -441,7 +526,7 @@ def create_entity_type( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_entity_type" not in self._stubs: - self._stubs["create_entity_type"] = self.grpc_channel.unary_unary( + self._stubs["create_entity_type"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.FeaturestoreService/CreateEntityType", request_serializer=featurestore_service.CreateEntityTypeRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -469,7 +554,7 @@ def get_entity_type( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_entity_type" not in self._stubs: - self._stubs["get_entity_type"] = self.grpc_channel.unary_unary( + self._stubs["get_entity_type"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.FeaturestoreService/GetEntityType", request_serializer=featurestore_service.GetEntityTypeRequest.serialize, response_deserializer=entity_type.EntityType.deserialize, @@ -498,7 +583,7 @@ def list_entity_types( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_entity_types" not in self._stubs: - self._stubs["list_entity_types"] = self.grpc_channel.unary_unary( + self._stubs["list_entity_types"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.FeaturestoreService/ListEntityTypes", request_serializer=featurestore_service.ListEntityTypesRequest.serialize, response_deserializer=featurestore_service.ListEntityTypesResponse.deserialize, @@ -527,7 +612,7 @@ def update_entity_type( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_entity_type" not in self._stubs: - self._stubs["update_entity_type"] = self.grpc_channel.unary_unary( + self._stubs["update_entity_type"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.FeaturestoreService/UpdateEntityType", request_serializer=featurestore_service.UpdateEntityTypeRequest.serialize, response_deserializer=gca_entity_type.EntityType.deserialize, @@ -558,7 +643,7 @@ def delete_entity_type( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_entity_type" not in self._stubs: - self._stubs["delete_entity_type"] = self.grpc_channel.unary_unary( + self._stubs["delete_entity_type"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.FeaturestoreService/DeleteEntityType", request_serializer=featurestore_service.DeleteEntityTypeRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -586,7 +671,7 @@ def create_feature( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_feature" not in self._stubs: - self._stubs["create_feature"] = self.grpc_channel.unary_unary( + self._stubs["create_feature"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.FeaturestoreService/CreateFeature", request_serializer=featurestore_service.CreateFeatureRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -615,7 +700,7 @@ def batch_create_features( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "batch_create_features" not in self._stubs: - self._stubs["batch_create_features"] = self.grpc_channel.unary_unary( + self._stubs["batch_create_features"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.FeaturestoreService/BatchCreateFeatures", request_serializer=featurestore_service.BatchCreateFeaturesRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -641,7 +726,7 @@ def get_feature( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_feature" not in self._stubs: - self._stubs["get_feature"] = self.grpc_channel.unary_unary( + self._stubs["get_feature"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.FeaturestoreService/GetFeature", request_serializer=featurestore_service.GetFeatureRequest.serialize, response_deserializer=feature.Feature.deserialize, @@ -670,7 +755,7 @@ def list_features( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_features" not in self._stubs: - self._stubs["list_features"] = self.grpc_channel.unary_unary( + self._stubs["list_features"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.FeaturestoreService/ListFeatures", request_serializer=featurestore_service.ListFeaturesRequest.serialize, response_deserializer=featurestore_service.ListFeaturesResponse.deserialize, @@ -698,7 +783,7 @@ def update_feature( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_feature" not in self._stubs: - self._stubs["update_feature"] = self.grpc_channel.unary_unary( + self._stubs["update_feature"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.FeaturestoreService/UpdateFeature", request_serializer=featurestore_service.UpdateFeatureRequest.serialize, response_deserializer=gca_feature.Feature.deserialize, @@ -726,7 +811,7 @@ def delete_feature( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_feature" not in self._stubs: - self._stubs["delete_feature"] = self.grpc_channel.unary_unary( + self._stubs["delete_feature"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.FeaturestoreService/DeleteFeature", request_serializer=featurestore_service.DeleteFeatureRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -779,7 +864,7 @@ def import_feature_values( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "import_feature_values" not in self._stubs: - self._stubs["import_feature_values"] = self.grpc_channel.unary_unary( + self._stubs["import_feature_values"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.FeaturestoreService/ImportFeatureValues", request_serializer=featurestore_service.ImportFeatureValuesRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -814,7 +899,7 @@ def batch_read_feature_values( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "batch_read_feature_values" not in self._stubs: - self._stubs["batch_read_feature_values"] = self.grpc_channel.unary_unary( + self._stubs["batch_read_feature_values"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.FeaturestoreService/BatchReadFeatureValues", request_serializer=featurestore_service.BatchReadFeatureValuesRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -844,7 +929,7 @@ def export_feature_values( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "export_feature_values" not in self._stubs: - self._stubs["export_feature_values"] = self.grpc_channel.unary_unary( + self._stubs["export_feature_values"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.FeaturestoreService/ExportFeatureValues", request_serializer=featurestore_service.ExportFeatureValuesRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -885,7 +970,7 @@ def delete_feature_values( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_feature_values" not in self._stubs: - self._stubs["delete_feature_values"] = self.grpc_channel.unary_unary( + self._stubs["delete_feature_values"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.FeaturestoreService/DeleteFeatureValues", request_serializer=featurestore_service.DeleteFeatureValuesRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -915,7 +1000,7 @@ def search_features( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "search_features" not in self._stubs: - self._stubs["search_features"] = self.grpc_channel.unary_unary( + self._stubs["search_features"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.FeaturestoreService/SearchFeatures", request_serializer=featurestore_service.SearchFeaturesRequest.serialize, response_deserializer=featurestore_service.SearchFeaturesResponse.deserialize, @@ -1088,7 +1173,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: @@ -1104,7 +1189,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, @@ -1121,7 +1206,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -1138,7 +1223,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -1155,7 +1240,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, @@ -1174,7 +1259,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, @@ -1193,7 +1278,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -1210,7 +1295,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -1235,7 +1320,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -1261,7 +1346,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -1290,7 +1375,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1beta1/services/featurestore_service/transports/rest.py b/google/cloud/aiplatform_v1beta1/services/featurestore_service/transports/rest.py index 92a1324d0b..aeab4dab5b 100644 --- a/google/cloud/aiplatform_v1beta1/services/featurestore_service/transports/rest.py +++ b/google/cloud/aiplatform_v1beta1/services/featurestore_service/transports/rest.py @@ -13,9 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging +import json # type: ignore from google.auth.transport.requests import AuthorizedSession # type: ignore -import json # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.api_core import exceptions as core_exceptions from google.api_core import retry as retries @@ -52,6 +53,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, @@ -252,9 +261,10 @@ def post_update_featurestore(self, response): def pre_batch_create_features( self, request: featurestore_service.BatchCreateFeaturesRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - featurestore_service.BatchCreateFeaturesRequest, Sequence[Tuple[str, str]] + featurestore_service.BatchCreateFeaturesRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for batch_create_features @@ -277,9 +287,10 @@ def post_batch_create_features( def pre_batch_read_feature_values( self, request: featurestore_service.BatchReadFeatureValuesRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - featurestore_service.BatchReadFeatureValuesRequest, Sequence[Tuple[str, str]] + featurestore_service.BatchReadFeatureValuesRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for batch_read_feature_values @@ -302,8 +313,11 @@ def post_batch_read_feature_values( def pre_create_entity_type( self, request: featurestore_service.CreateEntityTypeRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[featurestore_service.CreateEntityTypeRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + featurestore_service.CreateEntityTypeRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for create_entity_type Override in a subclass to manipulate the request or metadata @@ -325,8 +339,11 @@ def post_create_entity_type( def pre_create_feature( self, request: featurestore_service.CreateFeatureRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[featurestore_service.CreateFeatureRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + featurestore_service.CreateFeatureRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for create_feature Override in a subclass to manipulate the request or metadata @@ -348,9 +365,10 @@ def post_create_feature( def pre_create_featurestore( self, request: featurestore_service.CreateFeaturestoreRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - featurestore_service.CreateFeaturestoreRequest, Sequence[Tuple[str, str]] + featurestore_service.CreateFeaturestoreRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for create_featurestore @@ -373,8 +391,11 @@ def post_create_featurestore( def pre_delete_entity_type( self, request: featurestore_service.DeleteEntityTypeRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[featurestore_service.DeleteEntityTypeRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + featurestore_service.DeleteEntityTypeRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for delete_entity_type Override in a subclass to manipulate the request or metadata @@ -396,8 +417,11 @@ def post_delete_entity_type( def pre_delete_feature( self, request: featurestore_service.DeleteFeatureRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[featurestore_service.DeleteFeatureRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + featurestore_service.DeleteFeatureRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for delete_feature Override in a subclass to manipulate the request or metadata @@ -419,9 +443,10 @@ def post_delete_feature( def pre_delete_featurestore( self, request: featurestore_service.DeleteFeaturestoreRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - featurestore_service.DeleteFeaturestoreRequest, Sequence[Tuple[str, str]] + featurestore_service.DeleteFeaturestoreRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for delete_featurestore @@ -444,9 +469,10 @@ def post_delete_featurestore( def pre_delete_feature_values( self, request: featurestore_service.DeleteFeatureValuesRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - featurestore_service.DeleteFeatureValuesRequest, Sequence[Tuple[str, str]] + featurestore_service.DeleteFeatureValuesRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for delete_feature_values @@ -469,9 +495,10 @@ def post_delete_feature_values( def pre_export_feature_values( self, request: featurestore_service.ExportFeatureValuesRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - featurestore_service.ExportFeatureValuesRequest, Sequence[Tuple[str, str]] + featurestore_service.ExportFeatureValuesRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for export_feature_values @@ -494,8 +521,11 @@ def post_export_feature_values( def pre_get_entity_type( self, request: featurestore_service.GetEntityTypeRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[featurestore_service.GetEntityTypeRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + featurestore_service.GetEntityTypeRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for get_entity_type Override in a subclass to manipulate the request or metadata @@ -517,8 +547,10 @@ def post_get_entity_type( def pre_get_feature( self, request: featurestore_service.GetFeatureRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[featurestore_service.GetFeatureRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + featurestore_service.GetFeatureRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_feature Override in a subclass to manipulate the request or metadata @@ -538,8 +570,11 @@ def post_get_feature(self, response: feature.Feature) -> feature.Feature: def pre_get_featurestore( self, request: featurestore_service.GetFeaturestoreRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[featurestore_service.GetFeaturestoreRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + featurestore_service.GetFeaturestoreRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for get_featurestore Override in a subclass to manipulate the request or metadata @@ -561,9 +596,10 @@ def post_get_featurestore( def pre_import_feature_values( self, request: featurestore_service.ImportFeatureValuesRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - featurestore_service.ImportFeatureValuesRequest, Sequence[Tuple[str, str]] + featurestore_service.ImportFeatureValuesRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for import_feature_values @@ -586,8 +622,11 @@ def post_import_feature_values( def pre_list_entity_types( self, request: featurestore_service.ListEntityTypesRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[featurestore_service.ListEntityTypesRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + featurestore_service.ListEntityTypesRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for list_entity_types Override in a subclass to manipulate the request or metadata @@ -609,8 +648,11 @@ def post_list_entity_types( def pre_list_features( self, request: featurestore_service.ListFeaturesRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[featurestore_service.ListFeaturesRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + featurestore_service.ListFeaturesRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for list_features Override in a subclass to manipulate the request or metadata @@ -632,9 +674,10 @@ def post_list_features( def pre_list_featurestores( self, request: featurestore_service.ListFeaturestoresRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - featurestore_service.ListFeaturestoresRequest, Sequence[Tuple[str, str]] + featurestore_service.ListFeaturestoresRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for list_featurestores @@ -657,8 +700,11 @@ def post_list_featurestores( def pre_search_features( self, request: featurestore_service.SearchFeaturesRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[featurestore_service.SearchFeaturesRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + featurestore_service.SearchFeaturesRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for search_features Override in a subclass to manipulate the request or metadata @@ -680,8 +726,11 @@ def post_search_features( def pre_update_entity_type( self, request: featurestore_service.UpdateEntityTypeRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[featurestore_service.UpdateEntityTypeRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + featurestore_service.UpdateEntityTypeRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for update_entity_type Override in a subclass to manipulate the request or metadata @@ -703,8 +752,11 @@ def post_update_entity_type( def pre_update_feature( self, request: featurestore_service.UpdateFeatureRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[featurestore_service.UpdateFeatureRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + featurestore_service.UpdateFeatureRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for update_feature Override in a subclass to manipulate the request or metadata @@ -724,9 +776,10 @@ def post_update_feature(self, response: gca_feature.Feature) -> gca_feature.Feat def pre_update_featurestore( self, request: featurestore_service.UpdateFeaturestoreRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - featurestore_service.UpdateFeaturestoreRequest, Sequence[Tuple[str, str]] + featurestore_service.UpdateFeaturestoreRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for update_featurestore @@ -749,8 +802,10 @@ def post_update_featurestore( def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -772,8 +827,10 @@ def post_get_location( def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -795,8 +852,10 @@ def post_list_locations( def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -816,8 +875,10 @@ def post_get_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -837,8 +898,11 @@ def post_set_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -860,8 +924,10 @@ def post_test_iam_permissions( def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -881,8 +947,10 @@ def post_cancel_operation(self, response: None) -> None: 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 @@ -902,8 +970,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 @@ -925,8 +995,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 @@ -948,8 +1020,10 @@ def post_list_operations( def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -1630,6 +1704,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -1846,6 +1924,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -2052,6 +2134,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}", @@ -2268,6 +2354,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, ], "google.longrunning.Operations.ListOperations": [ { @@ -2466,6 +2556,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*}/operations", @@ -2682,6 +2776,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*}/operations", + }, ], "google.longrunning.Operations.WaitOperation": [ { @@ -2880,6 +2978,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "post", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}:wait", @@ -3092,6 +3194,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, ], } @@ -3148,7 +3254,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 batch create features method over HTTP. @@ -3161,8 +3267,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: @@ -3175,6 +3283,7 @@ def __call__( http_options = ( _BaseFeaturestoreServiceRestTransport._BaseBatchCreateFeatures._get_http_options() ) + request, metadata = self._interceptor.pre_batch_create_features( request, metadata ) @@ -3191,6 +3300,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.aiplatform_v1beta1.FeaturestoreServiceClient.BatchCreateFeatures", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "rpcName": "BatchCreateFeatures", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( FeaturestoreServiceRestTransport._BatchCreateFeatures._get_response( @@ -3212,7 +3348,29 @@ def __call__( # Return the response resp = operations_pb2.Operation() json_format.Parse(response.content, resp, ignore_unknown_fields=True) + resp = self._interceptor.post_batch_create_features(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.aiplatform_v1beta1.FeaturestoreServiceClient.batch_create_features", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "rpcName": "BatchCreateFeatures", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _BatchReadFeatureValues( @@ -3252,7 +3410,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 batch read feature values method over HTTP. @@ -3263,8 +3421,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: @@ -3277,6 +3437,7 @@ def __call__( http_options = ( _BaseFeaturestoreServiceRestTransport._BaseBatchReadFeatureValues._get_http_options() ) + request, metadata = self._interceptor.pre_batch_read_feature_values( request, metadata ) @@ -3293,6 +3454,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.aiplatform_v1beta1.FeaturestoreServiceClient.BatchReadFeatureValues", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "rpcName": "BatchReadFeatureValues", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( FeaturestoreServiceRestTransport._BatchReadFeatureValues._get_response( @@ -3314,7 +3502,29 @@ def __call__( # Return the response resp = operations_pb2.Operation() json_format.Parse(response.content, resp, ignore_unknown_fields=True) + resp = self._interceptor.post_batch_read_feature_values(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.aiplatform_v1beta1.FeaturestoreServiceClient.batch_read_feature_values", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "rpcName": "BatchReadFeatureValues", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _CreateEntityType( @@ -3354,7 +3564,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 entity type method over HTTP. @@ -3365,8 +3575,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: @@ -3379,6 +3591,7 @@ def __call__( http_options = ( _BaseFeaturestoreServiceRestTransport._BaseCreateEntityType._get_http_options() ) + request, metadata = self._interceptor.pre_create_entity_type( request, metadata ) @@ -3395,6 +3608,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.aiplatform_v1beta1.FeaturestoreServiceClient.CreateEntityType", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "rpcName": "CreateEntityType", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeaturestoreServiceRestTransport._CreateEntityType._get_response( self._host, @@ -3414,7 +3654,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_entity_type(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.aiplatform_v1beta1.FeaturestoreServiceClient.create_entity_type", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "rpcName": "CreateEntityType", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _CreateFeature( @@ -3454,7 +3716,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 feature method over HTTP. @@ -3467,8 +3729,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: @@ -3481,6 +3745,7 @@ def __call__( http_options = ( _BaseFeaturestoreServiceRestTransport._BaseCreateFeature._get_http_options() ) + request, metadata = self._interceptor.pre_create_feature(request, metadata) transcoded_request = _BaseFeaturestoreServiceRestTransport._BaseCreateFeature._get_transcoded_request( http_options, request @@ -3495,6 +3760,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.aiplatform_v1beta1.FeaturestoreServiceClient.CreateFeature", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "rpcName": "CreateFeature", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeaturestoreServiceRestTransport._CreateFeature._get_response( self._host, @@ -3514,7 +3806,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_feature(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.aiplatform_v1beta1.FeaturestoreServiceClient.create_feature", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "rpcName": "CreateFeature", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _CreateFeaturestore( @@ -3554,7 +3868,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 featurestore method over HTTP. @@ -3565,8 +3879,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: @@ -3579,6 +3895,7 @@ def __call__( http_options = ( _BaseFeaturestoreServiceRestTransport._BaseCreateFeaturestore._get_http_options() ) + request, metadata = self._interceptor.pre_create_featurestore( request, metadata ) @@ -3595,6 +3912,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.aiplatform_v1beta1.FeaturestoreServiceClient.CreateFeaturestore", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "rpcName": "CreateFeaturestore", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( FeaturestoreServiceRestTransport._CreateFeaturestore._get_response( @@ -3616,7 +3960,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_featurestore(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.aiplatform_v1beta1.FeaturestoreServiceClient.create_featurestore", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "rpcName": "CreateFeaturestore", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _DeleteEntityType( @@ -3655,7 +4021,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 entity type method over HTTP. @@ -3666,8 +4032,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: @@ -3680,6 +4048,7 @@ def __call__( http_options = ( _BaseFeaturestoreServiceRestTransport._BaseDeleteEntityType._get_http_options() ) + request, metadata = self._interceptor.pre_delete_entity_type( request, metadata ) @@ -3692,6 +4061,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.aiplatform_v1beta1.FeaturestoreServiceClient.DeleteEntityType", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "rpcName": "DeleteEntityType", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeaturestoreServiceRestTransport._DeleteEntityType._get_response( self._host, @@ -3710,7 +4106,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_entity_type(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.aiplatform_v1beta1.FeaturestoreServiceClient.delete_entity_type", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "rpcName": "DeleteEntityType", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _DeleteFeature( @@ -3749,7 +4167,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 feature method over HTTP. @@ -3762,8 +4180,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: @@ -3776,6 +4196,7 @@ def __call__( http_options = ( _BaseFeaturestoreServiceRestTransport._BaseDeleteFeature._get_http_options() ) + request, metadata = self._interceptor.pre_delete_feature(request, metadata) transcoded_request = _BaseFeaturestoreServiceRestTransport._BaseDeleteFeature._get_transcoded_request( http_options, request @@ -3786,6 +4207,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.aiplatform_v1beta1.FeaturestoreServiceClient.DeleteFeature", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "rpcName": "DeleteFeature", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeaturestoreServiceRestTransport._DeleteFeature._get_response( self._host, @@ -3804,7 +4252,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_feature(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.aiplatform_v1beta1.FeaturestoreServiceClient.delete_feature", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "rpcName": "DeleteFeature", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _DeleteFeaturestore( @@ -3843,7 +4313,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 featurestore method over HTTP. @@ -3854,8 +4324,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: @@ -3868,6 +4340,7 @@ def __call__( http_options = ( _BaseFeaturestoreServiceRestTransport._BaseDeleteFeaturestore._get_http_options() ) + request, metadata = self._interceptor.pre_delete_featurestore( request, metadata ) @@ -3880,6 +4353,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.aiplatform_v1beta1.FeaturestoreServiceClient.DeleteFeaturestore", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "rpcName": "DeleteFeaturestore", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( FeaturestoreServiceRestTransport._DeleteFeaturestore._get_response( @@ -3900,7 +4400,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_featurestore(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.aiplatform_v1beta1.FeaturestoreServiceClient.delete_featurestore", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "rpcName": "DeleteFeaturestore", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _DeleteFeatureValues( @@ -3940,7 +4462,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 feature values method over HTTP. @@ -3951,8 +4473,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: @@ -3965,6 +4489,7 @@ def __call__( http_options = ( _BaseFeaturestoreServiceRestTransport._BaseDeleteFeatureValues._get_http_options() ) + request, metadata = self._interceptor.pre_delete_feature_values( request, metadata ) @@ -3981,6 +4506,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.aiplatform_v1beta1.FeaturestoreServiceClient.DeleteFeatureValues", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "rpcName": "DeleteFeatureValues", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( FeaturestoreServiceRestTransport._DeleteFeatureValues._get_response( @@ -4002,7 +4554,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_feature_values(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.aiplatform_v1beta1.FeaturestoreServiceClient.delete_feature_values", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "rpcName": "DeleteFeatureValues", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ExportFeatureValues( @@ -4042,7 +4616,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 export feature values method over HTTP. @@ -4053,8 +4627,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: @@ -4067,6 +4643,7 @@ def __call__( http_options = ( _BaseFeaturestoreServiceRestTransport._BaseExportFeatureValues._get_http_options() ) + request, metadata = self._interceptor.pre_export_feature_values( request, metadata ) @@ -4083,6 +4660,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.aiplatform_v1beta1.FeaturestoreServiceClient.ExportFeatureValues", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "rpcName": "ExportFeatureValues", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( FeaturestoreServiceRestTransport._ExportFeatureValues._get_response( @@ -4104,7 +4708,29 @@ def __call__( # Return the response resp = operations_pb2.Operation() json_format.Parse(response.content, resp, ignore_unknown_fields=True) + resp = self._interceptor.post_export_feature_values(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.aiplatform_v1beta1.FeaturestoreServiceClient.export_feature_values", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "rpcName": "ExportFeatureValues", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _GetEntityType( @@ -4143,7 +4769,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]]] = (), ) -> entity_type.EntityType: r"""Call the get entity type method over HTTP. @@ -4154,8 +4780,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: ~.entity_type.EntityType: @@ -4171,6 +4799,7 @@ def __call__( http_options = ( _BaseFeaturestoreServiceRestTransport._BaseGetEntityType._get_http_options() ) + request, metadata = self._interceptor.pre_get_entity_type(request, metadata) transcoded_request = _BaseFeaturestoreServiceRestTransport._BaseGetEntityType._get_transcoded_request( http_options, request @@ -4181,6 +4810,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.aiplatform_v1beta1.FeaturestoreServiceClient.GetEntityType", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "rpcName": "GetEntityType", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeaturestoreServiceRestTransport._GetEntityType._get_response( self._host, @@ -4201,7 +4857,29 @@ def __call__( pb_resp = entity_type.EntityType.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_entity_type(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = entity_type.EntityType.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.aiplatform_v1beta1.FeaturestoreServiceClient.get_entity_type", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "rpcName": "GetEntityType", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _GetFeature( @@ -4240,7 +4918,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]]] = (), ) -> feature.Feature: r"""Call the get feature method over HTTP. @@ -4253,8 +4931,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: ~.feature.Feature: @@ -4267,6 +4947,7 @@ def __call__( http_options = ( _BaseFeaturestoreServiceRestTransport._BaseGetFeature._get_http_options() ) + request, metadata = self._interceptor.pre_get_feature(request, metadata) transcoded_request = _BaseFeaturestoreServiceRestTransport._BaseGetFeature._get_transcoded_request( http_options, request @@ -4277,6 +4958,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.aiplatform_v1beta1.FeaturestoreServiceClient.GetFeature", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "rpcName": "GetFeature", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeaturestoreServiceRestTransport._GetFeature._get_response( self._host, @@ -4297,7 +5005,29 @@ def __call__( pb_resp = feature.Feature.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_feature(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = feature.Feature.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.aiplatform_v1beta1.FeaturestoreServiceClient.get_feature", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "rpcName": "GetFeature", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _GetFeaturestore( @@ -4336,7 +5066,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]]] = (), ) -> featurestore.Featurestore: r"""Call the get featurestore method over HTTP. @@ -4347,8 +5077,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: ~.featurestore.Featurestore: @@ -4363,6 +5095,7 @@ def __call__( http_options = ( _BaseFeaturestoreServiceRestTransport._BaseGetFeaturestore._get_http_options() ) + request, metadata = self._interceptor.pre_get_featurestore( request, metadata ) @@ -4375,6 +5108,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.aiplatform_v1beta1.FeaturestoreServiceClient.GetFeaturestore", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "rpcName": "GetFeaturestore", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeaturestoreServiceRestTransport._GetFeaturestore._get_response( self._host, @@ -4395,7 +5155,29 @@ def __call__( pb_resp = featurestore.Featurestore.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_featurestore(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = featurestore.Featurestore.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.aiplatform_v1beta1.FeaturestoreServiceClient.get_featurestore", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "rpcName": "GetFeaturestore", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ImportFeatureValues( @@ -4435,7 +5217,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 import feature values method over HTTP. @@ -4446,8 +5228,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: @@ -4460,6 +5244,7 @@ def __call__( http_options = ( _BaseFeaturestoreServiceRestTransport._BaseImportFeatureValues._get_http_options() ) + request, metadata = self._interceptor.pre_import_feature_values( request, metadata ) @@ -4476,6 +5261,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.aiplatform_v1beta1.FeaturestoreServiceClient.ImportFeatureValues", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "rpcName": "ImportFeatureValues", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( FeaturestoreServiceRestTransport._ImportFeatureValues._get_response( @@ -4497,7 +5309,29 @@ def __call__( # Return the response resp = operations_pb2.Operation() json_format.Parse(response.content, resp, ignore_unknown_fields=True) + resp = self._interceptor.post_import_feature_values(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.aiplatform_v1beta1.FeaturestoreServiceClient.import_feature_values", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "rpcName": "ImportFeatureValues", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListEntityTypes( @@ -4536,7 +5370,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]]] = (), ) -> featurestore_service.ListEntityTypesResponse: r"""Call the list entity types method over HTTP. @@ -4547,8 +5381,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: ~.featurestore_service.ListEntityTypesResponse: @@ -4560,6 +5396,7 @@ def __call__( http_options = ( _BaseFeaturestoreServiceRestTransport._BaseListEntityTypes._get_http_options() ) + request, metadata = self._interceptor.pre_list_entity_types( request, metadata ) @@ -4572,6 +5409,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.aiplatform_v1beta1.FeaturestoreServiceClient.ListEntityTypes", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "rpcName": "ListEntityTypes", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeaturestoreServiceRestTransport._ListEntityTypes._get_response( self._host, @@ -4592,7 +5456,31 @@ def __call__( pb_resp = featurestore_service.ListEntityTypesResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_entity_types(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + featurestore_service.ListEntityTypesResponse.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.aiplatform_v1beta1.FeaturestoreServiceClient.list_entity_types", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "rpcName": "ListEntityTypes", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListFeatures( @@ -4631,7 +5519,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]]] = (), ) -> featurestore_service.ListFeaturesResponse: r"""Call the list features method over HTTP. @@ -4644,8 +5532,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: ~.featurestore_service.ListFeaturesResponse: @@ -4659,6 +5549,7 @@ def __call__( http_options = ( _BaseFeaturestoreServiceRestTransport._BaseListFeatures._get_http_options() ) + request, metadata = self._interceptor.pre_list_features(request, metadata) transcoded_request = _BaseFeaturestoreServiceRestTransport._BaseListFeatures._get_transcoded_request( http_options, request @@ -4669,6 +5560,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.aiplatform_v1beta1.FeaturestoreServiceClient.ListFeatures", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "rpcName": "ListFeatures", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeaturestoreServiceRestTransport._ListFeatures._get_response( self._host, @@ -4689,7 +5607,31 @@ def __call__( pb_resp = featurestore_service.ListFeaturesResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_features(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + featurestore_service.ListFeaturesResponse.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.aiplatform_v1beta1.FeaturestoreServiceClient.list_features", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "rpcName": "ListFeatures", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListFeaturestores( @@ -4728,7 +5670,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]]] = (), ) -> featurestore_service.ListFeaturestoresResponse: r"""Call the list featurestores method over HTTP. @@ -4739,8 +5681,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: ~.featurestore_service.ListFeaturestoresResponse: @@ -4752,6 +5696,7 @@ def __call__( http_options = ( _BaseFeaturestoreServiceRestTransport._BaseListFeaturestores._get_http_options() ) + request, metadata = self._interceptor.pre_list_featurestores( request, metadata ) @@ -4764,6 +5709,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.aiplatform_v1beta1.FeaturestoreServiceClient.ListFeaturestores", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "rpcName": "ListFeaturestores", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( FeaturestoreServiceRestTransport._ListFeaturestores._get_response( @@ -4786,7 +5758,31 @@ def __call__( pb_resp = featurestore_service.ListFeaturestoresResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_featurestores(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + featurestore_service.ListFeaturestoresResponse.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.aiplatform_v1beta1.FeaturestoreServiceClient.list_featurestores", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "rpcName": "ListFeaturestores", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _SearchFeatures( @@ -4825,7 +5821,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]]] = (), ) -> featurestore_service.SearchFeaturesResponse: r"""Call the search features method over HTTP. @@ -4836,8 +5832,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: ~.featurestore_service.SearchFeaturesResponse: @@ -4849,6 +5847,7 @@ def __call__( http_options = ( _BaseFeaturestoreServiceRestTransport._BaseSearchFeatures._get_http_options() ) + request, metadata = self._interceptor.pre_search_features(request, metadata) transcoded_request = _BaseFeaturestoreServiceRestTransport._BaseSearchFeatures._get_transcoded_request( http_options, request @@ -4859,6 +5858,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.aiplatform_v1beta1.FeaturestoreServiceClient.SearchFeatures", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "rpcName": "SearchFeatures", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeaturestoreServiceRestTransport._SearchFeatures._get_response( self._host, @@ -4879,7 +5905,31 @@ def __call__( pb_resp = featurestore_service.SearchFeaturesResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_search_features(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + featurestore_service.SearchFeaturesResponse.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.aiplatform_v1beta1.FeaturestoreServiceClient.search_features", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "rpcName": "SearchFeatures", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _UpdateEntityType( @@ -4919,7 +5969,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]]] = (), ) -> gca_entity_type.EntityType: r"""Call the update entity type method over HTTP. @@ -4930,8 +5980,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: ~.gca_entity_type.EntityType: @@ -4947,6 +5999,7 @@ def __call__( http_options = ( _BaseFeaturestoreServiceRestTransport._BaseUpdateEntityType._get_http_options() ) + request, metadata = self._interceptor.pre_update_entity_type( request, metadata ) @@ -4963,6 +6016,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.aiplatform_v1beta1.FeaturestoreServiceClient.UpdateEntityType", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "rpcName": "UpdateEntityType", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeaturestoreServiceRestTransport._UpdateEntityType._get_response( self._host, @@ -4984,7 +6064,29 @@ def __call__( pb_resp = gca_entity_type.EntityType.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_update_entity_type(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gca_entity_type.EntityType.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.aiplatform_v1beta1.FeaturestoreServiceClient.update_entity_type", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "rpcName": "UpdateEntityType", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _UpdateFeature( @@ -5024,7 +6126,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]]] = (), ) -> gca_feature.Feature: r"""Call the update feature method over HTTP. @@ -5037,8 +6139,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: ~.gca_feature.Feature: @@ -5051,6 +6155,7 @@ def __call__( http_options = ( _BaseFeaturestoreServiceRestTransport._BaseUpdateFeature._get_http_options() ) + request, metadata = self._interceptor.pre_update_feature(request, metadata) transcoded_request = _BaseFeaturestoreServiceRestTransport._BaseUpdateFeature._get_transcoded_request( http_options, request @@ -5065,6 +6170,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.aiplatform_v1beta1.FeaturestoreServiceClient.UpdateFeature", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "rpcName": "UpdateFeature", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeaturestoreServiceRestTransport._UpdateFeature._get_response( self._host, @@ -5086,7 +6218,29 @@ def __call__( pb_resp = gca_feature.Feature.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_update_feature(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gca_feature.Feature.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.aiplatform_v1beta1.FeaturestoreServiceClient.update_feature", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "rpcName": "UpdateFeature", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _UpdateFeaturestore( @@ -5126,7 +6280,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 featurestore method over HTTP. @@ -5137,8 +6291,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: @@ -5151,6 +6307,7 @@ def __call__( http_options = ( _BaseFeaturestoreServiceRestTransport._BaseUpdateFeaturestore._get_http_options() ) + request, metadata = self._interceptor.pre_update_featurestore( request, metadata ) @@ -5167,6 +6324,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.aiplatform_v1beta1.FeaturestoreServiceClient.UpdateFeaturestore", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "rpcName": "UpdateFeaturestore", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( FeaturestoreServiceRestTransport._UpdateFeaturestore._get_response( @@ -5188,7 +6372,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_featurestore(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.aiplatform_v1beta1.FeaturestoreServiceClient.update_featurestore", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "rpcName": "UpdateFeaturestore", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp @property @@ -5439,7 +6645,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]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -5450,8 +6656,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: locations_pb2.Location: Response from GetLocation method. @@ -5460,6 +6668,7 @@ def __call__( http_options = ( _BaseFeaturestoreServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = self._interceptor.pre_get_location(request, metadata) transcoded_request = _BaseFeaturestoreServiceRestTransport._BaseGetLocation._get_transcoded_request( http_options, request @@ -5470,6 +6679,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.aiplatform_v1beta1.FeaturestoreServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeaturestoreServiceRestTransport._GetLocation._get_response( self._host, @@ -5489,6 +6725,27 @@ def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_location(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.aiplatform_v1beta1.FeaturestoreServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5531,7 +6788,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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -5542,8 +6799,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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -5552,6 +6811,7 @@ def __call__( http_options = ( _BaseFeaturestoreServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = self._interceptor.pre_list_locations(request, metadata) transcoded_request = _BaseFeaturestoreServiceRestTransport._BaseListLocations._get_transcoded_request( http_options, request @@ -5562,6 +6822,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.aiplatform_v1beta1.FeaturestoreServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeaturestoreServiceRestTransport._ListLocations._get_response( self._host, @@ -5581,6 +6868,27 @@ def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_list_locations(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.aiplatform_v1beta1.FeaturestoreServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5624,7 +6932,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]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -5635,8 +6943,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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -5645,6 +6955,7 @@ def __call__( http_options = ( _BaseFeaturestoreServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_get_iam_policy(request, metadata) transcoded_request = _BaseFeaturestoreServiceRestTransport._BaseGetIamPolicy._get_transcoded_request( http_options, request @@ -5659,6 +6970,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.aiplatform_v1beta1.FeaturestoreServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeaturestoreServiceRestTransport._GetIamPolicy._get_response( self._host, @@ -5679,6 +7017,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_iam_policy(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.aiplatform_v1beta1.FeaturestoreServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5722,7 +7081,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]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -5733,8 +7092,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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -5743,6 +7104,7 @@ def __call__( http_options = ( _BaseFeaturestoreServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_set_iam_policy(request, metadata) transcoded_request = _BaseFeaturestoreServiceRestTransport._BaseSetIamPolicy._get_transcoded_request( http_options, request @@ -5757,6 +7119,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.aiplatform_v1beta1.FeaturestoreServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeaturestoreServiceRestTransport._SetIamPolicy._get_response( self._host, @@ -5777,6 +7166,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_set_iam_policy(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.aiplatform_v1beta1.FeaturestoreServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5820,7 +7230,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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -5831,8 +7241,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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -5841,6 +7253,7 @@ def __call__( http_options = ( _BaseFeaturestoreServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -5857,6 +7270,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.aiplatform_v1beta1.FeaturestoreServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( FeaturestoreServiceRestTransport._TestIamPermissions._get_response( @@ -5879,6 +7319,27 @@ def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_test_iam_permissions(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.aiplatform_v1beta1.FeaturestoreServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5921,7 +7382,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 cancel operation method over HTTP. @@ -5932,13 +7393,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 = ( _BaseFeaturestoreServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = self._interceptor.pre_cancel_operation( request, metadata ) @@ -5951,6 +7415,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.aiplatform_v1beta1.FeaturestoreServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeaturestoreServiceRestTransport._CancelOperation._get_response( self._host, @@ -6008,7 +7499,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. @@ -6019,13 +7510,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 = ( _BaseFeaturestoreServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = self._interceptor.pre_delete_operation( request, metadata ) @@ -6038,6 +7532,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.aiplatform_v1beta1.FeaturestoreServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeaturestoreServiceRestTransport._DeleteOperation._get_response( self._host, @@ -6095,7 +7616,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. @@ -6106,8 +7627,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. @@ -6116,6 +7639,7 @@ def __call__( http_options = ( _BaseFeaturestoreServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = self._interceptor.pre_get_operation(request, metadata) transcoded_request = _BaseFeaturestoreServiceRestTransport._BaseGetOperation._get_transcoded_request( http_options, request @@ -6126,6 +7650,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.aiplatform_v1beta1.FeaturestoreServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeaturestoreServiceRestTransport._GetOperation._get_response( self._host, @@ -6145,6 +7696,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.aiplatform_v1beta1.FeaturestoreServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -6187,7 +7759,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. @@ -6198,8 +7770,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. @@ -6208,6 +7782,7 @@ def __call__( http_options = ( _BaseFeaturestoreServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = self._interceptor.pre_list_operations(request, metadata) transcoded_request = _BaseFeaturestoreServiceRestTransport._BaseListOperations._get_transcoded_request( http_options, request @@ -6218,6 +7793,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.aiplatform_v1beta1.FeaturestoreServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeaturestoreServiceRestTransport._ListOperations._get_response( self._host, @@ -6237,6 +7839,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.aiplatform_v1beta1.FeaturestoreServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -6279,7 +7902,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 wait operation method over HTTP. @@ -6290,8 +7913,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 WaitOperation method. @@ -6300,6 +7925,7 @@ def __call__( http_options = ( _BaseFeaturestoreServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = self._interceptor.pre_wait_operation(request, metadata) transcoded_request = _BaseFeaturestoreServiceRestTransport._BaseWaitOperation._get_transcoded_request( http_options, request @@ -6310,6 +7936,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.aiplatform_v1beta1.FeaturestoreServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = FeaturestoreServiceRestTransport._WaitOperation._get_response( self._host, @@ -6329,6 +7982,27 @@ def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = self._interceptor.post_wait_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.aiplatform_v1beta1.FeaturestoreServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1beta1/services/featurestore_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1beta1/services/featurestore_service/transports/rest_asyncio.py index 4a20dcce42..cca10648c7 100644 --- a/google/cloud/aiplatform_v1beta1/services/featurestore_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/featurestore_service/transports/rest_asyncio.py @@ -63,6 +63,18 @@ from .base import DEFAULT_CLIENT_INFO as BASE_DEFAULT_CLIENT_INFO + +import logging + +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__) + try: OptionalRetry = Union[retries.AsyncRetry, gapic_v1.method._MethodDefault, None] except AttributeError: # pragma: NO COVER @@ -267,9 +279,10 @@ async def post_update_featurestore(self, response): async def pre_batch_create_features( self, request: featurestore_service.BatchCreateFeaturesRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - featurestore_service.BatchCreateFeaturesRequest, Sequence[Tuple[str, str]] + featurestore_service.BatchCreateFeaturesRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for batch_create_features @@ -292,9 +305,10 @@ async def post_batch_create_features( async def pre_batch_read_feature_values( self, request: featurestore_service.BatchReadFeatureValuesRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - featurestore_service.BatchReadFeatureValuesRequest, Sequence[Tuple[str, str]] + featurestore_service.BatchReadFeatureValuesRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for batch_read_feature_values @@ -317,8 +331,11 @@ async def post_batch_read_feature_values( async def pre_create_entity_type( self, request: featurestore_service.CreateEntityTypeRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[featurestore_service.CreateEntityTypeRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + featurestore_service.CreateEntityTypeRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for create_entity_type Override in a subclass to manipulate the request or metadata @@ -340,8 +357,11 @@ async def post_create_entity_type( async def pre_create_feature( self, request: featurestore_service.CreateFeatureRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[featurestore_service.CreateFeatureRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + featurestore_service.CreateFeatureRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for create_feature Override in a subclass to manipulate the request or metadata @@ -363,9 +383,10 @@ async def post_create_feature( async def pre_create_featurestore( self, request: featurestore_service.CreateFeaturestoreRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - featurestore_service.CreateFeaturestoreRequest, Sequence[Tuple[str, str]] + featurestore_service.CreateFeaturestoreRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for create_featurestore @@ -388,8 +409,11 @@ async def post_create_featurestore( async def pre_delete_entity_type( self, request: featurestore_service.DeleteEntityTypeRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[featurestore_service.DeleteEntityTypeRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + featurestore_service.DeleteEntityTypeRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for delete_entity_type Override in a subclass to manipulate the request or metadata @@ -411,8 +435,11 @@ async def post_delete_entity_type( async def pre_delete_feature( self, request: featurestore_service.DeleteFeatureRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[featurestore_service.DeleteFeatureRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + featurestore_service.DeleteFeatureRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for delete_feature Override in a subclass to manipulate the request or metadata @@ -434,9 +461,10 @@ async def post_delete_feature( async def pre_delete_featurestore( self, request: featurestore_service.DeleteFeaturestoreRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - featurestore_service.DeleteFeaturestoreRequest, Sequence[Tuple[str, str]] + featurestore_service.DeleteFeaturestoreRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for delete_featurestore @@ -459,9 +487,10 @@ async def post_delete_featurestore( async def pre_delete_feature_values( self, request: featurestore_service.DeleteFeatureValuesRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - featurestore_service.DeleteFeatureValuesRequest, Sequence[Tuple[str, str]] + featurestore_service.DeleteFeatureValuesRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for delete_feature_values @@ -484,9 +513,10 @@ async def post_delete_feature_values( async def pre_export_feature_values( self, request: featurestore_service.ExportFeatureValuesRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - featurestore_service.ExportFeatureValuesRequest, Sequence[Tuple[str, str]] + featurestore_service.ExportFeatureValuesRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for export_feature_values @@ -509,8 +539,11 @@ async def post_export_feature_values( async def pre_get_entity_type( self, request: featurestore_service.GetEntityTypeRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[featurestore_service.GetEntityTypeRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + featurestore_service.GetEntityTypeRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for get_entity_type Override in a subclass to manipulate the request or metadata @@ -532,8 +565,10 @@ async def post_get_entity_type( async def pre_get_feature( self, request: featurestore_service.GetFeatureRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[featurestore_service.GetFeatureRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + featurestore_service.GetFeatureRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_feature Override in a subclass to manipulate the request or metadata @@ -553,8 +588,11 @@ async def post_get_feature(self, response: feature.Feature) -> feature.Feature: async def pre_get_featurestore( self, request: featurestore_service.GetFeaturestoreRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[featurestore_service.GetFeaturestoreRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + featurestore_service.GetFeaturestoreRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for get_featurestore Override in a subclass to manipulate the request or metadata @@ -576,9 +614,10 @@ async def post_get_featurestore( async def pre_import_feature_values( self, request: featurestore_service.ImportFeatureValuesRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - featurestore_service.ImportFeatureValuesRequest, Sequence[Tuple[str, str]] + featurestore_service.ImportFeatureValuesRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for import_feature_values @@ -601,8 +640,11 @@ async def post_import_feature_values( async def pre_list_entity_types( self, request: featurestore_service.ListEntityTypesRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[featurestore_service.ListEntityTypesRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + featurestore_service.ListEntityTypesRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for list_entity_types Override in a subclass to manipulate the request or metadata @@ -624,8 +666,11 @@ async def post_list_entity_types( async def pre_list_features( self, request: featurestore_service.ListFeaturesRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[featurestore_service.ListFeaturesRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + featurestore_service.ListFeaturesRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for list_features Override in a subclass to manipulate the request or metadata @@ -647,9 +692,10 @@ async def post_list_features( async def pre_list_featurestores( self, request: featurestore_service.ListFeaturestoresRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - featurestore_service.ListFeaturestoresRequest, Sequence[Tuple[str, str]] + featurestore_service.ListFeaturestoresRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for list_featurestores @@ -672,8 +718,11 @@ async def post_list_featurestores( async def pre_search_features( self, request: featurestore_service.SearchFeaturesRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[featurestore_service.SearchFeaturesRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + featurestore_service.SearchFeaturesRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for search_features Override in a subclass to manipulate the request or metadata @@ -695,8 +744,11 @@ async def post_search_features( async def pre_update_entity_type( self, request: featurestore_service.UpdateEntityTypeRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[featurestore_service.UpdateEntityTypeRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + featurestore_service.UpdateEntityTypeRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for update_entity_type Override in a subclass to manipulate the request or metadata @@ -718,8 +770,11 @@ async def post_update_entity_type( async def pre_update_feature( self, request: featurestore_service.UpdateFeatureRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[featurestore_service.UpdateFeatureRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + featurestore_service.UpdateFeatureRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for update_feature Override in a subclass to manipulate the request or metadata @@ -741,9 +796,10 @@ async def post_update_feature( async def pre_update_featurestore( self, request: featurestore_service.UpdateFeaturestoreRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - featurestore_service.UpdateFeaturestoreRequest, Sequence[Tuple[str, str]] + featurestore_service.UpdateFeaturestoreRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for update_featurestore @@ -766,8 +822,10 @@ async def post_update_featurestore( async def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -789,8 +847,10 @@ async def post_get_location( async def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -812,8 +872,10 @@ async def post_list_locations( async def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -835,8 +897,10 @@ async def post_get_iam_policy( async def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -858,8 +922,11 @@ async def post_set_iam_policy( async def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -881,8 +948,10 @@ async def post_test_iam_permissions( async def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -902,8 +971,10 @@ async def post_cancel_operation(self, response: None) -> None: async 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 @@ -923,8 +994,10 @@ async def post_delete_operation(self, response: None) -> None: async 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 @@ -946,8 +1019,10 @@ async def post_get_operation( async 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 @@ -969,8 +1044,10 @@ async def post_list_operations( async def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -1257,7 +1334,7 @@ async 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 batch create features method over HTTP. @@ -1270,8 +1347,10 @@ async def __call__( 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: @@ -1284,6 +1363,7 @@ async def __call__( http_options = ( _BaseFeaturestoreServiceRestTransport._BaseBatchCreateFeatures._get_http_options() ) + request, metadata = await self._interceptor.pre_batch_create_features( request, metadata ) @@ -1300,6 +1380,33 @@ async 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.aiplatform_v1beta1.FeaturestoreServiceClient.BatchCreateFeatures", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "rpcName": "BatchCreateFeatures", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeaturestoreServiceRestTransport._BatchCreateFeatures._get_response( self._host, @@ -1328,6 +1435,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_batch_create_features(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.FeaturestoreServiceAsyncClient.batch_create_features", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "rpcName": "BatchCreateFeatures", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _BatchReadFeatureValues( @@ -1367,7 +1496,7 @@ async 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 batch read feature values method over HTTP. @@ -1378,8 +1507,10 @@ async def __call__( 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: @@ -1392,6 +1523,7 @@ async def __call__( http_options = ( _BaseFeaturestoreServiceRestTransport._BaseBatchReadFeatureValues._get_http_options() ) + request, metadata = await self._interceptor.pre_batch_read_feature_values( request, metadata ) @@ -1408,6 +1540,33 @@ async 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.aiplatform_v1beta1.FeaturestoreServiceClient.BatchReadFeatureValues", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "rpcName": "BatchReadFeatureValues", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeaturestoreServiceRestTransport._BatchReadFeatureValues._get_response( self._host, @@ -1436,6 +1595,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_batch_read_feature_values(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.FeaturestoreServiceAsyncClient.batch_read_feature_values", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "rpcName": "BatchReadFeatureValues", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _CreateEntityType( @@ -1475,7 +1656,7 @@ async 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 entity type method over HTTP. @@ -1486,8 +1667,10 @@ async def __call__( 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: @@ -1500,6 +1683,7 @@ async def __call__( http_options = ( _BaseFeaturestoreServiceRestTransport._BaseCreateEntityType._get_http_options() ) + request, metadata = await self._interceptor.pre_create_entity_type( request, metadata ) @@ -1516,6 +1700,33 @@ async 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.aiplatform_v1beta1.FeaturestoreServiceClient.CreateEntityType", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "rpcName": "CreateEntityType", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeaturestoreServiceRestTransport._CreateEntityType._get_response( self._host, @@ -1544,6 +1755,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_create_entity_type(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.FeaturestoreServiceAsyncClient.create_entity_type", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "rpcName": "CreateEntityType", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _CreateFeature( @@ -1583,7 +1816,7 @@ async 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 feature method over HTTP. @@ -1596,8 +1829,10 @@ async def __call__( 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: @@ -1610,6 +1845,7 @@ async def __call__( http_options = ( _BaseFeaturestoreServiceRestTransport._BaseCreateFeature._get_http_options() ) + request, metadata = await self._interceptor.pre_create_feature( request, metadata ) @@ -1626,6 +1862,33 @@ async 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.aiplatform_v1beta1.FeaturestoreServiceClient.CreateFeature", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "rpcName": "CreateFeature", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeaturestoreServiceRestTransport._CreateFeature._get_response( self._host, @@ -1654,6 +1917,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_create_feature(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.FeaturestoreServiceAsyncClient.create_feature", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "rpcName": "CreateFeature", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _CreateFeaturestore( @@ -1693,7 +1978,7 @@ async 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 featurestore method over HTTP. @@ -1704,8 +1989,10 @@ async def __call__( 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: @@ -1718,6 +2005,7 @@ async def __call__( http_options = ( _BaseFeaturestoreServiceRestTransport._BaseCreateFeaturestore._get_http_options() ) + request, metadata = await self._interceptor.pre_create_featurestore( request, metadata ) @@ -1734,6 +2022,33 @@ async 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.aiplatform_v1beta1.FeaturestoreServiceClient.CreateFeaturestore", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "rpcName": "CreateFeaturestore", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeaturestoreServiceRestTransport._CreateFeaturestore._get_response( self._host, @@ -1762,6 +2077,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_create_featurestore(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.FeaturestoreServiceAsyncClient.create_featurestore", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "rpcName": "CreateFeaturestore", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _DeleteEntityType( @@ -1800,7 +2137,7 @@ async 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 entity type method over HTTP. @@ -1811,8 +2148,10 @@ async def __call__( 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: @@ -1825,6 +2164,7 @@ async def __call__( http_options = ( _BaseFeaturestoreServiceRestTransport._BaseDeleteEntityType._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_entity_type( request, metadata ) @@ -1837,6 +2177,33 @@ async 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.aiplatform_v1beta1.FeaturestoreServiceClient.DeleteEntityType", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "rpcName": "DeleteEntityType", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeaturestoreServiceRestTransport._DeleteEntityType._get_response( self._host, @@ -1864,6 +2231,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_delete_entity_type(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.FeaturestoreServiceAsyncClient.delete_entity_type", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "rpcName": "DeleteEntityType", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _DeleteFeature( @@ -1902,7 +2291,7 @@ async 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 feature method over HTTP. @@ -1915,8 +2304,10 @@ async def __call__( 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: @@ -1929,6 +2320,7 @@ async def __call__( http_options = ( _BaseFeaturestoreServiceRestTransport._BaseDeleteFeature._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_feature( request, metadata ) @@ -1941,6 +2333,33 @@ async 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.aiplatform_v1beta1.FeaturestoreServiceClient.DeleteFeature", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "rpcName": "DeleteFeature", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeaturestoreServiceRestTransport._DeleteFeature._get_response( self._host, @@ -1968,6 +2387,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_delete_feature(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.FeaturestoreServiceAsyncClient.delete_feature", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "rpcName": "DeleteFeature", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _DeleteFeaturestore( @@ -2006,7 +2447,7 @@ async 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 featurestore method over HTTP. @@ -2017,8 +2458,10 @@ async def __call__( 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: @@ -2031,6 +2474,7 @@ async def __call__( http_options = ( _BaseFeaturestoreServiceRestTransport._BaseDeleteFeaturestore._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_featurestore( request, metadata ) @@ -2043,6 +2487,33 @@ async 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.aiplatform_v1beta1.FeaturestoreServiceClient.DeleteFeaturestore", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "rpcName": "DeleteFeaturestore", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeaturestoreServiceRestTransport._DeleteFeaturestore._get_response( self._host, @@ -2070,6 +2541,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_delete_featurestore(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.FeaturestoreServiceAsyncClient.delete_featurestore", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "rpcName": "DeleteFeaturestore", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _DeleteFeatureValues( @@ -2109,7 +2602,7 @@ async 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 feature values method over HTTP. @@ -2120,8 +2613,10 @@ async def __call__( 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: @@ -2134,6 +2629,7 @@ async def __call__( http_options = ( _BaseFeaturestoreServiceRestTransport._BaseDeleteFeatureValues._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_feature_values( request, metadata ) @@ -2150,6 +2646,33 @@ async 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.aiplatform_v1beta1.FeaturestoreServiceClient.DeleteFeatureValues", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "rpcName": "DeleteFeatureValues", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeaturestoreServiceRestTransport._DeleteFeatureValues._get_response( self._host, @@ -2178,6 +2701,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_delete_feature_values(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.FeaturestoreServiceAsyncClient.delete_feature_values", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "rpcName": "DeleteFeatureValues", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ExportFeatureValues( @@ -2217,7 +2762,7 @@ async 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 export feature values method over HTTP. @@ -2228,8 +2773,10 @@ async def __call__( 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: @@ -2242,6 +2789,7 @@ async def __call__( http_options = ( _BaseFeaturestoreServiceRestTransport._BaseExportFeatureValues._get_http_options() ) + request, metadata = await self._interceptor.pre_export_feature_values( request, metadata ) @@ -2258,6 +2806,33 @@ async 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.aiplatform_v1beta1.FeaturestoreServiceClient.ExportFeatureValues", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "rpcName": "ExportFeatureValues", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeaturestoreServiceRestTransport._ExportFeatureValues._get_response( self._host, @@ -2286,6 +2861,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_export_feature_values(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.FeaturestoreServiceAsyncClient.export_feature_values", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "rpcName": "ExportFeatureValues", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _GetEntityType( @@ -2324,7 +2921,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> entity_type.EntityType: r"""Call the get entity type method over HTTP. @@ -2335,8 +2932,10 @@ async def __call__( 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: ~.entity_type.EntityType: @@ -2352,6 +2951,7 @@ async def __call__( http_options = ( _BaseFeaturestoreServiceRestTransport._BaseGetEntityType._get_http_options() ) + request, metadata = await self._interceptor.pre_get_entity_type( request, metadata ) @@ -2364,6 +2964,33 @@ async 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.aiplatform_v1beta1.FeaturestoreServiceClient.GetEntityType", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "rpcName": "GetEntityType", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeaturestoreServiceRestTransport._GetEntityType._get_response( self._host, @@ -2391,6 +3018,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_get_entity_type(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = entity_type.EntityType.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.FeaturestoreServiceAsyncClient.get_entity_type", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "rpcName": "GetEntityType", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _GetFeature( @@ -2429,7 +3078,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> feature.Feature: r"""Call the get feature method over HTTP. @@ -2442,8 +3091,10 @@ async def __call__( 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: ~.feature.Feature: @@ -2456,6 +3107,7 @@ async def __call__( http_options = ( _BaseFeaturestoreServiceRestTransport._BaseGetFeature._get_http_options() ) + request, metadata = await self._interceptor.pre_get_feature( request, metadata ) @@ -2468,6 +3120,33 @@ async 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.aiplatform_v1beta1.FeaturestoreServiceClient.GetFeature", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "rpcName": "GetFeature", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncFeaturestoreServiceRestTransport._GetFeature._get_response( @@ -2497,6 +3176,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_get_feature(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = feature.Feature.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.FeaturestoreServiceAsyncClient.get_feature", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "rpcName": "GetFeature", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _GetFeaturestore( @@ -2535,7 +3236,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> featurestore.Featurestore: r"""Call the get featurestore method over HTTP. @@ -2546,8 +3247,10 @@ async def __call__( 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: ~.featurestore.Featurestore: @@ -2562,6 +3265,7 @@ async def __call__( http_options = ( _BaseFeaturestoreServiceRestTransport._BaseGetFeaturestore._get_http_options() ) + request, metadata = await self._interceptor.pre_get_featurestore( request, metadata ) @@ -2574,6 +3278,33 @@ async 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.aiplatform_v1beta1.FeaturestoreServiceClient.GetFeaturestore", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "rpcName": "GetFeaturestore", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeaturestoreServiceRestTransport._GetFeaturestore._get_response( self._host, @@ -2601,6 +3332,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_get_featurestore(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = featurestore.Featurestore.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.FeaturestoreServiceAsyncClient.get_featurestore", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "rpcName": "GetFeaturestore", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ImportFeatureValues( @@ -2640,7 +3393,7 @@ async 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 import feature values method over HTTP. @@ -2651,8 +3404,10 @@ async def __call__( 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: @@ -2665,6 +3420,7 @@ async def __call__( http_options = ( _BaseFeaturestoreServiceRestTransport._BaseImportFeatureValues._get_http_options() ) + request, metadata = await self._interceptor.pre_import_feature_values( request, metadata ) @@ -2681,6 +3437,33 @@ async 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.aiplatform_v1beta1.FeaturestoreServiceClient.ImportFeatureValues", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "rpcName": "ImportFeatureValues", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeaturestoreServiceRestTransport._ImportFeatureValues._get_response( self._host, @@ -2709,6 +3492,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_import_feature_values(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.FeaturestoreServiceAsyncClient.import_feature_values", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "rpcName": "ImportFeatureValues", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ListEntityTypes( @@ -2747,7 +3552,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> featurestore_service.ListEntityTypesResponse: r"""Call the list entity types method over HTTP. @@ -2758,8 +3563,10 @@ async def __call__( 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: ~.featurestore_service.ListEntityTypesResponse: @@ -2771,6 +3578,7 @@ async def __call__( http_options = ( _BaseFeaturestoreServiceRestTransport._BaseListEntityTypes._get_http_options() ) + request, metadata = await self._interceptor.pre_list_entity_types( request, metadata ) @@ -2783,6 +3591,33 @@ async 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.aiplatform_v1beta1.FeaturestoreServiceClient.ListEntityTypes", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "rpcName": "ListEntityTypes", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeaturestoreServiceRestTransport._ListEntityTypes._get_response( self._host, @@ -2810,6 +3645,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_list_entity_types(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + featurestore_service.ListEntityTypesResponse.to_json(response) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.FeaturestoreServiceAsyncClient.list_entity_types", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "rpcName": "ListEntityTypes", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ListFeatures( @@ -2848,7 +3707,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> featurestore_service.ListFeaturesResponse: r"""Call the list features method over HTTP. @@ -2861,8 +3720,10 @@ async def __call__( 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: ~.featurestore_service.ListFeaturesResponse: @@ -2876,6 +3737,7 @@ async def __call__( http_options = ( _BaseFeaturestoreServiceRestTransport._BaseListFeatures._get_http_options() ) + request, metadata = await self._interceptor.pre_list_features( request, metadata ) @@ -2888,6 +3750,33 @@ async 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.aiplatform_v1beta1.FeaturestoreServiceClient.ListFeatures", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "rpcName": "ListFeatures", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncFeaturestoreServiceRestTransport._ListFeatures._get_response( @@ -2917,6 +3806,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_list_features(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + featurestore_service.ListFeaturesResponse.to_json(response) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.FeaturestoreServiceAsyncClient.list_features", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "rpcName": "ListFeatures", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ListFeaturestores( @@ -2955,7 +3868,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> featurestore_service.ListFeaturestoresResponse: r"""Call the list featurestores method over HTTP. @@ -2966,8 +3879,10 @@ async def __call__( 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: ~.featurestore_service.ListFeaturestoresResponse: @@ -2979,6 +3894,7 @@ async def __call__( http_options = ( _BaseFeaturestoreServiceRestTransport._BaseListFeaturestores._get_http_options() ) + request, metadata = await self._interceptor.pre_list_featurestores( request, metadata ) @@ -2991,6 +3907,33 @@ async 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.aiplatform_v1beta1.FeaturestoreServiceClient.ListFeaturestores", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "rpcName": "ListFeaturestores", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeaturestoreServiceRestTransport._ListFeaturestores._get_response( self._host, @@ -3018,6 +3961,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_list_featurestores(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + featurestore_service.ListFeaturestoresResponse.to_json(response) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.FeaturestoreServiceAsyncClient.list_featurestores", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "rpcName": "ListFeaturestores", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _SearchFeatures( @@ -3056,7 +4023,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> featurestore_service.SearchFeaturesResponse: r"""Call the search features method over HTTP. @@ -3067,8 +4034,10 @@ async def __call__( 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: ~.featurestore_service.SearchFeaturesResponse: @@ -3080,6 +4049,7 @@ async def __call__( http_options = ( _BaseFeaturestoreServiceRestTransport._BaseSearchFeatures._get_http_options() ) + request, metadata = await self._interceptor.pre_search_features( request, metadata ) @@ -3092,6 +4062,33 @@ async 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.aiplatform_v1beta1.FeaturestoreServiceClient.SearchFeatures", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "rpcName": "SearchFeatures", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeaturestoreServiceRestTransport._SearchFeatures._get_response( self._host, @@ -3119,6 +4116,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_search_features(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + featurestore_service.SearchFeaturesResponse.to_json(response) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.FeaturestoreServiceAsyncClient.search_features", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "rpcName": "SearchFeatures", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _UpdateEntityType( @@ -3158,7 +4179,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> gca_entity_type.EntityType: r"""Call the update entity type method over HTTP. @@ -3169,8 +4190,10 @@ async def __call__( 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: ~.gca_entity_type.EntityType: @@ -3186,6 +4209,7 @@ async def __call__( http_options = ( _BaseFeaturestoreServiceRestTransport._BaseUpdateEntityType._get_http_options() ) + request, metadata = await self._interceptor.pre_update_entity_type( request, metadata ) @@ -3202,6 +4226,33 @@ async 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.aiplatform_v1beta1.FeaturestoreServiceClient.UpdateEntityType", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "rpcName": "UpdateEntityType", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeaturestoreServiceRestTransport._UpdateEntityType._get_response( self._host, @@ -3230,6 +4281,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_update_entity_type(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gca_entity_type.EntityType.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.FeaturestoreServiceAsyncClient.update_entity_type", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "rpcName": "UpdateEntityType", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _UpdateFeature( @@ -3269,7 +4342,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> gca_feature.Feature: r"""Call the update feature method over HTTP. @@ -3282,8 +4355,10 @@ async def __call__( 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: ~.gca_feature.Feature: @@ -3296,6 +4371,7 @@ async def __call__( http_options = ( _BaseFeaturestoreServiceRestTransport._BaseUpdateFeature._get_http_options() ) + request, metadata = await self._interceptor.pre_update_feature( request, metadata ) @@ -3312,6 +4388,33 @@ async 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.aiplatform_v1beta1.FeaturestoreServiceClient.UpdateFeature", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "rpcName": "UpdateFeature", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeaturestoreServiceRestTransport._UpdateFeature._get_response( self._host, @@ -3340,6 +4443,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_update_feature(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gca_feature.Feature.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.FeaturestoreServiceAsyncClient.update_feature", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "rpcName": "UpdateFeature", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _UpdateFeaturestore( @@ -3379,7 +4504,7 @@ async 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 featurestore method over HTTP. @@ -3390,8 +4515,10 @@ async def __call__( 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: @@ -3404,6 +4531,7 @@ async def __call__( http_options = ( _BaseFeaturestoreServiceRestTransport._BaseUpdateFeaturestore._get_http_options() ) + request, metadata = await self._interceptor.pre_update_featurestore( request, metadata ) @@ -3420,6 +4548,33 @@ async 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.aiplatform_v1beta1.FeaturestoreServiceClient.UpdateFeaturestore", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "rpcName": "UpdateFeaturestore", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeaturestoreServiceRestTransport._UpdateFeaturestore._get_response( self._host, @@ -3448,6 +4603,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_update_featurestore(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.FeaturestoreServiceAsyncClient.update_featurestore", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "rpcName": "UpdateFeaturestore", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp @property @@ -4023,6 +5200,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -4239,6 +5420,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -4445,6 +5630,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}", @@ -4661,6 +5850,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, ], "google.longrunning.Operations.ListOperations": [ { @@ -4859,6 +6052,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*}/operations", @@ -5075,6 +6272,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*}/operations", + }, ], "google.longrunning.Operations.WaitOperation": [ { @@ -5273,6 +6474,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "post", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}:wait", @@ -5485,6 +6690,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, ], } @@ -5709,7 +6918,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -5720,8 +6929,10 @@ async def __call__( 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: locations_pb2.Location: Response from GetLocation method. @@ -5730,6 +6941,7 @@ async def __call__( http_options = ( _BaseFeaturestoreServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_location( request, metadata ) @@ -5742,6 +6954,33 @@ async 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.aiplatform_v1beta1.FeaturestoreServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncFeaturestoreServiceRestTransport._GetLocation._get_response( @@ -5769,6 +7008,27 @@ async def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_location(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.aiplatform_v1beta1.FeaturestoreServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5811,7 +7071,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -5822,8 +7082,10 @@ async def __call__( 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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -5832,6 +7094,7 @@ async def __call__( http_options = ( _BaseFeaturestoreServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_locations( request, metadata ) @@ -5844,6 +7107,33 @@ async 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.aiplatform_v1beta1.FeaturestoreServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeaturestoreServiceRestTransport._ListLocations._get_response( self._host, @@ -5869,6 +7159,27 @@ async def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_list_locations(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.aiplatform_v1beta1.FeaturestoreServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5912,7 +7223,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -5923,8 +7234,10 @@ async def __call__( 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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -5933,6 +7246,7 @@ async def __call__( http_options = ( _BaseFeaturestoreServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_get_iam_policy( request, metadata ) @@ -5949,6 +7263,33 @@ async 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.aiplatform_v1beta1.FeaturestoreServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncFeaturestoreServiceRestTransport._GetIamPolicy._get_response( @@ -5977,6 +7318,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_iam_policy(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.aiplatform_v1beta1.FeaturestoreServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -6020,7 +7382,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -6031,8 +7393,10 @@ async def __call__( 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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -6041,6 +7405,7 @@ async def __call__( http_options = ( _BaseFeaturestoreServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_set_iam_policy( request, metadata ) @@ -6057,6 +7422,33 @@ async 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.aiplatform_v1beta1.FeaturestoreServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncFeaturestoreServiceRestTransport._SetIamPolicy._get_response( @@ -6085,6 +7477,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_set_iam_policy(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.aiplatform_v1beta1.FeaturestoreServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -6128,7 +7541,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -6139,8 +7552,10 @@ async def __call__( 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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -6149,6 +7564,7 @@ async def __call__( http_options = ( _BaseFeaturestoreServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = await self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -6165,6 +7581,33 @@ async 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.aiplatform_v1beta1.FeaturestoreServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeaturestoreServiceRestTransport._TestIamPermissions._get_response( self._host, @@ -6191,6 +7634,27 @@ async def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_test_iam_permissions(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.aiplatform_v1beta1.FeaturestoreServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -6233,7 +7697,7 @@ async 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 cancel operation method over HTTP. @@ -6244,13 +7708,16 @@ async def __call__( 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`. """ http_options = ( _BaseFeaturestoreServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_cancel_operation( request, metadata ) @@ -6263,6 +7730,33 @@ async 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.aiplatform_v1beta1.FeaturestoreServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeaturestoreServiceRestTransport._CancelOperation._get_response( self._host, @@ -6326,7 +7820,7 @@ async 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. @@ -6337,13 +7831,16 @@ async def __call__( 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`. """ http_options = ( _BaseFeaturestoreServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_operation( request, metadata ) @@ -6356,6 +7853,33 @@ async 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.aiplatform_v1beta1.FeaturestoreServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeaturestoreServiceRestTransport._DeleteOperation._get_response( self._host, @@ -6419,7 +7943,7 @@ async 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. @@ -6430,8 +7954,10 @@ async def __call__( 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: Response from GetOperation method. @@ -6440,6 +7966,7 @@ async def __call__( http_options = ( _BaseFeaturestoreServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_operation( request, metadata ) @@ -6452,6 +7979,33 @@ async 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.aiplatform_v1beta1.FeaturestoreServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncFeaturestoreServiceRestTransport._GetOperation._get_response( @@ -6479,6 +8033,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1beta1.FeaturestoreServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -6521,7 +8096,7 @@ async 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. @@ -6532,8 +8107,10 @@ async def __call__( 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 from ListOperations method. @@ -6542,6 +8119,7 @@ async def __call__( http_options = ( _BaseFeaturestoreServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_operations( request, metadata ) @@ -6554,6 +8132,33 @@ async 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.aiplatform_v1beta1.FeaturestoreServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeaturestoreServiceRestTransport._ListOperations._get_response( self._host, @@ -6579,6 +8184,27 @@ async def __call__( resp = operations_pb2.ListOperationsResponse() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1beta1.FeaturestoreServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -6621,7 +8247,7 @@ async 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 wait operation method over HTTP. @@ -6632,8 +8258,10 @@ async def __call__( 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: Response from WaitOperation method. @@ -6642,6 +8270,7 @@ async def __call__( http_options = ( _BaseFeaturestoreServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_wait_operation( request, metadata ) @@ -6654,6 +8283,33 @@ async 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.aiplatform_v1beta1.FeaturestoreServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncFeaturestoreServiceRestTransport._WaitOperation._get_response( self._host, @@ -6679,6 +8335,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_wait_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.aiplatform_v1beta1.FeaturestoreServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.FeaturestoreService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1beta1/services/featurestore_service/transports/rest_base.py b/google/cloud/aiplatform_v1beta1/services/featurestore_service/transports/rest_base.py index 7171126f1e..6b7ccf457b 100644 --- a/google/cloud/aiplatform_v1beta1/services/featurestore_service/transports/rest_base.py +++ b/google/cloud/aiplatform_v1beta1/services/featurestore_service/transports/rest_base.py @@ -2117,6 +2117,10 @@ def _get_http_options(): "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -2333,6 +2337,10 @@ def _get_http_options(): "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -2558,6 +2566,10 @@ def _get_http_options(): "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}", @@ -2774,6 +2786,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, ] return http_options @@ -2991,6 +3007,10 @@ def _get_http_options(): "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*}/operations", @@ -3207,6 +3227,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*}/operations", + }, ] return http_options @@ -3424,6 +3448,10 @@ def _get_http_options(): "method": "post", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}:wait", @@ -3636,6 +3664,10 @@ def _get_http_options(): "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, ] return http_options diff --git a/google/cloud/aiplatform_v1beta1/services/gen_ai_cache_service/async_client.py b/google/cloud/aiplatform_v1beta1/services/gen_ai_cache_service/async_client.py index 8f5c59f9c6..ffe7c2837b 100644 --- a/google/cloud/aiplatform_v1beta1/services/gen_ai_cache_service/async_client.py +++ b/google/cloud/aiplatform_v1beta1/services/gen_ai_cache_service/async_client.py @@ -13,6 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging as std_logging from collections import OrderedDict import re from typing import ( @@ -60,6 +61,15 @@ from .transports.grpc_asyncio import GenAiCacheServiceGrpcAsyncIOTransport from .client import GenAiCacheServiceClient +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 GenAiCacheServiceAsyncClient: """Service for managing Vertex AI's CachedContent resource.""" @@ -273,6 +283,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.aiplatform_v1beta1.GenAiCacheServiceAsyncClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.GenAiCacheService", + "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.aiplatform.v1beta1.GenAiCacheService", + "credentialsType": None, + }, + ) + async def create_cached_content( self, request: Optional[ @@ -283,7 +315,7 @@ async def create_cached_content( cached_content: Optional[gca_cached_content.CachedContent] = 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]]] = (), ) -> gca_cached_content.CachedContent: r"""Creates cached content, this call will initialize the cached content in the data storage, and users need to @@ -336,8 +368,10 @@ async def sample_create_cached_content(): 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.aiplatform_v1beta1.types.CachedContent: @@ -403,7 +437,7 @@ async def get_cached_content( 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]]] = (), ) -> cached_content.CachedContent: r"""Gets cached content configurations @@ -447,8 +481,10 @@ async def sample_get_cached_content(): 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.aiplatform_v1beta1.types.CachedContent: @@ -513,7 +549,7 @@ async def update_cached_content( 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]]] = (), ) -> gca_cached_content.CachedContent: r"""Updates cached content configurations @@ -564,8 +600,10 @@ async def sample_update_cached_content(): 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.aiplatform_v1beta1.types.CachedContent: @@ -633,7 +671,7 @@ async def delete_cached_content( 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 cached content @@ -674,8 +712,10 @@ async def sample_delete_cached_content(): 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 @@ -729,7 +769,7 @@ async def list_cached_contents( 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.ListCachedContentsAsyncPager: r"""Lists cached contents in a project @@ -773,8 +813,10 @@ async def sample_list_cached_contents(): 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.aiplatform_v1beta1.services.gen_ai_cache_service.pagers.ListCachedContentsAsyncPager: @@ -848,7 +890,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. @@ -859,8 +901,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. @@ -901,7 +945,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. @@ -912,8 +956,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. @@ -954,7 +1000,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. @@ -970,8 +1016,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 """ @@ -1008,7 +1056,7 @@ async def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -1023,8 +1071,10 @@ async def cancel_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 """ @@ -1061,7 +1111,7 @@ async def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -1078,8 +1128,10 @@ async def wait_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. @@ -1120,7 +1172,7 @@ async def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -1133,8 +1185,10 @@ async def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -1239,7 +1293,7 @@ async def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -1253,8 +1307,10 @@ async def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -1359,7 +1415,7 @@ async def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -1374,8 +1430,10 @@ async def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -1419,7 +1477,7 @@ async def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -1430,8 +1488,10 @@ async def get_location( 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: ~.location_pb2.Location: Location object. @@ -1472,7 +1532,7 @@ async def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -1483,8 +1543,10 @@ async def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1beta1/services/gen_ai_cache_service/client.py b/google/cloud/aiplatform_v1beta1/services/gen_ai_cache_service/client.py index ca96eb46e2..689426bfd4 100644 --- a/google/cloud/aiplatform_v1beta1/services/gen_ai_cache_service/client.py +++ b/google/cloud/aiplatform_v1beta1/services/gen_ai_cache_service/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 ( @@ -48,6 +49,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.cloud.aiplatform_v1beta1.services.gen_ai_cache_service import pagers from google.cloud.aiplatform_v1beta1.types import cached_content from google.cloud.aiplatform_v1beta1.types import cached_content as gca_cached_content @@ -628,6 +638,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( @@ -719,6 +733,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.aiplatform_v1beta1.GenAiCacheServiceClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.GenAiCacheService", + "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.aiplatform.v1beta1.GenAiCacheService", + "credentialsType": None, + }, + ) + def create_cached_content( self, request: Optional[ @@ -729,7 +766,7 @@ def create_cached_content( cached_content: Optional[gca_cached_content.CachedContent] = 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]]] = (), ) -> gca_cached_content.CachedContent: r"""Creates cached content, this call will initialize the cached content in the data storage, and users need to @@ -782,8 +819,10 @@ def sample_create_cached_content(): 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.aiplatform_v1beta1.types.CachedContent: @@ -846,7 +885,7 @@ def get_cached_content( 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]]] = (), ) -> cached_content.CachedContent: r"""Gets cached content configurations @@ -890,8 +929,10 @@ def sample_get_cached_content(): 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.aiplatform_v1beta1.types.CachedContent: @@ -953,7 +994,7 @@ def update_cached_content( 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]]] = (), ) -> gca_cached_content.CachedContent: r"""Updates cached content configurations @@ -1004,8 +1045,10 @@ def sample_update_cached_content(): 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.aiplatform_v1beta1.types.CachedContent: @@ -1070,7 +1113,7 @@ def delete_cached_content( 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 cached content @@ -1111,8 +1154,10 @@ def sample_delete_cached_content(): 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 @@ -1163,7 +1208,7 @@ def list_cached_contents( 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.ListCachedContentsPager: r"""Lists cached contents in a project @@ -1207,8 +1252,10 @@ def sample_list_cached_contents(): 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.aiplatform_v1beta1.services.gen_ai_cache_service.pagers.ListCachedContentsPager: @@ -1292,7 +1339,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. @@ -1303,8 +1350,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. @@ -1345,7 +1394,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. @@ -1356,8 +1405,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. @@ -1398,7 +1449,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. @@ -1414,8 +1465,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 """ @@ -1452,7 +1505,7 @@ def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -1467,8 +1520,10 @@ def cancel_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 """ @@ -1505,7 +1560,7 @@ def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -1522,8 +1577,10 @@ def wait_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. @@ -1564,7 +1621,7 @@ def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -1577,8 +1634,10 @@ def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -1683,7 +1742,7 @@ def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -1697,8 +1756,10 @@ def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -1803,7 +1864,7 @@ def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -1818,8 +1879,10 @@ def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -1861,7 +1924,7 @@ def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -1872,8 +1935,10 @@ def get_location( 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: ~.location_pb2.Location: Location object. @@ -1914,7 +1979,7 @@ def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -1925,8 +1990,10 @@ def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1beta1/services/gen_ai_cache_service/pagers.py b/google/cloud/aiplatform_v1beta1/services/gen_ai_cache_service/pagers.py index 91e1305a06..77c2ce1d72 100644 --- a/google/cloud/aiplatform_v1beta1/services/gen_ai_cache_service/pagers.py +++ b/google/cloud/aiplatform_v1beta1/services/gen_ai_cache_service/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 = gen_ai_cache_service.ListCachedContentsRequest(request) @@ -143,7 +145,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. @@ -157,8 +159,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 = gen_ai_cache_service.ListCachedContentsRequest(request) diff --git a/google/cloud/aiplatform_v1beta1/services/gen_ai_cache_service/transports/grpc.py b/google/cloud/aiplatform_v1beta1/services/gen_ai_cache_service/transports/grpc.py index c1b0118b6c..f2b5cdc581 100644 --- a/google/cloud/aiplatform_v1beta1/services/gen_ai_cache_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1beta1/services/gen_ai_cache_service/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 import warnings from typing import Callable, Dict, Optional, Sequence, Tuple, Union @@ -21,8 +24,11 @@ import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from google.cloud.aiplatform_v1beta1.types import cached_content from google.cloud.aiplatform_v1beta1.types import cached_content as gca_cached_content @@ -34,6 +40,81 @@ from google.protobuf import empty_pb2 # type: ignore from .base import GenAiCacheServiceTransport, DEFAULT_CLIENT_INFO +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.aiplatform.v1beta1.GenAiCacheService", + "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.aiplatform.v1beta1.GenAiCacheService", + "rpcName": client_call_details.method, + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class GenAiCacheServiceGrpcTransport(GenAiCacheServiceTransport): """gRPC backend transport for GenAiCacheService. @@ -187,7 +268,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 @@ -266,7 +352,7 @@ def create_cached_content( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_cached_content" not in self._stubs: - self._stubs["create_cached_content"] = self.grpc_channel.unary_unary( + self._stubs["create_cached_content"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.GenAiCacheService/CreateCachedContent", request_serializer=gen_ai_cache_service.CreateCachedContentRequest.serialize, response_deserializer=gca_cached_content.CachedContent.deserialize, @@ -294,7 +380,7 @@ def get_cached_content( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_cached_content" not in self._stubs: - self._stubs["get_cached_content"] = self.grpc_channel.unary_unary( + self._stubs["get_cached_content"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.GenAiCacheService/GetCachedContent", request_serializer=gen_ai_cache_service.GetCachedContentRequest.serialize, response_deserializer=cached_content.CachedContent.deserialize, @@ -323,7 +409,7 @@ def update_cached_content( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_cached_content" not in self._stubs: - self._stubs["update_cached_content"] = self.grpc_channel.unary_unary( + self._stubs["update_cached_content"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.GenAiCacheService/UpdateCachedContent", request_serializer=gen_ai_cache_service.UpdateCachedContentRequest.serialize, response_deserializer=gca_cached_content.CachedContent.deserialize, @@ -349,7 +435,7 @@ def delete_cached_content( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_cached_content" not in self._stubs: - self._stubs["delete_cached_content"] = self.grpc_channel.unary_unary( + self._stubs["delete_cached_content"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.GenAiCacheService/DeleteCachedContent", request_serializer=gen_ai_cache_service.DeleteCachedContentRequest.serialize, response_deserializer=empty_pb2.Empty.FromString, @@ -378,7 +464,7 @@ def list_cached_contents( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_cached_contents" not in self._stubs: - self._stubs["list_cached_contents"] = self.grpc_channel.unary_unary( + self._stubs["list_cached_contents"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.GenAiCacheService/ListCachedContents", request_serializer=gen_ai_cache_service.ListCachedContentsRequest.serialize, response_deserializer=gen_ai_cache_service.ListCachedContentsResponse.deserialize, @@ -386,7 +472,7 @@ def list_cached_contents( return self._stubs["list_cached_contents"] def close(self): - self.grpc_channel.close() + self._logged_channel.close() @property def delete_operation( @@ -398,7 +484,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, @@ -415,7 +501,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -432,7 +518,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -449,7 +535,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, @@ -468,7 +554,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, @@ -487,7 +573,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -504,7 +590,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -529,7 +615,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -555,7 +641,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -584,7 +670,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1beta1/services/gen_ai_cache_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1beta1/services/gen_ai_cache_service/transports/grpc_asyncio.py index d51af63f3b..b28a430c76 100644 --- a/google/cloud/aiplatform_v1beta1/services/gen_ai_cache_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/gen_ai_cache_service/transports/grpc_asyncio.py @@ -14,6 +14,9 @@ # limitations under the License. # import inspect +import json +import pickle +import logging as std_logging import warnings from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union @@ -23,8 +26,11 @@ from google.api_core import retry_async as retries from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from grpc.experimental import aio # type: ignore from google.cloud.aiplatform_v1beta1.types import cached_content @@ -38,6 +44,82 @@ from .base import GenAiCacheServiceTransport, DEFAULT_CLIENT_INFO from .grpc import GenAiCacheServiceGrpcTransport +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.aiplatform.v1beta1.GenAiCacheService", + "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.aiplatform.v1beta1.GenAiCacheService", + "rpcName": str(client_call_details.method), + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class GenAiCacheServiceGrpcAsyncIOTransport(GenAiCacheServiceTransport): """gRPC AsyncIO backend transport for GenAiCacheService. @@ -234,10 +316,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 @@ -274,7 +359,7 @@ def create_cached_content( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_cached_content" not in self._stubs: - self._stubs["create_cached_content"] = self.grpc_channel.unary_unary( + self._stubs["create_cached_content"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.GenAiCacheService/CreateCachedContent", request_serializer=gen_ai_cache_service.CreateCachedContentRequest.serialize, response_deserializer=gca_cached_content.CachedContent.deserialize, @@ -303,7 +388,7 @@ def get_cached_content( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_cached_content" not in self._stubs: - self._stubs["get_cached_content"] = self.grpc_channel.unary_unary( + self._stubs["get_cached_content"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.GenAiCacheService/GetCachedContent", request_serializer=gen_ai_cache_service.GetCachedContentRequest.serialize, response_deserializer=cached_content.CachedContent.deserialize, @@ -332,7 +417,7 @@ def update_cached_content( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_cached_content" not in self._stubs: - self._stubs["update_cached_content"] = self.grpc_channel.unary_unary( + self._stubs["update_cached_content"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.GenAiCacheService/UpdateCachedContent", request_serializer=gen_ai_cache_service.UpdateCachedContentRequest.serialize, response_deserializer=gca_cached_content.CachedContent.deserialize, @@ -360,7 +445,7 @@ def delete_cached_content( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_cached_content" not in self._stubs: - self._stubs["delete_cached_content"] = self.grpc_channel.unary_unary( + self._stubs["delete_cached_content"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.GenAiCacheService/DeleteCachedContent", request_serializer=gen_ai_cache_service.DeleteCachedContentRequest.serialize, response_deserializer=empty_pb2.Empty.FromString, @@ -389,7 +474,7 @@ def list_cached_contents( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_cached_contents" not in self._stubs: - self._stubs["list_cached_contents"] = self.grpc_channel.unary_unary( + self._stubs["list_cached_contents"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.GenAiCacheService/ListCachedContents", request_serializer=gen_ai_cache_service.ListCachedContentsRequest.serialize, response_deserializer=gen_ai_cache_service.ListCachedContentsResponse.deserialize, @@ -482,7 +567,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: @@ -498,7 +583,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, @@ -515,7 +600,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -532,7 +617,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -549,7 +634,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, @@ -568,7 +653,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, @@ -587,7 +672,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -604,7 +689,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -629,7 +714,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -655,7 +740,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -684,7 +769,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1beta1/services/gen_ai_cache_service/transports/rest.py b/google/cloud/aiplatform_v1beta1/services/gen_ai_cache_service/transports/rest.py index 400aa863ad..0c3a0f41f2 100644 --- a/google/cloud/aiplatform_v1beta1/services/gen_ai_cache_service/transports/rest.py +++ b/google/cloud/aiplatform_v1beta1/services/gen_ai_cache_service/transports/rest.py @@ -13,9 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging +import json # type: ignore from google.auth.transport.requests import AuthorizedSession # type: ignore -import json # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.api_core import exceptions as core_exceptions from google.api_core import retry as retries @@ -49,6 +50,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, @@ -117,9 +126,10 @@ def post_update_cached_content(self, response): def pre_create_cached_content( self, request: gen_ai_cache_service.CreateCachedContentRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - gen_ai_cache_service.CreateCachedContentRequest, Sequence[Tuple[str, str]] + gen_ai_cache_service.CreateCachedContentRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for create_cached_content @@ -142,9 +152,10 @@ def post_create_cached_content( def pre_delete_cached_content( self, request: gen_ai_cache_service.DeleteCachedContentRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - gen_ai_cache_service.DeleteCachedContentRequest, Sequence[Tuple[str, str]] + gen_ai_cache_service.DeleteCachedContentRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for delete_cached_content @@ -156,8 +167,11 @@ def pre_delete_cached_content( def pre_get_cached_content( self, request: gen_ai_cache_service.GetCachedContentRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[gen_ai_cache_service.GetCachedContentRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + gen_ai_cache_service.GetCachedContentRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for get_cached_content Override in a subclass to manipulate the request or metadata @@ -179,9 +193,10 @@ def post_get_cached_content( def pre_list_cached_contents( self, request: gen_ai_cache_service.ListCachedContentsRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - gen_ai_cache_service.ListCachedContentsRequest, Sequence[Tuple[str, str]] + gen_ai_cache_service.ListCachedContentsRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for list_cached_contents @@ -204,9 +219,10 @@ def post_list_cached_contents( def pre_update_cached_content( self, request: gen_ai_cache_service.UpdateCachedContentRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - gen_ai_cache_service.UpdateCachedContentRequest, Sequence[Tuple[str, str]] + gen_ai_cache_service.UpdateCachedContentRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for update_cached_content @@ -229,8 +245,10 @@ def post_update_cached_content( def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -252,8 +270,10 @@ def post_get_location( def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -275,8 +295,10 @@ def post_list_locations( def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -296,8 +318,10 @@ def post_get_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -317,8 +341,11 @@ def post_set_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -340,8 +367,10 @@ def post_test_iam_permissions( def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -361,8 +390,10 @@ def post_cancel_operation(self, response: None) -> None: 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 @@ -382,8 +413,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 @@ -405,8 +438,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 @@ -428,8 +463,10 @@ def post_list_operations( def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -572,7 +609,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]]] = (), ) -> gca_cached_content.CachedContent: r"""Call the create cached content method over HTTP. @@ -583,8 +620,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: ~.gca_cached_content.CachedContent: @@ -597,6 +636,7 @@ def __call__( http_options = ( _BaseGenAiCacheServiceRestTransport._BaseCreateCachedContent._get_http_options() ) + request, metadata = self._interceptor.pre_create_cached_content( request, metadata ) @@ -613,6 +653,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.aiplatform_v1beta1.GenAiCacheServiceClient.CreateCachedContent", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.GenAiCacheService", + "rpcName": "CreateCachedContent", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( GenAiCacheServiceRestTransport._CreateCachedContent._get_response( @@ -636,7 +703,31 @@ def __call__( pb_resp = gca_cached_content.CachedContent.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_create_cached_content(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gca_cached_content.CachedContent.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.aiplatform_v1beta1.GenAiCacheServiceClient.create_cached_content", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.GenAiCacheService", + "rpcName": "CreateCachedContent", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _DeleteCachedContent( @@ -675,7 +766,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 cached content method over HTTP. @@ -686,13 +777,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 = ( _BaseGenAiCacheServiceRestTransport._BaseDeleteCachedContent._get_http_options() ) + request, metadata = self._interceptor.pre_delete_cached_content( request, metadata ) @@ -705,6 +799,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.aiplatform_v1beta1.GenAiCacheServiceClient.DeleteCachedContent", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.GenAiCacheService", + "rpcName": "DeleteCachedContent", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( GenAiCacheServiceRestTransport._DeleteCachedContent._get_response( @@ -758,7 +879,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]]] = (), ) -> cached_content.CachedContent: r"""Call the get cached content method over HTTP. @@ -769,8 +890,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: ~.cached_content.CachedContent: @@ -783,6 +906,7 @@ def __call__( http_options = ( _BaseGenAiCacheServiceRestTransport._BaseGetCachedContent._get_http_options() ) + request, metadata = self._interceptor.pre_get_cached_content( request, metadata ) @@ -795,6 +919,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.aiplatform_v1beta1.GenAiCacheServiceClient.GetCachedContent", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.GenAiCacheService", + "rpcName": "GetCachedContent", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = GenAiCacheServiceRestTransport._GetCachedContent._get_response( self._host, @@ -815,7 +966,29 @@ def __call__( pb_resp = cached_content.CachedContent.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_cached_content(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = cached_content.CachedContent.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.aiplatform_v1beta1.GenAiCacheServiceClient.get_cached_content", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.GenAiCacheService", + "rpcName": "GetCachedContent", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListCachedContents( @@ -854,7 +1027,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]]] = (), ) -> gen_ai_cache_service.ListCachedContentsResponse: r"""Call the list cached contents method over HTTP. @@ -864,8 +1037,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: ~.gen_ai_cache_service.ListCachedContentsResponse: @@ -877,6 +1052,7 @@ def __call__( http_options = ( _BaseGenAiCacheServiceRestTransport._BaseListCachedContents._get_http_options() ) + request, metadata = self._interceptor.pre_list_cached_contents( request, metadata ) @@ -889,6 +1065,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.aiplatform_v1beta1.GenAiCacheServiceClient.ListCachedContents", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.GenAiCacheService", + "rpcName": "ListCachedContents", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = GenAiCacheServiceRestTransport._ListCachedContents._get_response( self._host, @@ -909,7 +1112,33 @@ def __call__( pb_resp = gen_ai_cache_service.ListCachedContentsResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_cached_contents(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + gen_ai_cache_service.ListCachedContentsResponse.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.aiplatform_v1beta1.GenAiCacheServiceClient.list_cached_contents", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.GenAiCacheService", + "rpcName": "ListCachedContents", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _UpdateCachedContent( @@ -949,7 +1178,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]]] = (), ) -> gca_cached_content.CachedContent: r"""Call the update cached content method over HTTP. @@ -961,8 +1190,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: ~.gca_cached_content.CachedContent: @@ -975,6 +1206,7 @@ def __call__( http_options = ( _BaseGenAiCacheServiceRestTransport._BaseUpdateCachedContent._get_http_options() ) + request, metadata = self._interceptor.pre_update_cached_content( request, metadata ) @@ -991,6 +1223,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.aiplatform_v1beta1.GenAiCacheServiceClient.UpdateCachedContent", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.GenAiCacheService", + "rpcName": "UpdateCachedContent", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( GenAiCacheServiceRestTransport._UpdateCachedContent._get_response( @@ -1014,7 +1273,31 @@ def __call__( pb_resp = gca_cached_content.CachedContent.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_update_cached_content(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gca_cached_content.CachedContent.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.aiplatform_v1beta1.GenAiCacheServiceClient.update_cached_content", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.GenAiCacheService", + "rpcName": "UpdateCachedContent", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp @property @@ -1107,7 +1390,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]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -1118,8 +1401,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: locations_pb2.Location: Response from GetLocation method. @@ -1128,6 +1413,7 @@ def __call__( http_options = ( _BaseGenAiCacheServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = self._interceptor.pre_get_location(request, metadata) transcoded_request = _BaseGenAiCacheServiceRestTransport._BaseGetLocation._get_transcoded_request( http_options, request @@ -1138,6 +1424,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.aiplatform_v1beta1.GenAiCacheServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.GenAiCacheService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = GenAiCacheServiceRestTransport._GetLocation._get_response( self._host, @@ -1157,6 +1470,27 @@ def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_location(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.aiplatform_v1beta1.GenAiCacheServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.GenAiCacheService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1199,7 +1533,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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -1210,8 +1544,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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -1220,6 +1556,7 @@ def __call__( http_options = ( _BaseGenAiCacheServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = self._interceptor.pre_list_locations(request, metadata) transcoded_request = _BaseGenAiCacheServiceRestTransport._BaseListLocations._get_transcoded_request( http_options, request @@ -1230,6 +1567,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.aiplatform_v1beta1.GenAiCacheServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.GenAiCacheService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = GenAiCacheServiceRestTransport._ListLocations._get_response( self._host, @@ -1249,6 +1613,27 @@ def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_list_locations(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.aiplatform_v1beta1.GenAiCacheServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.GenAiCacheService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1291,7 +1676,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]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -1302,8 +1687,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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -1312,6 +1699,7 @@ def __call__( http_options = ( _BaseGenAiCacheServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_get_iam_policy(request, metadata) transcoded_request = _BaseGenAiCacheServiceRestTransport._BaseGetIamPolicy._get_transcoded_request( http_options, request @@ -1326,6 +1714,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.aiplatform_v1beta1.GenAiCacheServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.GenAiCacheService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = GenAiCacheServiceRestTransport._GetIamPolicy._get_response( self._host, @@ -1346,6 +1761,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_iam_policy(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.aiplatform_v1beta1.GenAiCacheServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.GenAiCacheService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1388,7 +1824,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]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -1399,8 +1835,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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -1409,6 +1847,7 @@ def __call__( http_options = ( _BaseGenAiCacheServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_set_iam_policy(request, metadata) transcoded_request = _BaseGenAiCacheServiceRestTransport._BaseSetIamPolicy._get_transcoded_request( http_options, request @@ -1423,6 +1862,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.aiplatform_v1beta1.GenAiCacheServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.GenAiCacheService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = GenAiCacheServiceRestTransport._SetIamPolicy._get_response( self._host, @@ -1443,6 +1909,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_set_iam_policy(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.aiplatform_v1beta1.GenAiCacheServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.GenAiCacheService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1486,7 +1973,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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -1497,8 +1984,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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -1507,6 +1996,7 @@ def __call__( http_options = ( _BaseGenAiCacheServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -1523,6 +2013,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.aiplatform_v1beta1.GenAiCacheServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.GenAiCacheService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = GenAiCacheServiceRestTransport._TestIamPermissions._get_response( self._host, @@ -1543,6 +2060,27 @@ def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_test_iam_permissions(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.aiplatform_v1beta1.GenAiCacheServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.GenAiCacheService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1585,7 +2123,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 cancel operation method over HTTP. @@ -1596,13 +2134,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 = ( _BaseGenAiCacheServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = self._interceptor.pre_cancel_operation( request, metadata ) @@ -1615,6 +2156,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.aiplatform_v1beta1.GenAiCacheServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.GenAiCacheService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = GenAiCacheServiceRestTransport._CancelOperation._get_response( self._host, @@ -1672,7 +2240,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. @@ -1683,13 +2251,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 = ( _BaseGenAiCacheServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = self._interceptor.pre_delete_operation( request, metadata ) @@ -1702,6 +2273,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.aiplatform_v1beta1.GenAiCacheServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.GenAiCacheService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = GenAiCacheServiceRestTransport._DeleteOperation._get_response( self._host, @@ -1758,7 +2356,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. @@ -1769,8 +2367,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. @@ -1779,6 +2379,7 @@ def __call__( http_options = ( _BaseGenAiCacheServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = self._interceptor.pre_get_operation(request, metadata) transcoded_request = _BaseGenAiCacheServiceRestTransport._BaseGetOperation._get_transcoded_request( http_options, request @@ -1789,6 +2390,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.aiplatform_v1beta1.GenAiCacheServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.GenAiCacheService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = GenAiCacheServiceRestTransport._GetOperation._get_response( self._host, @@ -1808,6 +2436,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.aiplatform_v1beta1.GenAiCacheServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.GenAiCacheService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1850,7 +2499,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. @@ -1861,8 +2510,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. @@ -1871,6 +2522,7 @@ def __call__( http_options = ( _BaseGenAiCacheServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = self._interceptor.pre_list_operations(request, metadata) transcoded_request = _BaseGenAiCacheServiceRestTransport._BaseListOperations._get_transcoded_request( http_options, request @@ -1881,6 +2533,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.aiplatform_v1beta1.GenAiCacheServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.GenAiCacheService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = GenAiCacheServiceRestTransport._ListOperations._get_response( self._host, @@ -1900,6 +2579,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.aiplatform_v1beta1.GenAiCacheServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.GenAiCacheService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1942,7 +2642,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 wait operation method over HTTP. @@ -1953,8 +2653,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 WaitOperation method. @@ -1963,6 +2665,7 @@ def __call__( http_options = ( _BaseGenAiCacheServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = self._interceptor.pre_wait_operation(request, metadata) transcoded_request = _BaseGenAiCacheServiceRestTransport._BaseWaitOperation._get_transcoded_request( http_options, request @@ -1973,6 +2676,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.aiplatform_v1beta1.GenAiCacheServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.GenAiCacheService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = GenAiCacheServiceRestTransport._WaitOperation._get_response( self._host, @@ -1992,6 +2722,27 @@ def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = self._interceptor.post_wait_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.aiplatform_v1beta1.GenAiCacheServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.GenAiCacheService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1beta1/services/gen_ai_cache_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1beta1/services/gen_ai_cache_service/transports/rest_asyncio.py index 29e99ad1b4..dcb62371c5 100644 --- a/google/cloud/aiplatform_v1beta1/services/gen_ai_cache_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/gen_ai_cache_service/transports/rest_asyncio.py @@ -59,6 +59,18 @@ from .base import DEFAULT_CLIENT_INFO as BASE_DEFAULT_CLIENT_INFO + +import logging + +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__) + try: OptionalRetry = Union[retries.AsyncRetry, gapic_v1.method._MethodDefault, None] except AttributeError: # pragma: NO COVER @@ -131,9 +143,10 @@ async def post_update_cached_content(self, response): async def pre_create_cached_content( self, request: gen_ai_cache_service.CreateCachedContentRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - gen_ai_cache_service.CreateCachedContentRequest, Sequence[Tuple[str, str]] + gen_ai_cache_service.CreateCachedContentRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for create_cached_content @@ -156,9 +169,10 @@ async def post_create_cached_content( async def pre_delete_cached_content( self, request: gen_ai_cache_service.DeleteCachedContentRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - gen_ai_cache_service.DeleteCachedContentRequest, Sequence[Tuple[str, str]] + gen_ai_cache_service.DeleteCachedContentRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for delete_cached_content @@ -170,8 +184,11 @@ async def pre_delete_cached_content( async def pre_get_cached_content( self, request: gen_ai_cache_service.GetCachedContentRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[gen_ai_cache_service.GetCachedContentRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + gen_ai_cache_service.GetCachedContentRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for get_cached_content Override in a subclass to manipulate the request or metadata @@ -193,9 +210,10 @@ async def post_get_cached_content( async def pre_list_cached_contents( self, request: gen_ai_cache_service.ListCachedContentsRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - gen_ai_cache_service.ListCachedContentsRequest, Sequence[Tuple[str, str]] + gen_ai_cache_service.ListCachedContentsRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for list_cached_contents @@ -218,9 +236,10 @@ async def post_list_cached_contents( async def pre_update_cached_content( self, request: gen_ai_cache_service.UpdateCachedContentRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - gen_ai_cache_service.UpdateCachedContentRequest, Sequence[Tuple[str, str]] + gen_ai_cache_service.UpdateCachedContentRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for update_cached_content @@ -243,8 +262,10 @@ async def post_update_cached_content( async def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -266,8 +287,10 @@ async def post_get_location( async def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -289,8 +312,10 @@ async def post_list_locations( async def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -312,8 +337,10 @@ async def post_get_iam_policy( async def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -335,8 +362,11 @@ async def post_set_iam_policy( async def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -358,8 +388,10 @@ async def post_test_iam_permissions( async def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -379,8 +411,10 @@ async def post_cancel_operation(self, response: None) -> None: async 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 @@ -400,8 +434,10 @@ async def post_delete_operation(self, response: None) -> None: async 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 @@ -423,8 +459,10 @@ async def post_get_operation( async 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 @@ -446,8 +484,10 @@ async def post_list_operations( async def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -650,7 +690,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> gca_cached_content.CachedContent: r"""Call the create cached content method over HTTP. @@ -661,8 +701,10 @@ async def __call__( 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: ~.gca_cached_content.CachedContent: @@ -675,6 +717,7 @@ async def __call__( http_options = ( _BaseGenAiCacheServiceRestTransport._BaseCreateCachedContent._get_http_options() ) + request, metadata = await self._interceptor.pre_create_cached_content( request, metadata ) @@ -691,6 +734,33 @@ async 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.aiplatform_v1beta1.GenAiCacheServiceClient.CreateCachedContent", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.GenAiCacheService", + "rpcName": "CreateCachedContent", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncGenAiCacheServiceRestTransport._CreateCachedContent._get_response( self._host, @@ -719,6 +789,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_create_cached_content(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gca_cached_content.CachedContent.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.GenAiCacheServiceAsyncClient.create_cached_content", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.GenAiCacheService", + "rpcName": "CreateCachedContent", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _DeleteCachedContent( @@ -757,7 +851,7 @@ async 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 cached content method over HTTP. @@ -768,13 +862,16 @@ async def __call__( 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`. """ http_options = ( _BaseGenAiCacheServiceRestTransport._BaseDeleteCachedContent._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_cached_content( request, metadata ) @@ -787,6 +884,33 @@ async 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.aiplatform_v1beta1.GenAiCacheServiceClient.DeleteCachedContent", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.GenAiCacheService", + "rpcName": "DeleteCachedContent", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncGenAiCacheServiceRestTransport._DeleteCachedContent._get_response( self._host, @@ -844,7 +968,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> cached_content.CachedContent: r"""Call the get cached content method over HTTP. @@ -855,8 +979,10 @@ async def __call__( 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: ~.cached_content.CachedContent: @@ -869,6 +995,7 @@ async def __call__( http_options = ( _BaseGenAiCacheServiceRestTransport._BaseGetCachedContent._get_http_options() ) + request, metadata = await self._interceptor.pre_get_cached_content( request, metadata ) @@ -881,6 +1008,33 @@ async 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.aiplatform_v1beta1.GenAiCacheServiceClient.GetCachedContent", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.GenAiCacheService", + "rpcName": "GetCachedContent", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncGenAiCacheServiceRestTransport._GetCachedContent._get_response( self._host, @@ -908,6 +1062,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_get_cached_content(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = cached_content.CachedContent.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.GenAiCacheServiceAsyncClient.get_cached_content", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.GenAiCacheService", + "rpcName": "GetCachedContent", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ListCachedContents( @@ -946,7 +1122,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> gen_ai_cache_service.ListCachedContentsResponse: r"""Call the list cached contents method over HTTP. @@ -956,8 +1132,10 @@ async def __call__( 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: ~.gen_ai_cache_service.ListCachedContentsResponse: @@ -969,6 +1147,7 @@ async def __call__( http_options = ( _BaseGenAiCacheServiceRestTransport._BaseListCachedContents._get_http_options() ) + request, metadata = await self._interceptor.pre_list_cached_contents( request, metadata ) @@ -981,6 +1160,33 @@ async 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.aiplatform_v1beta1.GenAiCacheServiceClient.ListCachedContents", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.GenAiCacheService", + "rpcName": "ListCachedContents", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncGenAiCacheServiceRestTransport._ListCachedContents._get_response( self._host, @@ -1008,6 +1214,32 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_list_cached_contents(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + gen_ai_cache_service.ListCachedContentsResponse.to_json( + response + ) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.GenAiCacheServiceAsyncClient.list_cached_contents", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.GenAiCacheService", + "rpcName": "ListCachedContents", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _UpdateCachedContent( @@ -1047,7 +1279,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> gca_cached_content.CachedContent: r"""Call the update cached content method over HTTP. @@ -1059,8 +1291,10 @@ async def __call__( 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: ~.gca_cached_content.CachedContent: @@ -1073,6 +1307,7 @@ async def __call__( http_options = ( _BaseGenAiCacheServiceRestTransport._BaseUpdateCachedContent._get_http_options() ) + request, metadata = await self._interceptor.pre_update_cached_content( request, metadata ) @@ -1089,6 +1324,33 @@ async 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.aiplatform_v1beta1.GenAiCacheServiceClient.UpdateCachedContent", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.GenAiCacheService", + "rpcName": "UpdateCachedContent", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncGenAiCacheServiceRestTransport._UpdateCachedContent._get_response( self._host, @@ -1117,6 +1379,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_update_cached_content(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gca_cached_content.CachedContent.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.GenAiCacheServiceAsyncClient.update_cached_content", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.GenAiCacheService", + "rpcName": "UpdateCachedContent", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp @property @@ -1200,7 +1486,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -1211,8 +1497,10 @@ async def __call__( 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: locations_pb2.Location: Response from GetLocation method. @@ -1221,6 +1509,7 @@ async def __call__( http_options = ( _BaseGenAiCacheServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_location( request, metadata ) @@ -1233,6 +1522,33 @@ async 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.aiplatform_v1beta1.GenAiCacheServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.GenAiCacheService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncGenAiCacheServiceRestTransport._GetLocation._get_response( @@ -1260,6 +1576,27 @@ async def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_location(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.aiplatform_v1beta1.GenAiCacheServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.GenAiCacheService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1302,7 +1639,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -1313,8 +1650,10 @@ async def __call__( 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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -1323,6 +1662,7 @@ async def __call__( http_options = ( _BaseGenAiCacheServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_locations( request, metadata ) @@ -1335,6 +1675,33 @@ async 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.aiplatform_v1beta1.GenAiCacheServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.GenAiCacheService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncGenAiCacheServiceRestTransport._ListLocations._get_response( @@ -1362,6 +1729,27 @@ async def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_list_locations(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.aiplatform_v1beta1.GenAiCacheServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.GenAiCacheService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1405,7 +1793,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -1416,8 +1804,10 @@ async def __call__( 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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -1426,6 +1816,7 @@ async def __call__( http_options = ( _BaseGenAiCacheServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_get_iam_policy( request, metadata ) @@ -1442,6 +1833,33 @@ async 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.aiplatform_v1beta1.GenAiCacheServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.GenAiCacheService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncGenAiCacheServiceRestTransport._GetIamPolicy._get_response( @@ -1470,6 +1888,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_iam_policy(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.aiplatform_v1beta1.GenAiCacheServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.GenAiCacheService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1513,7 +1952,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -1524,8 +1963,10 @@ async def __call__( 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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -1534,6 +1975,7 @@ async def __call__( http_options = ( _BaseGenAiCacheServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_set_iam_policy( request, metadata ) @@ -1550,6 +1992,33 @@ async 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.aiplatform_v1beta1.GenAiCacheServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.GenAiCacheService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncGenAiCacheServiceRestTransport._SetIamPolicy._get_response( @@ -1578,6 +2047,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_set_iam_policy(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.aiplatform_v1beta1.GenAiCacheServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.GenAiCacheService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1621,7 +2111,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -1632,8 +2122,10 @@ async def __call__( 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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -1642,6 +2134,7 @@ async def __call__( http_options = ( _BaseGenAiCacheServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = await self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -1658,6 +2151,33 @@ async 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.aiplatform_v1beta1.GenAiCacheServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.GenAiCacheService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncGenAiCacheServiceRestTransport._TestIamPermissions._get_response( self._host, @@ -1684,6 +2204,27 @@ async def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_test_iam_permissions(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.aiplatform_v1beta1.GenAiCacheServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.GenAiCacheService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1726,7 +2267,7 @@ async 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 cancel operation method over HTTP. @@ -1737,13 +2278,16 @@ async def __call__( 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`. """ http_options = ( _BaseGenAiCacheServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_cancel_operation( request, metadata ) @@ -1756,6 +2300,33 @@ async 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.aiplatform_v1beta1.GenAiCacheServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.GenAiCacheService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncGenAiCacheServiceRestTransport._CancelOperation._get_response( self._host, @@ -1819,7 +2390,7 @@ async 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. @@ -1830,13 +2401,16 @@ async def __call__( 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`. """ http_options = ( _BaseGenAiCacheServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_operation( request, metadata ) @@ -1849,6 +2423,33 @@ async 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.aiplatform_v1beta1.GenAiCacheServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.GenAiCacheService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncGenAiCacheServiceRestTransport._DeleteOperation._get_response( self._host, @@ -1912,7 +2513,7 @@ async 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. @@ -1923,8 +2524,10 @@ async def __call__( 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: Response from GetOperation method. @@ -1933,6 +2536,7 @@ async def __call__( http_options = ( _BaseGenAiCacheServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_operation( request, metadata ) @@ -1945,6 +2549,33 @@ async 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.aiplatform_v1beta1.GenAiCacheServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.GenAiCacheService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncGenAiCacheServiceRestTransport._GetOperation._get_response( @@ -1972,6 +2603,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1beta1.GenAiCacheServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.GenAiCacheService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -2014,7 +2666,7 @@ async 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. @@ -2025,8 +2677,10 @@ async def __call__( 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 from ListOperations method. @@ -2035,6 +2689,7 @@ async def __call__( http_options = ( _BaseGenAiCacheServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_operations( request, metadata ) @@ -2047,6 +2702,33 @@ async 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.aiplatform_v1beta1.GenAiCacheServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.GenAiCacheService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncGenAiCacheServiceRestTransport._ListOperations._get_response( @@ -2074,6 +2756,27 @@ async def __call__( resp = operations_pb2.ListOperationsResponse() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1beta1.GenAiCacheServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.GenAiCacheService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -2116,7 +2819,7 @@ async 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 wait operation method over HTTP. @@ -2127,8 +2830,10 @@ async def __call__( 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: Response from WaitOperation method. @@ -2137,6 +2842,7 @@ async def __call__( http_options = ( _BaseGenAiCacheServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_wait_operation( request, metadata ) @@ -2149,6 +2855,33 @@ async 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.aiplatform_v1beta1.GenAiCacheServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.GenAiCacheService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncGenAiCacheServiceRestTransport._WaitOperation._get_response( @@ -2176,6 +2909,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_wait_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.aiplatform_v1beta1.GenAiCacheServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.GenAiCacheService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1beta1/services/gen_ai_cache_service/transports/rest_base.py b/google/cloud/aiplatform_v1beta1/services/gen_ai_cache_service/transports/rest_base.py index c710e8585f..632056f415 100644 --- a/google/cloud/aiplatform_v1beta1/services/gen_ai_cache_service/transports/rest_base.py +++ b/google/cloud/aiplatform_v1beta1/services/gen_ai_cache_service/transports/rest_base.py @@ -1269,6 +1269,10 @@ def _get_http_options(): "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -1485,6 +1489,10 @@ def _get_http_options(): "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -1710,6 +1718,10 @@ def _get_http_options(): "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}", @@ -1926,6 +1938,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, ] return http_options @@ -2143,6 +2159,10 @@ def _get_http_options(): "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*}/operations", @@ -2359,6 +2379,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*}/operations", + }, ] return http_options @@ -2576,6 +2600,10 @@ def _get_http_options(): "method": "post", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}:wait", @@ -2788,6 +2816,10 @@ def _get_http_options(): "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, ] return http_options diff --git a/google/cloud/aiplatform_v1beta1/services/gen_ai_tuning_service/async_client.py b/google/cloud/aiplatform_v1beta1/services/gen_ai_tuning_service/async_client.py index e724c69104..3be37382d3 100644 --- a/google/cloud/aiplatform_v1beta1/services/gen_ai_tuning_service/async_client.py +++ b/google/cloud/aiplatform_v1beta1/services/gen_ai_tuning_service/async_client.py @@ -13,6 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging as std_logging from collections import OrderedDict import re from typing import ( @@ -61,6 +62,15 @@ from .transports.grpc_asyncio import GenAiTuningServiceGrpcAsyncIOTransport from .client import GenAiTuningServiceClient +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 GenAiTuningServiceAsyncClient: """A service for creating and managing GenAI Tuning Jobs.""" @@ -280,6 +290,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.aiplatform_v1beta1.GenAiTuningServiceAsyncClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.GenAiTuningService", + "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.aiplatform.v1beta1.GenAiTuningService", + "credentialsType": None, + }, + ) + async def create_tuning_job( self, request: Optional[ @@ -290,7 +322,7 @@ async def create_tuning_job( tuning_job: Optional[gca_tuning_job.TuningJob] = 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]]] = (), ) -> gca_tuning_job.TuningJob: r"""Creates a TuningJob. A created TuningJob right away will be attempted to be run. @@ -346,8 +378,10 @@ async def sample_create_tuning_job(): 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.aiplatform_v1beta1.types.TuningJob: @@ -410,7 +444,7 @@ async def get_tuning_job( 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]]] = (), ) -> tuning_job.TuningJob: r"""Gets a TuningJob. @@ -454,8 +488,10 @@ async def sample_get_tuning_job(): 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.aiplatform_v1beta1.types.TuningJob: @@ -518,7 +554,7 @@ async def list_tuning_jobs( 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.ListTuningJobsAsyncPager: r"""Lists TuningJobs in a Location. @@ -564,8 +600,10 @@ async def sample_list_tuning_jobs(): 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.aiplatform_v1beta1.services.gen_ai_tuning_service.pagers.ListTuningJobsAsyncPager: @@ -642,7 +680,7 @@ async def cancel_tuning_job( 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"""Cancels a TuningJob. Starts asynchronous cancellation on the TuningJob. The server makes a best effort to cancel the job, but @@ -695,8 +733,10 @@ async def sample_cancel_tuning_job(): 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 @@ -751,7 +791,7 @@ async def rebase_tuned_model( tuned_model_ref: Optional[tuning_job.TunedModelRef] = 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"""Rebase a TunedModel. Creates a LongRunningOperation that takes a legacy Tuned @@ -814,8 +854,10 @@ async def sample_rebase_tuned_model(): 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: @@ -889,7 +931,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. @@ -900,8 +942,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. @@ -942,7 +986,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. @@ -953,8 +997,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. @@ -995,7 +1041,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. @@ -1011,8 +1057,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 """ @@ -1049,7 +1097,7 @@ async def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -1064,8 +1112,10 @@ async def cancel_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 """ @@ -1102,7 +1152,7 @@ async def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -1119,8 +1169,10 @@ async def wait_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. @@ -1161,7 +1213,7 @@ async def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -1174,8 +1226,10 @@ async def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -1280,7 +1334,7 @@ async def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -1294,8 +1348,10 @@ async def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -1400,7 +1456,7 @@ async def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -1415,8 +1471,10 @@ async def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -1460,7 +1518,7 @@ async def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -1471,8 +1529,10 @@ async def get_location( 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: ~.location_pb2.Location: Location object. @@ -1513,7 +1573,7 @@ async def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -1524,8 +1584,10 @@ async def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1beta1/services/gen_ai_tuning_service/client.py b/google/cloud/aiplatform_v1beta1/services/gen_ai_tuning_service/client.py index 98013636ef..4041061223 100644 --- a/google/cloud/aiplatform_v1beta1/services/gen_ai_tuning_service/client.py +++ b/google/cloud/aiplatform_v1beta1/services/gen_ai_tuning_service/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 ( @@ -48,6 +49,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.cloud.aiplatform_v1beta1.services.gen_ai_tuning_service import pagers @@ -697,6 +707,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( @@ -788,6 +802,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.aiplatform_v1beta1.GenAiTuningServiceClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.GenAiTuningService", + "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.aiplatform.v1beta1.GenAiTuningService", + "credentialsType": None, + }, + ) + def create_tuning_job( self, request: Optional[ @@ -798,7 +835,7 @@ def create_tuning_job( tuning_job: Optional[gca_tuning_job.TuningJob] = 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]]] = (), ) -> gca_tuning_job.TuningJob: r"""Creates a TuningJob. A created TuningJob right away will be attempted to be run. @@ -854,8 +891,10 @@ def sample_create_tuning_job(): 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.aiplatform_v1beta1.types.TuningJob: @@ -915,7 +954,7 @@ def get_tuning_job( 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]]] = (), ) -> tuning_job.TuningJob: r"""Gets a TuningJob. @@ -959,8 +998,10 @@ def sample_get_tuning_job(): 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.aiplatform_v1beta1.types.TuningJob: @@ -1020,7 +1061,7 @@ def list_tuning_jobs( 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.ListTuningJobsPager: r"""Lists TuningJobs in a Location. @@ -1066,8 +1107,10 @@ def sample_list_tuning_jobs(): 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.aiplatform_v1beta1.services.gen_ai_tuning_service.pagers.ListTuningJobsPager: @@ -1141,7 +1184,7 @@ def cancel_tuning_job( 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"""Cancels a TuningJob. Starts asynchronous cancellation on the TuningJob. The server makes a best effort to cancel the job, but @@ -1194,8 +1237,10 @@ def sample_cancel_tuning_job(): 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 @@ -1247,7 +1292,7 @@ def rebase_tuned_model( tuned_model_ref: Optional[tuning_job.TunedModelRef] = 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"""Rebase a TunedModel. Creates a LongRunningOperation that takes a legacy Tuned @@ -1310,8 +1355,10 @@ def sample_rebase_tuned_model(): 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: @@ -1395,7 +1442,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. @@ -1406,8 +1453,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. @@ -1448,7 +1497,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. @@ -1459,8 +1508,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. @@ -1501,7 +1552,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. @@ -1517,8 +1568,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 """ @@ -1555,7 +1608,7 @@ def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -1570,8 +1623,10 @@ def cancel_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 """ @@ -1608,7 +1663,7 @@ def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -1625,8 +1680,10 @@ def wait_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. @@ -1667,7 +1724,7 @@ def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -1680,8 +1737,10 @@ def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -1786,7 +1845,7 @@ def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -1800,8 +1859,10 @@ def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -1906,7 +1967,7 @@ def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -1921,8 +1982,10 @@ def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -1964,7 +2027,7 @@ def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -1975,8 +2038,10 @@ def get_location( 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: ~.location_pb2.Location: Location object. @@ -2017,7 +2082,7 @@ def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -2028,8 +2093,10 @@ def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1beta1/services/gen_ai_tuning_service/pagers.py b/google/cloud/aiplatform_v1beta1/services/gen_ai_tuning_service/pagers.py index 46617ea2b6..d891f739cd 100644 --- a/google/cloud/aiplatform_v1beta1/services/gen_ai_tuning_service/pagers.py +++ b/google/cloud/aiplatform_v1beta1/services/gen_ai_tuning_service/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 = genai_tuning_service.ListTuningJobsRequest(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 = genai_tuning_service.ListTuningJobsRequest(request) diff --git a/google/cloud/aiplatform_v1beta1/services/gen_ai_tuning_service/transports/grpc.py b/google/cloud/aiplatform_v1beta1/services/gen_ai_tuning_service/transports/grpc.py index 9a502d4a0f..59eba96c2d 100644 --- a/google/cloud/aiplatform_v1beta1/services/gen_ai_tuning_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1beta1/services/gen_ai_tuning_service/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 import warnings from typing import Callable, Dict, Optional, Sequence, Tuple, Union @@ -22,8 +25,11 @@ import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from google.cloud.aiplatform_v1beta1.types import genai_tuning_service from google.cloud.aiplatform_v1beta1.types import tuning_job @@ -35,6 +41,81 @@ from google.protobuf import empty_pb2 # type: ignore from .base import GenAiTuningServiceTransport, DEFAULT_CLIENT_INFO +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.aiplatform.v1beta1.GenAiTuningService", + "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.aiplatform.v1beta1.GenAiTuningService", + "rpcName": client_call_details.method, + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class GenAiTuningServiceGrpcTransport(GenAiTuningServiceTransport): """gRPC backend transport for GenAiTuningService. @@ -189,7 +270,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 @@ -253,7 +339,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 @@ -280,7 +368,7 @@ def create_tuning_job( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_tuning_job" not in self._stubs: - self._stubs["create_tuning_job"] = self.grpc_channel.unary_unary( + self._stubs["create_tuning_job"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.GenAiTuningService/CreateTuningJob", request_serializer=genai_tuning_service.CreateTuningJobRequest.serialize, response_deserializer=gca_tuning_job.TuningJob.deserialize, @@ -306,7 +394,7 @@ def get_tuning_job( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_tuning_job" not in self._stubs: - self._stubs["get_tuning_job"] = self.grpc_channel.unary_unary( + self._stubs["get_tuning_job"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.GenAiTuningService/GetTuningJob", request_serializer=genai_tuning_service.GetTuningJobRequest.serialize, response_deserializer=tuning_job.TuningJob.deserialize, @@ -335,7 +423,7 @@ def list_tuning_jobs( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_tuning_jobs" not in self._stubs: - self._stubs["list_tuning_jobs"] = self.grpc_channel.unary_unary( + self._stubs["list_tuning_jobs"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.GenAiTuningService/ListTuningJobs", request_serializer=genai_tuning_service.ListTuningJobsRequest.serialize, response_deserializer=genai_tuning_service.ListTuningJobsResponse.deserialize, @@ -373,7 +461,7 @@ def cancel_tuning_job( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_tuning_job" not in self._stubs: - self._stubs["cancel_tuning_job"] = self.grpc_channel.unary_unary( + self._stubs["cancel_tuning_job"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.GenAiTuningService/CancelTuningJob", request_serializer=genai_tuning_service.CancelTuningJobRequest.serialize, response_deserializer=empty_pb2.Empty.FromString, @@ -404,7 +492,7 @@ def rebase_tuned_model( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "rebase_tuned_model" not in self._stubs: - self._stubs["rebase_tuned_model"] = self.grpc_channel.unary_unary( + self._stubs["rebase_tuned_model"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.GenAiTuningService/RebaseTunedModel", request_serializer=genai_tuning_service.RebaseTunedModelRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -412,7 +500,7 @@ def rebase_tuned_model( return self._stubs["rebase_tuned_model"] def close(self): - self.grpc_channel.close() + self._logged_channel.close() @property def delete_operation( @@ -424,7 +512,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, @@ -441,7 +529,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -458,7 +546,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -475,7 +563,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, @@ -494,7 +582,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, @@ -513,7 +601,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -530,7 +618,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -555,7 +643,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -581,7 +669,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -610,7 +698,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1beta1/services/gen_ai_tuning_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1beta1/services/gen_ai_tuning_service/transports/grpc_asyncio.py index 4a04b893b9..b6fc58c413 100644 --- a/google/cloud/aiplatform_v1beta1/services/gen_ai_tuning_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/gen_ai_tuning_service/transports/grpc_asyncio.py @@ -14,6 +14,9 @@ # limitations under the License. # import inspect +import json +import pickle +import logging as std_logging import warnings from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union @@ -24,8 +27,11 @@ from google.api_core import operations_v1 from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from grpc.experimental import aio # type: ignore from google.cloud.aiplatform_v1beta1.types import genai_tuning_service @@ -39,6 +45,82 @@ from .base import GenAiTuningServiceTransport, DEFAULT_CLIENT_INFO from .grpc import GenAiTuningServiceGrpcTransport +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.aiplatform.v1beta1.GenAiTuningService", + "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.aiplatform.v1beta1.GenAiTuningService", + "rpcName": str(client_call_details.method), + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class GenAiTuningServiceGrpcAsyncIOTransport(GenAiTuningServiceTransport): """gRPC AsyncIO backend transport for GenAiTuningService. @@ -236,10 +318,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 @@ -262,7 +347,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. @@ -291,7 +376,7 @@ def create_tuning_job( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_tuning_job" not in self._stubs: - self._stubs["create_tuning_job"] = self.grpc_channel.unary_unary( + self._stubs["create_tuning_job"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.GenAiTuningService/CreateTuningJob", request_serializer=genai_tuning_service.CreateTuningJobRequest.serialize, response_deserializer=gca_tuning_job.TuningJob.deserialize, @@ -319,7 +404,7 @@ def get_tuning_job( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_tuning_job" not in self._stubs: - self._stubs["get_tuning_job"] = self.grpc_channel.unary_unary( + self._stubs["get_tuning_job"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.GenAiTuningService/GetTuningJob", request_serializer=genai_tuning_service.GetTuningJobRequest.serialize, response_deserializer=tuning_job.TuningJob.deserialize, @@ -348,7 +433,7 @@ def list_tuning_jobs( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_tuning_jobs" not in self._stubs: - self._stubs["list_tuning_jobs"] = self.grpc_channel.unary_unary( + self._stubs["list_tuning_jobs"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.GenAiTuningService/ListTuningJobs", request_serializer=genai_tuning_service.ListTuningJobsRequest.serialize, response_deserializer=genai_tuning_service.ListTuningJobsResponse.deserialize, @@ -388,7 +473,7 @@ def cancel_tuning_job( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_tuning_job" not in self._stubs: - self._stubs["cancel_tuning_job"] = self.grpc_channel.unary_unary( + self._stubs["cancel_tuning_job"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.GenAiTuningService/CancelTuningJob", request_serializer=genai_tuning_service.CancelTuningJobRequest.serialize, response_deserializer=empty_pb2.Empty.FromString, @@ -420,7 +505,7 @@ def rebase_tuned_model( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "rebase_tuned_model" not in self._stubs: - self._stubs["rebase_tuned_model"] = self.grpc_channel.unary_unary( + self._stubs["rebase_tuned_model"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.GenAiTuningService/RebaseTunedModel", request_serializer=genai_tuning_service.RebaseTunedModelRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -513,7 +598,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: @@ -529,7 +614,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, @@ -546,7 +631,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -563,7 +648,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -580,7 +665,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, @@ -599,7 +684,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, @@ -618,7 +703,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -635,7 +720,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -660,7 +745,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -686,7 +771,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -715,7 +800,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1beta1/services/gen_ai_tuning_service/transports/rest.py b/google/cloud/aiplatform_v1beta1/services/gen_ai_tuning_service/transports/rest.py index 6f8dd3d947..625248bba9 100644 --- a/google/cloud/aiplatform_v1beta1/services/gen_ai_tuning_service/transports/rest.py +++ b/google/cloud/aiplatform_v1beta1/services/gen_ai_tuning_service/transports/rest.py @@ -13,9 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging +import json # type: ignore from google.auth.transport.requests import AuthorizedSession # type: ignore -import json # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.api_core import exceptions as core_exceptions from google.api_core import retry as retries @@ -50,6 +51,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, @@ -118,8 +127,11 @@ def post_rebase_tuned_model(self, response): def pre_cancel_tuning_job( self, request: genai_tuning_service.CancelTuningJobRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[genai_tuning_service.CancelTuningJobRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + genai_tuning_service.CancelTuningJobRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for cancel_tuning_job Override in a subclass to manipulate the request or metadata @@ -130,8 +142,11 @@ def pre_cancel_tuning_job( def pre_create_tuning_job( self, request: genai_tuning_service.CreateTuningJobRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[genai_tuning_service.CreateTuningJobRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + genai_tuning_service.CreateTuningJobRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for create_tuning_job Override in a subclass to manipulate the request or metadata @@ -153,8 +168,11 @@ def post_create_tuning_job( def pre_get_tuning_job( self, request: genai_tuning_service.GetTuningJobRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[genai_tuning_service.GetTuningJobRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + genai_tuning_service.GetTuningJobRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for get_tuning_job Override in a subclass to manipulate the request or metadata @@ -176,8 +194,11 @@ def post_get_tuning_job( def pre_list_tuning_jobs( self, request: genai_tuning_service.ListTuningJobsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[genai_tuning_service.ListTuningJobsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + genai_tuning_service.ListTuningJobsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for list_tuning_jobs Override in a subclass to manipulate the request or metadata @@ -199,8 +220,11 @@ def post_list_tuning_jobs( def pre_rebase_tuned_model( self, request: genai_tuning_service.RebaseTunedModelRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[genai_tuning_service.RebaseTunedModelRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + genai_tuning_service.RebaseTunedModelRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for rebase_tuned_model Override in a subclass to manipulate the request or metadata @@ -222,8 +246,10 @@ def post_rebase_tuned_model( def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -245,8 +271,10 @@ def post_get_location( def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -268,8 +296,10 @@ def post_list_locations( def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -289,8 +319,10 @@ def post_get_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -310,8 +342,11 @@ def post_set_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -333,8 +368,10 @@ def post_test_iam_permissions( def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -354,8 +391,10 @@ def post_cancel_operation(self, response: None) -> None: 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 @@ -375,8 +414,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 @@ -398,8 +439,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 @@ -421,8 +464,10 @@ def post_list_operations( def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -1102,6 +1147,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -1318,6 +1367,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -1524,6 +1577,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}", @@ -1740,6 +1797,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, ], "google.longrunning.Operations.ListOperations": [ { @@ -1938,6 +1999,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*}/operations", @@ -2154,6 +2219,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*}/operations", + }, ], "google.longrunning.Operations.WaitOperation": [ { @@ -2352,6 +2421,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "post", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}:wait", @@ -2564,6 +2637,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, ], } @@ -2620,7 +2697,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 cancel tuning job method over HTTP. @@ -2631,13 +2708,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 = ( _BaseGenAiTuningServiceRestTransport._BaseCancelTuningJob._get_http_options() ) + request, metadata = self._interceptor.pre_cancel_tuning_job( request, metadata ) @@ -2654,6 +2734,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.aiplatform_v1beta1.GenAiTuningServiceClient.CancelTuningJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.GenAiTuningService", + "rpcName": "CancelTuningJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = GenAiTuningServiceRestTransport._CancelTuningJob._get_response( self._host, @@ -2707,7 +2814,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]]] = (), ) -> gca_tuning_job.TuningJob: r"""Call the create tuning job method over HTTP. @@ -2718,8 +2825,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: ~.gca_tuning_job.TuningJob: @@ -2731,6 +2840,7 @@ def __call__( http_options = ( _BaseGenAiTuningServiceRestTransport._BaseCreateTuningJob._get_http_options() ) + request, metadata = self._interceptor.pre_create_tuning_job( request, metadata ) @@ -2747,6 +2857,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.aiplatform_v1beta1.GenAiTuningServiceClient.CreateTuningJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.GenAiTuningService", + "rpcName": "CreateTuningJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = GenAiTuningServiceRestTransport._CreateTuningJob._get_response( self._host, @@ -2768,7 +2905,29 @@ def __call__( pb_resp = gca_tuning_job.TuningJob.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_create_tuning_job(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gca_tuning_job.TuningJob.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.aiplatform_v1beta1.GenAiTuningServiceClient.create_tuning_job", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.GenAiTuningService", + "rpcName": "CreateTuningJob", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _GetTuningJob( @@ -2807,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]]] = (), ) -> tuning_job.TuningJob: r"""Call the get tuning job method over HTTP. @@ -2818,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: ~.tuning_job.TuningJob: @@ -2831,6 +2992,7 @@ def __call__( http_options = ( _BaseGenAiTuningServiceRestTransport._BaseGetTuningJob._get_http_options() ) + request, metadata = self._interceptor.pre_get_tuning_job(request, metadata) transcoded_request = _BaseGenAiTuningServiceRestTransport._BaseGetTuningJob._get_transcoded_request( http_options, request @@ -2841,6 +3003,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.aiplatform_v1beta1.GenAiTuningServiceClient.GetTuningJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.GenAiTuningService", + "rpcName": "GetTuningJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = GenAiTuningServiceRestTransport._GetTuningJob._get_response( self._host, @@ -2861,7 +3050,29 @@ def __call__( pb_resp = tuning_job.TuningJob.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_tuning_job(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = tuning_job.TuningJob.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.aiplatform_v1beta1.GenAiTuningServiceClient.get_tuning_job", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.GenAiTuningService", + "rpcName": "GetTuningJob", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListTuningJobs( @@ -2900,7 +3111,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]]] = (), ) -> genai_tuning_service.ListTuningJobsResponse: r"""Call the list tuning jobs method over HTTP. @@ -2911,8 +3122,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: ~.genai_tuning_service.ListTuningJobsResponse: @@ -2924,6 +3137,7 @@ def __call__( http_options = ( _BaseGenAiTuningServiceRestTransport._BaseListTuningJobs._get_http_options() ) + request, metadata = self._interceptor.pre_list_tuning_jobs( request, metadata ) @@ -2936,6 +3150,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.aiplatform_v1beta1.GenAiTuningServiceClient.ListTuningJobs", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.GenAiTuningService", + "rpcName": "ListTuningJobs", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = GenAiTuningServiceRestTransport._ListTuningJobs._get_response( self._host, @@ -2956,7 +3197,31 @@ def __call__( pb_resp = genai_tuning_service.ListTuningJobsResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_tuning_jobs(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + genai_tuning_service.ListTuningJobsResponse.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.aiplatform_v1beta1.GenAiTuningServiceClient.list_tuning_jobs", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.GenAiTuningService", + "rpcName": "ListTuningJobs", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _RebaseTunedModel( @@ -2996,7 +3261,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 rebase tuned model method over HTTP. @@ -3007,8 +3272,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: @@ -3021,6 +3288,7 @@ def __call__( http_options = ( _BaseGenAiTuningServiceRestTransport._BaseRebaseTunedModel._get_http_options() ) + request, metadata = self._interceptor.pre_rebase_tuned_model( request, metadata ) @@ -3037,6 +3305,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.aiplatform_v1beta1.GenAiTuningServiceClient.RebaseTunedModel", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.GenAiTuningService", + "rpcName": "RebaseTunedModel", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = GenAiTuningServiceRestTransport._RebaseTunedModel._get_response( self._host, @@ -3056,7 +3351,29 @@ def __call__( # Return the response resp = operations_pb2.Operation() json_format.Parse(response.content, resp, ignore_unknown_fields=True) + resp = self._interceptor.post_rebase_tuned_model(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.aiplatform_v1beta1.GenAiTuningServiceClient.rebase_tuned_model", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.GenAiTuningService", + "rpcName": "RebaseTunedModel", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp @property @@ -3146,7 +3463,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]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -3157,8 +3474,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: locations_pb2.Location: Response from GetLocation method. @@ -3167,6 +3486,7 @@ def __call__( http_options = ( _BaseGenAiTuningServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = self._interceptor.pre_get_location(request, metadata) transcoded_request = _BaseGenAiTuningServiceRestTransport._BaseGetLocation._get_transcoded_request( http_options, request @@ -3177,6 +3497,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.aiplatform_v1beta1.GenAiTuningServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.GenAiTuningService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = GenAiTuningServiceRestTransport._GetLocation._get_response( self._host, @@ -3196,6 +3543,27 @@ def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_location(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.aiplatform_v1beta1.GenAiTuningServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.GenAiTuningService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3238,7 +3606,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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -3249,8 +3617,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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -3259,6 +3629,7 @@ def __call__( http_options = ( _BaseGenAiTuningServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = self._interceptor.pre_list_locations(request, metadata) transcoded_request = _BaseGenAiTuningServiceRestTransport._BaseListLocations._get_transcoded_request( http_options, request @@ -3269,6 +3640,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.aiplatform_v1beta1.GenAiTuningServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.GenAiTuningService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = GenAiTuningServiceRestTransport._ListLocations._get_response( self._host, @@ -3288,6 +3686,27 @@ def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_list_locations(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.aiplatform_v1beta1.GenAiTuningServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.GenAiTuningService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3331,7 +3750,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]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -3342,8 +3761,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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -3352,6 +3773,7 @@ def __call__( http_options = ( _BaseGenAiTuningServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_get_iam_policy(request, metadata) transcoded_request = _BaseGenAiTuningServiceRestTransport._BaseGetIamPolicy._get_transcoded_request( http_options, request @@ -3366,6 +3788,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.aiplatform_v1beta1.GenAiTuningServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.GenAiTuningService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = GenAiTuningServiceRestTransport._GetIamPolicy._get_response( self._host, @@ -3386,6 +3835,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_iam_policy(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.aiplatform_v1beta1.GenAiTuningServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.GenAiTuningService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3429,7 +3899,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]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -3440,8 +3910,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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -3450,6 +3922,7 @@ def __call__( http_options = ( _BaseGenAiTuningServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_set_iam_policy(request, metadata) transcoded_request = _BaseGenAiTuningServiceRestTransport._BaseSetIamPolicy._get_transcoded_request( http_options, request @@ -3464,6 +3937,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.aiplatform_v1beta1.GenAiTuningServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.GenAiTuningService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = GenAiTuningServiceRestTransport._SetIamPolicy._get_response( self._host, @@ -3484,6 +3984,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_set_iam_policy(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.aiplatform_v1beta1.GenAiTuningServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.GenAiTuningService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3527,7 +4048,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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -3538,8 +4059,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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -3548,6 +4071,7 @@ def __call__( http_options = ( _BaseGenAiTuningServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -3564,6 +4088,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.aiplatform_v1beta1.GenAiTuningServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.GenAiTuningService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( GenAiTuningServiceRestTransport._TestIamPermissions._get_response( @@ -3586,6 +4137,27 @@ def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_test_iam_permissions(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.aiplatform_v1beta1.GenAiTuningServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.GenAiTuningService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3628,7 +4200,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 cancel operation method over HTTP. @@ -3639,13 +4211,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 = ( _BaseGenAiTuningServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = self._interceptor.pre_cancel_operation( request, metadata ) @@ -3658,6 +4233,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.aiplatform_v1beta1.GenAiTuningServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.GenAiTuningService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = GenAiTuningServiceRestTransport._CancelOperation._get_response( self._host, @@ -3715,7 +4317,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. @@ -3726,13 +4328,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 = ( _BaseGenAiTuningServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = self._interceptor.pre_delete_operation( request, metadata ) @@ -3745,6 +4350,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.aiplatform_v1beta1.GenAiTuningServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.GenAiTuningService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = GenAiTuningServiceRestTransport._DeleteOperation._get_response( self._host, @@ -3802,7 +4434,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. @@ -3813,8 +4445,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. @@ -3823,6 +4457,7 @@ def __call__( http_options = ( _BaseGenAiTuningServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = self._interceptor.pre_get_operation(request, metadata) transcoded_request = _BaseGenAiTuningServiceRestTransport._BaseGetOperation._get_transcoded_request( http_options, request @@ -3833,6 +4468,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.aiplatform_v1beta1.GenAiTuningServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.GenAiTuningService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = GenAiTuningServiceRestTransport._GetOperation._get_response( self._host, @@ -3852,6 +4514,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.aiplatform_v1beta1.GenAiTuningServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.GenAiTuningService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3894,7 +4577,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. @@ -3905,8 +4588,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. @@ -3915,6 +4600,7 @@ def __call__( http_options = ( _BaseGenAiTuningServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = self._interceptor.pre_list_operations(request, metadata) transcoded_request = _BaseGenAiTuningServiceRestTransport._BaseListOperations._get_transcoded_request( http_options, request @@ -3925,6 +4611,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.aiplatform_v1beta1.GenAiTuningServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.GenAiTuningService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = GenAiTuningServiceRestTransport._ListOperations._get_response( self._host, @@ -3944,6 +4657,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.aiplatform_v1beta1.GenAiTuningServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.GenAiTuningService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3986,7 +4720,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 wait operation method over HTTP. @@ -3997,8 +4731,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 WaitOperation method. @@ -4007,6 +4743,7 @@ def __call__( http_options = ( _BaseGenAiTuningServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = self._interceptor.pre_wait_operation(request, metadata) transcoded_request = _BaseGenAiTuningServiceRestTransport._BaseWaitOperation._get_transcoded_request( http_options, request @@ -4017,6 +4754,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.aiplatform_v1beta1.GenAiTuningServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.GenAiTuningService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = GenAiTuningServiceRestTransport._WaitOperation._get_response( self._host, @@ -4036,6 +4800,27 @@ def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = self._interceptor.post_wait_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.aiplatform_v1beta1.GenAiTuningServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.GenAiTuningService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1beta1/services/gen_ai_tuning_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1beta1/services/gen_ai_tuning_service/transports/rest_asyncio.py index 6a33b5c054..07cbe30639 100644 --- a/google/cloud/aiplatform_v1beta1/services/gen_ai_tuning_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/gen_ai_tuning_service/transports/rest_asyncio.py @@ -61,6 +61,18 @@ from .base import DEFAULT_CLIENT_INFO as BASE_DEFAULT_CLIENT_INFO + +import logging + +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__) + try: OptionalRetry = Union[retries.AsyncRetry, gapic_v1.method._MethodDefault, None] except AttributeError: # pragma: NO COVER @@ -133,8 +145,11 @@ async def post_rebase_tuned_model(self, response): async def pre_cancel_tuning_job( self, request: genai_tuning_service.CancelTuningJobRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[genai_tuning_service.CancelTuningJobRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + genai_tuning_service.CancelTuningJobRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for cancel_tuning_job Override in a subclass to manipulate the request or metadata @@ -145,8 +160,11 @@ async def pre_cancel_tuning_job( async def pre_create_tuning_job( self, request: genai_tuning_service.CreateTuningJobRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[genai_tuning_service.CreateTuningJobRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + genai_tuning_service.CreateTuningJobRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for create_tuning_job Override in a subclass to manipulate the request or metadata @@ -168,8 +186,11 @@ async def post_create_tuning_job( async def pre_get_tuning_job( self, request: genai_tuning_service.GetTuningJobRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[genai_tuning_service.GetTuningJobRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + genai_tuning_service.GetTuningJobRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for get_tuning_job Override in a subclass to manipulate the request or metadata @@ -191,8 +212,11 @@ async def post_get_tuning_job( async def pre_list_tuning_jobs( self, request: genai_tuning_service.ListTuningJobsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[genai_tuning_service.ListTuningJobsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + genai_tuning_service.ListTuningJobsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for list_tuning_jobs Override in a subclass to manipulate the request or metadata @@ -214,8 +238,11 @@ async def post_list_tuning_jobs( async def pre_rebase_tuned_model( self, request: genai_tuning_service.RebaseTunedModelRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[genai_tuning_service.RebaseTunedModelRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + genai_tuning_service.RebaseTunedModelRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for rebase_tuned_model Override in a subclass to manipulate the request or metadata @@ -237,8 +264,10 @@ async def post_rebase_tuned_model( async def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -260,8 +289,10 @@ async def post_get_location( async def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -283,8 +314,10 @@ async def post_list_locations( async def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -306,8 +339,10 @@ async def post_get_iam_policy( async def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -329,8 +364,11 @@ async def post_set_iam_policy( async def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -352,8 +390,10 @@ async def post_test_iam_permissions( async def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -373,8 +413,10 @@ async def post_cancel_operation(self, response: None) -> None: async 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 @@ -394,8 +436,10 @@ async def post_delete_operation(self, response: None) -> None: async 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 @@ -417,8 +461,10 @@ async def post_get_operation( async 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 @@ -440,8 +486,10 @@ async def post_list_operations( async def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -647,7 +695,7 @@ async 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 cancel tuning job method over HTTP. @@ -658,13 +706,16 @@ async def __call__( 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`. """ http_options = ( _BaseGenAiTuningServiceRestTransport._BaseCancelTuningJob._get_http_options() ) + request, metadata = await self._interceptor.pre_cancel_tuning_job( request, metadata ) @@ -681,6 +732,33 @@ async 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.aiplatform_v1beta1.GenAiTuningServiceClient.CancelTuningJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.GenAiTuningService", + "rpcName": "CancelTuningJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncGenAiTuningServiceRestTransport._CancelTuningJob._get_response( self._host, @@ -740,7 +818,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> gca_tuning_job.TuningJob: r"""Call the create tuning job method over HTTP. @@ -751,8 +829,10 @@ async def __call__( 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: ~.gca_tuning_job.TuningJob: @@ -764,6 +844,7 @@ async def __call__( http_options = ( _BaseGenAiTuningServiceRestTransport._BaseCreateTuningJob._get_http_options() ) + request, metadata = await self._interceptor.pre_create_tuning_job( request, metadata ) @@ -780,6 +861,33 @@ async 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.aiplatform_v1beta1.GenAiTuningServiceClient.CreateTuningJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.GenAiTuningService", + "rpcName": "CreateTuningJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncGenAiTuningServiceRestTransport._CreateTuningJob._get_response( self._host, @@ -808,6 +916,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_create_tuning_job(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gca_tuning_job.TuningJob.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.GenAiTuningServiceAsyncClient.create_tuning_job", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.GenAiTuningService", + "rpcName": "CreateTuningJob", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _GetTuningJob( @@ -846,7 +976,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> tuning_job.TuningJob: r"""Call the get tuning job method over HTTP. @@ -857,8 +987,10 @@ async def __call__( 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: ~.tuning_job.TuningJob: @@ -870,6 +1002,7 @@ async def __call__( http_options = ( _BaseGenAiTuningServiceRestTransport._BaseGetTuningJob._get_http_options() ) + request, metadata = await self._interceptor.pre_get_tuning_job( request, metadata ) @@ -882,6 +1015,33 @@ async 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.aiplatform_v1beta1.GenAiTuningServiceClient.GetTuningJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.GenAiTuningService", + "rpcName": "GetTuningJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncGenAiTuningServiceRestTransport._GetTuningJob._get_response( @@ -911,6 +1071,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_get_tuning_job(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = tuning_job.TuningJob.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.GenAiTuningServiceAsyncClient.get_tuning_job", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.GenAiTuningService", + "rpcName": "GetTuningJob", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ListTuningJobs( @@ -949,7 +1131,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> genai_tuning_service.ListTuningJobsResponse: r"""Call the list tuning jobs method over HTTP. @@ -960,8 +1142,10 @@ async def __call__( 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: ~.genai_tuning_service.ListTuningJobsResponse: @@ -973,6 +1157,7 @@ async def __call__( http_options = ( _BaseGenAiTuningServiceRestTransport._BaseListTuningJobs._get_http_options() ) + request, metadata = await self._interceptor.pre_list_tuning_jobs( request, metadata ) @@ -985,6 +1170,33 @@ async 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.aiplatform_v1beta1.GenAiTuningServiceClient.ListTuningJobs", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.GenAiTuningService", + "rpcName": "ListTuningJobs", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncGenAiTuningServiceRestTransport._ListTuningJobs._get_response( self._host, @@ -1012,6 +1224,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_list_tuning_jobs(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + genai_tuning_service.ListTuningJobsResponse.to_json(response) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.GenAiTuningServiceAsyncClient.list_tuning_jobs", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.GenAiTuningService", + "rpcName": "ListTuningJobs", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _RebaseTunedModel( @@ -1051,7 +1287,7 @@ async 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 rebase tuned model method over HTTP. @@ -1062,8 +1298,10 @@ async def __call__( 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: @@ -1076,6 +1314,7 @@ async def __call__( http_options = ( _BaseGenAiTuningServiceRestTransport._BaseRebaseTunedModel._get_http_options() ) + request, metadata = await self._interceptor.pre_rebase_tuned_model( request, metadata ) @@ -1092,6 +1331,33 @@ async 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.aiplatform_v1beta1.GenAiTuningServiceClient.RebaseTunedModel", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.GenAiTuningService", + "rpcName": "RebaseTunedModel", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncGenAiTuningServiceRestTransport._RebaseTunedModel._get_response( self._host, @@ -1120,6 +1386,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_rebase_tuned_model(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.GenAiTuningServiceAsyncClient.rebase_tuned_model", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.GenAiTuningService", + "rpcName": "RebaseTunedModel", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp @property @@ -1695,6 +1983,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -1911,6 +2203,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -2117,6 +2413,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}", @@ -2333,6 +2633,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, ], "google.longrunning.Operations.ListOperations": [ { @@ -2531,6 +2835,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*}/operations", @@ -2747,6 +3055,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*}/operations", + }, ], "google.longrunning.Operations.WaitOperation": [ { @@ -2945,6 +3257,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "post", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}:wait", @@ -3157,6 +3473,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, ], } @@ -3252,7 +3572,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -3263,8 +3583,10 @@ async def __call__( 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: locations_pb2.Location: Response from GetLocation method. @@ -3273,6 +3595,7 @@ async def __call__( http_options = ( _BaseGenAiTuningServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_location( request, metadata ) @@ -3285,6 +3608,33 @@ async 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.aiplatform_v1beta1.GenAiTuningServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.GenAiTuningService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncGenAiTuningServiceRestTransport._GetLocation._get_response( @@ -3312,6 +3662,27 @@ async def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_location(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.aiplatform_v1beta1.GenAiTuningServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.GenAiTuningService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3354,7 +3725,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -3365,8 +3736,10 @@ async def __call__( 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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -3375,6 +3748,7 @@ async def __call__( http_options = ( _BaseGenAiTuningServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_locations( request, metadata ) @@ -3387,6 +3761,33 @@ async 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.aiplatform_v1beta1.GenAiTuningServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.GenAiTuningService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncGenAiTuningServiceRestTransport._ListLocations._get_response( @@ -3414,6 +3815,27 @@ async def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_list_locations(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.aiplatform_v1beta1.GenAiTuningServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.GenAiTuningService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3457,7 +3879,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -3468,8 +3890,10 @@ async def __call__( 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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -3478,6 +3902,7 @@ async def __call__( http_options = ( _BaseGenAiTuningServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_get_iam_policy( request, metadata ) @@ -3494,6 +3919,33 @@ async 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.aiplatform_v1beta1.GenAiTuningServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.GenAiTuningService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncGenAiTuningServiceRestTransport._GetIamPolicy._get_response( @@ -3522,6 +3974,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_iam_policy(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.aiplatform_v1beta1.GenAiTuningServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.GenAiTuningService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3565,7 +4038,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -3576,8 +4049,10 @@ async def __call__( 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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -3586,6 +4061,7 @@ async def __call__( http_options = ( _BaseGenAiTuningServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_set_iam_policy( request, metadata ) @@ -3602,6 +4078,33 @@ async 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.aiplatform_v1beta1.GenAiTuningServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.GenAiTuningService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncGenAiTuningServiceRestTransport._SetIamPolicy._get_response( @@ -3630,6 +4133,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_set_iam_policy(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.aiplatform_v1beta1.GenAiTuningServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.GenAiTuningService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3673,7 +4197,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -3684,8 +4208,10 @@ async def __call__( 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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -3694,6 +4220,7 @@ async def __call__( http_options = ( _BaseGenAiTuningServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = await self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -3710,6 +4237,33 @@ async 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.aiplatform_v1beta1.GenAiTuningServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.GenAiTuningService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncGenAiTuningServiceRestTransport._TestIamPermissions._get_response( self._host, @@ -3736,6 +4290,27 @@ async def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_test_iam_permissions(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.aiplatform_v1beta1.GenAiTuningServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.GenAiTuningService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3778,7 +4353,7 @@ async 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 cancel operation method over HTTP. @@ -3789,13 +4364,16 @@ async def __call__( 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`. """ http_options = ( _BaseGenAiTuningServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_cancel_operation( request, metadata ) @@ -3808,6 +4386,33 @@ async 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.aiplatform_v1beta1.GenAiTuningServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.GenAiTuningService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncGenAiTuningServiceRestTransport._CancelOperation._get_response( self._host, @@ -3871,7 +4476,7 @@ async 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. @@ -3882,13 +4487,16 @@ async def __call__( 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`. """ http_options = ( _BaseGenAiTuningServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_operation( request, metadata ) @@ -3901,6 +4509,33 @@ async 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.aiplatform_v1beta1.GenAiTuningServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.GenAiTuningService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncGenAiTuningServiceRestTransport._DeleteOperation._get_response( self._host, @@ -3964,7 +4599,7 @@ async 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. @@ -3975,8 +4610,10 @@ async def __call__( 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: Response from GetOperation method. @@ -3985,6 +4622,7 @@ async def __call__( http_options = ( _BaseGenAiTuningServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_operation( request, metadata ) @@ -3997,6 +4635,33 @@ async 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.aiplatform_v1beta1.GenAiTuningServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.GenAiTuningService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncGenAiTuningServiceRestTransport._GetOperation._get_response( @@ -4024,6 +4689,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1beta1.GenAiTuningServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.GenAiTuningService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4066,7 +4752,7 @@ async 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. @@ -4077,8 +4763,10 @@ async def __call__( 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 from ListOperations method. @@ -4087,6 +4775,7 @@ async def __call__( http_options = ( _BaseGenAiTuningServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_operations( request, metadata ) @@ -4099,6 +4788,33 @@ async 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.aiplatform_v1beta1.GenAiTuningServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.GenAiTuningService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncGenAiTuningServiceRestTransport._ListOperations._get_response( self._host, @@ -4124,6 +4840,27 @@ async def __call__( resp = operations_pb2.ListOperationsResponse() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1beta1.GenAiTuningServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.GenAiTuningService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4166,7 +4903,7 @@ async 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 wait operation method over HTTP. @@ -4177,8 +4914,10 @@ async def __call__( 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: Response from WaitOperation method. @@ -4187,6 +4926,7 @@ async def __call__( http_options = ( _BaseGenAiTuningServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_wait_operation( request, metadata ) @@ -4199,6 +4939,33 @@ async 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.aiplatform_v1beta1.GenAiTuningServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.GenAiTuningService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncGenAiTuningServiceRestTransport._WaitOperation._get_response( @@ -4226,6 +4993,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_wait_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.aiplatform_v1beta1.GenAiTuningServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.GenAiTuningService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1beta1/services/gen_ai_tuning_service/transports/rest_base.py b/google/cloud/aiplatform_v1beta1/services/gen_ai_tuning_service/transports/rest_base.py index 1356d1c730..87d777e74f 100644 --- a/google/cloud/aiplatform_v1beta1/services/gen_ai_tuning_service/transports/rest_base.py +++ b/google/cloud/aiplatform_v1beta1/services/gen_ai_tuning_service/transports/rest_base.py @@ -1277,6 +1277,10 @@ def _get_http_options(): "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -1493,6 +1497,10 @@ def _get_http_options(): "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -1718,6 +1726,10 @@ def _get_http_options(): "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}", @@ -1934,6 +1946,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, ] return http_options @@ -2151,6 +2167,10 @@ def _get_http_options(): "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*}/operations", @@ -2367,6 +2387,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*}/operations", + }, ] return http_options @@ -2584,6 +2608,10 @@ def _get_http_options(): "method": "post", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}:wait", @@ -2796,6 +2824,10 @@ def _get_http_options(): "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, ] return http_options diff --git a/google/cloud/aiplatform_v1beta1/services/index_endpoint_service/async_client.py b/google/cloud/aiplatform_v1beta1/services/index_endpoint_service/async_client.py index d2353f6905..c248b96cf5 100644 --- a/google/cloud/aiplatform_v1beta1/services/index_endpoint_service/async_client.py +++ b/google/cloud/aiplatform_v1beta1/services/index_endpoint_service/async_client.py @@ -13,6 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging as std_logging from collections import OrderedDict import re from typing import ( @@ -63,6 +64,15 @@ from .transports.grpc_asyncio import IndexEndpointServiceGrpcAsyncIOTransport from .client import IndexEndpointServiceClient +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 IndexEndpointServiceAsyncClient: """A service for managing Vertex AI's IndexEndpoints.""" @@ -280,6 +290,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.aiplatform_v1beta1.IndexEndpointServiceAsyncClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexEndpointService", + "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.aiplatform.v1beta1.IndexEndpointService", + "credentialsType": None, + }, + ) + async def create_index_endpoint( self, request: Optional[ @@ -290,7 +322,7 @@ async def create_index_endpoint( index_endpoint: Optional[gca_index_endpoint.IndexEndpoint] = 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"""Creates an IndexEndpoint. @@ -350,8 +382,10 @@ async def sample_create_index_endpoint(): 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: @@ -426,7 +460,7 @@ async def get_index_endpoint( 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]]] = (), ) -> index_endpoint.IndexEndpoint: r"""Gets an IndexEndpoint. @@ -471,8 +505,10 @@ async def sample_get_index_endpoint(): 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.aiplatform_v1beta1.types.IndexEndpoint: @@ -536,7 +572,7 @@ async def list_index_endpoints( 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.ListIndexEndpointsAsyncPager: r"""Lists IndexEndpoints in a Location. @@ -582,8 +618,10 @@ async def sample_list_index_endpoints(): 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.aiplatform_v1beta1.services.index_endpoint_service.pagers.ListIndexEndpointsAsyncPager: @@ -661,7 +699,7 @@ async def update_index_endpoint( 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]]] = (), ) -> gca_index_endpoint.IndexEndpoint: r"""Updates an IndexEndpoint. @@ -715,8 +753,10 @@ async def sample_update_index_endpoint(): 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.aiplatform_v1beta1.types.IndexEndpoint: @@ -784,7 +824,7 @@ async def delete_index_endpoint( 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"""Deletes an IndexEndpoint. @@ -833,8 +873,10 @@ async def sample_delete_index_endpoint(): 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: @@ -916,7 +958,7 @@ async def deploy_index( deployed_index: Optional[gca_index_endpoint.DeployedIndex] = 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"""Deploys an Index into this IndexEndpoint, creating a DeployedIndex within it. @@ -979,8 +1021,10 @@ async def sample_deploy_index(): 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: @@ -1058,7 +1102,7 @@ async def undeploy_index( deployed_index_id: 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"""Undeploys an Index from an IndexEndpoint, removing a DeployedIndex from it, and freeing all resources it's @@ -1117,8 +1161,10 @@ async def sample_undeploy_index(): 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: @@ -1196,7 +1242,7 @@ async def mutate_deployed_index( deployed_index: Optional[gca_index_endpoint.DeployedIndex] = 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 existing DeployedIndex under an IndexEndpoint. @@ -1260,8 +1306,10 @@ async def sample_mutate_deployed_index(): 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: @@ -1335,7 +1383,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. @@ -1346,8 +1394,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. @@ -1388,7 +1438,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. @@ -1399,8 +1449,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. @@ -1441,7 +1493,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. @@ -1457,8 +1509,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 """ @@ -1495,7 +1549,7 @@ async def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -1510,8 +1564,10 @@ async def cancel_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 """ @@ -1548,7 +1604,7 @@ async def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -1565,8 +1621,10 @@ async def wait_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. @@ -1607,7 +1665,7 @@ async def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -1620,8 +1678,10 @@ async def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -1726,7 +1786,7 @@ async def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -1740,8 +1800,10 @@ async def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -1846,7 +1908,7 @@ async def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -1861,8 +1923,10 @@ async def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -1906,7 +1970,7 @@ async def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -1917,8 +1981,10 @@ async def get_location( 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: ~.location_pb2.Location: Location object. @@ -1959,7 +2025,7 @@ async def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -1970,8 +2036,10 @@ async def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1beta1/services/index_endpoint_service/client.py b/google/cloud/aiplatform_v1beta1/services/index_endpoint_service/client.py index 4ea0892333..1a9d997b2a 100644 --- a/google/cloud/aiplatform_v1beta1/services/index_endpoint_service/client.py +++ b/google/cloud/aiplatform_v1beta1/services/index_endpoint_service/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 ( @@ -48,6 +49,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 as gac_operation # type: ignore from google.api_core import operation_async # type: ignore from google.cloud.aiplatform_v1beta1.services.index_endpoint_service import pagers @@ -653,6 +663,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( @@ -744,6 +758,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.aiplatform_v1beta1.IndexEndpointServiceClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexEndpointService", + "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.aiplatform.v1beta1.IndexEndpointService", + "credentialsType": None, + }, + ) + def create_index_endpoint( self, request: Optional[ @@ -754,7 +791,7 @@ def create_index_endpoint( index_endpoint: Optional[gca_index_endpoint.IndexEndpoint] = 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]]] = (), ) -> gac_operation.Operation: r"""Creates an IndexEndpoint. @@ -814,8 +851,10 @@ def sample_create_index_endpoint(): 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: @@ -887,7 +926,7 @@ def get_index_endpoint( 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]]] = (), ) -> index_endpoint.IndexEndpoint: r"""Gets an IndexEndpoint. @@ -932,8 +971,10 @@ def sample_get_index_endpoint(): 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.aiplatform_v1beta1.types.IndexEndpoint: @@ -994,7 +1035,7 @@ def list_index_endpoints( 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.ListIndexEndpointsPager: r"""Lists IndexEndpoints in a Location. @@ -1040,8 +1081,10 @@ def sample_list_index_endpoints(): 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.aiplatform_v1beta1.services.index_endpoint_service.pagers.ListIndexEndpointsPager: @@ -1116,7 +1159,7 @@ def update_index_endpoint( 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]]] = (), ) -> gca_index_endpoint.IndexEndpoint: r"""Updates an IndexEndpoint. @@ -1170,8 +1213,10 @@ def sample_update_index_endpoint(): 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.aiplatform_v1beta1.types.IndexEndpoint: @@ -1236,7 +1281,7 @@ def delete_index_endpoint( 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]]] = (), ) -> gac_operation.Operation: r"""Deletes an IndexEndpoint. @@ -1285,8 +1330,10 @@ def sample_delete_index_endpoint(): 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: @@ -1365,7 +1412,7 @@ def deploy_index( deployed_index: Optional[gca_index_endpoint.DeployedIndex] = 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]]] = (), ) -> gac_operation.Operation: r"""Deploys an Index into this IndexEndpoint, creating a DeployedIndex within it. @@ -1428,8 +1475,10 @@ def sample_deploy_index(): 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: @@ -1504,7 +1553,7 @@ def undeploy_index( deployed_index_id: 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]]] = (), ) -> gac_operation.Operation: r"""Undeploys an Index from an IndexEndpoint, removing a DeployedIndex from it, and freeing all resources it's @@ -1563,8 +1612,10 @@ def sample_undeploy_index(): 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: @@ -1639,7 +1690,7 @@ def mutate_deployed_index( deployed_index: Optional[gca_index_endpoint.DeployedIndex] = 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]]] = (), ) -> gac_operation.Operation: r"""Update an existing DeployedIndex under an IndexEndpoint. @@ -1703,8 +1754,10 @@ def sample_mutate_deployed_index(): 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: @@ -1788,7 +1841,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. @@ -1799,8 +1852,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. @@ -1841,7 +1896,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. @@ -1852,8 +1907,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. @@ -1894,7 +1951,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. @@ -1910,8 +1967,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 """ @@ -1948,7 +2007,7 @@ def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -1963,8 +2022,10 @@ def cancel_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 """ @@ -2001,7 +2062,7 @@ def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -2018,8 +2079,10 @@ def wait_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. @@ -2060,7 +2123,7 @@ def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -2073,8 +2136,10 @@ def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -2179,7 +2244,7 @@ def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -2193,8 +2258,10 @@ def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -2299,7 +2366,7 @@ def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -2314,8 +2381,10 @@ def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -2357,7 +2426,7 @@ def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -2368,8 +2437,10 @@ def get_location( 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: ~.location_pb2.Location: Location object. @@ -2410,7 +2481,7 @@ def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -2421,8 +2492,10 @@ def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1beta1/services/index_endpoint_service/pagers.py b/google/cloud/aiplatform_v1beta1/services/index_endpoint_service/pagers.py index 39506c02eb..e2fa93e96c 100644 --- a/google/cloud/aiplatform_v1beta1/services/index_endpoint_service/pagers.py +++ b/google/cloud/aiplatform_v1beta1/services/index_endpoint_service/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 = index_endpoint_service.ListIndexEndpointsRequest(request) @@ -143,7 +145,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. @@ -157,8 +159,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 = index_endpoint_service.ListIndexEndpointsRequest(request) diff --git a/google/cloud/aiplatform_v1beta1/services/index_endpoint_service/transports/grpc.py b/google/cloud/aiplatform_v1beta1/services/index_endpoint_service/transports/grpc.py index 48cc9fb7c5..9c93dfb6e0 100644 --- a/google/cloud/aiplatform_v1beta1/services/index_endpoint_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1beta1/services/index_endpoint_service/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 import warnings from typing import Callable, Dict, Optional, Sequence, Tuple, Union @@ -22,8 +25,11 @@ import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from google.cloud.aiplatform_v1beta1.types import index_endpoint from google.cloud.aiplatform_v1beta1.types import index_endpoint as gca_index_endpoint @@ -34,6 +40,81 @@ from google.longrunning import operations_pb2 # type: ignore from .base import IndexEndpointServiceTransport, DEFAULT_CLIENT_INFO +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.aiplatform.v1beta1.IndexEndpointService", + "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.aiplatform.v1beta1.IndexEndpointService", + "rpcName": client_call_details.method, + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class IndexEndpointServiceGrpcTransport(IndexEndpointServiceTransport): """gRPC backend transport for IndexEndpointService. @@ -188,7 +269,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 @@ -252,7 +338,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 @@ -278,7 +366,7 @@ def create_index_endpoint( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_index_endpoint" not in self._stubs: - self._stubs["create_index_endpoint"] = self.grpc_channel.unary_unary( + self._stubs["create_index_endpoint"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.IndexEndpointService/CreateIndexEndpoint", request_serializer=index_endpoint_service.CreateIndexEndpointRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -306,7 +394,7 @@ def get_index_endpoint( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_index_endpoint" not in self._stubs: - self._stubs["get_index_endpoint"] = self.grpc_channel.unary_unary( + self._stubs["get_index_endpoint"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.IndexEndpointService/GetIndexEndpoint", request_serializer=index_endpoint_service.GetIndexEndpointRequest.serialize, response_deserializer=index_endpoint.IndexEndpoint.deserialize, @@ -335,7 +423,7 @@ def list_index_endpoints( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_index_endpoints" not in self._stubs: - self._stubs["list_index_endpoints"] = self.grpc_channel.unary_unary( + self._stubs["list_index_endpoints"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.IndexEndpointService/ListIndexEndpoints", request_serializer=index_endpoint_service.ListIndexEndpointsRequest.serialize, response_deserializer=index_endpoint_service.ListIndexEndpointsResponse.deserialize, @@ -364,7 +452,7 @@ def update_index_endpoint( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_index_endpoint" not in self._stubs: - self._stubs["update_index_endpoint"] = self.grpc_channel.unary_unary( + self._stubs["update_index_endpoint"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.IndexEndpointService/UpdateIndexEndpoint", request_serializer=index_endpoint_service.UpdateIndexEndpointRequest.serialize, response_deserializer=gca_index_endpoint.IndexEndpoint.deserialize, @@ -392,7 +480,7 @@ def delete_index_endpoint( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_index_endpoint" not in self._stubs: - self._stubs["delete_index_endpoint"] = self.grpc_channel.unary_unary( + self._stubs["delete_index_endpoint"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.IndexEndpointService/DeleteIndexEndpoint", request_serializer=index_endpoint_service.DeleteIndexEndpointRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -422,7 +510,7 @@ def deploy_index( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "deploy_index" not in self._stubs: - self._stubs["deploy_index"] = self.grpc_channel.unary_unary( + self._stubs["deploy_index"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.IndexEndpointService/DeployIndex", request_serializer=index_endpoint_service.DeployIndexRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -452,7 +540,7 @@ def undeploy_index( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "undeploy_index" not in self._stubs: - self._stubs["undeploy_index"] = self.grpc_channel.unary_unary( + self._stubs["undeploy_index"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.IndexEndpointService/UndeployIndex", request_serializer=index_endpoint_service.UndeployIndexRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -481,7 +569,7 @@ def mutate_deployed_index( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "mutate_deployed_index" not in self._stubs: - self._stubs["mutate_deployed_index"] = self.grpc_channel.unary_unary( + self._stubs["mutate_deployed_index"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.IndexEndpointService/MutateDeployedIndex", request_serializer=index_endpoint_service.MutateDeployedIndexRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -489,7 +577,7 @@ def mutate_deployed_index( return self._stubs["mutate_deployed_index"] def close(self): - self.grpc_channel.close() + self._logged_channel.close() @property def delete_operation( @@ -501,7 +589,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, @@ -518,7 +606,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -535,7 +623,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -552,7 +640,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, @@ -571,7 +659,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, @@ -590,7 +678,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -607,7 +695,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -632,7 +720,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -658,7 +746,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -687,7 +775,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1beta1/services/index_endpoint_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1beta1/services/index_endpoint_service/transports/grpc_asyncio.py index d7f0cf4851..63721718f0 100644 --- a/google/cloud/aiplatform_v1beta1/services/index_endpoint_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/index_endpoint_service/transports/grpc_asyncio.py @@ -14,6 +14,9 @@ # limitations under the License. # import inspect +import json +import pickle +import logging as std_logging import warnings from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union @@ -24,8 +27,11 @@ from google.api_core import operations_v1 from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from grpc.experimental import aio # type: ignore from google.cloud.aiplatform_v1beta1.types import index_endpoint @@ -38,6 +44,82 @@ from .base import IndexEndpointServiceTransport, DEFAULT_CLIENT_INFO from .grpc import IndexEndpointServiceGrpcTransport +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.aiplatform.v1beta1.IndexEndpointService", + "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.aiplatform.v1beta1.IndexEndpointService", + "rpcName": str(client_call_details.method), + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class IndexEndpointServiceGrpcAsyncIOTransport(IndexEndpointServiceTransport): """gRPC AsyncIO backend transport for IndexEndpointService. @@ -235,10 +317,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 @@ -261,7 +346,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. @@ -289,7 +374,7 @@ def create_index_endpoint( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_index_endpoint" not in self._stubs: - self._stubs["create_index_endpoint"] = self.grpc_channel.unary_unary( + self._stubs["create_index_endpoint"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.IndexEndpointService/CreateIndexEndpoint", request_serializer=index_endpoint_service.CreateIndexEndpointRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -318,7 +403,7 @@ def get_index_endpoint( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_index_endpoint" not in self._stubs: - self._stubs["get_index_endpoint"] = self.grpc_channel.unary_unary( + self._stubs["get_index_endpoint"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.IndexEndpointService/GetIndexEndpoint", request_serializer=index_endpoint_service.GetIndexEndpointRequest.serialize, response_deserializer=index_endpoint.IndexEndpoint.deserialize, @@ -347,7 +432,7 @@ def list_index_endpoints( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_index_endpoints" not in self._stubs: - self._stubs["list_index_endpoints"] = self.grpc_channel.unary_unary( + self._stubs["list_index_endpoints"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.IndexEndpointService/ListIndexEndpoints", request_serializer=index_endpoint_service.ListIndexEndpointsRequest.serialize, response_deserializer=index_endpoint_service.ListIndexEndpointsResponse.deserialize, @@ -376,7 +461,7 @@ def update_index_endpoint( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_index_endpoint" not in self._stubs: - self._stubs["update_index_endpoint"] = self.grpc_channel.unary_unary( + self._stubs["update_index_endpoint"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.IndexEndpointService/UpdateIndexEndpoint", request_serializer=index_endpoint_service.UpdateIndexEndpointRequest.serialize, response_deserializer=gca_index_endpoint.IndexEndpoint.deserialize, @@ -405,7 +490,7 @@ def delete_index_endpoint( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_index_endpoint" not in self._stubs: - self._stubs["delete_index_endpoint"] = self.grpc_channel.unary_unary( + self._stubs["delete_index_endpoint"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.IndexEndpointService/DeleteIndexEndpoint", request_serializer=index_endpoint_service.DeleteIndexEndpointRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -435,7 +520,7 @@ def deploy_index( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "deploy_index" not in self._stubs: - self._stubs["deploy_index"] = self.grpc_channel.unary_unary( + self._stubs["deploy_index"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.IndexEndpointService/DeployIndex", request_serializer=index_endpoint_service.DeployIndexRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -466,7 +551,7 @@ def undeploy_index( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "undeploy_index" not in self._stubs: - self._stubs["undeploy_index"] = self.grpc_channel.unary_unary( + self._stubs["undeploy_index"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.IndexEndpointService/UndeployIndex", request_serializer=index_endpoint_service.UndeployIndexRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -496,7 +581,7 @@ def mutate_deployed_index( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "mutate_deployed_index" not in self._stubs: - self._stubs["mutate_deployed_index"] = self.grpc_channel.unary_unary( + self._stubs["mutate_deployed_index"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.IndexEndpointService/MutateDeployedIndex", request_serializer=index_endpoint_service.MutateDeployedIndexRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -604,7 +689,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: @@ -620,7 +705,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, @@ -637,7 +722,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -654,7 +739,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -671,7 +756,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, @@ -690,7 +775,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, @@ -709,7 +794,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -726,7 +811,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -751,7 +836,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -777,7 +862,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -806,7 +891,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1beta1/services/index_endpoint_service/transports/rest.py b/google/cloud/aiplatform_v1beta1/services/index_endpoint_service/transports/rest.py index 4e3cba09da..1ec05401b7 100644 --- a/google/cloud/aiplatform_v1beta1/services/index_endpoint_service/transports/rest.py +++ b/google/cloud/aiplatform_v1beta1/services/index_endpoint_service/transports/rest.py @@ -13,9 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging +import json # type: ignore from google.auth.transport.requests import AuthorizedSession # type: ignore -import json # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.api_core import exceptions as core_exceptions from google.api_core import retry as retries @@ -49,6 +50,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, @@ -145,9 +154,10 @@ def post_update_index_endpoint(self, response): def pre_create_index_endpoint( self, request: index_endpoint_service.CreateIndexEndpointRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - index_endpoint_service.CreateIndexEndpointRequest, Sequence[Tuple[str, str]] + index_endpoint_service.CreateIndexEndpointRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for create_index_endpoint @@ -170,9 +180,10 @@ def post_create_index_endpoint( def pre_delete_index_endpoint( self, request: index_endpoint_service.DeleteIndexEndpointRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - index_endpoint_service.DeleteIndexEndpointRequest, Sequence[Tuple[str, str]] + index_endpoint_service.DeleteIndexEndpointRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for delete_index_endpoint @@ -195,8 +206,11 @@ def post_delete_index_endpoint( def pre_deploy_index( self, request: index_endpoint_service.DeployIndexRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[index_endpoint_service.DeployIndexRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + index_endpoint_service.DeployIndexRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for deploy_index Override in a subclass to manipulate the request or metadata @@ -218,9 +232,10 @@ def post_deploy_index( def pre_get_index_endpoint( self, request: index_endpoint_service.GetIndexEndpointRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - index_endpoint_service.GetIndexEndpointRequest, Sequence[Tuple[str, str]] + index_endpoint_service.GetIndexEndpointRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for get_index_endpoint @@ -243,9 +258,10 @@ def post_get_index_endpoint( def pre_list_index_endpoints( self, request: index_endpoint_service.ListIndexEndpointsRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - index_endpoint_service.ListIndexEndpointsRequest, Sequence[Tuple[str, str]] + index_endpoint_service.ListIndexEndpointsRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for list_index_endpoints @@ -268,9 +284,10 @@ def post_list_index_endpoints( def pre_mutate_deployed_index( self, request: index_endpoint_service.MutateDeployedIndexRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - index_endpoint_service.MutateDeployedIndexRequest, Sequence[Tuple[str, str]] + index_endpoint_service.MutateDeployedIndexRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for mutate_deployed_index @@ -293,8 +310,11 @@ def post_mutate_deployed_index( def pre_undeploy_index( self, request: index_endpoint_service.UndeployIndexRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[index_endpoint_service.UndeployIndexRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + index_endpoint_service.UndeployIndexRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for undeploy_index Override in a subclass to manipulate the request or metadata @@ -316,9 +336,10 @@ def post_undeploy_index( def pre_update_index_endpoint( self, request: index_endpoint_service.UpdateIndexEndpointRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - index_endpoint_service.UpdateIndexEndpointRequest, Sequence[Tuple[str, str]] + index_endpoint_service.UpdateIndexEndpointRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for update_index_endpoint @@ -341,8 +362,10 @@ def post_update_index_endpoint( def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -364,8 +387,10 @@ def post_get_location( def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -387,8 +412,10 @@ def post_list_locations( def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -408,8 +435,10 @@ def post_get_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -429,8 +458,11 @@ def post_set_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -452,8 +484,10 @@ def post_test_iam_permissions( def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -473,8 +507,10 @@ def post_cancel_operation(self, response: None) -> None: 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 @@ -494,8 +530,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 @@ -517,8 +555,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 @@ -540,8 +580,10 @@ def post_list_operations( def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -1221,6 +1263,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -1437,6 +1483,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -1643,6 +1693,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}", @@ -1859,6 +1913,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, ], "google.longrunning.Operations.ListOperations": [ { @@ -2057,6 +2115,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*}/operations", @@ -2273,6 +2335,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*}/operations", + }, ], "google.longrunning.Operations.WaitOperation": [ { @@ -2471,6 +2537,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "post", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}:wait", @@ -2683,6 +2753,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, ], } @@ -2739,7 +2813,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 index endpoint method over HTTP. @@ -2750,8 +2824,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: @@ -2764,6 +2840,7 @@ def __call__( http_options = ( _BaseIndexEndpointServiceRestTransport._BaseCreateIndexEndpoint._get_http_options() ) + request, metadata = self._interceptor.pre_create_index_endpoint( request, metadata ) @@ -2780,6 +2857,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.aiplatform_v1beta1.IndexEndpointServiceClient.CreateIndexEndpoint", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexEndpointService", + "rpcName": "CreateIndexEndpoint", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( IndexEndpointServiceRestTransport._CreateIndexEndpoint._get_response( @@ -2801,7 +2905,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_index_endpoint(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.aiplatform_v1beta1.IndexEndpointServiceClient.create_index_endpoint", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexEndpointService", + "rpcName": "CreateIndexEndpoint", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _DeleteIndexEndpoint( @@ -2840,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]]] = (), ) -> operations_pb2.Operation: r"""Call the delete index endpoint method over HTTP. @@ -2851,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: ~.operations_pb2.Operation: @@ -2865,6 +2993,7 @@ def __call__( http_options = ( _BaseIndexEndpointServiceRestTransport._BaseDeleteIndexEndpoint._get_http_options() ) + request, metadata = self._interceptor.pre_delete_index_endpoint( request, metadata ) @@ -2877,6 +3006,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.aiplatform_v1beta1.IndexEndpointServiceClient.DeleteIndexEndpoint", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexEndpointService", + "rpcName": "DeleteIndexEndpoint", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( IndexEndpointServiceRestTransport._DeleteIndexEndpoint._get_response( @@ -2897,7 +3053,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_index_endpoint(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.aiplatform_v1beta1.IndexEndpointServiceClient.delete_index_endpoint", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexEndpointService", + "rpcName": "DeleteIndexEndpoint", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _DeployIndex( @@ -2937,7 +3115,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 deploy index method over HTTP. @@ -2948,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: ~.operations_pb2.Operation: @@ -2962,6 +3142,7 @@ def __call__( http_options = ( _BaseIndexEndpointServiceRestTransport._BaseDeployIndex._get_http_options() ) + request, metadata = self._interceptor.pre_deploy_index(request, metadata) transcoded_request = _BaseIndexEndpointServiceRestTransport._BaseDeployIndex._get_transcoded_request( http_options, request @@ -2976,6 +3157,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.aiplatform_v1beta1.IndexEndpointServiceClient.DeployIndex", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexEndpointService", + "rpcName": "DeployIndex", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = IndexEndpointServiceRestTransport._DeployIndex._get_response( self._host, @@ -2995,7 +3203,29 @@ def __call__( # Return the response resp = operations_pb2.Operation() json_format.Parse(response.content, resp, ignore_unknown_fields=True) + resp = self._interceptor.post_deploy_index(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.aiplatform_v1beta1.IndexEndpointServiceClient.deploy_index", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexEndpointService", + "rpcName": "DeployIndex", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _GetIndexEndpoint( @@ -3034,7 +3264,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]]] = (), ) -> index_endpoint.IndexEndpoint: r"""Call the get index endpoint method over HTTP. @@ -3045,8 +3275,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: ~.index_endpoint.IndexEndpoint: @@ -3059,6 +3291,7 @@ def __call__( http_options = ( _BaseIndexEndpointServiceRestTransport._BaseGetIndexEndpoint._get_http_options() ) + request, metadata = self._interceptor.pre_get_index_endpoint( request, metadata ) @@ -3071,6 +3304,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.aiplatform_v1beta1.IndexEndpointServiceClient.GetIndexEndpoint", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexEndpointService", + "rpcName": "GetIndexEndpoint", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( IndexEndpointServiceRestTransport._GetIndexEndpoint._get_response( @@ -3093,7 +3353,29 @@ def __call__( pb_resp = index_endpoint.IndexEndpoint.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_index_endpoint(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = index_endpoint.IndexEndpoint.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.aiplatform_v1beta1.IndexEndpointServiceClient.get_index_endpoint", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexEndpointService", + "rpcName": "GetIndexEndpoint", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListIndexEndpoints( @@ -3132,7 +3414,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]]] = (), ) -> index_endpoint_service.ListIndexEndpointsResponse: r"""Call the list index endpoints method over HTTP. @@ -3143,8 +3425,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: ~.index_endpoint_service.ListIndexEndpointsResponse: @@ -3156,6 +3440,7 @@ def __call__( http_options = ( _BaseIndexEndpointServiceRestTransport._BaseListIndexEndpoints._get_http_options() ) + request, metadata = self._interceptor.pre_list_index_endpoints( request, metadata ) @@ -3168,6 +3453,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.aiplatform_v1beta1.IndexEndpointServiceClient.ListIndexEndpoints", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexEndpointService", + "rpcName": "ListIndexEndpoints", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( IndexEndpointServiceRestTransport._ListIndexEndpoints._get_response( @@ -3190,7 +3502,33 @@ def __call__( pb_resp = index_endpoint_service.ListIndexEndpointsResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_index_endpoints(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + index_endpoint_service.ListIndexEndpointsResponse.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.aiplatform_v1beta1.IndexEndpointServiceClient.list_index_endpoints", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexEndpointService", + "rpcName": "ListIndexEndpoints", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _MutateDeployedIndex( @@ -3230,7 +3568,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 mutate deployed index method over HTTP. @@ -3241,8 +3579,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: @@ -3255,6 +3595,7 @@ def __call__( http_options = ( _BaseIndexEndpointServiceRestTransport._BaseMutateDeployedIndex._get_http_options() ) + request, metadata = self._interceptor.pre_mutate_deployed_index( request, metadata ) @@ -3271,6 +3612,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.aiplatform_v1beta1.IndexEndpointServiceClient.MutateDeployedIndex", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexEndpointService", + "rpcName": "MutateDeployedIndex", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( IndexEndpointServiceRestTransport._MutateDeployedIndex._get_response( @@ -3292,7 +3660,29 @@ def __call__( # Return the response resp = operations_pb2.Operation() json_format.Parse(response.content, resp, ignore_unknown_fields=True) + resp = self._interceptor.post_mutate_deployed_index(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.aiplatform_v1beta1.IndexEndpointServiceClient.mutate_deployed_index", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexEndpointService", + "rpcName": "MutateDeployedIndex", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _UndeployIndex( @@ -3332,7 +3722,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 undeploy index method over HTTP. @@ -3343,8 +3733,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: @@ -3357,6 +3749,7 @@ def __call__( http_options = ( _BaseIndexEndpointServiceRestTransport._BaseUndeployIndex._get_http_options() ) + request, metadata = self._interceptor.pre_undeploy_index(request, metadata) transcoded_request = _BaseIndexEndpointServiceRestTransport._BaseUndeployIndex._get_transcoded_request( http_options, request @@ -3371,6 +3764,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.aiplatform_v1beta1.IndexEndpointServiceClient.UndeployIndex", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexEndpointService", + "rpcName": "UndeployIndex", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = IndexEndpointServiceRestTransport._UndeployIndex._get_response( self._host, @@ -3390,7 +3810,29 @@ def __call__( # Return the response resp = operations_pb2.Operation() json_format.Parse(response.content, resp, ignore_unknown_fields=True) + resp = self._interceptor.post_undeploy_index(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.aiplatform_v1beta1.IndexEndpointServiceClient.undeploy_index", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexEndpointService", + "rpcName": "UndeployIndex", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _UpdateIndexEndpoint( @@ -3430,7 +3872,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]]] = (), ) -> gca_index_endpoint.IndexEndpoint: r"""Call the update index endpoint method over HTTP. @@ -3441,8 +3883,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: ~.gca_index_endpoint.IndexEndpoint: @@ -3455,6 +3899,7 @@ def __call__( http_options = ( _BaseIndexEndpointServiceRestTransport._BaseUpdateIndexEndpoint._get_http_options() ) + request, metadata = self._interceptor.pre_update_index_endpoint( request, metadata ) @@ -3471,6 +3916,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.aiplatform_v1beta1.IndexEndpointServiceClient.UpdateIndexEndpoint", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexEndpointService", + "rpcName": "UpdateIndexEndpoint", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( IndexEndpointServiceRestTransport._UpdateIndexEndpoint._get_response( @@ -3494,7 +3966,31 @@ def __call__( pb_resp = gca_index_endpoint.IndexEndpoint.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_update_index_endpoint(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gca_index_endpoint.IndexEndpoint.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.aiplatform_v1beta1.IndexEndpointServiceClient.update_index_endpoint", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexEndpointService", + "rpcName": "UpdateIndexEndpoint", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp @property @@ -3619,7 +4115,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]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -3630,8 +4126,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: locations_pb2.Location: Response from GetLocation method. @@ -3640,6 +4138,7 @@ def __call__( http_options = ( _BaseIndexEndpointServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = self._interceptor.pre_get_location(request, metadata) transcoded_request = _BaseIndexEndpointServiceRestTransport._BaseGetLocation._get_transcoded_request( http_options, request @@ -3650,6 +4149,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.aiplatform_v1beta1.IndexEndpointServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexEndpointService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = IndexEndpointServiceRestTransport._GetLocation._get_response( self._host, @@ -3669,6 +4195,27 @@ def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_location(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.aiplatform_v1beta1.IndexEndpointServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexEndpointService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3711,7 +4258,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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -3722,8 +4269,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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -3732,6 +4281,7 @@ def __call__( http_options = ( _BaseIndexEndpointServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = self._interceptor.pre_list_locations(request, metadata) transcoded_request = _BaseIndexEndpointServiceRestTransport._BaseListLocations._get_transcoded_request( http_options, request @@ -3742,6 +4292,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.aiplatform_v1beta1.IndexEndpointServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexEndpointService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = IndexEndpointServiceRestTransport._ListLocations._get_response( self._host, @@ -3761,6 +4338,27 @@ def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_list_locations(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.aiplatform_v1beta1.IndexEndpointServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexEndpointService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3804,7 +4402,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]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -3815,8 +4413,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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -3825,6 +4425,7 @@ def __call__( http_options = ( _BaseIndexEndpointServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_get_iam_policy(request, metadata) transcoded_request = _BaseIndexEndpointServiceRestTransport._BaseGetIamPolicy._get_transcoded_request( http_options, request @@ -3839,6 +4440,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.aiplatform_v1beta1.IndexEndpointServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexEndpointService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = IndexEndpointServiceRestTransport._GetIamPolicy._get_response( self._host, @@ -3859,6 +4487,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_iam_policy(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.aiplatform_v1beta1.IndexEndpointServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexEndpointService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3902,7 +4551,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]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -3913,8 +4562,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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -3923,6 +4574,7 @@ def __call__( http_options = ( _BaseIndexEndpointServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_set_iam_policy(request, metadata) transcoded_request = _BaseIndexEndpointServiceRestTransport._BaseSetIamPolicy._get_transcoded_request( http_options, request @@ -3937,6 +4589,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.aiplatform_v1beta1.IndexEndpointServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexEndpointService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = IndexEndpointServiceRestTransport._SetIamPolicy._get_response( self._host, @@ -3957,6 +4636,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_set_iam_policy(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.aiplatform_v1beta1.IndexEndpointServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexEndpointService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4000,7 +4700,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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -4011,8 +4711,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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -4021,6 +4723,7 @@ def __call__( http_options = ( _BaseIndexEndpointServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -4037,6 +4740,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.aiplatform_v1beta1.IndexEndpointServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexEndpointService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( IndexEndpointServiceRestTransport._TestIamPermissions._get_response( @@ -4059,6 +4789,27 @@ def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_test_iam_permissions(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.aiplatform_v1beta1.IndexEndpointServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexEndpointService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4101,7 +4852,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 cancel operation method over HTTP. @@ -4112,13 +4863,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 = ( _BaseIndexEndpointServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = self._interceptor.pre_cancel_operation( request, metadata ) @@ -4131,6 +4885,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.aiplatform_v1beta1.IndexEndpointServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexEndpointService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = IndexEndpointServiceRestTransport._CancelOperation._get_response( self._host, @@ -4188,7 +4969,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. @@ -4199,13 +4980,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 = ( _BaseIndexEndpointServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = self._interceptor.pre_delete_operation( request, metadata ) @@ -4218,6 +5002,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.aiplatform_v1beta1.IndexEndpointServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexEndpointService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = IndexEndpointServiceRestTransport._DeleteOperation._get_response( self._host, @@ -4275,7 +5086,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. @@ -4286,8 +5097,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. @@ -4296,6 +5109,7 @@ def __call__( http_options = ( _BaseIndexEndpointServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = self._interceptor.pre_get_operation(request, metadata) transcoded_request = _BaseIndexEndpointServiceRestTransport._BaseGetOperation._get_transcoded_request( http_options, request @@ -4306,6 +5120,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.aiplatform_v1beta1.IndexEndpointServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexEndpointService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = IndexEndpointServiceRestTransport._GetOperation._get_response( self._host, @@ -4325,6 +5166,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.aiplatform_v1beta1.IndexEndpointServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexEndpointService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4367,7 +5229,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. @@ -4378,8 +5240,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. @@ -4388,6 +5252,7 @@ def __call__( http_options = ( _BaseIndexEndpointServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = self._interceptor.pre_list_operations(request, metadata) transcoded_request = _BaseIndexEndpointServiceRestTransport._BaseListOperations._get_transcoded_request( http_options, request @@ -4398,6 +5263,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.aiplatform_v1beta1.IndexEndpointServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexEndpointService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = IndexEndpointServiceRestTransport._ListOperations._get_response( self._host, @@ -4417,6 +5309,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.aiplatform_v1beta1.IndexEndpointServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexEndpointService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4459,7 +5372,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 wait operation method over HTTP. @@ -4470,8 +5383,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 WaitOperation method. @@ -4480,6 +5395,7 @@ def __call__( http_options = ( _BaseIndexEndpointServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = self._interceptor.pre_wait_operation(request, metadata) transcoded_request = _BaseIndexEndpointServiceRestTransport._BaseWaitOperation._get_transcoded_request( http_options, request @@ -4490,6 +5406,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.aiplatform_v1beta1.IndexEndpointServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexEndpointService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = IndexEndpointServiceRestTransport._WaitOperation._get_response( self._host, @@ -4509,6 +5452,27 @@ def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = self._interceptor.post_wait_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.aiplatform_v1beta1.IndexEndpointServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexEndpointService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1beta1/services/index_endpoint_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1beta1/services/index_endpoint_service/transports/rest_asyncio.py index 6022cc5e60..de82b44414 100644 --- a/google/cloud/aiplatform_v1beta1/services/index_endpoint_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/index_endpoint_service/transports/rest_asyncio.py @@ -60,6 +60,18 @@ from .base import DEFAULT_CLIENT_INFO as BASE_DEFAULT_CLIENT_INFO + +import logging + +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__) + try: OptionalRetry = Union[retries.AsyncRetry, gapic_v1.method._MethodDefault, None] except AttributeError: # pragma: NO COVER @@ -160,9 +172,10 @@ async def post_update_index_endpoint(self, response): async def pre_create_index_endpoint( self, request: index_endpoint_service.CreateIndexEndpointRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - index_endpoint_service.CreateIndexEndpointRequest, Sequence[Tuple[str, str]] + index_endpoint_service.CreateIndexEndpointRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for create_index_endpoint @@ -185,9 +198,10 @@ async def post_create_index_endpoint( async def pre_delete_index_endpoint( self, request: index_endpoint_service.DeleteIndexEndpointRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - index_endpoint_service.DeleteIndexEndpointRequest, Sequence[Tuple[str, str]] + index_endpoint_service.DeleteIndexEndpointRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for delete_index_endpoint @@ -210,8 +224,11 @@ async def post_delete_index_endpoint( async def pre_deploy_index( self, request: index_endpoint_service.DeployIndexRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[index_endpoint_service.DeployIndexRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + index_endpoint_service.DeployIndexRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for deploy_index Override in a subclass to manipulate the request or metadata @@ -233,9 +250,10 @@ async def post_deploy_index( async def pre_get_index_endpoint( self, request: index_endpoint_service.GetIndexEndpointRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - index_endpoint_service.GetIndexEndpointRequest, Sequence[Tuple[str, str]] + index_endpoint_service.GetIndexEndpointRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for get_index_endpoint @@ -258,9 +276,10 @@ async def post_get_index_endpoint( async def pre_list_index_endpoints( self, request: index_endpoint_service.ListIndexEndpointsRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - index_endpoint_service.ListIndexEndpointsRequest, Sequence[Tuple[str, str]] + index_endpoint_service.ListIndexEndpointsRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for list_index_endpoints @@ -283,9 +302,10 @@ async def post_list_index_endpoints( async def pre_mutate_deployed_index( self, request: index_endpoint_service.MutateDeployedIndexRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - index_endpoint_service.MutateDeployedIndexRequest, Sequence[Tuple[str, str]] + index_endpoint_service.MutateDeployedIndexRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for mutate_deployed_index @@ -308,8 +328,11 @@ async def post_mutate_deployed_index( async def pre_undeploy_index( self, request: index_endpoint_service.UndeployIndexRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[index_endpoint_service.UndeployIndexRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + index_endpoint_service.UndeployIndexRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for undeploy_index Override in a subclass to manipulate the request or metadata @@ -331,9 +354,10 @@ async def post_undeploy_index( async def pre_update_index_endpoint( self, request: index_endpoint_service.UpdateIndexEndpointRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - index_endpoint_service.UpdateIndexEndpointRequest, Sequence[Tuple[str, str]] + index_endpoint_service.UpdateIndexEndpointRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for update_index_endpoint @@ -356,8 +380,10 @@ async def post_update_index_endpoint( async def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -379,8 +405,10 @@ async def post_get_location( async def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -402,8 +430,10 @@ async def post_list_locations( async def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -425,8 +455,10 @@ async def post_get_iam_policy( async def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -448,8 +480,11 @@ async def post_set_iam_policy( async def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -471,8 +506,10 @@ async def post_test_iam_permissions( async def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -492,8 +529,10 @@ async def post_cancel_operation(self, response: None) -> None: async 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 @@ -513,8 +552,10 @@ async def post_delete_operation(self, response: None) -> None: async 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 @@ -536,8 +577,10 @@ async def post_get_operation( async 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 @@ -559,8 +602,10 @@ async def post_list_operations( async def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -781,7 +826,7 @@ async 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 index endpoint method over HTTP. @@ -792,8 +837,10 @@ async def __call__( 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: @@ -806,6 +853,7 @@ async def __call__( http_options = ( _BaseIndexEndpointServiceRestTransport._BaseCreateIndexEndpoint._get_http_options() ) + request, metadata = await self._interceptor.pre_create_index_endpoint( request, metadata ) @@ -822,6 +870,33 @@ async 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.aiplatform_v1beta1.IndexEndpointServiceClient.CreateIndexEndpoint", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexEndpointService", + "rpcName": "CreateIndexEndpoint", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncIndexEndpointServiceRestTransport._CreateIndexEndpoint._get_response( self._host, @@ -850,6 +925,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_create_index_endpoint(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.IndexEndpointServiceAsyncClient.create_index_endpoint", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexEndpointService", + "rpcName": "CreateIndexEndpoint", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _DeleteIndexEndpoint( @@ -888,7 +985,7 @@ async 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 index endpoint method over HTTP. @@ -899,8 +996,10 @@ async def __call__( 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: @@ -913,6 +1012,7 @@ async def __call__( http_options = ( _BaseIndexEndpointServiceRestTransport._BaseDeleteIndexEndpoint._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_index_endpoint( request, metadata ) @@ -925,6 +1025,33 @@ async 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.aiplatform_v1beta1.IndexEndpointServiceClient.DeleteIndexEndpoint", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexEndpointService", + "rpcName": "DeleteIndexEndpoint", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncIndexEndpointServiceRestTransport._DeleteIndexEndpoint._get_response( self._host, @@ -952,6 +1079,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_delete_index_endpoint(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.IndexEndpointServiceAsyncClient.delete_index_endpoint", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexEndpointService", + "rpcName": "DeleteIndexEndpoint", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _DeployIndex( @@ -991,7 +1140,7 @@ async 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 deploy index method over HTTP. @@ -1002,8 +1151,10 @@ async def __call__( 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: @@ -1016,6 +1167,7 @@ async def __call__( http_options = ( _BaseIndexEndpointServiceRestTransport._BaseDeployIndex._get_http_options() ) + request, metadata = await self._interceptor.pre_deploy_index( request, metadata ) @@ -1032,6 +1184,33 @@ async 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.aiplatform_v1beta1.IndexEndpointServiceClient.DeployIndex", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexEndpointService", + "rpcName": "DeployIndex", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncIndexEndpointServiceRestTransport._DeployIndex._get_response( @@ -1062,6 +1241,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_deploy_index(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.IndexEndpointServiceAsyncClient.deploy_index", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexEndpointService", + "rpcName": "DeployIndex", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _GetIndexEndpoint( @@ -1100,7 +1301,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> index_endpoint.IndexEndpoint: r"""Call the get index endpoint method over HTTP. @@ -1111,8 +1312,10 @@ async def __call__( 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: ~.index_endpoint.IndexEndpoint: @@ -1125,6 +1328,7 @@ async def __call__( http_options = ( _BaseIndexEndpointServiceRestTransport._BaseGetIndexEndpoint._get_http_options() ) + request, metadata = await self._interceptor.pre_get_index_endpoint( request, metadata ) @@ -1137,6 +1341,33 @@ async 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.aiplatform_v1beta1.IndexEndpointServiceClient.GetIndexEndpoint", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexEndpointService", + "rpcName": "GetIndexEndpoint", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncIndexEndpointServiceRestTransport._GetIndexEndpoint._get_response( self._host, @@ -1164,6 +1395,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_get_index_endpoint(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = index_endpoint.IndexEndpoint.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.IndexEndpointServiceAsyncClient.get_index_endpoint", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexEndpointService", + "rpcName": "GetIndexEndpoint", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ListIndexEndpoints( @@ -1202,7 +1455,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> index_endpoint_service.ListIndexEndpointsResponse: r"""Call the list index endpoints method over HTTP. @@ -1213,8 +1466,10 @@ async def __call__( 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: ~.index_endpoint_service.ListIndexEndpointsResponse: @@ -1226,6 +1481,7 @@ async def __call__( http_options = ( _BaseIndexEndpointServiceRestTransport._BaseListIndexEndpoints._get_http_options() ) + request, metadata = await self._interceptor.pre_list_index_endpoints( request, metadata ) @@ -1238,6 +1494,33 @@ async 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.aiplatform_v1beta1.IndexEndpointServiceClient.ListIndexEndpoints", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexEndpointService", + "rpcName": "ListIndexEndpoints", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncIndexEndpointServiceRestTransport._ListIndexEndpoints._get_response( self._host, @@ -1265,6 +1548,32 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_list_index_endpoints(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + index_endpoint_service.ListIndexEndpointsResponse.to_json( + response + ) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.IndexEndpointServiceAsyncClient.list_index_endpoints", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexEndpointService", + "rpcName": "ListIndexEndpoints", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _MutateDeployedIndex( @@ -1304,7 +1613,7 @@ async 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 mutate deployed index method over HTTP. @@ -1315,8 +1624,10 @@ async def __call__( 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: @@ -1329,6 +1640,7 @@ async def __call__( http_options = ( _BaseIndexEndpointServiceRestTransport._BaseMutateDeployedIndex._get_http_options() ) + request, metadata = await self._interceptor.pre_mutate_deployed_index( request, metadata ) @@ -1345,6 +1657,33 @@ async 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.aiplatform_v1beta1.IndexEndpointServiceClient.MutateDeployedIndex", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexEndpointService", + "rpcName": "MutateDeployedIndex", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncIndexEndpointServiceRestTransport._MutateDeployedIndex._get_response( self._host, @@ -1373,6 +1712,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_mutate_deployed_index(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.IndexEndpointServiceAsyncClient.mutate_deployed_index", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexEndpointService", + "rpcName": "MutateDeployedIndex", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _UndeployIndex( @@ -1412,7 +1773,7 @@ async 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 undeploy index method over HTTP. @@ -1423,8 +1784,10 @@ async def __call__( 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: @@ -1437,6 +1800,7 @@ async def __call__( http_options = ( _BaseIndexEndpointServiceRestTransport._BaseUndeployIndex._get_http_options() ) + request, metadata = await self._interceptor.pre_undeploy_index( request, metadata ) @@ -1453,6 +1817,33 @@ async 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.aiplatform_v1beta1.IndexEndpointServiceClient.UndeployIndex", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexEndpointService", + "rpcName": "UndeployIndex", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncIndexEndpointServiceRestTransport._UndeployIndex._get_response( self._host, @@ -1481,6 +1872,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_undeploy_index(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.IndexEndpointServiceAsyncClient.undeploy_index", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexEndpointService", + "rpcName": "UndeployIndex", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _UpdateIndexEndpoint( @@ -1520,7 +1933,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> gca_index_endpoint.IndexEndpoint: r"""Call the update index endpoint method over HTTP. @@ -1531,8 +1944,10 @@ async def __call__( 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: ~.gca_index_endpoint.IndexEndpoint: @@ -1545,6 +1960,7 @@ async def __call__( http_options = ( _BaseIndexEndpointServiceRestTransport._BaseUpdateIndexEndpoint._get_http_options() ) + request, metadata = await self._interceptor.pre_update_index_endpoint( request, metadata ) @@ -1561,6 +1977,33 @@ async 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.aiplatform_v1beta1.IndexEndpointServiceClient.UpdateIndexEndpoint", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexEndpointService", + "rpcName": "UpdateIndexEndpoint", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncIndexEndpointServiceRestTransport._UpdateIndexEndpoint._get_response( self._host, @@ -1589,6 +2032,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_update_index_endpoint(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gca_index_endpoint.IndexEndpoint.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.IndexEndpointServiceAsyncClient.update_index_endpoint", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexEndpointService", + "rpcName": "UpdateIndexEndpoint", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp @property @@ -2164,6 +2631,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -2380,6 +2851,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -2586,6 +3061,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}", @@ -2802,6 +3281,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, ], "google.longrunning.Operations.ListOperations": [ { @@ -3000,6 +3483,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*}/operations", @@ -3216,6 +3703,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*}/operations", + }, ], "google.longrunning.Operations.WaitOperation": [ { @@ -3414,6 +3905,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "post", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}:wait", @@ -3626,6 +4121,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, ], } @@ -3750,7 +4249,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -3761,8 +4260,10 @@ async def __call__( 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: locations_pb2.Location: Response from GetLocation method. @@ -3771,6 +4272,7 @@ async def __call__( http_options = ( _BaseIndexEndpointServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_location( request, metadata ) @@ -3783,6 +4285,33 @@ async 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.aiplatform_v1beta1.IndexEndpointServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexEndpointService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncIndexEndpointServiceRestTransport._GetLocation._get_response( @@ -3810,6 +4339,27 @@ async def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_location(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.aiplatform_v1beta1.IndexEndpointServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexEndpointService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3852,7 +4402,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -3863,8 +4413,10 @@ async def __call__( 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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -3873,6 +4425,7 @@ async def __call__( http_options = ( _BaseIndexEndpointServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_locations( request, metadata ) @@ -3885,6 +4438,33 @@ async 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.aiplatform_v1beta1.IndexEndpointServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexEndpointService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncIndexEndpointServiceRestTransport._ListLocations._get_response( self._host, @@ -3910,6 +4490,27 @@ async def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_list_locations(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.aiplatform_v1beta1.IndexEndpointServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexEndpointService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3953,7 +4554,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -3964,8 +4565,10 @@ async def __call__( 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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -3974,6 +4577,7 @@ async def __call__( http_options = ( _BaseIndexEndpointServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_get_iam_policy( request, metadata ) @@ -3990,6 +4594,33 @@ async 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.aiplatform_v1beta1.IndexEndpointServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexEndpointService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncIndexEndpointServiceRestTransport._GetIamPolicy._get_response( self._host, @@ -4016,6 +4647,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_iam_policy(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.aiplatform_v1beta1.IndexEndpointServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexEndpointService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4059,7 +4711,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -4070,8 +4722,10 @@ async def __call__( 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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -4080,6 +4734,7 @@ async def __call__( http_options = ( _BaseIndexEndpointServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_set_iam_policy( request, metadata ) @@ -4096,6 +4751,33 @@ async 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.aiplatform_v1beta1.IndexEndpointServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexEndpointService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncIndexEndpointServiceRestTransport._SetIamPolicy._get_response( self._host, @@ -4122,6 +4804,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_set_iam_policy(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.aiplatform_v1beta1.IndexEndpointServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexEndpointService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4165,7 +4868,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -4176,8 +4879,10 @@ async def __call__( 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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -4186,6 +4891,7 @@ async def __call__( http_options = ( _BaseIndexEndpointServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = await self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -4202,6 +4908,33 @@ async 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.aiplatform_v1beta1.IndexEndpointServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexEndpointService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncIndexEndpointServiceRestTransport._TestIamPermissions._get_response( self._host, @@ -4228,6 +4961,27 @@ async def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_test_iam_permissions(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.aiplatform_v1beta1.IndexEndpointServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexEndpointService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4270,7 +5024,7 @@ async 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 cancel operation method over HTTP. @@ -4281,13 +5035,16 @@ async def __call__( 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`. """ http_options = ( _BaseIndexEndpointServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_cancel_operation( request, metadata ) @@ -4300,6 +5057,33 @@ async 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.aiplatform_v1beta1.IndexEndpointServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexEndpointService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncIndexEndpointServiceRestTransport._CancelOperation._get_response( self._host, @@ -4363,7 +5147,7 @@ async 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. @@ -4374,13 +5158,16 @@ async def __call__( 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`. """ http_options = ( _BaseIndexEndpointServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_operation( request, metadata ) @@ -4393,6 +5180,33 @@ async 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.aiplatform_v1beta1.IndexEndpointServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexEndpointService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncIndexEndpointServiceRestTransport._DeleteOperation._get_response( self._host, @@ -4456,7 +5270,7 @@ async 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. @@ -4467,8 +5281,10 @@ async def __call__( 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: Response from GetOperation method. @@ -4477,6 +5293,7 @@ async def __call__( http_options = ( _BaseIndexEndpointServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_operation( request, metadata ) @@ -4489,6 +5306,33 @@ async 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.aiplatform_v1beta1.IndexEndpointServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexEndpointService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncIndexEndpointServiceRestTransport._GetOperation._get_response( self._host, @@ -4514,6 +5358,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1beta1.IndexEndpointServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexEndpointService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4556,7 +5421,7 @@ async 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. @@ -4567,8 +5432,10 @@ async def __call__( 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 from ListOperations method. @@ -4577,6 +5444,7 @@ async def __call__( http_options = ( _BaseIndexEndpointServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_operations( request, metadata ) @@ -4589,6 +5457,33 @@ async 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.aiplatform_v1beta1.IndexEndpointServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexEndpointService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncIndexEndpointServiceRestTransport._ListOperations._get_response( self._host, @@ -4614,6 +5509,27 @@ async def __call__( resp = operations_pb2.ListOperationsResponse() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1beta1.IndexEndpointServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexEndpointService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4656,7 +5572,7 @@ async 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 wait operation method over HTTP. @@ -4667,8 +5583,10 @@ async def __call__( 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: Response from WaitOperation method. @@ -4677,6 +5595,7 @@ async def __call__( http_options = ( _BaseIndexEndpointServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_wait_operation( request, metadata ) @@ -4689,6 +5608,33 @@ async 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.aiplatform_v1beta1.IndexEndpointServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexEndpointService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncIndexEndpointServiceRestTransport._WaitOperation._get_response( self._host, @@ -4714,6 +5660,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_wait_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.aiplatform_v1beta1.IndexEndpointServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexEndpointService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1beta1/services/index_endpoint_service/transports/rest_base.py b/google/cloud/aiplatform_v1beta1/services/index_endpoint_service/transports/rest_base.py index 3ce2ba9ec4..ecf34dab89 100644 --- a/google/cloud/aiplatform_v1beta1/services/index_endpoint_service/transports/rest_base.py +++ b/google/cloud/aiplatform_v1beta1/services/index_endpoint_service/transports/rest_base.py @@ -1439,6 +1439,10 @@ def _get_http_options(): "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -1655,6 +1659,10 @@ def _get_http_options(): "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -1880,6 +1888,10 @@ def _get_http_options(): "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}", @@ -2096,6 +2108,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, ] return http_options @@ -2313,6 +2329,10 @@ def _get_http_options(): "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*}/operations", @@ -2529,6 +2549,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*}/operations", + }, ] return http_options @@ -2746,6 +2770,10 @@ def _get_http_options(): "method": "post", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}:wait", @@ -2958,6 +2986,10 @@ def _get_http_options(): "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, ] return http_options diff --git a/google/cloud/aiplatform_v1beta1/services/index_service/async_client.py b/google/cloud/aiplatform_v1beta1/services/index_service/async_client.py index 4913acf3b0..4a920414d5 100644 --- a/google/cloud/aiplatform_v1beta1/services/index_service/async_client.py +++ b/google/cloud/aiplatform_v1beta1/services/index_service/async_client.py @@ -13,6 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging as std_logging from collections import OrderedDict import re from typing import ( @@ -64,6 +65,15 @@ from .transports.grpc_asyncio import IndexServiceGrpcAsyncIOTransport from .client import IndexServiceClient +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 IndexServiceAsyncClient: """A service for creating and managing Vertex AI's Index @@ -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.aiplatform_v1beta1.IndexServiceAsyncClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexService", + "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.aiplatform.v1beta1.IndexService", + "credentialsType": None, + }, + ) + async def create_index( self, request: Optional[Union[index_service.CreateIndexRequest, dict]] = None, @@ -279,7 +311,7 @@ async def create_index( index: Optional[gca_index.Index] = 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"""Creates an Index. @@ -337,8 +369,10 @@ async def sample_create_index(): 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: @@ -412,7 +446,7 @@ async def get_index( 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]]] = (), ) -> index.Index: r"""Gets an Index. @@ -456,8 +490,10 @@ async def sample_get_index(): 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.aiplatform_v1beta1.types.Index: @@ -520,7 +556,7 @@ async def list_indexes( 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.ListIndexesAsyncPager: r"""Lists Indexes in a Location. @@ -566,8 +602,10 @@ async def sample_list_indexes(): 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.aiplatform_v1beta1.services.index_service.pagers.ListIndexesAsyncPager: @@ -643,7 +681,7 @@ async def update_index( 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"""Updates an Index. @@ -702,8 +740,10 @@ async def sample_update_index(): 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: @@ -779,7 +819,7 @@ async def delete_index( 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"""Deletes an Index. An Index can only be deleted when all its [DeployedIndexes][google.cloud.aiplatform.v1beta1.Index.deployed_indexes] @@ -830,8 +870,10 @@ async def sample_delete_index(): 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: @@ -909,7 +951,7 @@ async def upsert_datapoints( *, 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]]] = (), ) -> index_service.UpsertDatapointsResponse: r"""Add/update Datapoints into an Index. @@ -946,8 +988,10 @@ async def sample_upsert_datapoints(): 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.aiplatform_v1beta1.types.UpsertDatapointsResponse: @@ -993,7 +1037,7 @@ async def remove_datapoints( *, 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]]] = (), ) -> index_service.RemoveDatapointsResponse: r"""Remove Datapoints from an Index. @@ -1030,8 +1074,10 @@ async def sample_remove_datapoints(): 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.aiplatform_v1beta1.types.RemoveDatapointsResponse: @@ -1077,7 +1123,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. @@ -1088,8 +1134,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. @@ -1130,7 +1178,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. @@ -1141,8 +1189,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. @@ -1183,7 +1233,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. @@ -1199,8 +1249,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 """ @@ -1237,7 +1289,7 @@ async def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -1252,8 +1304,10 @@ async def cancel_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 """ @@ -1290,7 +1344,7 @@ async def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -1307,8 +1361,10 @@ async def wait_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. @@ -1349,7 +1405,7 @@ async def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -1362,8 +1418,10 @@ async def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -1468,7 +1526,7 @@ async def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -1482,8 +1540,10 @@ async def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -1588,7 +1648,7 @@ async def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -1603,8 +1663,10 @@ async def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -1648,7 +1710,7 @@ async def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -1659,8 +1721,10 @@ async def get_location( 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: ~.location_pb2.Location: Location object. @@ -1701,7 +1765,7 @@ async def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -1712,8 +1776,10 @@ async def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1beta1/services/index_service/client.py b/google/cloud/aiplatform_v1beta1/services/index_service/client.py index f4046dd5ef..0865754eb3 100644 --- a/google/cloud/aiplatform_v1beta1/services/index_service/client.py +++ b/google/cloud/aiplatform_v1beta1/services/index_service/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 ( @@ -48,6 +49,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 as gac_operation # type: ignore from google.api_core import operation_async # type: ignore from google.cloud.aiplatform_v1beta1.services.index_service import pagers @@ -628,6 +638,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( @@ -715,6 +729,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.aiplatform_v1beta1.IndexServiceClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexService", + "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.aiplatform.v1beta1.IndexService", + "credentialsType": None, + }, + ) + def create_index( self, request: Optional[Union[index_service.CreateIndexRequest, dict]] = None, @@ -723,7 +760,7 @@ def create_index( index: Optional[gca_index.Index] = 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]]] = (), ) -> gac_operation.Operation: r"""Creates an Index. @@ -781,8 +818,10 @@ def sample_create_index(): 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: @@ -853,7 +892,7 @@ def get_index( 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]]] = (), ) -> index.Index: r"""Gets an Index. @@ -897,8 +936,10 @@ def sample_get_index(): 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.aiplatform_v1beta1.types.Index: @@ -958,7 +999,7 @@ def list_indexes( 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.ListIndexesPager: r"""Lists Indexes in a Location. @@ -1004,8 +1045,10 @@ def sample_list_indexes(): 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.aiplatform_v1beta1.services.index_service.pagers.ListIndexesPager: @@ -1078,7 +1121,7 @@ def update_index( 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]]] = (), ) -> gac_operation.Operation: r"""Updates an Index. @@ -1137,8 +1180,10 @@ def sample_update_index(): 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: @@ -1211,7 +1256,7 @@ def delete_index( 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]]] = (), ) -> gac_operation.Operation: r"""Deletes an Index. An Index can only be deleted when all its [DeployedIndexes][google.cloud.aiplatform.v1beta1.Index.deployed_indexes] @@ -1262,8 +1307,10 @@ def sample_delete_index(): 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: @@ -1338,7 +1385,7 @@ def upsert_datapoints( *, 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]]] = (), ) -> index_service.UpsertDatapointsResponse: r"""Add/update Datapoints into an Index. @@ -1375,8 +1422,10 @@ def sample_upsert_datapoints(): 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.aiplatform_v1beta1.types.UpsertDatapointsResponse: @@ -1420,7 +1469,7 @@ def remove_datapoints( *, 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]]] = (), ) -> index_service.RemoveDatapointsResponse: r"""Remove Datapoints from an Index. @@ -1457,8 +1506,10 @@ def sample_remove_datapoints(): 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.aiplatform_v1beta1.types.RemoveDatapointsResponse: @@ -1515,7 +1566,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. @@ -1526,8 +1577,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. @@ -1568,7 +1621,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. @@ -1579,8 +1632,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. @@ -1621,7 +1676,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. @@ -1637,8 +1692,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 """ @@ -1675,7 +1732,7 @@ def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -1690,8 +1747,10 @@ def cancel_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 """ @@ -1728,7 +1787,7 @@ def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -1745,8 +1804,10 @@ def wait_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. @@ -1787,7 +1848,7 @@ def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -1800,8 +1861,10 @@ def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -1906,7 +1969,7 @@ def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -1920,8 +1983,10 @@ def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -2026,7 +2091,7 @@ def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -2041,8 +2106,10 @@ def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -2084,7 +2151,7 @@ def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -2095,8 +2162,10 @@ def get_location( 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: ~.location_pb2.Location: Location object. @@ -2137,7 +2206,7 @@ def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -2148,8 +2217,10 @@ def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1beta1/services/index_service/pagers.py b/google/cloud/aiplatform_v1beta1/services/index_service/pagers.py index ac90df799b..e693436a3f 100644 --- a/google/cloud/aiplatform_v1beta1/services/index_service/pagers.py +++ b/google/cloud/aiplatform_v1beta1/services/index_service/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 = index_service.ListIndexesRequest(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 = index_service.ListIndexesRequest(request) diff --git a/google/cloud/aiplatform_v1beta1/services/index_service/transports/grpc.py b/google/cloud/aiplatform_v1beta1/services/index_service/transports/grpc.py index dbaf4f494d..80e65e8f10 100644 --- a/google/cloud/aiplatform_v1beta1/services/index_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1beta1/services/index_service/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 import warnings from typing import Callable, Dict, Optional, Sequence, Tuple, Union @@ -22,8 +25,11 @@ import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from google.cloud.aiplatform_v1beta1.types import index from google.cloud.aiplatform_v1beta1.types import index_service @@ -33,6 +39,81 @@ from google.longrunning import operations_pb2 # type: ignore from .base import IndexServiceTransport, DEFAULT_CLIENT_INFO +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.aiplatform.v1beta1.IndexService", + "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.aiplatform.v1beta1.IndexService", + "rpcName": client_call_details.method, + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class IndexServiceGrpcTransport(IndexServiceTransport): """gRPC backend transport for IndexService. @@ -188,7 +269,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 @@ -252,7 +338,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 @@ -276,7 +364,7 @@ def create_index( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_index" not in self._stubs: - self._stubs["create_index"] = self.grpc_channel.unary_unary( + self._stubs["create_index"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.IndexService/CreateIndex", request_serializer=index_service.CreateIndexRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -300,7 +388,7 @@ def get_index(self) -> Callable[[index_service.GetIndexRequest], index.Index]: # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_index" not in self._stubs: - self._stubs["get_index"] = self.grpc_channel.unary_unary( + self._stubs["get_index"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.IndexService/GetIndex", request_serializer=index_service.GetIndexRequest.serialize, response_deserializer=index.Index.deserialize, @@ -328,7 +416,7 @@ def list_indexes( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_indexes" not in self._stubs: - self._stubs["list_indexes"] = self.grpc_channel.unary_unary( + self._stubs["list_indexes"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.IndexService/ListIndexes", request_serializer=index_service.ListIndexesRequest.serialize, response_deserializer=index_service.ListIndexesResponse.deserialize, @@ -354,7 +442,7 @@ def update_index( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_index" not in self._stubs: - self._stubs["update_index"] = self.grpc_channel.unary_unary( + self._stubs["update_index"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.IndexService/UpdateIndex", request_serializer=index_service.UpdateIndexRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -382,7 +470,7 @@ def delete_index( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_index" not in self._stubs: - self._stubs["delete_index"] = self.grpc_channel.unary_unary( + self._stubs["delete_index"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.IndexService/DeleteIndex", request_serializer=index_service.DeleteIndexRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -410,7 +498,7 @@ def upsert_datapoints( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "upsert_datapoints" not in self._stubs: - self._stubs["upsert_datapoints"] = self.grpc_channel.unary_unary( + self._stubs["upsert_datapoints"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.IndexService/UpsertDatapoints", request_serializer=index_service.UpsertDatapointsRequest.serialize, response_deserializer=index_service.UpsertDatapointsResponse.deserialize, @@ -438,7 +526,7 @@ def remove_datapoints( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "remove_datapoints" not in self._stubs: - self._stubs["remove_datapoints"] = self.grpc_channel.unary_unary( + self._stubs["remove_datapoints"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.IndexService/RemoveDatapoints", request_serializer=index_service.RemoveDatapointsRequest.serialize, response_deserializer=index_service.RemoveDatapointsResponse.deserialize, @@ -446,7 +534,7 @@ def remove_datapoints( return self._stubs["remove_datapoints"] def close(self): - self.grpc_channel.close() + self._logged_channel.close() @property def delete_operation( @@ -458,7 +546,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, @@ -475,7 +563,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -492,7 +580,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -509,7 +597,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, @@ -528,7 +616,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, @@ -547,7 +635,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -564,7 +652,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -589,7 +677,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -615,7 +703,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -644,7 +732,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1beta1/services/index_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1beta1/services/index_service/transports/grpc_asyncio.py index 0673cc2ea5..2d96e1938c 100644 --- a/google/cloud/aiplatform_v1beta1/services/index_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/index_service/transports/grpc_asyncio.py @@ -14,6 +14,9 @@ # limitations under the License. # import inspect +import json +import pickle +import logging as std_logging import warnings from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union @@ -24,8 +27,11 @@ from google.api_core import operations_v1 from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from grpc.experimental import aio # type: ignore from google.cloud.aiplatform_v1beta1.types import index @@ -37,6 +43,82 @@ from .base import IndexServiceTransport, DEFAULT_CLIENT_INFO from .grpc import IndexServiceGrpcTransport +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.aiplatform.v1beta1.IndexService", + "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.aiplatform.v1beta1.IndexService", + "rpcName": str(client_call_details.method), + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class IndexServiceGrpcAsyncIOTransport(IndexServiceTransport): """gRPC AsyncIO backend transport for IndexService. @@ -235,10 +317,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 @@ -261,7 +346,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. @@ -288,7 +373,7 @@ def create_index( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_index" not in self._stubs: - self._stubs["create_index"] = self.grpc_channel.unary_unary( + self._stubs["create_index"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.IndexService/CreateIndex", request_serializer=index_service.CreateIndexRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -314,7 +399,7 @@ def get_index( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_index" not in self._stubs: - self._stubs["get_index"] = self.grpc_channel.unary_unary( + self._stubs["get_index"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.IndexService/GetIndex", request_serializer=index_service.GetIndexRequest.serialize, response_deserializer=index.Index.deserialize, @@ -342,7 +427,7 @@ def list_indexes( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_indexes" not in self._stubs: - self._stubs["list_indexes"] = self.grpc_channel.unary_unary( + self._stubs["list_indexes"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.IndexService/ListIndexes", request_serializer=index_service.ListIndexesRequest.serialize, response_deserializer=index_service.ListIndexesResponse.deserialize, @@ -370,7 +455,7 @@ def update_index( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_index" not in self._stubs: - self._stubs["update_index"] = self.grpc_channel.unary_unary( + self._stubs["update_index"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.IndexService/UpdateIndex", request_serializer=index_service.UpdateIndexRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -400,7 +485,7 @@ def delete_index( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_index" not in self._stubs: - self._stubs["delete_index"] = self.grpc_channel.unary_unary( + self._stubs["delete_index"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.IndexService/DeleteIndex", request_serializer=index_service.DeleteIndexRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -429,7 +514,7 @@ def upsert_datapoints( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "upsert_datapoints" not in self._stubs: - self._stubs["upsert_datapoints"] = self.grpc_channel.unary_unary( + self._stubs["upsert_datapoints"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.IndexService/UpsertDatapoints", request_serializer=index_service.UpsertDatapointsRequest.serialize, response_deserializer=index_service.UpsertDatapointsResponse.deserialize, @@ -458,7 +543,7 @@ def remove_datapoints( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "remove_datapoints" not in self._stubs: - self._stubs["remove_datapoints"] = self.grpc_channel.unary_unary( + self._stubs["remove_datapoints"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.IndexService/RemoveDatapoints", request_serializer=index_service.RemoveDatapointsRequest.serialize, response_deserializer=index_service.RemoveDatapointsResponse.deserialize, @@ -561,7 +646,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: @@ -577,7 +662,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, @@ -594,7 +679,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -611,7 +696,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -628,7 +713,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, @@ -647,7 +732,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, @@ -666,7 +751,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -683,7 +768,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -708,7 +793,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -734,7 +819,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -763,7 +848,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1beta1/services/index_service/transports/rest.py b/google/cloud/aiplatform_v1beta1/services/index_service/transports/rest.py index 9d9093bda0..a612bffb10 100644 --- a/google/cloud/aiplatform_v1beta1/services/index_service/transports/rest.py +++ b/google/cloud/aiplatform_v1beta1/services/index_service/transports/rest.py @@ -13,9 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging +import json # type: ignore from google.auth.transport.requests import AuthorizedSession # type: ignore -import json # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.api_core import exceptions as core_exceptions from google.api_core import retry as retries @@ -48,6 +49,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, @@ -136,8 +145,10 @@ def post_upsert_datapoints(self, response): def pre_create_index( self, request: index_service.CreateIndexRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[index_service.CreateIndexRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + index_service.CreateIndexRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for create_index Override in a subclass to manipulate the request or metadata @@ -159,8 +170,10 @@ def post_create_index( def pre_delete_index( self, request: index_service.DeleteIndexRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[index_service.DeleteIndexRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + index_service.DeleteIndexRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for delete_index Override in a subclass to manipulate the request or metadata @@ -182,8 +195,8 @@ def post_delete_index( def pre_get_index( self, request: index_service.GetIndexRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[index_service.GetIndexRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[index_service.GetIndexRequest, Sequence[Tuple[str, Union[str, bytes]]]]: """Pre-rpc interceptor for get_index Override in a subclass to manipulate the request or metadata @@ -203,8 +216,10 @@ def post_get_index(self, response: index.Index) -> index.Index: def pre_list_indexes( self, request: index_service.ListIndexesRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[index_service.ListIndexesRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + index_service.ListIndexesRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_indexes Override in a subclass to manipulate the request or metadata @@ -226,8 +241,10 @@ def post_list_indexes( def pre_remove_datapoints( self, request: index_service.RemoveDatapointsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[index_service.RemoveDatapointsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + index_service.RemoveDatapointsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for remove_datapoints Override in a subclass to manipulate the request or metadata @@ -249,8 +266,10 @@ def post_remove_datapoints( def pre_update_index( self, request: index_service.UpdateIndexRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[index_service.UpdateIndexRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + index_service.UpdateIndexRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for update_index Override in a subclass to manipulate the request or metadata @@ -272,8 +291,10 @@ def post_update_index( def pre_upsert_datapoints( self, request: index_service.UpsertDatapointsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[index_service.UpsertDatapointsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + index_service.UpsertDatapointsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for upsert_datapoints Override in a subclass to manipulate the request or metadata @@ -295,8 +316,10 @@ def post_upsert_datapoints( def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -318,8 +341,10 @@ def post_get_location( def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -341,8 +366,10 @@ def post_list_locations( def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -362,8 +389,10 @@ def post_get_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -383,8 +412,11 @@ def post_set_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -406,8 +438,10 @@ def post_test_iam_permissions( def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -427,8 +461,10 @@ def post_cancel_operation(self, response: None) -> None: 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 @@ -448,8 +484,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 @@ -471,8 +509,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 @@ -494,8 +534,10 @@ def post_list_operations( def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -1176,6 +1218,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -1392,6 +1438,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -1598,6 +1648,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}", @@ -1814,6 +1868,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, ], "google.longrunning.Operations.ListOperations": [ { @@ -2012,6 +2070,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*}/operations", @@ -2228,6 +2290,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*}/operations", + }, ], "google.longrunning.Operations.WaitOperation": [ { @@ -2426,6 +2492,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "post", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}:wait", @@ -2638,6 +2708,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, ], } @@ -2693,7 +2767,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 index method over HTTP. @@ -2704,8 +2778,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: @@ -2718,6 +2794,7 @@ def __call__( http_options = ( _BaseIndexServiceRestTransport._BaseCreateIndex._get_http_options() ) + request, metadata = self._interceptor.pre_create_index(request, metadata) transcoded_request = ( _BaseIndexServiceRestTransport._BaseCreateIndex._get_transcoded_request( @@ -2738,6 +2815,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.aiplatform_v1beta1.IndexServiceClient.CreateIndex", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexService", + "rpcName": "CreateIndex", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = IndexServiceRestTransport._CreateIndex._get_response( self._host, @@ -2757,7 +2861,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_index(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.aiplatform_v1beta1.IndexServiceClient.create_index", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexService", + "rpcName": "CreateIndex", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _DeleteIndex( @@ -2795,7 +2921,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 index method over HTTP. @@ -2806,8 +2932,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: @@ -2820,6 +2948,7 @@ def __call__( http_options = ( _BaseIndexServiceRestTransport._BaseDeleteIndex._get_http_options() ) + request, metadata = self._interceptor.pre_delete_index(request, metadata) transcoded_request = ( _BaseIndexServiceRestTransport._BaseDeleteIndex._get_transcoded_request( @@ -2834,6 +2963,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.aiplatform_v1beta1.IndexServiceClient.DeleteIndex", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexService", + "rpcName": "DeleteIndex", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = IndexServiceRestTransport._DeleteIndex._get_response( self._host, @@ -2852,7 +3008,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_index(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.aiplatform_v1beta1.IndexServiceClient.delete_index", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexService", + "rpcName": "DeleteIndex", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _GetIndex(_BaseIndexServiceRestTransport._BaseGetIndex, IndexServiceRestStub): @@ -2888,7 +3066,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]]] = (), ) -> index.Index: r"""Call the get index method over HTTP. @@ -2899,8 +3077,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: ~.index.Index: @@ -2914,6 +3094,7 @@ def __call__( http_options = ( _BaseIndexServiceRestTransport._BaseGetIndex._get_http_options() ) + request, metadata = self._interceptor.pre_get_index(request, metadata) transcoded_request = ( _BaseIndexServiceRestTransport._BaseGetIndex._get_transcoded_request( @@ -2928,6 +3109,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 = 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.aiplatform_v1beta1.IndexServiceClient.GetIndex", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexService", + "rpcName": "GetIndex", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = IndexServiceRestTransport._GetIndex._get_response( self._host, @@ -2948,7 +3156,29 @@ def __call__( pb_resp = index.Index.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_index(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = index.Index.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.aiplatform_v1beta1.IndexServiceClient.get_index", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexService", + "rpcName": "GetIndex", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListIndexes( @@ -2986,7 +3216,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]]] = (), ) -> index_service.ListIndexesResponse: r"""Call the list indexes method over HTTP. @@ -2997,8 +3227,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: ~.index_service.ListIndexesResponse: @@ -3010,6 +3242,7 @@ def __call__( http_options = ( _BaseIndexServiceRestTransport._BaseListIndexes._get_http_options() ) + request, metadata = self._interceptor.pre_list_indexes(request, metadata) transcoded_request = ( _BaseIndexServiceRestTransport._BaseListIndexes._get_transcoded_request( @@ -3024,6 +3257,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 = 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.aiplatform_v1beta1.IndexServiceClient.ListIndexes", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexService", + "rpcName": "ListIndexes", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = IndexServiceRestTransport._ListIndexes._get_response( self._host, @@ -3044,7 +3304,31 @@ def __call__( pb_resp = index_service.ListIndexesResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_indexes(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = index_service.ListIndexesResponse.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.aiplatform_v1beta1.IndexServiceClient.list_indexes", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexService", + "rpcName": "ListIndexes", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _RemoveDatapoints( @@ -3083,7 +3367,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]]] = (), ) -> index_service.RemoveDatapointsResponse: r"""Call the remove datapoints method over HTTP. @@ -3094,8 +3378,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: ~.index_service.RemoveDatapointsResponse: @@ -3107,6 +3393,7 @@ def __call__( http_options = ( _BaseIndexServiceRestTransport._BaseRemoveDatapoints._get_http_options() ) + request, metadata = self._interceptor.pre_remove_datapoints( request, metadata ) @@ -3123,6 +3410,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.aiplatform_v1beta1.IndexServiceClient.RemoveDatapoints", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexService", + "rpcName": "RemoveDatapoints", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = IndexServiceRestTransport._RemoveDatapoints._get_response( self._host, @@ -3144,7 +3458,31 @@ def __call__( pb_resp = index_service.RemoveDatapointsResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_remove_datapoints(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = index_service.RemoveDatapointsResponse.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.aiplatform_v1beta1.IndexServiceClient.remove_datapoints", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexService", + "rpcName": "RemoveDatapoints", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _UpdateIndex( @@ -3183,7 +3521,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 index method over HTTP. @@ -3194,8 +3532,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: @@ -3208,6 +3548,7 @@ def __call__( http_options = ( _BaseIndexServiceRestTransport._BaseUpdateIndex._get_http_options() ) + request, metadata = self._interceptor.pre_update_index(request, metadata) transcoded_request = ( _BaseIndexServiceRestTransport._BaseUpdateIndex._get_transcoded_request( @@ -3228,6 +3569,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.aiplatform_v1beta1.IndexServiceClient.UpdateIndex", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexService", + "rpcName": "UpdateIndex", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = IndexServiceRestTransport._UpdateIndex._get_response( self._host, @@ -3247,7 +3615,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_index(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.aiplatform_v1beta1.IndexServiceClient.update_index", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexService", + "rpcName": "UpdateIndex", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _UpsertDatapoints( @@ -3286,7 +3676,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]]] = (), ) -> index_service.UpsertDatapointsResponse: r"""Call the upsert datapoints method over HTTP. @@ -3297,8 +3687,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: ~.index_service.UpsertDatapointsResponse: @@ -3310,6 +3702,7 @@ def __call__( http_options = ( _BaseIndexServiceRestTransport._BaseUpsertDatapoints._get_http_options() ) + request, metadata = self._interceptor.pre_upsert_datapoints( request, metadata ) @@ -3326,6 +3719,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.aiplatform_v1beta1.IndexServiceClient.UpsertDatapoints", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexService", + "rpcName": "UpsertDatapoints", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = IndexServiceRestTransport._UpsertDatapoints._get_response( self._host, @@ -3347,7 +3767,31 @@ def __call__( pb_resp = index_service.UpsertDatapointsResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_upsert_datapoints(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = index_service.UpsertDatapointsResponse.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.aiplatform_v1beta1.IndexServiceClient.upsert_datapoints", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexService", + "rpcName": "UpsertDatapoints", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp @property @@ -3449,7 +3893,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]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -3460,8 +3904,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: locations_pb2.Location: Response from GetLocation method. @@ -3470,6 +3916,7 @@ def __call__( http_options = ( _BaseIndexServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = self._interceptor.pre_get_location(request, metadata) transcoded_request = ( _BaseIndexServiceRestTransport._BaseGetLocation._get_transcoded_request( @@ -3484,6 +3931,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.aiplatform_v1beta1.IndexServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = IndexServiceRestTransport._GetLocation._get_response( self._host, @@ -3503,6 +3977,27 @@ def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_location(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.aiplatform_v1beta1.IndexServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3544,7 +4039,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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -3555,8 +4050,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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -3565,6 +4062,7 @@ def __call__( http_options = ( _BaseIndexServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = self._interceptor.pre_list_locations(request, metadata) transcoded_request = _BaseIndexServiceRestTransport._BaseListLocations._get_transcoded_request( http_options, request @@ -3575,6 +4073,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.aiplatform_v1beta1.IndexServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = IndexServiceRestTransport._ListLocations._get_response( self._host, @@ -3594,6 +4119,27 @@ def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_list_locations(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.aiplatform_v1beta1.IndexServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3636,7 +4182,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]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -3647,8 +4193,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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -3657,6 +4205,7 @@ def __call__( http_options = ( _BaseIndexServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_get_iam_policy(request, metadata) transcoded_request = _BaseIndexServiceRestTransport._BaseGetIamPolicy._get_transcoded_request( http_options, request @@ -3675,6 +4224,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.aiplatform_v1beta1.IndexServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = IndexServiceRestTransport._GetIamPolicy._get_response( self._host, @@ -3695,6 +4271,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_iam_policy(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.aiplatform_v1beta1.IndexServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3737,7 +4334,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]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -3748,8 +4345,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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -3758,6 +4357,7 @@ def __call__( http_options = ( _BaseIndexServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_set_iam_policy(request, metadata) transcoded_request = _BaseIndexServiceRestTransport._BaseSetIamPolicy._get_transcoded_request( http_options, request @@ -3776,6 +4376,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.aiplatform_v1beta1.IndexServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = IndexServiceRestTransport._SetIamPolicy._get_response( self._host, @@ -3796,6 +4423,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_set_iam_policy(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.aiplatform_v1beta1.IndexServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3838,7 +4486,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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -3849,8 +4497,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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -3859,6 +4509,7 @@ def __call__( http_options = ( _BaseIndexServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -3875,6 +4526,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.aiplatform_v1beta1.IndexServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = IndexServiceRestTransport._TestIamPermissions._get_response( self._host, @@ -3895,6 +4573,27 @@ def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_test_iam_permissions(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.aiplatform_v1beta1.IndexServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3936,7 +4635,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 cancel operation method over HTTP. @@ -3947,13 +4646,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 = ( _BaseIndexServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = self._interceptor.pre_cancel_operation( request, metadata ) @@ -3966,6 +4668,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.aiplatform_v1beta1.IndexServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = IndexServiceRestTransport._CancelOperation._get_response( self._host, @@ -4022,7 +4751,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. @@ -4033,13 +4762,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 = ( _BaseIndexServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = self._interceptor.pre_delete_operation( request, metadata ) @@ -4052,6 +4784,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.aiplatform_v1beta1.IndexServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = IndexServiceRestTransport._DeleteOperation._get_response( self._host, @@ -4108,7 +4867,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. @@ -4119,8 +4878,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. @@ -4129,6 +4890,7 @@ def __call__( http_options = ( _BaseIndexServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = self._interceptor.pre_get_operation(request, metadata) transcoded_request = _BaseIndexServiceRestTransport._BaseGetOperation._get_transcoded_request( http_options, request @@ -4141,6 +4903,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.aiplatform_v1beta1.IndexServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = IndexServiceRestTransport._GetOperation._get_response( self._host, @@ -4160,6 +4949,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.aiplatform_v1beta1.IndexServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4201,7 +5011,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. @@ -4212,8 +5022,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. @@ -4222,6 +5034,7 @@ def __call__( http_options = ( _BaseIndexServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = self._interceptor.pre_list_operations(request, metadata) transcoded_request = _BaseIndexServiceRestTransport._BaseListOperations._get_transcoded_request( http_options, request @@ -4232,6 +5045,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.aiplatform_v1beta1.IndexServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = IndexServiceRestTransport._ListOperations._get_response( self._host, @@ -4251,6 +5091,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.aiplatform_v1beta1.IndexServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4292,7 +5153,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 wait operation method over HTTP. @@ -4303,8 +5164,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 WaitOperation method. @@ -4313,6 +5176,7 @@ def __call__( http_options = ( _BaseIndexServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = self._interceptor.pre_wait_operation(request, metadata) transcoded_request = _BaseIndexServiceRestTransport._BaseWaitOperation._get_transcoded_request( http_options, request @@ -4323,6 +5187,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.aiplatform_v1beta1.IndexServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = IndexServiceRestTransport._WaitOperation._get_response( self._host, @@ -4342,6 +5233,27 @@ def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = self._interceptor.post_wait_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.aiplatform_v1beta1.IndexServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1beta1/services/index_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1beta1/services/index_service/transports/rest_asyncio.py index 42543ad167..b8d4a2324a 100644 --- a/google/cloud/aiplatform_v1beta1/services/index_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/index_service/transports/rest_asyncio.py @@ -59,6 +59,18 @@ from .base import DEFAULT_CLIENT_INFO as BASE_DEFAULT_CLIENT_INFO + +import logging + +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__) + try: OptionalRetry = Union[retries.AsyncRetry, gapic_v1.method._MethodDefault, None] except AttributeError: # pragma: NO COVER @@ -151,8 +163,10 @@ async def post_upsert_datapoints(self, response): async def pre_create_index( self, request: index_service.CreateIndexRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[index_service.CreateIndexRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + index_service.CreateIndexRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for create_index Override in a subclass to manipulate the request or metadata @@ -174,8 +188,10 @@ async def post_create_index( async def pre_delete_index( self, request: index_service.DeleteIndexRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[index_service.DeleteIndexRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + index_service.DeleteIndexRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for delete_index Override in a subclass to manipulate the request or metadata @@ -197,8 +213,8 @@ async def post_delete_index( async def pre_get_index( self, request: index_service.GetIndexRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[index_service.GetIndexRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[index_service.GetIndexRequest, Sequence[Tuple[str, Union[str, bytes]]]]: """Pre-rpc interceptor for get_index Override in a subclass to manipulate the request or metadata @@ -218,8 +234,10 @@ async def post_get_index(self, response: index.Index) -> index.Index: async def pre_list_indexes( self, request: index_service.ListIndexesRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[index_service.ListIndexesRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + index_service.ListIndexesRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_indexes Override in a subclass to manipulate the request or metadata @@ -241,8 +259,10 @@ async def post_list_indexes( async def pre_remove_datapoints( self, request: index_service.RemoveDatapointsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[index_service.RemoveDatapointsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + index_service.RemoveDatapointsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for remove_datapoints Override in a subclass to manipulate the request or metadata @@ -264,8 +284,10 @@ async def post_remove_datapoints( async def pre_update_index( self, request: index_service.UpdateIndexRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[index_service.UpdateIndexRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + index_service.UpdateIndexRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for update_index Override in a subclass to manipulate the request or metadata @@ -287,8 +309,10 @@ async def post_update_index( async def pre_upsert_datapoints( self, request: index_service.UpsertDatapointsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[index_service.UpsertDatapointsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + index_service.UpsertDatapointsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for upsert_datapoints Override in a subclass to manipulate the request or metadata @@ -310,8 +334,10 @@ async def post_upsert_datapoints( async def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -333,8 +359,10 @@ async def post_get_location( async def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -356,8 +384,10 @@ async def post_list_locations( async def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -379,8 +409,10 @@ async def post_get_iam_policy( async def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -402,8 +434,11 @@ async def post_set_iam_policy( async def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -425,8 +460,10 @@ async def post_test_iam_permissions( async def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -446,8 +483,10 @@ async def post_cancel_operation(self, response: None) -> None: async 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 @@ -467,8 +506,10 @@ async def post_delete_operation(self, response: None) -> None: async 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 @@ -490,8 +531,10 @@ async def post_get_operation( async 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 @@ -513,8 +556,10 @@ async def post_list_operations( async def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -730,7 +775,7 @@ async 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 index method over HTTP. @@ -741,8 +786,10 @@ async def __call__( 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: @@ -755,6 +802,7 @@ async def __call__( http_options = ( _BaseIndexServiceRestTransport._BaseCreateIndex._get_http_options() ) + request, metadata = await self._interceptor.pre_create_index( request, metadata ) @@ -777,6 +825,33 @@ async 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.aiplatform_v1beta1.IndexServiceClient.CreateIndex", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexService", + "rpcName": "CreateIndex", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncIndexServiceRestTransport._CreateIndex._get_response( self._host, @@ -805,6 +880,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_create_index(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.IndexServiceAsyncClient.create_index", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexService", + "rpcName": "CreateIndex", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _DeleteIndex( @@ -842,7 +939,7 @@ async 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 index method over HTTP. @@ -853,8 +950,10 @@ async def __call__( 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: @@ -867,6 +966,7 @@ async def __call__( http_options = ( _BaseIndexServiceRestTransport._BaseDeleteIndex._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_index( request, metadata ) @@ -883,6 +983,33 @@ async 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.aiplatform_v1beta1.IndexServiceClient.DeleteIndex", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexService", + "rpcName": "DeleteIndex", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncIndexServiceRestTransport._DeleteIndex._get_response( self._host, @@ -910,6 +1037,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_delete_index(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.IndexServiceAsyncClient.delete_index", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexService", + "rpcName": "DeleteIndex", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _GetIndex( @@ -947,7 +1096,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> index.Index: r"""Call the get index method over HTTP. @@ -958,8 +1107,10 @@ async def __call__( 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: ~.index.Index: @@ -973,6 +1124,7 @@ async def __call__( http_options = ( _BaseIndexServiceRestTransport._BaseGetIndex._get_http_options() ) + request, metadata = await self._interceptor.pre_get_index(request, metadata) transcoded_request = ( _BaseIndexServiceRestTransport._BaseGetIndex._get_transcoded_request( @@ -987,6 +1139,33 @@ async 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 = 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.aiplatform_v1beta1.IndexServiceClient.GetIndex", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexService", + "rpcName": "GetIndex", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncIndexServiceRestTransport._GetIndex._get_response( self._host, @@ -1014,6 +1193,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_get_index(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = index.Index.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.IndexServiceAsyncClient.get_index", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexService", + "rpcName": "GetIndex", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ListIndexes( @@ -1051,7 +1252,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> index_service.ListIndexesResponse: r"""Call the list indexes method over HTTP. @@ -1062,8 +1263,10 @@ async def __call__( 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: ~.index_service.ListIndexesResponse: @@ -1075,6 +1278,7 @@ async def __call__( http_options = ( _BaseIndexServiceRestTransport._BaseListIndexes._get_http_options() ) + request, metadata = await self._interceptor.pre_list_indexes( request, metadata ) @@ -1091,6 +1295,33 @@ async 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 = 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.aiplatform_v1beta1.IndexServiceClient.ListIndexes", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexService", + "rpcName": "ListIndexes", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncIndexServiceRestTransport._ListIndexes._get_response( self._host, @@ -1118,6 +1349,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_list_indexes(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = index_service.ListIndexesResponse.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.IndexServiceAsyncClient.list_indexes", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexService", + "rpcName": "ListIndexes", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _RemoveDatapoints( @@ -1156,7 +1411,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> index_service.RemoveDatapointsResponse: r"""Call the remove datapoints method over HTTP. @@ -1167,8 +1422,10 @@ async def __call__( 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: ~.index_service.RemoveDatapointsResponse: @@ -1180,6 +1437,7 @@ async def __call__( http_options = ( _BaseIndexServiceRestTransport._BaseRemoveDatapoints._get_http_options() ) + request, metadata = await self._interceptor.pre_remove_datapoints( request, metadata ) @@ -1196,6 +1454,33 @@ async 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.aiplatform_v1beta1.IndexServiceClient.RemoveDatapoints", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexService", + "rpcName": "RemoveDatapoints", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncIndexServiceRestTransport._RemoveDatapoints._get_response( @@ -1226,6 +1511,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_remove_datapoints(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = index_service.RemoveDatapointsResponse.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.IndexServiceAsyncClient.remove_datapoints", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexService", + "rpcName": "RemoveDatapoints", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _UpdateIndex( @@ -1264,7 +1573,7 @@ async 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 index method over HTTP. @@ -1275,8 +1584,10 @@ async def __call__( 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: @@ -1289,6 +1600,7 @@ async def __call__( http_options = ( _BaseIndexServiceRestTransport._BaseUpdateIndex._get_http_options() ) + request, metadata = await self._interceptor.pre_update_index( request, metadata ) @@ -1311,6 +1623,33 @@ async 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.aiplatform_v1beta1.IndexServiceClient.UpdateIndex", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexService", + "rpcName": "UpdateIndex", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncIndexServiceRestTransport._UpdateIndex._get_response( self._host, @@ -1339,6 +1678,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_update_index(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.IndexServiceAsyncClient.update_index", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexService", + "rpcName": "UpdateIndex", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _UpsertDatapoints( @@ -1377,7 +1738,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> index_service.UpsertDatapointsResponse: r"""Call the upsert datapoints method over HTTP. @@ -1388,8 +1749,10 @@ async def __call__( 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: ~.index_service.UpsertDatapointsResponse: @@ -1401,6 +1764,7 @@ async def __call__( http_options = ( _BaseIndexServiceRestTransport._BaseUpsertDatapoints._get_http_options() ) + request, metadata = await self._interceptor.pre_upsert_datapoints( request, metadata ) @@ -1417,6 +1781,33 @@ async 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.aiplatform_v1beta1.IndexServiceClient.UpsertDatapoints", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexService", + "rpcName": "UpsertDatapoints", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncIndexServiceRestTransport._UpsertDatapoints._get_response( @@ -1447,6 +1838,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_upsert_datapoints(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = index_service.UpsertDatapointsResponse.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.IndexServiceAsyncClient.upsert_datapoints", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexService", + "rpcName": "UpsertDatapoints", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp @property @@ -2022,6 +2437,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -2238,6 +2657,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -2444,6 +2867,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}", @@ -2660,6 +3087,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, ], "google.longrunning.Operations.ListOperations": [ { @@ -2858,6 +3289,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*}/operations", @@ -3074,6 +3509,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*}/operations", + }, ], "google.longrunning.Operations.WaitOperation": [ { @@ -3272,6 +3711,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "post", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}:wait", @@ -3484,6 +3927,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, ], } @@ -3587,7 +4034,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -3598,8 +4045,10 @@ async def __call__( 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: locations_pb2.Location: Response from GetLocation method. @@ -3608,6 +4057,7 @@ async def __call__( http_options = ( _BaseIndexServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_location( request, metadata ) @@ -3624,6 +4074,33 @@ async 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.aiplatform_v1beta1.IndexServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncIndexServiceRestTransport._GetLocation._get_response( self._host, @@ -3649,6 +4126,27 @@ async def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_location(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.aiplatform_v1beta1.IndexServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3690,7 +4188,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -3701,8 +4199,10 @@ async def __call__( 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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -3711,6 +4211,7 @@ async def __call__( http_options = ( _BaseIndexServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_locations( request, metadata ) @@ -3723,6 +4224,33 @@ async 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.aiplatform_v1beta1.IndexServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncIndexServiceRestTransport._ListLocations._get_response( @@ -3750,6 +4278,27 @@ async def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_list_locations(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.aiplatform_v1beta1.IndexServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3792,7 +4341,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -3803,8 +4352,10 @@ async def __call__( 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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -3813,6 +4364,7 @@ async def __call__( http_options = ( _BaseIndexServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_get_iam_policy( request, metadata ) @@ -3833,6 +4385,33 @@ async 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.aiplatform_v1beta1.IndexServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncIndexServiceRestTransport._GetIamPolicy._get_response( self._host, @@ -3859,6 +4438,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_iam_policy(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.aiplatform_v1beta1.IndexServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3901,7 +4501,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -3912,8 +4512,10 @@ async def __call__( 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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -3922,6 +4524,7 @@ async def __call__( http_options = ( _BaseIndexServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_set_iam_policy( request, metadata ) @@ -3942,6 +4545,33 @@ async 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.aiplatform_v1beta1.IndexServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncIndexServiceRestTransport._SetIamPolicy._get_response( self._host, @@ -3968,6 +4598,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_set_iam_policy(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.aiplatform_v1beta1.IndexServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4011,7 +4662,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -4022,8 +4673,10 @@ async def __call__( 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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -4032,6 +4685,7 @@ async def __call__( http_options = ( _BaseIndexServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = await self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -4048,6 +4702,33 @@ async 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.aiplatform_v1beta1.IndexServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncIndexServiceRestTransport._TestIamPermissions._get_response( @@ -4076,6 +4757,27 @@ async def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_test_iam_permissions(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.aiplatform_v1beta1.IndexServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4117,7 +4819,7 @@ async 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 cancel operation method over HTTP. @@ -4128,13 +4830,16 @@ async def __call__( 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`. """ http_options = ( _BaseIndexServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_cancel_operation( request, metadata ) @@ -4147,6 +4852,33 @@ async 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.aiplatform_v1beta1.IndexServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncIndexServiceRestTransport._CancelOperation._get_response( @@ -4211,7 +4943,7 @@ async 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. @@ -4222,13 +4954,16 @@ async def __call__( 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`. """ http_options = ( _BaseIndexServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_operation( request, metadata ) @@ -4241,6 +4976,33 @@ async 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.aiplatform_v1beta1.IndexServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncIndexServiceRestTransport._DeleteOperation._get_response( @@ -4305,7 +5067,7 @@ async 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. @@ -4316,8 +5078,10 @@ async def __call__( 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: Response from GetOperation method. @@ -4326,6 +5090,7 @@ async def __call__( http_options = ( _BaseIndexServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_operation( request, metadata ) @@ -4340,6 +5105,33 @@ async 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.aiplatform_v1beta1.IndexServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncIndexServiceRestTransport._GetOperation._get_response( self._host, @@ -4365,6 +5157,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1beta1.IndexServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4406,7 +5219,7 @@ async 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. @@ -4417,8 +5230,10 @@ async def __call__( 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 from ListOperations method. @@ -4427,6 +5242,7 @@ async def __call__( http_options = ( _BaseIndexServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_operations( request, metadata ) @@ -4439,6 +5255,33 @@ async 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.aiplatform_v1beta1.IndexServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncIndexServiceRestTransport._ListOperations._get_response( @@ -4466,6 +5309,27 @@ async def __call__( resp = operations_pb2.ListOperationsResponse() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1beta1.IndexServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4507,7 +5371,7 @@ async 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 wait operation method over HTTP. @@ -4518,8 +5382,10 @@ async def __call__( 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: Response from WaitOperation method. @@ -4528,6 +5394,7 @@ async def __call__( http_options = ( _BaseIndexServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_wait_operation( request, metadata ) @@ -4540,6 +5407,33 @@ async 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.aiplatform_v1beta1.IndexServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncIndexServiceRestTransport._WaitOperation._get_response( @@ -4567,6 +5461,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_wait_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.aiplatform_v1beta1.IndexServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.IndexService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1beta1/services/index_service/transports/rest_base.py b/google/cloud/aiplatform_v1beta1/services/index_service/transports/rest_base.py index 6136c7e54c..657e2aa8a4 100644 --- a/google/cloud/aiplatform_v1beta1/services/index_service/transports/rest_base.py +++ b/google/cloud/aiplatform_v1beta1/services/index_service/transports/rest_base.py @@ -1379,6 +1379,10 @@ def _get_http_options(): "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -1595,6 +1599,10 @@ def _get_http_options(): "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -1820,6 +1828,10 @@ def _get_http_options(): "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}", @@ -2036,6 +2048,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, ] return http_options @@ -2253,6 +2269,10 @@ def _get_http_options(): "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*}/operations", @@ -2469,6 +2489,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*}/operations", + }, ] return http_options @@ -2686,6 +2710,10 @@ def _get_http_options(): "method": "post", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}:wait", @@ -2898,6 +2926,10 @@ def _get_http_options(): "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, ] return http_options diff --git a/google/cloud/aiplatform_v1beta1/services/job_service/async_client.py b/google/cloud/aiplatform_v1beta1/services/job_service/async_client.py index 576f9222e5..7c386641e3 100644 --- a/google/cloud/aiplatform_v1beta1/services/job_service/async_client.py +++ b/google/cloud/aiplatform_v1beta1/services/job_service/async_client.py @@ -13,6 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging as std_logging from collections import OrderedDict import re from typing import ( @@ -93,6 +94,15 @@ from .transports.grpc_asyncio import JobServiceGrpcAsyncIOTransport from .client import JobServiceClient +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 JobServiceAsyncClient: """A service for creating and managing Vertex AI's jobs.""" @@ -346,6 +356,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.aiplatform_v1beta1.JobServiceAsyncClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "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.aiplatform.v1beta1.JobService", + "credentialsType": None, + }, + ) + async def create_custom_job( self, request: Optional[Union[job_service.CreateCustomJobRequest, dict]] = None, @@ -354,7 +386,7 @@ async def create_custom_job( custom_job: Optional[gca_custom_job.CustomJob] = 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]]] = (), ) -> gca_custom_job.CustomJob: r"""Creates a CustomJob. A created CustomJob right away will be attempted to be run. @@ -410,8 +442,10 @@ async def sample_create_custom_job(): 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.aiplatform_v1beta1.types.CustomJob: @@ -480,7 +514,7 @@ async def get_custom_job( 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]]] = (), ) -> custom_job.CustomJob: r"""Gets a CustomJob. @@ -524,8 +558,10 @@ async def sample_get_custom_job(): 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.aiplatform_v1beta1.types.CustomJob: @@ -592,7 +628,7 @@ async def list_custom_jobs( 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.ListCustomJobsAsyncPager: r"""Lists CustomJobs in a Location. @@ -638,8 +674,10 @@ async def sample_list_custom_jobs(): 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.aiplatform_v1beta1.services.job_service.pagers.ListCustomJobsAsyncPager: @@ -714,7 +752,7 @@ async def delete_custom_job( 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"""Deletes a CustomJob. @@ -763,8 +801,10 @@ async def sample_delete_custom_job(): 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: @@ -843,7 +883,7 @@ async def cancel_custom_job( 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"""Cancels a CustomJob. Starts asynchronous cancellation on the CustomJob. The server makes a best effort to cancel the job, but @@ -896,8 +936,10 @@ async def sample_cancel_custom_job(): 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 @@ -950,7 +992,7 @@ async def create_data_labeling_job( data_labeling_job: Optional[gca_data_labeling_job.DataLabelingJob] = 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]]] = (), ) -> gca_data_labeling_job.DataLabelingJob: r"""Creates a DataLabelingJob. @@ -1010,8 +1052,10 @@ async def sample_create_data_labeling_job(): 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.aiplatform_v1beta1.types.DataLabelingJob: @@ -1075,7 +1119,7 @@ async def get_data_labeling_job( 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]]] = (), ) -> data_labeling_job.DataLabelingJob: r"""Gets a DataLabelingJob. @@ -1119,8 +1163,10 @@ async def sample_get_data_labeling_job(): 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.aiplatform_v1beta1.types.DataLabelingJob: @@ -1182,7 +1228,7 @@ async def list_data_labeling_jobs( 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.ListDataLabelingJobsAsyncPager: r"""Lists DataLabelingJobs in a Location. @@ -1227,8 +1273,10 @@ async def sample_list_data_labeling_jobs(): 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.aiplatform_v1beta1.services.job_service.pagers.ListDataLabelingJobsAsyncPager: @@ -1303,7 +1351,7 @@ async def delete_data_labeling_job( 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"""Deletes a DataLabelingJob. @@ -1352,8 +1400,10 @@ async def sample_delete_data_labeling_job(): 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: @@ -1432,7 +1482,7 @@ async def cancel_data_labeling_job( 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"""Cancels a DataLabelingJob. Success of cancellation is not guaranteed. @@ -1474,8 +1524,10 @@ async def sample_cancel_data_labeling_job(): 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 @@ -1532,7 +1584,7 @@ async def create_hyperparameter_tuning_job( ] = 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]]] = (), ) -> gca_hyperparameter_tuning_job.HyperparameterTuningJob: r"""Creates a HyperparameterTuningJob @@ -1596,8 +1648,10 @@ async def sample_create_hyperparameter_tuning_job(): 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.aiplatform_v1beta1.types.HyperparameterTuningJob: @@ -1664,7 +1718,7 @@ async def get_hyperparameter_tuning_job( 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]]] = (), ) -> hyperparameter_tuning_job.HyperparameterTuningJob: r"""Gets a HyperparameterTuningJob @@ -1709,8 +1763,10 @@ async def sample_get_hyperparameter_tuning_job(): 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.aiplatform_v1beta1.types.HyperparameterTuningJob: @@ -1775,7 +1831,7 @@ async def list_hyperparameter_tuning_jobs( 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.ListHyperparameterTuningJobsAsyncPager: r"""Lists HyperparameterTuningJobs in a Location. @@ -1821,8 +1877,10 @@ async def sample_list_hyperparameter_tuning_jobs(): 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.aiplatform_v1beta1.services.job_service.pagers.ListHyperparameterTuningJobsAsyncPager: @@ -1899,7 +1957,7 @@ async def delete_hyperparameter_tuning_job( 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"""Deletes a HyperparameterTuningJob. @@ -1948,8 +2006,10 @@ async def sample_delete_hyperparameter_tuning_job(): 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: @@ -2030,7 +2090,7 @@ async def cancel_hyperparameter_tuning_job( 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"""Cancels a HyperparameterTuningJob. Starts asynchronous cancellation on the HyperparameterTuningJob. The server makes a @@ -2085,8 +2145,10 @@ async def sample_cancel_hyperparameter_tuning_job(): 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 @@ -2139,7 +2201,7 @@ async def create_nas_job( nas_job: Optional[gca_nas_job.NasJob] = 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]]] = (), ) -> gca_nas_job.NasJob: r"""Creates a NasJob @@ -2196,8 +2258,10 @@ async def sample_create_nas_job(): 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.aiplatform_v1beta1.types.NasJob: @@ -2260,7 +2324,7 @@ async def get_nas_job( 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]]] = (), ) -> nas_job.NasJob: r"""Gets a NasJob @@ -2304,8 +2368,10 @@ async def sample_get_nas_job(): 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.aiplatform_v1beta1.types.NasJob: @@ -2366,7 +2432,7 @@ async def list_nas_jobs( 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.ListNasJobsAsyncPager: r"""Lists NasJobs in a Location. @@ -2412,8 +2478,10 @@ async def sample_list_nas_jobs(): 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.aiplatform_v1beta1.services.job_service.pagers.ListNasJobsAsyncPager: @@ -2488,7 +2556,7 @@ async def delete_nas_job( 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"""Deletes a NasJob. @@ -2537,8 +2605,10 @@ async def sample_delete_nas_job(): 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: @@ -2617,7 +2687,7 @@ async def cancel_nas_job( 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"""Cancels a NasJob. Starts asynchronous cancellation on the NasJob. The server makes a best effort to cancel the job, but @@ -2670,8 +2740,10 @@ async def sample_cancel_nas_job(): 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 @@ -2723,7 +2795,7 @@ async def get_nas_trial_detail( 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]]] = (), ) -> nas_job.NasTrialDetail: r"""Gets a NasTrialDetail. @@ -2768,8 +2840,10 @@ async def sample_get_nas_trial_detail(): 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.aiplatform_v1beta1.types.NasTrialDetail: @@ -2832,7 +2906,7 @@ async def list_nas_trial_details( 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.ListNasTrialDetailsAsyncPager: r"""List top NasTrialDetails of a NasJob. @@ -2877,8 +2951,10 @@ async def sample_list_nas_trial_details(): 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.aiplatform_v1beta1.services.job_service.pagers.ListNasTrialDetailsAsyncPager: @@ -2958,7 +3034,7 @@ async def create_batch_prediction_job( ] = 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]]] = (), ) -> gca_batch_prediction_job.BatchPredictionJob: r"""Creates a BatchPredictionJob. A BatchPredictionJob once created will right away be attempted to start. @@ -3019,8 +3095,10 @@ async def sample_create_batch_prediction_job(): 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.aiplatform_v1beta1.types.BatchPredictionJob: @@ -3088,7 +3166,7 @@ async def get_batch_prediction_job( 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]]] = (), ) -> batch_prediction_job.BatchPredictionJob: r"""Gets a BatchPredictionJob @@ -3133,8 +3211,10 @@ async def sample_get_batch_prediction_job(): 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.aiplatform_v1beta1.types.BatchPredictionJob: @@ -3202,7 +3282,7 @@ async def list_batch_prediction_jobs( 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.ListBatchPredictionJobsAsyncPager: r"""Lists BatchPredictionJobs in a Location. @@ -3248,8 +3328,10 @@ async def sample_list_batch_prediction_jobs(): 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.aiplatform_v1beta1.services.job_service.pagers.ListBatchPredictionJobsAsyncPager: @@ -3326,7 +3408,7 @@ async def delete_batch_prediction_job( 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"""Deletes a BatchPredictionJob. Can only be called on jobs that already finished. @@ -3376,8 +3458,10 @@ async def sample_delete_batch_prediction_job(): 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: @@ -3458,7 +3542,7 @@ async def cancel_batch_prediction_job( 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"""Cancels a BatchPredictionJob. @@ -3511,8 +3595,10 @@ async def sample_cancel_batch_prediction_job(): 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 @@ -3569,7 +3655,7 @@ async def create_model_deployment_monitoring_job( ] = 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]]] = (), ) -> gca_model_deployment_monitoring_job.ModelDeploymentMonitoringJob: r"""Creates a ModelDeploymentMonitoringJob. It will run periodically on a configured interval. @@ -3627,8 +3713,10 @@ async def sample_create_model_deployment_monitoring_job(): 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.aiplatform_v1beta1.types.ModelDeploymentMonitoringJob: @@ -3701,7 +3789,7 @@ async def search_model_deployment_monitoring_stats_anomalies( deployed_model_id: 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.SearchModelDeploymentMonitoringStatsAnomaliesAsyncPager: r"""Searches Model Monitoring Statistics generated within a given time window. @@ -3756,8 +3844,10 @@ async def sample_search_model_deployment_monitoring_stats_anomalies(): 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.aiplatform_v1beta1.services.job_service.pagers.SearchModelDeploymentMonitoringStatsAnomaliesAsyncPager: @@ -3847,7 +3937,7 @@ async def get_model_deployment_monitoring_job( 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]]] = (), ) -> model_deployment_monitoring_job.ModelDeploymentMonitoringJob: r"""Gets a ModelDeploymentMonitoringJob. @@ -3892,8 +3982,10 @@ async def sample_get_model_deployment_monitoring_job(): 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.aiplatform_v1beta1.types.ModelDeploymentMonitoringJob: @@ -3959,7 +4051,7 @@ async def list_model_deployment_monitoring_jobs( 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.ListModelDeploymentMonitoringJobsAsyncPager: r"""Lists ModelDeploymentMonitoringJobs in a Location. @@ -4005,8 +4097,10 @@ async def sample_list_model_deployment_monitoring_jobs(): 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.aiplatform_v1beta1.services.job_service.pagers.ListModelDeploymentMonitoringJobsAsyncPager: @@ -4088,7 +4182,7 @@ async def update_model_deployment_monitoring_job( 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"""Updates a ModelDeploymentMonitoringJob. @@ -4174,8 +4268,10 @@ async def sample_update_model_deployment_monitoring_job(): 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: @@ -4260,7 +4356,7 @@ async def delete_model_deployment_monitoring_job( 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"""Deletes a ModelDeploymentMonitoringJob. @@ -4309,8 +4405,10 @@ async def sample_delete_model_deployment_monitoring_job(): 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: @@ -4393,7 +4491,7 @@ async def pause_model_deployment_monitoring_job( 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"""Pauses a ModelDeploymentMonitoringJob. If the job is running, the server makes a best effort to cancel the job. Will mark @@ -4438,8 +4536,10 @@ async def sample_pause_model_deployment_monitoring_job(): 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 @@ -4495,7 +4595,7 @@ async def resume_model_deployment_monitoring_job( 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"""Resumes a paused ModelDeploymentMonitoringJob. It will start to run from next scheduled time. A deleted @@ -4539,8 +4639,10 @@ async def sample_resume_model_deployment_monitoring_job(): 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 @@ -4593,7 +4695,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. @@ -4604,8 +4706,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. @@ -4646,7 +4750,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. @@ -4657,8 +4761,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. @@ -4699,7 +4805,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. @@ -4715,8 +4821,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 """ @@ -4753,7 +4861,7 @@ async def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -4768,8 +4876,10 @@ async def cancel_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 """ @@ -4806,7 +4916,7 @@ async def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -4823,8 +4933,10 @@ async def wait_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. @@ -4865,7 +4977,7 @@ async def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -4878,8 +4990,10 @@ async def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -4984,7 +5098,7 @@ async def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -4998,8 +5112,10 @@ async def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -5104,7 +5220,7 @@ async def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -5119,8 +5235,10 @@ async def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -5164,7 +5282,7 @@ async def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -5175,8 +5293,10 @@ async def get_location( 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: ~.location_pb2.Location: Location object. @@ -5217,7 +5337,7 @@ async def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -5228,8 +5348,10 @@ async def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1beta1/services/job_service/client.py b/google/cloud/aiplatform_v1beta1/services/job_service/client.py index da22c83f4b..db1cfa15e3 100644 --- a/google/cloud/aiplatform_v1beta1/services/job_service/client.py +++ b/google/cloud/aiplatform_v1beta1/services/job_service/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 ( @@ -48,6 +49,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 as gac_operation # type: ignore from google.api_core import operation_async # type: ignore from google.cloud.aiplatform_v1beta1.services.job_service import pagers @@ -1010,6 +1020,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( @@ -1097,6 +1111,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.aiplatform_v1beta1.JobServiceClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "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.aiplatform.v1beta1.JobService", + "credentialsType": None, + }, + ) + def create_custom_job( self, request: Optional[Union[job_service.CreateCustomJobRequest, dict]] = None, @@ -1105,7 +1142,7 @@ def create_custom_job( custom_job: Optional[gca_custom_job.CustomJob] = 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]]] = (), ) -> gca_custom_job.CustomJob: r"""Creates a CustomJob. A created CustomJob right away will be attempted to be run. @@ -1161,8 +1198,10 @@ def sample_create_custom_job(): 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.aiplatform_v1beta1.types.CustomJob: @@ -1228,7 +1267,7 @@ def get_custom_job( 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]]] = (), ) -> custom_job.CustomJob: r"""Gets a CustomJob. @@ -1272,8 +1311,10 @@ def sample_get_custom_job(): 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.aiplatform_v1beta1.types.CustomJob: @@ -1337,7 +1378,7 @@ def list_custom_jobs( 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.ListCustomJobsPager: r"""Lists CustomJobs in a Location. @@ -1383,8 +1424,10 @@ def sample_list_custom_jobs(): 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.aiplatform_v1beta1.services.job_service.pagers.ListCustomJobsPager: @@ -1456,7 +1499,7 @@ def delete_custom_job( 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]]] = (), ) -> gac_operation.Operation: r"""Deletes a CustomJob. @@ -1505,8 +1548,10 @@ def sample_delete_custom_job(): 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: @@ -1582,7 +1627,7 @@ def cancel_custom_job( 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"""Cancels a CustomJob. Starts asynchronous cancellation on the CustomJob. The server makes a best effort to cancel the job, but @@ -1635,8 +1680,10 @@ def sample_cancel_custom_job(): 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 @@ -1686,7 +1733,7 @@ def create_data_labeling_job( data_labeling_job: Optional[gca_data_labeling_job.DataLabelingJob] = 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]]] = (), ) -> gca_data_labeling_job.DataLabelingJob: r"""Creates a DataLabelingJob. @@ -1746,8 +1793,10 @@ def sample_create_data_labeling_job(): 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.aiplatform_v1beta1.types.DataLabelingJob: @@ -1808,7 +1857,7 @@ def get_data_labeling_job( 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]]] = (), ) -> data_labeling_job.DataLabelingJob: r"""Gets a DataLabelingJob. @@ -1852,8 +1901,10 @@ def sample_get_data_labeling_job(): 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.aiplatform_v1beta1.types.DataLabelingJob: @@ -1912,7 +1963,7 @@ def list_data_labeling_jobs( 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.ListDataLabelingJobsPager: r"""Lists DataLabelingJobs in a Location. @@ -1957,8 +2008,10 @@ def sample_list_data_labeling_jobs(): 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.aiplatform_v1beta1.services.job_service.pagers.ListDataLabelingJobsPager: @@ -2030,7 +2083,7 @@ def delete_data_labeling_job( 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]]] = (), ) -> gac_operation.Operation: r"""Deletes a DataLabelingJob. @@ -2079,8 +2132,10 @@ def sample_delete_data_labeling_job(): 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: @@ -2156,7 +2211,7 @@ def cancel_data_labeling_job( 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"""Cancels a DataLabelingJob. Success of cancellation is not guaranteed. @@ -2198,8 +2253,10 @@ def sample_cancel_data_labeling_job(): 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 @@ -2253,7 +2310,7 @@ def create_hyperparameter_tuning_job( ] = 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]]] = (), ) -> gca_hyperparameter_tuning_job.HyperparameterTuningJob: r"""Creates a HyperparameterTuningJob @@ -2317,8 +2374,10 @@ def sample_create_hyperparameter_tuning_job(): 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.aiplatform_v1beta1.types.HyperparameterTuningJob: @@ -2384,7 +2443,7 @@ def get_hyperparameter_tuning_job( 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]]] = (), ) -> hyperparameter_tuning_job.HyperparameterTuningJob: r"""Gets a HyperparameterTuningJob @@ -2429,8 +2488,10 @@ def sample_get_hyperparameter_tuning_job(): 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.aiplatform_v1beta1.types.HyperparameterTuningJob: @@ -2494,7 +2555,7 @@ def list_hyperparameter_tuning_jobs( 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.ListHyperparameterTuningJobsPager: r"""Lists HyperparameterTuningJobs in a Location. @@ -2540,8 +2601,10 @@ def sample_list_hyperparameter_tuning_jobs(): 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.aiplatform_v1beta1.services.job_service.pagers.ListHyperparameterTuningJobsPager: @@ -2617,7 +2680,7 @@ def delete_hyperparameter_tuning_job( 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]]] = (), ) -> gac_operation.Operation: r"""Deletes a HyperparameterTuningJob. @@ -2666,8 +2729,10 @@ def sample_delete_hyperparameter_tuning_job(): 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: @@ -2747,7 +2812,7 @@ def cancel_hyperparameter_tuning_job( 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"""Cancels a HyperparameterTuningJob. Starts asynchronous cancellation on the HyperparameterTuningJob. The server makes a @@ -2802,8 +2867,10 @@ def sample_cancel_hyperparameter_tuning_job(): 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 @@ -2855,7 +2922,7 @@ def create_nas_job( nas_job: Optional[gca_nas_job.NasJob] = 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]]] = (), ) -> gca_nas_job.NasJob: r"""Creates a NasJob @@ -2912,8 +2979,10 @@ def sample_create_nas_job(): 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.aiplatform_v1beta1.types.NasJob: @@ -2973,7 +3042,7 @@ def get_nas_job( 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]]] = (), ) -> nas_job.NasJob: r"""Gets a NasJob @@ -3017,8 +3086,10 @@ def sample_get_nas_job(): 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.aiplatform_v1beta1.types.NasJob: @@ -3076,7 +3147,7 @@ def list_nas_jobs( 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.ListNasJobsPager: r"""Lists NasJobs in a Location. @@ -3122,8 +3193,10 @@ def sample_list_nas_jobs(): 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.aiplatform_v1beta1.services.job_service.pagers.ListNasJobsPager: @@ -3195,7 +3268,7 @@ def delete_nas_job( 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]]] = (), ) -> gac_operation.Operation: r"""Deletes a NasJob. @@ -3244,8 +3317,10 @@ def sample_delete_nas_job(): 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: @@ -3321,7 +3396,7 @@ def cancel_nas_job( 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"""Cancels a NasJob. Starts asynchronous cancellation on the NasJob. The server makes a best effort to cancel the job, but @@ -3374,8 +3449,10 @@ def sample_cancel_nas_job(): 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 @@ -3424,7 +3501,7 @@ def get_nas_trial_detail( 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]]] = (), ) -> nas_job.NasTrialDetail: r"""Gets a NasTrialDetail. @@ -3469,8 +3546,10 @@ def sample_get_nas_trial_detail(): 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.aiplatform_v1beta1.types.NasTrialDetail: @@ -3530,7 +3609,7 @@ def list_nas_trial_details( 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.ListNasTrialDetailsPager: r"""List top NasTrialDetails of a NasJob. @@ -3575,8 +3654,10 @@ def sample_list_nas_trial_details(): 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.aiplatform_v1beta1.services.job_service.pagers.ListNasTrialDetailsPager: @@ -3653,7 +3734,7 @@ def create_batch_prediction_job( ] = 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]]] = (), ) -> gca_batch_prediction_job.BatchPredictionJob: r"""Creates a BatchPredictionJob. A BatchPredictionJob once created will right away be attempted to start. @@ -3714,8 +3795,10 @@ def sample_create_batch_prediction_job(): 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.aiplatform_v1beta1.types.BatchPredictionJob: @@ -3782,7 +3865,7 @@ def get_batch_prediction_job( 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]]] = (), ) -> batch_prediction_job.BatchPredictionJob: r"""Gets a BatchPredictionJob @@ -3827,8 +3910,10 @@ def sample_get_batch_prediction_job(): 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.aiplatform_v1beta1.types.BatchPredictionJob: @@ -3893,7 +3978,7 @@ def list_batch_prediction_jobs( 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.ListBatchPredictionJobsPager: r"""Lists BatchPredictionJobs in a Location. @@ -3939,8 +4024,10 @@ def sample_list_batch_prediction_jobs(): 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.aiplatform_v1beta1.services.job_service.pagers.ListBatchPredictionJobsPager: @@ -4016,7 +4103,7 @@ def delete_batch_prediction_job( 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]]] = (), ) -> gac_operation.Operation: r"""Deletes a BatchPredictionJob. Can only be called on jobs that already finished. @@ -4066,8 +4153,10 @@ def sample_delete_batch_prediction_job(): 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: @@ -4147,7 +4236,7 @@ def cancel_batch_prediction_job( 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"""Cancels a BatchPredictionJob. @@ -4200,8 +4289,10 @@ def sample_cancel_batch_prediction_job(): 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 @@ -4257,7 +4348,7 @@ def create_model_deployment_monitoring_job( ] = 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]]] = (), ) -> gca_model_deployment_monitoring_job.ModelDeploymentMonitoringJob: r"""Creates a ModelDeploymentMonitoringJob. It will run periodically on a configured interval. @@ -4315,8 +4406,10 @@ def sample_create_model_deployment_monitoring_job(): 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.aiplatform_v1beta1.types.ModelDeploymentMonitoringJob: @@ -4390,7 +4483,7 @@ def search_model_deployment_monitoring_stats_anomalies( deployed_model_id: 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.SearchModelDeploymentMonitoringStatsAnomaliesPager: r"""Searches Model Monitoring Statistics generated within a given time window. @@ -4445,8 +4538,10 @@ def sample_search_model_deployment_monitoring_stats_anomalies(): 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.aiplatform_v1beta1.services.job_service.pagers.SearchModelDeploymentMonitoringStatsAnomaliesPager: @@ -4537,7 +4632,7 @@ def get_model_deployment_monitoring_job( 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]]] = (), ) -> model_deployment_monitoring_job.ModelDeploymentMonitoringJob: r"""Gets a ModelDeploymentMonitoringJob. @@ -4582,8 +4677,10 @@ def sample_get_model_deployment_monitoring_job(): 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.aiplatform_v1beta1.types.ModelDeploymentMonitoringJob: @@ -4648,7 +4745,7 @@ def list_model_deployment_monitoring_jobs( 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.ListModelDeploymentMonitoringJobsPager: r"""Lists ModelDeploymentMonitoringJobs in a Location. @@ -4694,8 +4791,10 @@ def sample_list_model_deployment_monitoring_jobs(): 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.aiplatform_v1beta1.services.job_service.pagers.ListModelDeploymentMonitoringJobsPager: @@ -4776,7 +4875,7 @@ def update_model_deployment_monitoring_job( 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]]] = (), ) -> gac_operation.Operation: r"""Updates a ModelDeploymentMonitoringJob. @@ -4862,8 +4961,10 @@ def sample_update_model_deployment_monitoring_job(): 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: @@ -4949,7 +5050,7 @@ def delete_model_deployment_monitoring_job( 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]]] = (), ) -> gac_operation.Operation: r"""Deletes a ModelDeploymentMonitoringJob. @@ -4998,8 +5099,10 @@ def sample_delete_model_deployment_monitoring_job(): 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: @@ -5081,7 +5184,7 @@ def pause_model_deployment_monitoring_job( 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"""Pauses a ModelDeploymentMonitoringJob. If the job is running, the server makes a best effort to cancel the job. Will mark @@ -5126,8 +5229,10 @@ def sample_pause_model_deployment_monitoring_job(): 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 @@ -5182,7 +5287,7 @@ def resume_model_deployment_monitoring_job( 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"""Resumes a paused ModelDeploymentMonitoringJob. It will start to run from next scheduled time. A deleted @@ -5226,8 +5331,10 @@ def sample_resume_model_deployment_monitoring_job(): 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 @@ -5292,7 +5399,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. @@ -5303,8 +5410,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. @@ -5345,7 +5454,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. @@ -5356,8 +5465,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. @@ -5398,7 +5509,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. @@ -5414,8 +5525,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 """ @@ -5452,7 +5565,7 @@ def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -5467,8 +5580,10 @@ def cancel_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 """ @@ -5505,7 +5620,7 @@ def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -5522,8 +5637,10 @@ def wait_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. @@ -5564,7 +5681,7 @@ def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -5577,8 +5694,10 @@ def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -5683,7 +5802,7 @@ def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -5697,8 +5816,10 @@ def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -5803,7 +5924,7 @@ def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -5818,8 +5939,10 @@ def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -5861,7 +5984,7 @@ def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -5872,8 +5995,10 @@ def get_location( 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: ~.location_pb2.Location: Location object. @@ -5914,7 +6039,7 @@ def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -5925,8 +6050,10 @@ def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1beta1/services/job_service/pagers.py b/google/cloud/aiplatform_v1beta1/services/job_service/pagers.py index 77e0fb6999..e92adc0b3b 100644 --- a/google/cloud/aiplatform_v1beta1/services/job_service/pagers.py +++ b/google/cloud/aiplatform_v1beta1/services/job_service/pagers.py @@ -75,7 +75,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. @@ -89,8 +89,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 = job_service.ListCustomJobsRequest(request) @@ -149,7 +151,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. @@ -163,8 +165,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 = job_service.ListCustomJobsRequest(request) @@ -227,7 +231,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. @@ -241,8 +245,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 = job_service.ListDataLabelingJobsRequest(request) @@ -301,7 +307,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. @@ -315,8 +321,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 = job_service.ListDataLabelingJobsRequest(request) @@ -379,7 +387,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. @@ -393,8 +401,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 = job_service.ListHyperparameterTuningJobsRequest(request) @@ -455,7 +465,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. @@ -469,8 +479,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 = job_service.ListHyperparameterTuningJobsRequest(request) @@ -537,7 +549,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. @@ -551,8 +563,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 = job_service.ListNasJobsRequest(request) @@ -611,7 +625,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. @@ -625,8 +639,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 = job_service.ListNasJobsRequest(request) @@ -689,7 +705,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. @@ -703,8 +719,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 = job_service.ListNasTrialDetailsRequest(request) @@ -763,7 +781,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. @@ -777,8 +795,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 = job_service.ListNasTrialDetailsRequest(request) @@ -841,7 +861,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. @@ -855,8 +875,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 = job_service.ListBatchPredictionJobsRequest(request) @@ -915,7 +937,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. @@ -929,8 +951,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 = job_service.ListBatchPredictionJobsRequest(request) @@ -995,7 +1019,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. @@ -1009,8 +1033,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 = ( @@ -1080,7 +1106,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. @@ -1094,8 +1120,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 = ( @@ -1168,7 +1196,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. @@ -1182,8 +1210,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 = job_service.ListModelDeploymentMonitoringJobsRequest(request) @@ -1246,7 +1276,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. @@ -1260,8 +1290,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 = job_service.ListModelDeploymentMonitoringJobsRequest(request) diff --git a/google/cloud/aiplatform_v1beta1/services/job_service/transports/grpc.py b/google/cloud/aiplatform_v1beta1/services/job_service/transports/grpc.py index cfe881a0ef..d0e47e06a1 100644 --- a/google/cloud/aiplatform_v1beta1/services/job_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1beta1/services/job_service/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 import warnings from typing import Callable, Dict, Optional, Sequence, Tuple, Union @@ -22,8 +25,11 @@ import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from google.cloud.aiplatform_v1beta1.types import batch_prediction_job from google.cloud.aiplatform_v1beta1.types import ( @@ -53,6 +59,81 @@ from google.protobuf import empty_pb2 # type: ignore from .base import JobServiceTransport, DEFAULT_CLIENT_INFO +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.aiplatform.v1beta1.JobService", + "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.aiplatform.v1beta1.JobService", + "rpcName": client_call_details.method, + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class JobServiceGrpcTransport(JobServiceTransport): """gRPC backend transport for JobService. @@ -207,7 +288,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 @@ -271,7 +357,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 @@ -296,7 +384,7 @@ def create_custom_job( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_custom_job" not in self._stubs: - self._stubs["create_custom_job"] = self.grpc_channel.unary_unary( + self._stubs["create_custom_job"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.JobService/CreateCustomJob", request_serializer=job_service.CreateCustomJobRequest.serialize, response_deserializer=gca_custom_job.CustomJob.deserialize, @@ -322,7 +410,7 @@ def get_custom_job( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_custom_job" not in self._stubs: - self._stubs["get_custom_job"] = self.grpc_channel.unary_unary( + self._stubs["get_custom_job"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.JobService/GetCustomJob", request_serializer=job_service.GetCustomJobRequest.serialize, response_deserializer=custom_job.CustomJob.deserialize, @@ -350,7 +438,7 @@ def list_custom_jobs( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_custom_jobs" not in self._stubs: - self._stubs["list_custom_jobs"] = self.grpc_channel.unary_unary( + self._stubs["list_custom_jobs"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.JobService/ListCustomJobs", request_serializer=job_service.ListCustomJobsRequest.serialize, response_deserializer=job_service.ListCustomJobsResponse.deserialize, @@ -376,7 +464,7 @@ def delete_custom_job( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_custom_job" not in self._stubs: - self._stubs["delete_custom_job"] = self.grpc_channel.unary_unary( + self._stubs["delete_custom_job"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.JobService/DeleteCustomJob", request_serializer=job_service.DeleteCustomJobRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -414,7 +502,7 @@ def cancel_custom_job( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_custom_job" not in self._stubs: - self._stubs["cancel_custom_job"] = self.grpc_channel.unary_unary( + self._stubs["cancel_custom_job"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.JobService/CancelCustomJob", request_serializer=job_service.CancelCustomJobRequest.serialize, response_deserializer=empty_pb2.Empty.FromString, @@ -443,7 +531,7 @@ def create_data_labeling_job( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_data_labeling_job" not in self._stubs: - self._stubs["create_data_labeling_job"] = self.grpc_channel.unary_unary( + self._stubs["create_data_labeling_job"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.JobService/CreateDataLabelingJob", request_serializer=job_service.CreateDataLabelingJobRequest.serialize, response_deserializer=gca_data_labeling_job.DataLabelingJob.deserialize, @@ -471,7 +559,7 @@ def get_data_labeling_job( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_data_labeling_job" not in self._stubs: - self._stubs["get_data_labeling_job"] = self.grpc_channel.unary_unary( + self._stubs["get_data_labeling_job"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.JobService/GetDataLabelingJob", request_serializer=job_service.GetDataLabelingJobRequest.serialize, response_deserializer=data_labeling_job.DataLabelingJob.deserialize, @@ -500,7 +588,7 @@ def list_data_labeling_jobs( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_data_labeling_jobs" not in self._stubs: - self._stubs["list_data_labeling_jobs"] = self.grpc_channel.unary_unary( + self._stubs["list_data_labeling_jobs"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.JobService/ListDataLabelingJobs", request_serializer=job_service.ListDataLabelingJobsRequest.serialize, response_deserializer=job_service.ListDataLabelingJobsResponse.deserialize, @@ -526,7 +614,7 @@ def delete_data_labeling_job( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_data_labeling_job" not in self._stubs: - self._stubs["delete_data_labeling_job"] = self.grpc_channel.unary_unary( + self._stubs["delete_data_labeling_job"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.JobService/DeleteDataLabelingJob", request_serializer=job_service.DeleteDataLabelingJobRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -553,7 +641,7 @@ def cancel_data_labeling_job( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_data_labeling_job" not in self._stubs: - self._stubs["cancel_data_labeling_job"] = self.grpc_channel.unary_unary( + self._stubs["cancel_data_labeling_job"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.JobService/CancelDataLabelingJob", request_serializer=job_service.CancelDataLabelingJobRequest.serialize, response_deserializer=empty_pb2.Empty.FromString, @@ -585,7 +673,7 @@ def create_hyperparameter_tuning_job( if "create_hyperparameter_tuning_job" not in self._stubs: self._stubs[ "create_hyperparameter_tuning_job" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.JobService/CreateHyperparameterTuningJob", request_serializer=job_service.CreateHyperparameterTuningJobRequest.serialize, response_deserializer=gca_hyperparameter_tuning_job.HyperparameterTuningJob.deserialize, @@ -616,7 +704,7 @@ def get_hyperparameter_tuning_job( if "get_hyperparameter_tuning_job" not in self._stubs: self._stubs[ "get_hyperparameter_tuning_job" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.JobService/GetHyperparameterTuningJob", request_serializer=job_service.GetHyperparameterTuningJobRequest.serialize, response_deserializer=hyperparameter_tuning_job.HyperparameterTuningJob.deserialize, @@ -648,7 +736,7 @@ def list_hyperparameter_tuning_jobs( if "list_hyperparameter_tuning_jobs" not in self._stubs: self._stubs[ "list_hyperparameter_tuning_jobs" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.JobService/ListHyperparameterTuningJobs", request_serializer=job_service.ListHyperparameterTuningJobsRequest.serialize, response_deserializer=job_service.ListHyperparameterTuningJobsResponse.deserialize, @@ -679,7 +767,7 @@ def delete_hyperparameter_tuning_job( if "delete_hyperparameter_tuning_job" not in self._stubs: self._stubs[ "delete_hyperparameter_tuning_job" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.JobService/DeleteHyperparameterTuningJob", request_serializer=job_service.DeleteHyperparameterTuningJobRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -721,7 +809,7 @@ def cancel_hyperparameter_tuning_job( if "cancel_hyperparameter_tuning_job" not in self._stubs: self._stubs[ "cancel_hyperparameter_tuning_job" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.JobService/CancelHyperparameterTuningJob", request_serializer=job_service.CancelHyperparameterTuningJobRequest.serialize, response_deserializer=empty_pb2.Empty.FromString, @@ -747,7 +835,7 @@ def create_nas_job( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_nas_job" not in self._stubs: - self._stubs["create_nas_job"] = self.grpc_channel.unary_unary( + self._stubs["create_nas_job"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.JobService/CreateNasJob", request_serializer=job_service.CreateNasJobRequest.serialize, response_deserializer=gca_nas_job.NasJob.deserialize, @@ -771,7 +859,7 @@ def get_nas_job(self) -> Callable[[job_service.GetNasJobRequest], nas_job.NasJob # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_nas_job" not in self._stubs: - self._stubs["get_nas_job"] = self.grpc_channel.unary_unary( + self._stubs["get_nas_job"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.JobService/GetNasJob", request_serializer=job_service.GetNasJobRequest.serialize, response_deserializer=nas_job.NasJob.deserialize, @@ -797,7 +885,7 @@ def list_nas_jobs( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_nas_jobs" not in self._stubs: - self._stubs["list_nas_jobs"] = self.grpc_channel.unary_unary( + self._stubs["list_nas_jobs"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.JobService/ListNasJobs", request_serializer=job_service.ListNasJobsRequest.serialize, response_deserializer=job_service.ListNasJobsResponse.deserialize, @@ -823,7 +911,7 @@ def delete_nas_job( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_nas_job" not in self._stubs: - self._stubs["delete_nas_job"] = self.grpc_channel.unary_unary( + self._stubs["delete_nas_job"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.JobService/DeleteNasJob", request_serializer=job_service.DeleteNasJobRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -861,7 +949,7 @@ def cancel_nas_job( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_nas_job" not in self._stubs: - self._stubs["cancel_nas_job"] = self.grpc_channel.unary_unary( + self._stubs["cancel_nas_job"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.JobService/CancelNasJob", request_serializer=job_service.CancelNasJobRequest.serialize, response_deserializer=empty_pb2.Empty.FromString, @@ -887,7 +975,7 @@ def get_nas_trial_detail( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_nas_trial_detail" not in self._stubs: - self._stubs["get_nas_trial_detail"] = self.grpc_channel.unary_unary( + self._stubs["get_nas_trial_detail"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.JobService/GetNasTrialDetail", request_serializer=job_service.GetNasTrialDetailRequest.serialize, response_deserializer=nas_job.NasTrialDetail.deserialize, @@ -916,7 +1004,7 @@ def list_nas_trial_details( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_nas_trial_details" not in self._stubs: - self._stubs["list_nas_trial_details"] = self.grpc_channel.unary_unary( + self._stubs["list_nas_trial_details"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.JobService/ListNasTrialDetails", request_serializer=job_service.ListNasTrialDetailsRequest.serialize, response_deserializer=job_service.ListNasTrialDetailsResponse.deserialize, @@ -946,7 +1034,9 @@ def create_batch_prediction_job( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_batch_prediction_job" not in self._stubs: - self._stubs["create_batch_prediction_job"] = self.grpc_channel.unary_unary( + self._stubs[ + "create_batch_prediction_job" + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.JobService/CreateBatchPredictionJob", request_serializer=job_service.CreateBatchPredictionJobRequest.serialize, response_deserializer=gca_batch_prediction_job.BatchPredictionJob.deserialize, @@ -975,7 +1065,7 @@ def get_batch_prediction_job( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_batch_prediction_job" not in self._stubs: - self._stubs["get_batch_prediction_job"] = self.grpc_channel.unary_unary( + self._stubs["get_batch_prediction_job"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.JobService/GetBatchPredictionJob", request_serializer=job_service.GetBatchPredictionJobRequest.serialize, response_deserializer=batch_prediction_job.BatchPredictionJob.deserialize, @@ -1004,7 +1094,9 @@ def list_batch_prediction_jobs( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_batch_prediction_jobs" not in self._stubs: - self._stubs["list_batch_prediction_jobs"] = self.grpc_channel.unary_unary( + self._stubs[ + "list_batch_prediction_jobs" + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.JobService/ListBatchPredictionJobs", request_serializer=job_service.ListBatchPredictionJobsRequest.serialize, response_deserializer=job_service.ListBatchPredictionJobsResponse.deserialize, @@ -1033,7 +1125,9 @@ def delete_batch_prediction_job( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_batch_prediction_job" not in self._stubs: - self._stubs["delete_batch_prediction_job"] = self.grpc_channel.unary_unary( + self._stubs[ + "delete_batch_prediction_job" + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.JobService/DeleteBatchPredictionJob", request_serializer=job_service.DeleteBatchPredictionJobRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -1070,7 +1164,9 @@ def cancel_batch_prediction_job( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_batch_prediction_job" not in self._stubs: - self._stubs["cancel_batch_prediction_job"] = self.grpc_channel.unary_unary( + self._stubs[ + "cancel_batch_prediction_job" + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.JobService/CancelBatchPredictionJob", request_serializer=job_service.CancelBatchPredictionJobRequest.serialize, response_deserializer=empty_pb2.Empty.FromString, @@ -1103,7 +1199,7 @@ def create_model_deployment_monitoring_job( if "create_model_deployment_monitoring_job" not in self._stubs: self._stubs[ "create_model_deployment_monitoring_job" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.JobService/CreateModelDeploymentMonitoringJob", request_serializer=job_service.CreateModelDeploymentMonitoringJobRequest.serialize, response_deserializer=gca_model_deployment_monitoring_job.ModelDeploymentMonitoringJob.deserialize, @@ -1136,7 +1232,7 @@ def search_model_deployment_monitoring_stats_anomalies( if "search_model_deployment_monitoring_stats_anomalies" not in self._stubs: self._stubs[ "search_model_deployment_monitoring_stats_anomalies" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.JobService/SearchModelDeploymentMonitoringStatsAnomalies", request_serializer=job_service.SearchModelDeploymentMonitoringStatsAnomaliesRequest.serialize, response_deserializer=job_service.SearchModelDeploymentMonitoringStatsAnomaliesResponse.deserialize, @@ -1168,7 +1264,7 @@ def get_model_deployment_monitoring_job( if "get_model_deployment_monitoring_job" not in self._stubs: self._stubs[ "get_model_deployment_monitoring_job" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.JobService/GetModelDeploymentMonitoringJob", request_serializer=job_service.GetModelDeploymentMonitoringJobRequest.serialize, response_deserializer=model_deployment_monitoring_job.ModelDeploymentMonitoringJob.deserialize, @@ -1200,7 +1296,7 @@ def list_model_deployment_monitoring_jobs( if "list_model_deployment_monitoring_jobs" not in self._stubs: self._stubs[ "list_model_deployment_monitoring_jobs" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.JobService/ListModelDeploymentMonitoringJobs", request_serializer=job_service.ListModelDeploymentMonitoringJobsRequest.serialize, response_deserializer=job_service.ListModelDeploymentMonitoringJobsResponse.deserialize, @@ -1232,7 +1328,7 @@ def update_model_deployment_monitoring_job( if "update_model_deployment_monitoring_job" not in self._stubs: self._stubs[ "update_model_deployment_monitoring_job" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.JobService/UpdateModelDeploymentMonitoringJob", request_serializer=job_service.UpdateModelDeploymentMonitoringJobRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -1264,7 +1360,7 @@ def delete_model_deployment_monitoring_job( if "delete_model_deployment_monitoring_job" not in self._stubs: self._stubs[ "delete_model_deployment_monitoring_job" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.JobService/DeleteModelDeploymentMonitoringJob", request_serializer=job_service.DeleteModelDeploymentMonitoringJobRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -1298,7 +1394,7 @@ def pause_model_deployment_monitoring_job( if "pause_model_deployment_monitoring_job" not in self._stubs: self._stubs[ "pause_model_deployment_monitoring_job" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.JobService/PauseModelDeploymentMonitoringJob", request_serializer=job_service.PauseModelDeploymentMonitoringJobRequest.serialize, response_deserializer=empty_pb2.Empty.FromString, @@ -1331,7 +1427,7 @@ def resume_model_deployment_monitoring_job( if "resume_model_deployment_monitoring_job" not in self._stubs: self._stubs[ "resume_model_deployment_monitoring_job" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.JobService/ResumeModelDeploymentMonitoringJob", request_serializer=job_service.ResumeModelDeploymentMonitoringJobRequest.serialize, response_deserializer=empty_pb2.Empty.FromString, @@ -1339,7 +1435,7 @@ def resume_model_deployment_monitoring_job( return self._stubs["resume_model_deployment_monitoring_job"] def close(self): - self.grpc_channel.close() + self._logged_channel.close() @property def delete_operation( @@ -1351,7 +1447,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, @@ -1368,7 +1464,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -1385,7 +1481,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -1402,7 +1498,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, @@ -1421,7 +1517,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, @@ -1440,7 +1536,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -1457,7 +1553,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -1482,7 +1578,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -1508,7 +1604,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -1537,7 +1633,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1beta1/services/job_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1beta1/services/job_service/transports/grpc_asyncio.py index 3f0f40c4da..c63772254c 100644 --- a/google/cloud/aiplatform_v1beta1/services/job_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/job_service/transports/grpc_asyncio.py @@ -14,6 +14,9 @@ # limitations under the License. # import inspect +import json +import pickle +import logging as std_logging import warnings from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union @@ -24,8 +27,11 @@ from google.api_core import operations_v1 from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from grpc.experimental import aio # type: ignore from google.cloud.aiplatform_v1beta1.types import batch_prediction_job @@ -57,6 +63,82 @@ from .base import JobServiceTransport, DEFAULT_CLIENT_INFO from .grpc import JobServiceGrpcTransport +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.aiplatform.v1beta1.JobService", + "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.aiplatform.v1beta1.JobService", + "rpcName": str(client_call_details.method), + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class JobServiceGrpcAsyncIOTransport(JobServiceTransport): """gRPC AsyncIO backend transport for JobService. @@ -254,10 +336,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 @@ -280,7 +365,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. @@ -308,7 +393,7 @@ def create_custom_job( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_custom_job" not in self._stubs: - self._stubs["create_custom_job"] = self.grpc_channel.unary_unary( + self._stubs["create_custom_job"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.JobService/CreateCustomJob", request_serializer=job_service.CreateCustomJobRequest.serialize, response_deserializer=gca_custom_job.CustomJob.deserialize, @@ -334,7 +419,7 @@ def get_custom_job( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_custom_job" not in self._stubs: - self._stubs["get_custom_job"] = self.grpc_channel.unary_unary( + self._stubs["get_custom_job"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.JobService/GetCustomJob", request_serializer=job_service.GetCustomJobRequest.serialize, response_deserializer=custom_job.CustomJob.deserialize, @@ -363,7 +448,7 @@ def list_custom_jobs( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_custom_jobs" not in self._stubs: - self._stubs["list_custom_jobs"] = self.grpc_channel.unary_unary( + self._stubs["list_custom_jobs"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.JobService/ListCustomJobs", request_serializer=job_service.ListCustomJobsRequest.serialize, response_deserializer=job_service.ListCustomJobsResponse.deserialize, @@ -391,7 +476,7 @@ def delete_custom_job( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_custom_job" not in self._stubs: - self._stubs["delete_custom_job"] = self.grpc_channel.unary_unary( + self._stubs["delete_custom_job"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.JobService/DeleteCustomJob", request_serializer=job_service.DeleteCustomJobRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -429,7 +514,7 @@ def cancel_custom_job( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_custom_job" not in self._stubs: - self._stubs["cancel_custom_job"] = self.grpc_channel.unary_unary( + self._stubs["cancel_custom_job"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.JobService/CancelCustomJob", request_serializer=job_service.CancelCustomJobRequest.serialize, response_deserializer=empty_pb2.Empty.FromString, @@ -458,7 +543,7 @@ def create_data_labeling_job( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_data_labeling_job" not in self._stubs: - self._stubs["create_data_labeling_job"] = self.grpc_channel.unary_unary( + self._stubs["create_data_labeling_job"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.JobService/CreateDataLabelingJob", request_serializer=job_service.CreateDataLabelingJobRequest.serialize, response_deserializer=gca_data_labeling_job.DataLabelingJob.deserialize, @@ -487,7 +572,7 @@ def get_data_labeling_job( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_data_labeling_job" not in self._stubs: - self._stubs["get_data_labeling_job"] = self.grpc_channel.unary_unary( + self._stubs["get_data_labeling_job"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.JobService/GetDataLabelingJob", request_serializer=job_service.GetDataLabelingJobRequest.serialize, response_deserializer=data_labeling_job.DataLabelingJob.deserialize, @@ -516,7 +601,7 @@ def list_data_labeling_jobs( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_data_labeling_jobs" not in self._stubs: - self._stubs["list_data_labeling_jobs"] = self.grpc_channel.unary_unary( + self._stubs["list_data_labeling_jobs"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.JobService/ListDataLabelingJobs", request_serializer=job_service.ListDataLabelingJobsRequest.serialize, response_deserializer=job_service.ListDataLabelingJobsResponse.deserialize, @@ -544,7 +629,7 @@ def delete_data_labeling_job( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_data_labeling_job" not in self._stubs: - self._stubs["delete_data_labeling_job"] = self.grpc_channel.unary_unary( + self._stubs["delete_data_labeling_job"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.JobService/DeleteDataLabelingJob", request_serializer=job_service.DeleteDataLabelingJobRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -573,7 +658,7 @@ def cancel_data_labeling_job( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_data_labeling_job" not in self._stubs: - self._stubs["cancel_data_labeling_job"] = self.grpc_channel.unary_unary( + self._stubs["cancel_data_labeling_job"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.JobService/CancelDataLabelingJob", request_serializer=job_service.CancelDataLabelingJobRequest.serialize, response_deserializer=empty_pb2.Empty.FromString, @@ -605,7 +690,7 @@ def create_hyperparameter_tuning_job( if "create_hyperparameter_tuning_job" not in self._stubs: self._stubs[ "create_hyperparameter_tuning_job" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.JobService/CreateHyperparameterTuningJob", request_serializer=job_service.CreateHyperparameterTuningJobRequest.serialize, response_deserializer=gca_hyperparameter_tuning_job.HyperparameterTuningJob.deserialize, @@ -636,7 +721,7 @@ def get_hyperparameter_tuning_job( if "get_hyperparameter_tuning_job" not in self._stubs: self._stubs[ "get_hyperparameter_tuning_job" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.JobService/GetHyperparameterTuningJob", request_serializer=job_service.GetHyperparameterTuningJobRequest.serialize, response_deserializer=hyperparameter_tuning_job.HyperparameterTuningJob.deserialize, @@ -668,7 +753,7 @@ def list_hyperparameter_tuning_jobs( if "list_hyperparameter_tuning_jobs" not in self._stubs: self._stubs[ "list_hyperparameter_tuning_jobs" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.JobService/ListHyperparameterTuningJobs", request_serializer=job_service.ListHyperparameterTuningJobsRequest.serialize, response_deserializer=job_service.ListHyperparameterTuningJobsResponse.deserialize, @@ -700,7 +785,7 @@ def delete_hyperparameter_tuning_job( if "delete_hyperparameter_tuning_job" not in self._stubs: self._stubs[ "delete_hyperparameter_tuning_job" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.JobService/DeleteHyperparameterTuningJob", request_serializer=job_service.DeleteHyperparameterTuningJobRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -744,7 +829,7 @@ def cancel_hyperparameter_tuning_job( if "cancel_hyperparameter_tuning_job" not in self._stubs: self._stubs[ "cancel_hyperparameter_tuning_job" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.JobService/CancelHyperparameterTuningJob", request_serializer=job_service.CancelHyperparameterTuningJobRequest.serialize, response_deserializer=empty_pb2.Empty.FromString, @@ -770,7 +855,7 @@ def create_nas_job( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_nas_job" not in self._stubs: - self._stubs["create_nas_job"] = self.grpc_channel.unary_unary( + self._stubs["create_nas_job"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.JobService/CreateNasJob", request_serializer=job_service.CreateNasJobRequest.serialize, response_deserializer=gca_nas_job.NasJob.deserialize, @@ -796,7 +881,7 @@ def get_nas_job( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_nas_job" not in self._stubs: - self._stubs["get_nas_job"] = self.grpc_channel.unary_unary( + self._stubs["get_nas_job"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.JobService/GetNasJob", request_serializer=job_service.GetNasJobRequest.serialize, response_deserializer=nas_job.NasJob.deserialize, @@ -824,7 +909,7 @@ def list_nas_jobs( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_nas_jobs" not in self._stubs: - self._stubs["list_nas_jobs"] = self.grpc_channel.unary_unary( + self._stubs["list_nas_jobs"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.JobService/ListNasJobs", request_serializer=job_service.ListNasJobsRequest.serialize, response_deserializer=job_service.ListNasJobsResponse.deserialize, @@ -852,7 +937,7 @@ def delete_nas_job( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_nas_job" not in self._stubs: - self._stubs["delete_nas_job"] = self.grpc_channel.unary_unary( + self._stubs["delete_nas_job"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.JobService/DeleteNasJob", request_serializer=job_service.DeleteNasJobRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -890,7 +975,7 @@ def cancel_nas_job( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_nas_job" not in self._stubs: - self._stubs["cancel_nas_job"] = self.grpc_channel.unary_unary( + self._stubs["cancel_nas_job"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.JobService/CancelNasJob", request_serializer=job_service.CancelNasJobRequest.serialize, response_deserializer=empty_pb2.Empty.FromString, @@ -918,7 +1003,7 @@ def get_nas_trial_detail( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_nas_trial_detail" not in self._stubs: - self._stubs["get_nas_trial_detail"] = self.grpc_channel.unary_unary( + self._stubs["get_nas_trial_detail"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.JobService/GetNasTrialDetail", request_serializer=job_service.GetNasTrialDetailRequest.serialize, response_deserializer=nas_job.NasTrialDetail.deserialize, @@ -947,7 +1032,7 @@ def list_nas_trial_details( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_nas_trial_details" not in self._stubs: - self._stubs["list_nas_trial_details"] = self.grpc_channel.unary_unary( + self._stubs["list_nas_trial_details"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.JobService/ListNasTrialDetails", request_serializer=job_service.ListNasTrialDetailsRequest.serialize, response_deserializer=job_service.ListNasTrialDetailsResponse.deserialize, @@ -977,7 +1062,9 @@ def create_batch_prediction_job( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_batch_prediction_job" not in self._stubs: - self._stubs["create_batch_prediction_job"] = self.grpc_channel.unary_unary( + self._stubs[ + "create_batch_prediction_job" + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.JobService/CreateBatchPredictionJob", request_serializer=job_service.CreateBatchPredictionJobRequest.serialize, response_deserializer=gca_batch_prediction_job.BatchPredictionJob.deserialize, @@ -1006,7 +1093,7 @@ def get_batch_prediction_job( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_batch_prediction_job" not in self._stubs: - self._stubs["get_batch_prediction_job"] = self.grpc_channel.unary_unary( + self._stubs["get_batch_prediction_job"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.JobService/GetBatchPredictionJob", request_serializer=job_service.GetBatchPredictionJobRequest.serialize, response_deserializer=batch_prediction_job.BatchPredictionJob.deserialize, @@ -1035,7 +1122,9 @@ def list_batch_prediction_jobs( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_batch_prediction_jobs" not in self._stubs: - self._stubs["list_batch_prediction_jobs"] = self.grpc_channel.unary_unary( + self._stubs[ + "list_batch_prediction_jobs" + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.JobService/ListBatchPredictionJobs", request_serializer=job_service.ListBatchPredictionJobsRequest.serialize, response_deserializer=job_service.ListBatchPredictionJobsResponse.deserialize, @@ -1065,7 +1154,9 @@ def delete_batch_prediction_job( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_batch_prediction_job" not in self._stubs: - self._stubs["delete_batch_prediction_job"] = self.grpc_channel.unary_unary( + self._stubs[ + "delete_batch_prediction_job" + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.JobService/DeleteBatchPredictionJob", request_serializer=job_service.DeleteBatchPredictionJobRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -1104,7 +1195,9 @@ def cancel_batch_prediction_job( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_batch_prediction_job" not in self._stubs: - self._stubs["cancel_batch_prediction_job"] = self.grpc_channel.unary_unary( + self._stubs[ + "cancel_batch_prediction_job" + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.JobService/CancelBatchPredictionJob", request_serializer=job_service.CancelBatchPredictionJobRequest.serialize, response_deserializer=empty_pb2.Empty.FromString, @@ -1137,7 +1230,7 @@ def create_model_deployment_monitoring_job( if "create_model_deployment_monitoring_job" not in self._stubs: self._stubs[ "create_model_deployment_monitoring_job" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.JobService/CreateModelDeploymentMonitoringJob", request_serializer=job_service.CreateModelDeploymentMonitoringJobRequest.serialize, response_deserializer=gca_model_deployment_monitoring_job.ModelDeploymentMonitoringJob.deserialize, @@ -1170,7 +1263,7 @@ def search_model_deployment_monitoring_stats_anomalies( if "search_model_deployment_monitoring_stats_anomalies" not in self._stubs: self._stubs[ "search_model_deployment_monitoring_stats_anomalies" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.JobService/SearchModelDeploymentMonitoringStatsAnomalies", request_serializer=job_service.SearchModelDeploymentMonitoringStatsAnomaliesRequest.serialize, response_deserializer=job_service.SearchModelDeploymentMonitoringStatsAnomaliesResponse.deserialize, @@ -1202,7 +1295,7 @@ def get_model_deployment_monitoring_job( if "get_model_deployment_monitoring_job" not in self._stubs: self._stubs[ "get_model_deployment_monitoring_job" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.JobService/GetModelDeploymentMonitoringJob", request_serializer=job_service.GetModelDeploymentMonitoringJobRequest.serialize, response_deserializer=model_deployment_monitoring_job.ModelDeploymentMonitoringJob.deserialize, @@ -1234,7 +1327,7 @@ def list_model_deployment_monitoring_jobs( if "list_model_deployment_monitoring_jobs" not in self._stubs: self._stubs[ "list_model_deployment_monitoring_jobs" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.JobService/ListModelDeploymentMonitoringJobs", request_serializer=job_service.ListModelDeploymentMonitoringJobsRequest.serialize, response_deserializer=job_service.ListModelDeploymentMonitoringJobsResponse.deserialize, @@ -1266,7 +1359,7 @@ def update_model_deployment_monitoring_job( if "update_model_deployment_monitoring_job" not in self._stubs: self._stubs[ "update_model_deployment_monitoring_job" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.JobService/UpdateModelDeploymentMonitoringJob", request_serializer=job_service.UpdateModelDeploymentMonitoringJobRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -1298,7 +1391,7 @@ def delete_model_deployment_monitoring_job( if "delete_model_deployment_monitoring_job" not in self._stubs: self._stubs[ "delete_model_deployment_monitoring_job" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.JobService/DeleteModelDeploymentMonitoringJob", request_serializer=job_service.DeleteModelDeploymentMonitoringJobRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -1333,7 +1426,7 @@ def pause_model_deployment_monitoring_job( if "pause_model_deployment_monitoring_job" not in self._stubs: self._stubs[ "pause_model_deployment_monitoring_job" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.JobService/PauseModelDeploymentMonitoringJob", request_serializer=job_service.PauseModelDeploymentMonitoringJobRequest.serialize, response_deserializer=empty_pb2.Empty.FromString, @@ -1367,7 +1460,7 @@ def resume_model_deployment_monitoring_job( if "resume_model_deployment_monitoring_job" not in self._stubs: self._stubs[ "resume_model_deployment_monitoring_job" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.JobService/ResumeModelDeploymentMonitoringJob", request_serializer=job_service.ResumeModelDeploymentMonitoringJobRequest.serialize, response_deserializer=empty_pb2.Empty.FromString, @@ -1610,7 +1703,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: @@ -1626,7 +1719,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, @@ -1643,7 +1736,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -1660,7 +1753,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -1677,7 +1770,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, @@ -1696,7 +1789,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, @@ -1715,7 +1808,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -1732,7 +1825,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -1757,7 +1850,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -1783,7 +1876,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -1812,7 +1905,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1beta1/services/job_service/transports/rest.py b/google/cloud/aiplatform_v1beta1/services/job_service/transports/rest.py index 98da1b6812..422e2aaf01 100644 --- a/google/cloud/aiplatform_v1beta1/services/job_service/transports/rest.py +++ b/google/cloud/aiplatform_v1beta1/services/job_service/transports/rest.py @@ -13,9 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging +import json # type: ignore from google.auth.transport.requests import AuthorizedSession # type: ignore -import json # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.api_core import exceptions as core_exceptions from google.api_core import retry as retries @@ -68,6 +69,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, @@ -352,8 +361,11 @@ def post_update_model_deployment_monitoring_job(self, response): def pre_cancel_batch_prediction_job( self, request: job_service.CancelBatchPredictionJobRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[job_service.CancelBatchPredictionJobRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + job_service.CancelBatchPredictionJobRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for cancel_batch_prediction_job Override in a subclass to manipulate the request or metadata @@ -364,8 +376,10 @@ def pre_cancel_batch_prediction_job( def pre_cancel_custom_job( self, request: job_service.CancelCustomJobRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[job_service.CancelCustomJobRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + job_service.CancelCustomJobRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_custom_job Override in a subclass to manipulate the request or metadata @@ -376,8 +390,11 @@ def pre_cancel_custom_job( def pre_cancel_data_labeling_job( self, request: job_service.CancelDataLabelingJobRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[job_service.CancelDataLabelingJobRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + job_service.CancelDataLabelingJobRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for cancel_data_labeling_job Override in a subclass to manipulate the request or metadata @@ -388,9 +405,10 @@ def pre_cancel_data_labeling_job( def pre_cancel_hyperparameter_tuning_job( self, request: job_service.CancelHyperparameterTuningJobRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - job_service.CancelHyperparameterTuningJobRequest, Sequence[Tuple[str, str]] + job_service.CancelHyperparameterTuningJobRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for cancel_hyperparameter_tuning_job @@ -402,8 +420,10 @@ def pre_cancel_hyperparameter_tuning_job( def pre_cancel_nas_job( self, request: job_service.CancelNasJobRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[job_service.CancelNasJobRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + job_service.CancelNasJobRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_nas_job Override in a subclass to manipulate the request or metadata @@ -414,8 +434,11 @@ def pre_cancel_nas_job( def pre_create_batch_prediction_job( self, request: job_service.CreateBatchPredictionJobRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[job_service.CreateBatchPredictionJobRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + job_service.CreateBatchPredictionJobRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for create_batch_prediction_job Override in a subclass to manipulate the request or metadata @@ -437,8 +460,10 @@ def post_create_batch_prediction_job( def pre_create_custom_job( self, request: job_service.CreateCustomJobRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[job_service.CreateCustomJobRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + job_service.CreateCustomJobRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for create_custom_job Override in a subclass to manipulate the request or metadata @@ -460,8 +485,11 @@ def post_create_custom_job( def pre_create_data_labeling_job( self, request: job_service.CreateDataLabelingJobRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[job_service.CreateDataLabelingJobRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + job_service.CreateDataLabelingJobRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for create_data_labeling_job Override in a subclass to manipulate the request or metadata @@ -483,9 +511,10 @@ def post_create_data_labeling_job( def pre_create_hyperparameter_tuning_job( self, request: job_service.CreateHyperparameterTuningJobRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - job_service.CreateHyperparameterTuningJobRequest, Sequence[Tuple[str, str]] + job_service.CreateHyperparameterTuningJobRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for create_hyperparameter_tuning_job @@ -508,9 +537,10 @@ def post_create_hyperparameter_tuning_job( def pre_create_model_deployment_monitoring_job( self, request: job_service.CreateModelDeploymentMonitoringJobRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - job_service.CreateModelDeploymentMonitoringJobRequest, Sequence[Tuple[str, str]] + job_service.CreateModelDeploymentMonitoringJobRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for create_model_deployment_monitoring_job @@ -533,8 +563,10 @@ def post_create_model_deployment_monitoring_job( def pre_create_nas_job( self, request: job_service.CreateNasJobRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[job_service.CreateNasJobRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + job_service.CreateNasJobRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for create_nas_job Override in a subclass to manipulate the request or metadata @@ -554,8 +586,11 @@ def post_create_nas_job(self, response: gca_nas_job.NasJob) -> gca_nas_job.NasJo def pre_delete_batch_prediction_job( self, request: job_service.DeleteBatchPredictionJobRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[job_service.DeleteBatchPredictionJobRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + job_service.DeleteBatchPredictionJobRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for delete_batch_prediction_job Override in a subclass to manipulate the request or metadata @@ -577,8 +612,10 @@ def post_delete_batch_prediction_job( def pre_delete_custom_job( self, request: job_service.DeleteCustomJobRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[job_service.DeleteCustomJobRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + job_service.DeleteCustomJobRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for delete_custom_job Override in a subclass to manipulate the request or metadata @@ -600,8 +637,11 @@ def post_delete_custom_job( def pre_delete_data_labeling_job( self, request: job_service.DeleteDataLabelingJobRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[job_service.DeleteDataLabelingJobRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + job_service.DeleteDataLabelingJobRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for delete_data_labeling_job Override in a subclass to manipulate the request or metadata @@ -623,9 +663,10 @@ def post_delete_data_labeling_job( def pre_delete_hyperparameter_tuning_job( self, request: job_service.DeleteHyperparameterTuningJobRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - job_service.DeleteHyperparameterTuningJobRequest, Sequence[Tuple[str, str]] + job_service.DeleteHyperparameterTuningJobRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for delete_hyperparameter_tuning_job @@ -648,9 +689,10 @@ def post_delete_hyperparameter_tuning_job( def pre_delete_model_deployment_monitoring_job( self, request: job_service.DeleteModelDeploymentMonitoringJobRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - job_service.DeleteModelDeploymentMonitoringJobRequest, Sequence[Tuple[str, str]] + job_service.DeleteModelDeploymentMonitoringJobRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for delete_model_deployment_monitoring_job @@ -673,8 +715,10 @@ def post_delete_model_deployment_monitoring_job( def pre_delete_nas_job( self, request: job_service.DeleteNasJobRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[job_service.DeleteNasJobRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + job_service.DeleteNasJobRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for delete_nas_job Override in a subclass to manipulate the request or metadata @@ -696,8 +740,11 @@ def post_delete_nas_job( def pre_get_batch_prediction_job( self, request: job_service.GetBatchPredictionJobRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[job_service.GetBatchPredictionJobRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + job_service.GetBatchPredictionJobRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for get_batch_prediction_job Override in a subclass to manipulate the request or metadata @@ -719,8 +766,10 @@ def post_get_batch_prediction_job( def pre_get_custom_job( self, request: job_service.GetCustomJobRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[job_service.GetCustomJobRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + job_service.GetCustomJobRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_custom_job Override in a subclass to manipulate the request or metadata @@ -742,8 +791,10 @@ def post_get_custom_job( def pre_get_data_labeling_job( self, request: job_service.GetDataLabelingJobRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[job_service.GetDataLabelingJobRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + job_service.GetDataLabelingJobRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_data_labeling_job Override in a subclass to manipulate the request or metadata @@ -765,9 +816,10 @@ def post_get_data_labeling_job( def pre_get_hyperparameter_tuning_job( self, request: job_service.GetHyperparameterTuningJobRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - job_service.GetHyperparameterTuningJobRequest, Sequence[Tuple[str, str]] + job_service.GetHyperparameterTuningJobRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for get_hyperparameter_tuning_job @@ -790,9 +842,10 @@ def post_get_hyperparameter_tuning_job( def pre_get_model_deployment_monitoring_job( self, request: job_service.GetModelDeploymentMonitoringJobRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - job_service.GetModelDeploymentMonitoringJobRequest, Sequence[Tuple[str, str]] + job_service.GetModelDeploymentMonitoringJobRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for get_model_deployment_monitoring_job @@ -813,8 +866,10 @@ def post_get_model_deployment_monitoring_job( return response def pre_get_nas_job( - self, request: job_service.GetNasJobRequest, metadata: Sequence[Tuple[str, str]] - ) -> Tuple[job_service.GetNasJobRequest, Sequence[Tuple[str, str]]]: + self, + request: job_service.GetNasJobRequest, + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[job_service.GetNasJobRequest, Sequence[Tuple[str, Union[str, bytes]]]]: """Pre-rpc interceptor for get_nas_job Override in a subclass to manipulate the request or metadata @@ -834,8 +889,10 @@ def post_get_nas_job(self, response: nas_job.NasJob) -> nas_job.NasJob: def pre_get_nas_trial_detail( self, request: job_service.GetNasTrialDetailRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[job_service.GetNasTrialDetailRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + job_service.GetNasTrialDetailRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_nas_trial_detail Override in a subclass to manipulate the request or metadata @@ -857,8 +914,11 @@ def post_get_nas_trial_detail( def pre_list_batch_prediction_jobs( self, request: job_service.ListBatchPredictionJobsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[job_service.ListBatchPredictionJobsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + job_service.ListBatchPredictionJobsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for list_batch_prediction_jobs Override in a subclass to manipulate the request or metadata @@ -880,8 +940,10 @@ def post_list_batch_prediction_jobs( def pre_list_custom_jobs( self, request: job_service.ListCustomJobsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[job_service.ListCustomJobsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + job_service.ListCustomJobsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_custom_jobs Override in a subclass to manipulate the request or metadata @@ -903,8 +965,10 @@ def post_list_custom_jobs( def pre_list_data_labeling_jobs( self, request: job_service.ListDataLabelingJobsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[job_service.ListDataLabelingJobsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + job_service.ListDataLabelingJobsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_data_labeling_jobs Override in a subclass to manipulate the request or metadata @@ -926,9 +990,10 @@ def post_list_data_labeling_jobs( def pre_list_hyperparameter_tuning_jobs( self, request: job_service.ListHyperparameterTuningJobsRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - job_service.ListHyperparameterTuningJobsRequest, Sequence[Tuple[str, str]] + job_service.ListHyperparameterTuningJobsRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for list_hyperparameter_tuning_jobs @@ -951,9 +1016,10 @@ def post_list_hyperparameter_tuning_jobs( def pre_list_model_deployment_monitoring_jobs( self, request: job_service.ListModelDeploymentMonitoringJobsRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - job_service.ListModelDeploymentMonitoringJobsRequest, Sequence[Tuple[str, str]] + job_service.ListModelDeploymentMonitoringJobsRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for list_model_deployment_monitoring_jobs @@ -976,8 +1042,8 @@ def post_list_model_deployment_monitoring_jobs( def pre_list_nas_jobs( self, request: job_service.ListNasJobsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[job_service.ListNasJobsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[job_service.ListNasJobsRequest, Sequence[Tuple[str, Union[str, bytes]]]]: """Pre-rpc interceptor for list_nas_jobs Override in a subclass to manipulate the request or metadata @@ -999,8 +1065,10 @@ def post_list_nas_jobs( def pre_list_nas_trial_details( self, request: job_service.ListNasTrialDetailsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[job_service.ListNasTrialDetailsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + job_service.ListNasTrialDetailsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_nas_trial_details Override in a subclass to manipulate the request or metadata @@ -1022,9 +1090,10 @@ def post_list_nas_trial_details( def pre_pause_model_deployment_monitoring_job( self, request: job_service.PauseModelDeploymentMonitoringJobRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - job_service.PauseModelDeploymentMonitoringJobRequest, Sequence[Tuple[str, str]] + job_service.PauseModelDeploymentMonitoringJobRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for pause_model_deployment_monitoring_job @@ -1036,9 +1105,10 @@ def pre_pause_model_deployment_monitoring_job( def pre_resume_model_deployment_monitoring_job( self, request: job_service.ResumeModelDeploymentMonitoringJobRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - job_service.ResumeModelDeploymentMonitoringJobRequest, Sequence[Tuple[str, str]] + job_service.ResumeModelDeploymentMonitoringJobRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for resume_model_deployment_monitoring_job @@ -1050,10 +1120,10 @@ def pre_resume_model_deployment_monitoring_job( def pre_search_model_deployment_monitoring_stats_anomalies( self, request: job_service.SearchModelDeploymentMonitoringStatsAnomaliesRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ job_service.SearchModelDeploymentMonitoringStatsAnomaliesRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for search_model_deployment_monitoring_stats_anomalies @@ -1077,9 +1147,10 @@ def post_search_model_deployment_monitoring_stats_anomalies( def pre_update_model_deployment_monitoring_job( self, request: job_service.UpdateModelDeploymentMonitoringJobRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - job_service.UpdateModelDeploymentMonitoringJobRequest, Sequence[Tuple[str, str]] + job_service.UpdateModelDeploymentMonitoringJobRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for update_model_deployment_monitoring_job @@ -1102,8 +1173,10 @@ def post_update_model_deployment_monitoring_job( def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -1125,8 +1198,10 @@ def post_get_location( def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -1148,8 +1223,10 @@ def post_list_locations( def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -1169,8 +1246,10 @@ def post_get_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -1190,8 +1269,11 @@ def post_set_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -1213,8 +1295,10 @@ def post_test_iam_permissions( def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -1234,8 +1318,10 @@ def post_cancel_operation(self, response: None) -> None: 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 @@ -1255,8 +1341,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 @@ -1278,8 +1366,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 @@ -1301,8 +1391,10 @@ def post_list_operations( def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -1982,6 +2074,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -2198,6 +2294,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -2404,6 +2504,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}", @@ -2620,6 +2724,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, ], "google.longrunning.Operations.ListOperations": [ { @@ -2818,6 +2926,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*}/operations", @@ -3034,6 +3146,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*}/operations", + }, ], "google.longrunning.Operations.WaitOperation": [ { @@ -3232,6 +3348,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "post", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}:wait", @@ -3444,6 +3564,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, ], } @@ -3499,7 +3623,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 cancel batch prediction job method over HTTP. @@ -3511,13 +3635,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 = ( _BaseJobServiceRestTransport._BaseCancelBatchPredictionJob._get_http_options() ) + request, metadata = self._interceptor.pre_cancel_batch_prediction_job( request, metadata ) @@ -3534,6 +3661,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.aiplatform_v1beta1.JobServiceClient.CancelBatchPredictionJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "CancelBatchPredictionJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = JobServiceRestTransport._CancelBatchPredictionJob._get_response( self._host, @@ -3586,7 +3740,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 cancel custom job method over HTTP. @@ -3597,13 +3751,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 = ( _BaseJobServiceRestTransport._BaseCancelCustomJob._get_http_options() ) + request, metadata = self._interceptor.pre_cancel_custom_job( request, metadata ) @@ -3620,6 +3777,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.aiplatform_v1beta1.JobServiceClient.CancelCustomJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "CancelCustomJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = JobServiceRestTransport._CancelCustomJob._get_response( self._host, @@ -3672,7 +3856,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 cancel data labeling job method over HTTP. @@ -3683,13 +3867,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 = ( _BaseJobServiceRestTransport._BaseCancelDataLabelingJob._get_http_options() ) + request, metadata = self._interceptor.pre_cancel_data_labeling_job( request, metadata ) @@ -3706,6 +3893,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.aiplatform_v1beta1.JobServiceClient.CancelDataLabelingJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "CancelDataLabelingJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = JobServiceRestTransport._CancelDataLabelingJob._get_response( self._host, @@ -3759,7 +3973,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 cancel hyperparameter tuning job method over HTTP. @@ -3771,13 +3985,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 = ( _BaseJobServiceRestTransport._BaseCancelHyperparameterTuningJob._get_http_options() ) + request, metadata = self._interceptor.pre_cancel_hyperparameter_tuning_job( request, metadata ) @@ -3794,6 +4011,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.aiplatform_v1beta1.JobServiceClient.CancelHyperparameterTuningJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "CancelHyperparameterTuningJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( JobServiceRestTransport._CancelHyperparameterTuningJob._get_response( @@ -3848,7 +4092,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 cancel nas job method over HTTP. @@ -3859,13 +4103,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 = ( _BaseJobServiceRestTransport._BaseCancelNasJob._get_http_options() ) + request, metadata = self._interceptor.pre_cancel_nas_job(request, metadata) transcoded_request = ( _BaseJobServiceRestTransport._BaseCancelNasJob._get_transcoded_request( @@ -3886,6 +4133,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.aiplatform_v1beta1.JobServiceClient.CancelNasJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "CancelNasJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = JobServiceRestTransport._CancelNasJob._get_response( self._host, @@ -3938,7 +4212,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]]] = (), ) -> gca_batch_prediction_job.BatchPredictionJob: r"""Call the create batch prediction job method over HTTP. @@ -3950,8 +4224,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: ~.gca_batch_prediction_job.BatchPredictionJob: @@ -3968,6 +4244,7 @@ def __call__( http_options = ( _BaseJobServiceRestTransport._BaseCreateBatchPredictionJob._get_http_options() ) + request, metadata = self._interceptor.pre_create_batch_prediction_job( request, metadata ) @@ -3984,6 +4261,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.aiplatform_v1beta1.JobServiceClient.CreateBatchPredictionJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "CreateBatchPredictionJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = JobServiceRestTransport._CreateBatchPredictionJob._get_response( self._host, @@ -4005,7 +4309,31 @@ def __call__( pb_resp = gca_batch_prediction_job.BatchPredictionJob.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_create_batch_prediction_job(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + gca_batch_prediction_job.BatchPredictionJob.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.aiplatform_v1beta1.JobServiceClient.create_batch_prediction_job", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "CreateBatchPredictionJob", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _CreateCustomJob( @@ -4044,7 +4372,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]]] = (), ) -> gca_custom_job.CustomJob: r"""Call the create custom job method over HTTP. @@ -4055,8 +4383,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: ~.gca_custom_job.CustomJob: @@ -4074,6 +4404,7 @@ def __call__( http_options = ( _BaseJobServiceRestTransport._BaseCreateCustomJob._get_http_options() ) + request, metadata = self._interceptor.pre_create_custom_job( request, metadata ) @@ -4090,6 +4421,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.aiplatform_v1beta1.JobServiceClient.CreateCustomJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "CreateCustomJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = JobServiceRestTransport._CreateCustomJob._get_response( self._host, @@ -4111,7 +4469,29 @@ def __call__( pb_resp = gca_custom_job.CustomJob.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_create_custom_job(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gca_custom_job.CustomJob.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.aiplatform_v1beta1.JobServiceClient.create_custom_job", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "CreateCustomJob", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _CreateDataLabelingJob( @@ -4150,7 +4530,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]]] = (), ) -> gca_data_labeling_job.DataLabelingJob: r"""Call the create data labeling job method over HTTP. @@ -4161,8 +4541,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: ~.gca_data_labeling_job.DataLabelingJob: @@ -4175,6 +4557,7 @@ def __call__( http_options = ( _BaseJobServiceRestTransport._BaseCreateDataLabelingJob._get_http_options() ) + request, metadata = self._interceptor.pre_create_data_labeling_job( request, metadata ) @@ -4191,6 +4574,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.aiplatform_v1beta1.JobServiceClient.CreateDataLabelingJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "CreateDataLabelingJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = JobServiceRestTransport._CreateDataLabelingJob._get_response( self._host, @@ -4212,7 +4622,31 @@ def __call__( pb_resp = gca_data_labeling_job.DataLabelingJob.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_create_data_labeling_job(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gca_data_labeling_job.DataLabelingJob.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.aiplatform_v1beta1.JobServiceClient.create_data_labeling_job", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "CreateDataLabelingJob", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _CreateHyperparameterTuningJob( @@ -4252,7 +4686,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]]] = (), ) -> gca_hyperparameter_tuning_job.HyperparameterTuningJob: r"""Call the create hyperparameter tuning job method over HTTP. @@ -4264,8 +4698,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: ~.gca_hyperparameter_tuning_job.HyperparameterTuningJob: @@ -4279,6 +4715,7 @@ def __call__( http_options = ( _BaseJobServiceRestTransport._BaseCreateHyperparameterTuningJob._get_http_options() ) + request, metadata = self._interceptor.pre_create_hyperparameter_tuning_job( request, metadata ) @@ -4295,6 +4732,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.aiplatform_v1beta1.JobServiceClient.CreateHyperparameterTuningJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "CreateHyperparameterTuningJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( JobServiceRestTransport._CreateHyperparameterTuningJob._get_response( @@ -4318,7 +4782,33 @@ def __call__( pb_resp = gca_hyperparameter_tuning_job.HyperparameterTuningJob.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_create_hyperparameter_tuning_job(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + gca_hyperparameter_tuning_job.HyperparameterTuningJob.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.aiplatform_v1beta1.JobServiceClient.create_hyperparameter_tuning_job", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "CreateHyperparameterTuningJob", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _CreateModelDeploymentMonitoringJob( @@ -4358,7 +4848,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]]] = (), ) -> gca_model_deployment_monitoring_job.ModelDeploymentMonitoringJob: r"""Call the create model deployment monitoring job method over HTTP. @@ -4370,8 +4860,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: ~.gca_model_deployment_monitoring_job.ModelDeploymentMonitoringJob: @@ -4386,6 +4878,7 @@ def __call__( http_options = ( _BaseJobServiceRestTransport._BaseCreateModelDeploymentMonitoringJob._get_http_options() ) + ( request, metadata, @@ -4405,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 = 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.aiplatform_v1beta1.JobServiceClient.CreateModelDeploymentMonitoringJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "CreateModelDeploymentMonitoringJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = JobServiceRestTransport._CreateModelDeploymentMonitoringJob._get_response( self._host, @@ -4430,7 +4950,31 @@ def __call__( ) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_create_model_deployment_monitoring_job(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gca_model_deployment_monitoring_job.ModelDeploymentMonitoringJob.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.aiplatform_v1beta1.JobServiceClient.create_model_deployment_monitoring_job", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "CreateModelDeploymentMonitoringJob", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _CreateNasJob( @@ -4469,7 +5013,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]]] = (), ) -> gca_nas_job.NasJob: r"""Call the create nas job method over HTTP. @@ -4480,8 +5024,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: ~.gca_nas_job.NasJob: @@ -4493,6 +5039,7 @@ def __call__( http_options = ( _BaseJobServiceRestTransport._BaseCreateNasJob._get_http_options() ) + request, metadata = self._interceptor.pre_create_nas_job(request, metadata) transcoded_request = ( _BaseJobServiceRestTransport._BaseCreateNasJob._get_transcoded_request( @@ -4513,6 +5060,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 = 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.aiplatform_v1beta1.JobServiceClient.CreateNasJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "CreateNasJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = JobServiceRestTransport._CreateNasJob._get_response( self._host, @@ -4534,7 +5108,29 @@ def __call__( pb_resp = gca_nas_job.NasJob.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_create_nas_job(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gca_nas_job.NasJob.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.aiplatform_v1beta1.JobServiceClient.create_nas_job", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "CreateNasJob", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _DeleteBatchPredictionJob( @@ -4572,7 +5168,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 batch prediction job method over HTTP. @@ -4584,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: @@ -4598,6 +5196,7 @@ def __call__( http_options = ( _BaseJobServiceRestTransport._BaseDeleteBatchPredictionJob._get_http_options() ) + request, metadata = self._interceptor.pre_delete_batch_prediction_job( request, metadata ) @@ -4610,6 +5209,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.aiplatform_v1beta1.JobServiceClient.DeleteBatchPredictionJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "DeleteBatchPredictionJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = JobServiceRestTransport._DeleteBatchPredictionJob._get_response( self._host, @@ -4628,7 +5254,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_batch_prediction_job(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.aiplatform_v1beta1.JobServiceClient.delete_batch_prediction_job", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "DeleteBatchPredictionJob", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _DeleteCustomJob( @@ -4666,7 +5314,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 custom job method over HTTP. @@ -4677,8 +5325,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: @@ -4691,6 +5341,7 @@ def __call__( http_options = ( _BaseJobServiceRestTransport._BaseDeleteCustomJob._get_http_options() ) + request, metadata = self._interceptor.pre_delete_custom_job( request, metadata ) @@ -4703,6 +5354,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.aiplatform_v1beta1.JobServiceClient.DeleteCustomJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "DeleteCustomJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = JobServiceRestTransport._DeleteCustomJob._get_response( self._host, @@ -4721,7 +5399,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_custom_job(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.aiplatform_v1beta1.JobServiceClient.delete_custom_job", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "DeleteCustomJob", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _DeleteDataLabelingJob( @@ -4759,7 +5459,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 data labeling job method over HTTP. @@ -4770,8 +5470,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: @@ -4784,6 +5486,7 @@ def __call__( http_options = ( _BaseJobServiceRestTransport._BaseDeleteDataLabelingJob._get_http_options() ) + request, metadata = self._interceptor.pre_delete_data_labeling_job( request, metadata ) @@ -4796,6 +5499,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.aiplatform_v1beta1.JobServiceClient.DeleteDataLabelingJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "DeleteDataLabelingJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = JobServiceRestTransport._DeleteDataLabelingJob._get_response( self._host, @@ -4814,7 +5544,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_data_labeling_job(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.aiplatform_v1beta1.JobServiceClient.delete_data_labeling_job", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "DeleteDataLabelingJob", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _DeleteHyperparameterTuningJob( @@ -4853,7 +5605,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 hyperparameter tuning job method over HTTP. @@ -4865,8 +5617,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: @@ -4879,6 +5633,7 @@ def __call__( http_options = ( _BaseJobServiceRestTransport._BaseDeleteHyperparameterTuningJob._get_http_options() ) + request, metadata = self._interceptor.pre_delete_hyperparameter_tuning_job( request, metadata ) @@ -4891,6 +5646,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.aiplatform_v1beta1.JobServiceClient.DeleteHyperparameterTuningJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "DeleteHyperparameterTuningJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( JobServiceRestTransport._DeleteHyperparameterTuningJob._get_response( @@ -4911,7 +5693,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_hyperparameter_tuning_job(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.aiplatform_v1beta1.JobServiceClient.delete_hyperparameter_tuning_job", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "DeleteHyperparameterTuningJob", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _DeleteModelDeploymentMonitoringJob( @@ -4950,7 +5754,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 model deployment monitoring job method over HTTP. @@ -4962,8 +5766,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: @@ -4976,6 +5782,7 @@ def __call__( http_options = ( _BaseJobServiceRestTransport._BaseDeleteModelDeploymentMonitoringJob._get_http_options() ) + ( request, metadata, @@ -4991,6 +5798,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.aiplatform_v1beta1.JobServiceClient.DeleteModelDeploymentMonitoringJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "DeleteModelDeploymentMonitoringJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = JobServiceRestTransport._DeleteModelDeploymentMonitoringJob._get_response( self._host, @@ -5009,7 +5843,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_model_deployment_monitoring_job(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.aiplatform_v1beta1.JobServiceClient.delete_model_deployment_monitoring_job", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "DeleteModelDeploymentMonitoringJob", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _DeleteNasJob( @@ -5047,7 +5903,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 nas job method over HTTP. @@ -5058,8 +5914,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: @@ -5072,6 +5930,7 @@ def __call__( http_options = ( _BaseJobServiceRestTransport._BaseDeleteNasJob._get_http_options() ) + request, metadata = self._interceptor.pre_delete_nas_job(request, metadata) transcoded_request = ( _BaseJobServiceRestTransport._BaseDeleteNasJob._get_transcoded_request( @@ -5086,6 +5945,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.aiplatform_v1beta1.JobServiceClient.DeleteNasJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "DeleteNasJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = JobServiceRestTransport._DeleteNasJob._get_response( self._host, @@ -5104,7 +5990,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_nas_job(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.aiplatform_v1beta1.JobServiceClient.delete_nas_job", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "DeleteNasJob", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _GetBatchPredictionJob( @@ -5142,7 +6050,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]]] = (), ) -> batch_prediction_job.BatchPredictionJob: r"""Call the get batch prediction job method over HTTP. @@ -5153,8 +6061,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: ~.batch_prediction_job.BatchPredictionJob: @@ -5171,6 +6081,7 @@ def __call__( http_options = ( _BaseJobServiceRestTransport._BaseGetBatchPredictionJob._get_http_options() ) + request, metadata = self._interceptor.pre_get_batch_prediction_job( request, metadata ) @@ -5183,6 +6094,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.aiplatform_v1beta1.JobServiceClient.GetBatchPredictionJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "GetBatchPredictionJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = JobServiceRestTransport._GetBatchPredictionJob._get_response( self._host, @@ -5203,7 +6141,31 @@ def __call__( pb_resp = batch_prediction_job.BatchPredictionJob.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_batch_prediction_job(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = batch_prediction_job.BatchPredictionJob.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.aiplatform_v1beta1.JobServiceClient.get_batch_prediction_job", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "GetBatchPredictionJob", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _GetCustomJob( @@ -5241,7 +6203,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]]] = (), ) -> custom_job.CustomJob: r"""Call the get custom job method over HTTP. @@ -5252,8 +6214,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: ~.custom_job.CustomJob: @@ -5271,6 +6235,7 @@ def __call__( http_options = ( _BaseJobServiceRestTransport._BaseGetCustomJob._get_http_options() ) + request, metadata = self._interceptor.pre_get_custom_job(request, metadata) transcoded_request = ( _BaseJobServiceRestTransport._BaseGetCustomJob._get_transcoded_request( @@ -5285,6 +6250,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 = 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.aiplatform_v1beta1.JobServiceClient.GetCustomJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "GetCustomJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = JobServiceRestTransport._GetCustomJob._get_response( self._host, @@ -5305,7 +6297,29 @@ def __call__( pb_resp = custom_job.CustomJob.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_custom_job(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = custom_job.CustomJob.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.aiplatform_v1beta1.JobServiceClient.get_custom_job", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "GetCustomJob", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _GetDataLabelingJob( @@ -5343,7 +6357,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]]] = (), ) -> data_labeling_job.DataLabelingJob: r"""Call the get data labeling job method over HTTP. @@ -5354,8 +6368,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: ~.data_labeling_job.DataLabelingJob: @@ -5368,6 +6384,7 @@ def __call__( http_options = ( _BaseJobServiceRestTransport._BaseGetDataLabelingJob._get_http_options() ) + request, metadata = self._interceptor.pre_get_data_labeling_job( request, metadata ) @@ -5380,6 +6397,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.aiplatform_v1beta1.JobServiceClient.GetDataLabelingJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "GetDataLabelingJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = JobServiceRestTransport._GetDataLabelingJob._get_response( self._host, @@ -5400,7 +6444,31 @@ def __call__( pb_resp = data_labeling_job.DataLabelingJob.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_data_labeling_job(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = data_labeling_job.DataLabelingJob.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.aiplatform_v1beta1.JobServiceClient.get_data_labeling_job", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "GetDataLabelingJob", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _GetHyperparameterTuningJob( @@ -5438,7 +6506,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]]] = (), ) -> hyperparameter_tuning_job.HyperparameterTuningJob: r"""Call the get hyperparameter tuning job method over HTTP. @@ -5450,8 +6518,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: ~.hyperparameter_tuning_job.HyperparameterTuningJob: @@ -5465,6 +6535,7 @@ def __call__( http_options = ( _BaseJobServiceRestTransport._BaseGetHyperparameterTuningJob._get_http_options() ) + request, metadata = self._interceptor.pre_get_hyperparameter_tuning_job( request, metadata ) @@ -5477,6 +6548,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.aiplatform_v1beta1.JobServiceClient.GetHyperparameterTuningJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "GetHyperparameterTuningJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( JobServiceRestTransport._GetHyperparameterTuningJob._get_response( @@ -5499,7 +6597,33 @@ def __call__( pb_resp = hyperparameter_tuning_job.HyperparameterTuningJob.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_hyperparameter_tuning_job(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + hyperparameter_tuning_job.HyperparameterTuningJob.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.aiplatform_v1beta1.JobServiceClient.get_hyperparameter_tuning_job", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "GetHyperparameterTuningJob", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _GetModelDeploymentMonitoringJob( @@ -5538,7 +6662,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]]] = (), ) -> model_deployment_monitoring_job.ModelDeploymentMonitoringJob: r"""Call the get model deployment monitoring job method over HTTP. @@ -5550,8 +6674,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: ~.model_deployment_monitoring_job.ModelDeploymentMonitoringJob: @@ -5566,6 +6692,7 @@ def __call__( http_options = ( _BaseJobServiceRestTransport._BaseGetModelDeploymentMonitoringJob._get_http_options() ) + ( request, metadata, @@ -5581,6 +6708,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.aiplatform_v1beta1.JobServiceClient.GetModelDeploymentMonitoringJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "GetModelDeploymentMonitoringJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( JobServiceRestTransport._GetModelDeploymentMonitoringJob._get_response( @@ -5605,7 +6759,31 @@ def __call__( ) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_model_deployment_monitoring_job(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = model_deployment_monitoring_job.ModelDeploymentMonitoringJob.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.aiplatform_v1beta1.JobServiceClient.get_model_deployment_monitoring_job", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "GetModelDeploymentMonitoringJob", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _GetNasJob(_BaseJobServiceRestTransport._BaseGetNasJob, JobServiceRestStub): @@ -5641,7 +6819,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]]] = (), ) -> nas_job.NasJob: r"""Call the get nas job method over HTTP. @@ -5652,8 +6830,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: ~.nas_job.NasJob: @@ -5665,6 +6845,7 @@ def __call__( http_options = ( _BaseJobServiceRestTransport._BaseGetNasJob._get_http_options() ) + request, metadata = self._interceptor.pre_get_nas_job(request, metadata) transcoded_request = ( _BaseJobServiceRestTransport._BaseGetNasJob._get_transcoded_request( @@ -5679,6 +6860,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 = 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.aiplatform_v1beta1.JobServiceClient.GetNasJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "GetNasJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = JobServiceRestTransport._GetNasJob._get_response( self._host, @@ -5699,7 +6907,29 @@ def __call__( pb_resp = nas_job.NasJob.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_nas_job(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = nas_job.NasJob.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.aiplatform_v1beta1.JobServiceClient.get_nas_job", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "GetNasJob", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _GetNasTrialDetail( @@ -5737,7 +6967,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]]] = (), ) -> nas_job.NasTrialDetail: r"""Call the get nas trial detail method over HTTP. @@ -5748,8 +6978,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: ~.nas_job.NasTrialDetail: @@ -5763,6 +6995,7 @@ def __call__( http_options = ( _BaseJobServiceRestTransport._BaseGetNasTrialDetail._get_http_options() ) + request, metadata = self._interceptor.pre_get_nas_trial_detail( request, metadata ) @@ -5775,6 +7008,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.aiplatform_v1beta1.JobServiceClient.GetNasTrialDetail", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "GetNasTrialDetail", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = JobServiceRestTransport._GetNasTrialDetail._get_response( self._host, @@ -5795,7 +7055,29 @@ def __call__( pb_resp = nas_job.NasTrialDetail.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_nas_trial_detail(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = nas_job.NasTrialDetail.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.aiplatform_v1beta1.JobServiceClient.get_nas_trial_detail", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "GetNasTrialDetail", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListBatchPredictionJobs( @@ -5833,7 +7115,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]]] = (), ) -> job_service.ListBatchPredictionJobsResponse: r"""Call the list batch prediction jobs method over HTTP. @@ -5845,8 +7127,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: ~.job_service.ListBatchPredictionJobsResponse: @@ -5858,6 +7142,7 @@ def __call__( http_options = ( _BaseJobServiceRestTransport._BaseListBatchPredictionJobs._get_http_options() ) + request, metadata = self._interceptor.pre_list_batch_prediction_jobs( request, metadata ) @@ -5870,6 +7155,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.aiplatform_v1beta1.JobServiceClient.ListBatchPredictionJobs", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "ListBatchPredictionJobs", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = JobServiceRestTransport._ListBatchPredictionJobs._get_response( self._host, @@ -5890,7 +7202,31 @@ def __call__( pb_resp = job_service.ListBatchPredictionJobsResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_batch_prediction_jobs(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + job_service.ListBatchPredictionJobsResponse.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.aiplatform_v1beta1.JobServiceClient.list_batch_prediction_jobs", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "ListBatchPredictionJobs", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListCustomJobs( @@ -5928,7 +7264,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]]] = (), ) -> job_service.ListCustomJobsResponse: r"""Call the list custom jobs method over HTTP. @@ -5939,8 +7275,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: ~.job_service.ListCustomJobsResponse: @@ -5952,6 +7290,7 @@ def __call__( http_options = ( _BaseJobServiceRestTransport._BaseListCustomJobs._get_http_options() ) + request, metadata = self._interceptor.pre_list_custom_jobs( request, metadata ) @@ -5966,6 +7305,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 = 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.aiplatform_v1beta1.JobServiceClient.ListCustomJobs", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "ListCustomJobs", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = JobServiceRestTransport._ListCustomJobs._get_response( self._host, @@ -5986,7 +7352,31 @@ def __call__( pb_resp = job_service.ListCustomJobsResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_custom_jobs(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = job_service.ListCustomJobsResponse.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.aiplatform_v1beta1.JobServiceClient.list_custom_jobs", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "ListCustomJobs", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListDataLabelingJobs( @@ -6024,7 +7414,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]]] = (), ) -> job_service.ListDataLabelingJobsResponse: r"""Call the list data labeling jobs method over HTTP. @@ -6035,8 +7425,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: ~.job_service.ListDataLabelingJobsResponse: @@ -6048,6 +7440,7 @@ def __call__( http_options = ( _BaseJobServiceRestTransport._BaseListDataLabelingJobs._get_http_options() ) + request, metadata = self._interceptor.pre_list_data_labeling_jobs( request, metadata ) @@ -6060,6 +7453,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.aiplatform_v1beta1.JobServiceClient.ListDataLabelingJobs", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "ListDataLabelingJobs", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = JobServiceRestTransport._ListDataLabelingJobs._get_response( self._host, @@ -6080,7 +7500,31 @@ def __call__( pb_resp = job_service.ListDataLabelingJobsResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_data_labeling_jobs(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = job_service.ListDataLabelingJobsResponse.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.aiplatform_v1beta1.JobServiceClient.list_data_labeling_jobs", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "ListDataLabelingJobs", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListHyperparameterTuningJobs( @@ -6119,7 +7563,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]]] = (), ) -> job_service.ListHyperparameterTuningJobsResponse: r"""Call the list hyperparameter tuning jobs method over HTTP. @@ -6131,8 +7575,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: ~.job_service.ListHyperparameterTuningJobsResponse: @@ -6144,6 +7590,7 @@ def __call__( http_options = ( _BaseJobServiceRestTransport._BaseListHyperparameterTuningJobs._get_http_options() ) + request, metadata = self._interceptor.pre_list_hyperparameter_tuning_jobs( request, metadata ) @@ -6156,6 +7603,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.aiplatform_v1beta1.JobServiceClient.ListHyperparameterTuningJobs", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "ListHyperparameterTuningJobs", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( JobServiceRestTransport._ListHyperparameterTuningJobs._get_response( @@ -6178,7 +7652,33 @@ def __call__( pb_resp = job_service.ListHyperparameterTuningJobsResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_hyperparameter_tuning_jobs(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + job_service.ListHyperparameterTuningJobsResponse.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.aiplatform_v1beta1.JobServiceClient.list_hyperparameter_tuning_jobs", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "ListHyperparameterTuningJobs", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListModelDeploymentMonitoringJobs( @@ -6217,7 +7717,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]]] = (), ) -> job_service.ListModelDeploymentMonitoringJobsResponse: r"""Call the list model deployment monitoring jobs method over HTTP. @@ -6229,8 +7729,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: ~.job_service.ListModelDeploymentMonitoringJobsResponse: @@ -6242,6 +7744,7 @@ def __call__( http_options = ( _BaseJobServiceRestTransport._BaseListModelDeploymentMonitoringJobs._get_http_options() ) + ( request, metadata, @@ -6257,6 +7760,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.aiplatform_v1beta1.JobServiceClient.ListModelDeploymentMonitoringJobs", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "ListModelDeploymentMonitoringJobs", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = JobServiceRestTransport._ListModelDeploymentMonitoringJobs._get_response( self._host, @@ -6277,7 +7807,33 @@ def __call__( pb_resp = job_service.ListModelDeploymentMonitoringJobsResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_model_deployment_monitoring_jobs(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + job_service.ListModelDeploymentMonitoringJobsResponse.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.aiplatform_v1beta1.JobServiceClient.list_model_deployment_monitoring_jobs", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "ListModelDeploymentMonitoringJobs", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListNasJobs( @@ -6315,7 +7871,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]]] = (), ) -> job_service.ListNasJobsResponse: r"""Call the list nas jobs method over HTTP. @@ -6326,8 +7882,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: ~.job_service.ListNasJobsResponse: @@ -6339,6 +7897,7 @@ def __call__( http_options = ( _BaseJobServiceRestTransport._BaseListNasJobs._get_http_options() ) + request, metadata = self._interceptor.pre_list_nas_jobs(request, metadata) transcoded_request = ( _BaseJobServiceRestTransport._BaseListNasJobs._get_transcoded_request( @@ -6353,6 +7912,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 = 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.aiplatform_v1beta1.JobServiceClient.ListNasJobs", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "ListNasJobs", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = JobServiceRestTransport._ListNasJobs._get_response( self._host, @@ -6373,7 +7959,29 @@ def __call__( pb_resp = job_service.ListNasJobsResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_nas_jobs(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = job_service.ListNasJobsResponse.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.aiplatform_v1beta1.JobServiceClient.list_nas_jobs", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "ListNasJobs", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListNasTrialDetails( @@ -6411,7 +8019,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]]] = (), ) -> job_service.ListNasTrialDetailsResponse: r"""Call the list nas trial details method over HTTP. @@ -6422,8 +8030,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: ~.job_service.ListNasTrialDetailsResponse: @@ -6435,6 +8045,7 @@ def __call__( http_options = ( _BaseJobServiceRestTransport._BaseListNasTrialDetails._get_http_options() ) + request, metadata = self._interceptor.pre_list_nas_trial_details( request, metadata ) @@ -6447,6 +8058,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.aiplatform_v1beta1.JobServiceClient.ListNasTrialDetails", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "ListNasTrialDetails", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = JobServiceRestTransport._ListNasTrialDetails._get_response( self._host, @@ -6467,7 +8105,31 @@ def __call__( pb_resp = job_service.ListNasTrialDetailsResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_nas_trial_details(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = job_service.ListNasTrialDetailsResponse.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.aiplatform_v1beta1.JobServiceClient.list_nas_trial_details", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "ListNasTrialDetails", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _PauseModelDeploymentMonitoringJob( @@ -6507,7 +8169,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 pause model deployment monitoring job method over HTTP. @@ -6519,13 +8181,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 = ( _BaseJobServiceRestTransport._BasePauseModelDeploymentMonitoringJob._get_http_options() ) + ( request, metadata, @@ -6545,6 +8210,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.aiplatform_v1beta1.JobServiceClient.PauseModelDeploymentMonitoringJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "PauseModelDeploymentMonitoringJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = JobServiceRestTransport._PauseModelDeploymentMonitoringJob._get_response( self._host, @@ -6598,7 +8290,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 resume model deployment monitoring job method over HTTP. @@ -6610,13 +8302,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 = ( _BaseJobServiceRestTransport._BaseResumeModelDeploymentMonitoringJob._get_http_options() ) + ( request, metadata, @@ -6636,6 +8331,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.aiplatform_v1beta1.JobServiceClient.ResumeModelDeploymentMonitoringJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "ResumeModelDeploymentMonitoringJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = JobServiceRestTransport._ResumeModelDeploymentMonitoringJob._get_response( self._host, @@ -6691,7 +8413,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]]] = (), ) -> job_service.SearchModelDeploymentMonitoringStatsAnomaliesResponse: r"""Call the search model deployment monitoring stats anomalies method over HTTP. @@ -6703,8 +8425,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: ~.job_service.SearchModelDeploymentMonitoringStatsAnomaliesResponse: @@ -6716,6 +8440,7 @@ def __call__( http_options = ( _BaseJobServiceRestTransport._BaseSearchModelDeploymentMonitoringStatsAnomalies._get_http_options() ) + ( request, metadata, @@ -6735,6 +8460,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.aiplatform_v1beta1.JobServiceClient.SearchModelDeploymentMonitoringStatsAnomalies", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "SearchModelDeploymentMonitoringStatsAnomalies", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = JobServiceRestTransport._SearchModelDeploymentMonitoringStatsAnomalies._get_response( self._host, @@ -6760,9 +8512,33 @@ def __call__( ) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_search_model_deployment_monitoring_stats_anomalies( resp ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = job_service.SearchModelDeploymentMonitoringStatsAnomaliesResponse.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.aiplatform_v1beta1.JobServiceClient.search_model_deployment_monitoring_stats_anomalies", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "SearchModelDeploymentMonitoringStatsAnomalies", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _UpdateModelDeploymentMonitoringJob( @@ -6802,7 +8578,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 model deployment monitoring job method over HTTP. @@ -6814,8 +8590,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: @@ -6828,6 +8606,7 @@ def __call__( http_options = ( _BaseJobServiceRestTransport._BaseUpdateModelDeploymentMonitoringJob._get_http_options() ) + ( request, metadata, @@ -6847,6 +8626,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.aiplatform_v1beta1.JobServiceClient.UpdateModelDeploymentMonitoringJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "UpdateModelDeploymentMonitoringJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = JobServiceRestTransport._UpdateModelDeploymentMonitoringJob._get_response( self._host, @@ -6866,7 +8672,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_model_deployment_monitoring_job(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.aiplatform_v1beta1.JobServiceClient.update_model_deployment_monitoring_job", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "UpdateModelDeploymentMonitoringJob", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp @property @@ -7243,7 +9071,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]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -7254,8 +9082,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: locations_pb2.Location: Response from GetLocation method. @@ -7264,6 +9094,7 @@ def __call__( http_options = ( _BaseJobServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = self._interceptor.pre_get_location(request, metadata) transcoded_request = ( _BaseJobServiceRestTransport._BaseGetLocation._get_transcoded_request( @@ -7278,6 +9109,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.aiplatform_v1beta1.JobServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = JobServiceRestTransport._GetLocation._get_response( self._host, @@ -7297,6 +9155,27 @@ def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_location(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.aiplatform_v1beta1.JobServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -7338,7 +9217,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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -7349,8 +9228,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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -7359,6 +9240,7 @@ def __call__( http_options = ( _BaseJobServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = self._interceptor.pre_list_locations(request, metadata) transcoded_request = ( _BaseJobServiceRestTransport._BaseListLocations._get_transcoded_request( @@ -7373,6 +9255,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.aiplatform_v1beta1.JobServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = JobServiceRestTransport._ListLocations._get_response( self._host, @@ -7392,6 +9301,27 @@ def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_list_locations(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.aiplatform_v1beta1.JobServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -7434,7 +9364,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]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -7445,8 +9375,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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -7455,6 +9387,7 @@ def __call__( http_options = ( _BaseJobServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_get_iam_policy(request, metadata) transcoded_request = ( _BaseJobServiceRestTransport._BaseGetIamPolicy._get_transcoded_request( @@ -7475,6 +9408,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.aiplatform_v1beta1.JobServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = JobServiceRestTransport._GetIamPolicy._get_response( self._host, @@ -7495,6 +9455,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_iam_policy(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.aiplatform_v1beta1.JobServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -7537,7 +9518,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]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -7548,8 +9529,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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -7558,6 +9541,7 @@ def __call__( http_options = ( _BaseJobServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_set_iam_policy(request, metadata) transcoded_request = ( _BaseJobServiceRestTransport._BaseSetIamPolicy._get_transcoded_request( @@ -7578,6 +9562,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.aiplatform_v1beta1.JobServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = JobServiceRestTransport._SetIamPolicy._get_response( self._host, @@ -7598,6 +9609,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_set_iam_policy(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.aiplatform_v1beta1.JobServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -7640,7 +9672,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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -7651,8 +9683,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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -7661,6 +9695,7 @@ def __call__( http_options = ( _BaseJobServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -7677,6 +9712,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.aiplatform_v1beta1.JobServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = JobServiceRestTransport._TestIamPermissions._get_response( self._host, @@ -7697,6 +9759,27 @@ def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_test_iam_permissions(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.aiplatform_v1beta1.JobServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -7738,7 +9821,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 cancel operation method over HTTP. @@ -7749,13 +9832,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 = ( _BaseJobServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = self._interceptor.pre_cancel_operation( request, metadata ) @@ -7768,6 +9854,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.aiplatform_v1beta1.JobServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = JobServiceRestTransport._CancelOperation._get_response( self._host, @@ -7824,7 +9937,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. @@ -7835,13 +9948,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 = ( _BaseJobServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = self._interceptor.pre_delete_operation( request, metadata ) @@ -7854,6 +9970,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.aiplatform_v1beta1.JobServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = JobServiceRestTransport._DeleteOperation._get_response( self._host, @@ -7910,7 +10053,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. @@ -7921,8 +10064,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. @@ -7931,6 +10076,7 @@ def __call__( http_options = ( _BaseJobServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = self._interceptor.pre_get_operation(request, metadata) transcoded_request = ( _BaseJobServiceRestTransport._BaseGetOperation._get_transcoded_request( @@ -7945,6 +10091,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.aiplatform_v1beta1.JobServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = JobServiceRestTransport._GetOperation._get_response( self._host, @@ -7964,6 +10137,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.aiplatform_v1beta1.JobServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -8005,7 +10199,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. @@ -8016,8 +10210,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. @@ -8026,6 +10222,7 @@ def __call__( http_options = ( _BaseJobServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = self._interceptor.pre_list_operations(request, metadata) transcoded_request = _BaseJobServiceRestTransport._BaseListOperations._get_transcoded_request( http_options, request @@ -8038,6 +10235,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.aiplatform_v1beta1.JobServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = JobServiceRestTransport._ListOperations._get_response( self._host, @@ -8057,6 +10281,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.aiplatform_v1beta1.JobServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -8098,7 +10343,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 wait operation method over HTTP. @@ -8109,8 +10354,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 WaitOperation method. @@ -8119,6 +10366,7 @@ def __call__( http_options = ( _BaseJobServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = self._interceptor.pre_wait_operation(request, metadata) transcoded_request = ( _BaseJobServiceRestTransport._BaseWaitOperation._get_transcoded_request( @@ -8133,6 +10381,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.aiplatform_v1beta1.JobServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = JobServiceRestTransport._WaitOperation._get_response( self._host, @@ -8152,6 +10427,27 @@ def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = self._interceptor.post_wait_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.aiplatform_v1beta1.JobServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1beta1/services/job_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1beta1/services/job_service/transports/rest_asyncio.py index 4410cdd322..4a9e488c91 100644 --- a/google/cloud/aiplatform_v1beta1/services/job_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/job_service/transports/rest_asyncio.py @@ -79,6 +79,18 @@ from .base import DEFAULT_CLIENT_INFO as BASE_DEFAULT_CLIENT_INFO + +import logging + +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__) + try: OptionalRetry = Union[retries.AsyncRetry, gapic_v1.method._MethodDefault, None] except AttributeError: # pragma: NO COVER @@ -367,8 +379,11 @@ async def post_update_model_deployment_monitoring_job(self, response): async def pre_cancel_batch_prediction_job( self, request: job_service.CancelBatchPredictionJobRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[job_service.CancelBatchPredictionJobRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + job_service.CancelBatchPredictionJobRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for cancel_batch_prediction_job Override in a subclass to manipulate the request or metadata @@ -379,8 +394,10 @@ async def pre_cancel_batch_prediction_job( async def pre_cancel_custom_job( self, request: job_service.CancelCustomJobRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[job_service.CancelCustomJobRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + job_service.CancelCustomJobRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_custom_job Override in a subclass to manipulate the request or metadata @@ -391,8 +408,11 @@ async def pre_cancel_custom_job( async def pre_cancel_data_labeling_job( self, request: job_service.CancelDataLabelingJobRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[job_service.CancelDataLabelingJobRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + job_service.CancelDataLabelingJobRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for cancel_data_labeling_job Override in a subclass to manipulate the request or metadata @@ -403,9 +423,10 @@ async def pre_cancel_data_labeling_job( async def pre_cancel_hyperparameter_tuning_job( self, request: job_service.CancelHyperparameterTuningJobRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - job_service.CancelHyperparameterTuningJobRequest, Sequence[Tuple[str, str]] + job_service.CancelHyperparameterTuningJobRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for cancel_hyperparameter_tuning_job @@ -417,8 +438,10 @@ async def pre_cancel_hyperparameter_tuning_job( async def pre_cancel_nas_job( self, request: job_service.CancelNasJobRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[job_service.CancelNasJobRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + job_service.CancelNasJobRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_nas_job Override in a subclass to manipulate the request or metadata @@ -429,8 +452,11 @@ async def pre_cancel_nas_job( async def pre_create_batch_prediction_job( self, request: job_service.CreateBatchPredictionJobRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[job_service.CreateBatchPredictionJobRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + job_service.CreateBatchPredictionJobRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for create_batch_prediction_job Override in a subclass to manipulate the request or metadata @@ -452,8 +478,10 @@ async def post_create_batch_prediction_job( async def pre_create_custom_job( self, request: job_service.CreateCustomJobRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[job_service.CreateCustomJobRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + job_service.CreateCustomJobRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for create_custom_job Override in a subclass to manipulate the request or metadata @@ -475,8 +503,11 @@ async def post_create_custom_job( async def pre_create_data_labeling_job( self, request: job_service.CreateDataLabelingJobRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[job_service.CreateDataLabelingJobRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + job_service.CreateDataLabelingJobRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for create_data_labeling_job Override in a subclass to manipulate the request or metadata @@ -498,9 +529,10 @@ async def post_create_data_labeling_job( async def pre_create_hyperparameter_tuning_job( self, request: job_service.CreateHyperparameterTuningJobRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - job_service.CreateHyperparameterTuningJobRequest, Sequence[Tuple[str, str]] + job_service.CreateHyperparameterTuningJobRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for create_hyperparameter_tuning_job @@ -523,9 +555,10 @@ async def post_create_hyperparameter_tuning_job( async def pre_create_model_deployment_monitoring_job( self, request: job_service.CreateModelDeploymentMonitoringJobRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - job_service.CreateModelDeploymentMonitoringJobRequest, Sequence[Tuple[str, str]] + job_service.CreateModelDeploymentMonitoringJobRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for create_model_deployment_monitoring_job @@ -548,8 +581,10 @@ async def post_create_model_deployment_monitoring_job( async def pre_create_nas_job( self, request: job_service.CreateNasJobRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[job_service.CreateNasJobRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + job_service.CreateNasJobRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for create_nas_job Override in a subclass to manipulate the request or metadata @@ -571,8 +606,11 @@ async def post_create_nas_job( async def pre_delete_batch_prediction_job( self, request: job_service.DeleteBatchPredictionJobRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[job_service.DeleteBatchPredictionJobRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + job_service.DeleteBatchPredictionJobRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for delete_batch_prediction_job Override in a subclass to manipulate the request or metadata @@ -594,8 +632,10 @@ async def post_delete_batch_prediction_job( async def pre_delete_custom_job( self, request: job_service.DeleteCustomJobRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[job_service.DeleteCustomJobRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + job_service.DeleteCustomJobRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for delete_custom_job Override in a subclass to manipulate the request or metadata @@ -617,8 +657,11 @@ async def post_delete_custom_job( async def pre_delete_data_labeling_job( self, request: job_service.DeleteDataLabelingJobRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[job_service.DeleteDataLabelingJobRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + job_service.DeleteDataLabelingJobRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for delete_data_labeling_job Override in a subclass to manipulate the request or metadata @@ -640,9 +683,10 @@ async def post_delete_data_labeling_job( async def pre_delete_hyperparameter_tuning_job( self, request: job_service.DeleteHyperparameterTuningJobRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - job_service.DeleteHyperparameterTuningJobRequest, Sequence[Tuple[str, str]] + job_service.DeleteHyperparameterTuningJobRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for delete_hyperparameter_tuning_job @@ -665,9 +709,10 @@ async def post_delete_hyperparameter_tuning_job( async def pre_delete_model_deployment_monitoring_job( self, request: job_service.DeleteModelDeploymentMonitoringJobRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - job_service.DeleteModelDeploymentMonitoringJobRequest, Sequence[Tuple[str, str]] + job_service.DeleteModelDeploymentMonitoringJobRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for delete_model_deployment_monitoring_job @@ -690,8 +735,10 @@ async def post_delete_model_deployment_monitoring_job( async def pre_delete_nas_job( self, request: job_service.DeleteNasJobRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[job_service.DeleteNasJobRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + job_service.DeleteNasJobRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for delete_nas_job Override in a subclass to manipulate the request or metadata @@ -713,8 +760,11 @@ async def post_delete_nas_job( async def pre_get_batch_prediction_job( self, request: job_service.GetBatchPredictionJobRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[job_service.GetBatchPredictionJobRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + job_service.GetBatchPredictionJobRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for get_batch_prediction_job Override in a subclass to manipulate the request or metadata @@ -736,8 +786,10 @@ async def post_get_batch_prediction_job( async def pre_get_custom_job( self, request: job_service.GetCustomJobRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[job_service.GetCustomJobRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + job_service.GetCustomJobRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_custom_job Override in a subclass to manipulate the request or metadata @@ -759,8 +811,10 @@ async def post_get_custom_job( async def pre_get_data_labeling_job( self, request: job_service.GetDataLabelingJobRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[job_service.GetDataLabelingJobRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + job_service.GetDataLabelingJobRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_data_labeling_job Override in a subclass to manipulate the request or metadata @@ -782,9 +836,10 @@ async def post_get_data_labeling_job( async def pre_get_hyperparameter_tuning_job( self, request: job_service.GetHyperparameterTuningJobRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - job_service.GetHyperparameterTuningJobRequest, Sequence[Tuple[str, str]] + job_service.GetHyperparameterTuningJobRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for get_hyperparameter_tuning_job @@ -807,9 +862,10 @@ async def post_get_hyperparameter_tuning_job( async def pre_get_model_deployment_monitoring_job( self, request: job_service.GetModelDeploymentMonitoringJobRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - job_service.GetModelDeploymentMonitoringJobRequest, Sequence[Tuple[str, str]] + job_service.GetModelDeploymentMonitoringJobRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for get_model_deployment_monitoring_job @@ -830,8 +886,10 @@ async def post_get_model_deployment_monitoring_job( return response async def pre_get_nas_job( - self, request: job_service.GetNasJobRequest, metadata: Sequence[Tuple[str, str]] - ) -> Tuple[job_service.GetNasJobRequest, Sequence[Tuple[str, str]]]: + self, + request: job_service.GetNasJobRequest, + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[job_service.GetNasJobRequest, Sequence[Tuple[str, Union[str, bytes]]]]: """Pre-rpc interceptor for get_nas_job Override in a subclass to manipulate the request or metadata @@ -851,8 +909,10 @@ async def post_get_nas_job(self, response: nas_job.NasJob) -> nas_job.NasJob: async def pre_get_nas_trial_detail( self, request: job_service.GetNasTrialDetailRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[job_service.GetNasTrialDetailRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + job_service.GetNasTrialDetailRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_nas_trial_detail Override in a subclass to manipulate the request or metadata @@ -874,8 +934,11 @@ async def post_get_nas_trial_detail( async def pre_list_batch_prediction_jobs( self, request: job_service.ListBatchPredictionJobsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[job_service.ListBatchPredictionJobsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + job_service.ListBatchPredictionJobsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for list_batch_prediction_jobs Override in a subclass to manipulate the request or metadata @@ -897,8 +960,10 @@ async def post_list_batch_prediction_jobs( async def pre_list_custom_jobs( self, request: job_service.ListCustomJobsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[job_service.ListCustomJobsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + job_service.ListCustomJobsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_custom_jobs Override in a subclass to manipulate the request or metadata @@ -920,8 +985,10 @@ async def post_list_custom_jobs( async def pre_list_data_labeling_jobs( self, request: job_service.ListDataLabelingJobsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[job_service.ListDataLabelingJobsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + job_service.ListDataLabelingJobsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_data_labeling_jobs Override in a subclass to manipulate the request or metadata @@ -943,9 +1010,10 @@ async def post_list_data_labeling_jobs( async def pre_list_hyperparameter_tuning_jobs( self, request: job_service.ListHyperparameterTuningJobsRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - job_service.ListHyperparameterTuningJobsRequest, Sequence[Tuple[str, str]] + job_service.ListHyperparameterTuningJobsRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for list_hyperparameter_tuning_jobs @@ -968,9 +1036,10 @@ async def post_list_hyperparameter_tuning_jobs( async def pre_list_model_deployment_monitoring_jobs( self, request: job_service.ListModelDeploymentMonitoringJobsRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - job_service.ListModelDeploymentMonitoringJobsRequest, Sequence[Tuple[str, str]] + job_service.ListModelDeploymentMonitoringJobsRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for list_model_deployment_monitoring_jobs @@ -993,8 +1062,8 @@ async def post_list_model_deployment_monitoring_jobs( async def pre_list_nas_jobs( self, request: job_service.ListNasJobsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[job_service.ListNasJobsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[job_service.ListNasJobsRequest, Sequence[Tuple[str, Union[str, bytes]]]]: """Pre-rpc interceptor for list_nas_jobs Override in a subclass to manipulate the request or metadata @@ -1016,8 +1085,10 @@ async def post_list_nas_jobs( async def pre_list_nas_trial_details( self, request: job_service.ListNasTrialDetailsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[job_service.ListNasTrialDetailsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + job_service.ListNasTrialDetailsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_nas_trial_details Override in a subclass to manipulate the request or metadata @@ -1039,9 +1110,10 @@ async def post_list_nas_trial_details( async def pre_pause_model_deployment_monitoring_job( self, request: job_service.PauseModelDeploymentMonitoringJobRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - job_service.PauseModelDeploymentMonitoringJobRequest, Sequence[Tuple[str, str]] + job_service.PauseModelDeploymentMonitoringJobRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for pause_model_deployment_monitoring_job @@ -1053,9 +1125,10 @@ async def pre_pause_model_deployment_monitoring_job( async def pre_resume_model_deployment_monitoring_job( self, request: job_service.ResumeModelDeploymentMonitoringJobRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - job_service.ResumeModelDeploymentMonitoringJobRequest, Sequence[Tuple[str, str]] + job_service.ResumeModelDeploymentMonitoringJobRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for resume_model_deployment_monitoring_job @@ -1067,10 +1140,10 @@ async def pre_resume_model_deployment_monitoring_job( async def pre_search_model_deployment_monitoring_stats_anomalies( self, request: job_service.SearchModelDeploymentMonitoringStatsAnomaliesRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ job_service.SearchModelDeploymentMonitoringStatsAnomaliesRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for search_model_deployment_monitoring_stats_anomalies @@ -1094,9 +1167,10 @@ async def post_search_model_deployment_monitoring_stats_anomalies( async def pre_update_model_deployment_monitoring_job( self, request: job_service.UpdateModelDeploymentMonitoringJobRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - job_service.UpdateModelDeploymentMonitoringJobRequest, Sequence[Tuple[str, str]] + job_service.UpdateModelDeploymentMonitoringJobRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for update_model_deployment_monitoring_job @@ -1119,8 +1193,10 @@ async def post_update_model_deployment_monitoring_job( async def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -1142,8 +1218,10 @@ async def post_get_location( async def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -1165,8 +1243,10 @@ async def post_list_locations( async def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -1188,8 +1268,10 @@ async def post_get_iam_policy( async def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -1211,8 +1293,11 @@ async def post_set_iam_policy( async def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -1234,8 +1319,10 @@ async def post_test_iam_permissions( async def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -1255,8 +1342,10 @@ async def post_cancel_operation(self, response: None) -> None: async 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 @@ -1276,8 +1365,10 @@ async def post_delete_operation(self, response: None) -> None: async 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 @@ -1299,8 +1390,10 @@ async def post_get_operation( async 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 @@ -1322,8 +1415,10 @@ async def post_list_operations( async def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -1679,7 +1774,7 @@ async 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 cancel batch prediction job method over HTTP. @@ -1691,13 +1786,16 @@ async def __call__( 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`. """ http_options = ( _BaseJobServiceRestTransport._BaseCancelBatchPredictionJob._get_http_options() ) + request, metadata = await self._interceptor.pre_cancel_batch_prediction_job( request, metadata ) @@ -1714,6 +1812,33 @@ async 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.aiplatform_v1beta1.JobServiceClient.CancelBatchPredictionJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "CancelBatchPredictionJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncJobServiceRestTransport._CancelBatchPredictionJob._get_response( self._host, @@ -1772,7 +1897,7 @@ async 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 cancel custom job method over HTTP. @@ -1783,13 +1908,16 @@ async def __call__( 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`. """ http_options = ( _BaseJobServiceRestTransport._BaseCancelCustomJob._get_http_options() ) + request, metadata = await self._interceptor.pre_cancel_custom_job( request, metadata ) @@ -1806,6 +1934,33 @@ async 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.aiplatform_v1beta1.JobServiceClient.CancelCustomJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "CancelCustomJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncJobServiceRestTransport._CancelCustomJob._get_response( @@ -1866,7 +2021,7 @@ async 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 cancel data labeling job method over HTTP. @@ -1877,13 +2032,16 @@ async def __call__( 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`. """ http_options = ( _BaseJobServiceRestTransport._BaseCancelDataLabelingJob._get_http_options() ) + request, metadata = await self._interceptor.pre_cancel_data_labeling_job( request, metadata ) @@ -1900,6 +2058,33 @@ async 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.aiplatform_v1beta1.JobServiceClient.CancelDataLabelingJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "CancelDataLabelingJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncJobServiceRestTransport._CancelDataLabelingJob._get_response( @@ -1961,7 +2146,7 @@ async 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 cancel hyperparameter tuning job method over HTTP. @@ -1973,13 +2158,16 @@ async def __call__( 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`. """ http_options = ( _BaseJobServiceRestTransport._BaseCancelHyperparameterTuningJob._get_http_options() ) + ( request, metadata, @@ -1999,6 +2187,33 @@ async 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.aiplatform_v1beta1.JobServiceClient.CancelHyperparameterTuningJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "CancelHyperparameterTuningJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncJobServiceRestTransport._CancelHyperparameterTuningJob._get_response( self._host, @@ -2057,7 +2272,7 @@ async 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 cancel nas job method over HTTP. @@ -2068,13 +2283,16 @@ async def __call__( 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`. """ http_options = ( _BaseJobServiceRestTransport._BaseCancelNasJob._get_http_options() ) + request, metadata = await self._interceptor.pre_cancel_nas_job( request, metadata ) @@ -2097,6 +2315,33 @@ async 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.aiplatform_v1beta1.JobServiceClient.CancelNasJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "CancelNasJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncJobServiceRestTransport._CancelNasJob._get_response( self._host, @@ -2156,7 +2401,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> gca_batch_prediction_job.BatchPredictionJob: r"""Call the create batch prediction job method over HTTP. @@ -2168,8 +2413,10 @@ async def __call__( 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: ~.gca_batch_prediction_job.BatchPredictionJob: @@ -2186,6 +2433,7 @@ async def __call__( http_options = ( _BaseJobServiceRestTransport._BaseCreateBatchPredictionJob._get_http_options() ) + request, metadata = await self._interceptor.pre_create_batch_prediction_job( request, metadata ) @@ -2202,6 +2450,33 @@ async 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.aiplatform_v1beta1.JobServiceClient.CreateBatchPredictionJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "CreateBatchPredictionJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncJobServiceRestTransport._CreateBatchPredictionJob._get_response( self._host, @@ -2230,6 +2505,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_create_batch_prediction_job(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + gca_batch_prediction_job.BatchPredictionJob.to_json(response) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.JobServiceAsyncClient.create_batch_prediction_job", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "CreateBatchPredictionJob", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _CreateCustomJob( @@ -2268,7 +2567,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> gca_custom_job.CustomJob: r"""Call the create custom job method over HTTP. @@ -2279,8 +2578,10 @@ async def __call__( 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: ~.gca_custom_job.CustomJob: @@ -2298,6 +2599,7 @@ async def __call__( http_options = ( _BaseJobServiceRestTransport._BaseCreateCustomJob._get_http_options() ) + request, metadata = await self._interceptor.pre_create_custom_job( request, metadata ) @@ -2314,6 +2616,33 @@ async 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.aiplatform_v1beta1.JobServiceClient.CreateCustomJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "CreateCustomJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncJobServiceRestTransport._CreateCustomJob._get_response( @@ -2344,6 +2673,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_create_custom_job(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gca_custom_job.CustomJob.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.JobServiceAsyncClient.create_custom_job", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "CreateCustomJob", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _CreateDataLabelingJob( @@ -2382,7 +2733,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> gca_data_labeling_job.DataLabelingJob: r"""Call the create data labeling job method over HTTP. @@ -2393,8 +2744,10 @@ async def __call__( 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: ~.gca_data_labeling_job.DataLabelingJob: @@ -2407,6 +2760,7 @@ async def __call__( http_options = ( _BaseJobServiceRestTransport._BaseCreateDataLabelingJob._get_http_options() ) + request, metadata = await self._interceptor.pre_create_data_labeling_job( request, metadata ) @@ -2423,6 +2777,33 @@ async 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.aiplatform_v1beta1.JobServiceClient.CreateDataLabelingJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "CreateDataLabelingJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncJobServiceRestTransport._CreateDataLabelingJob._get_response( @@ -2453,6 +2834,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_create_data_labeling_job(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gca_data_labeling_job.DataLabelingJob.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.JobServiceAsyncClient.create_data_labeling_job", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "CreateDataLabelingJob", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _CreateHyperparameterTuningJob( @@ -2492,7 +2897,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> gca_hyperparameter_tuning_job.HyperparameterTuningJob: r"""Call the create hyperparameter tuning job method over HTTP. @@ -2504,8 +2909,10 @@ async def __call__( 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: ~.gca_hyperparameter_tuning_job.HyperparameterTuningJob: @@ -2519,6 +2926,7 @@ async def __call__( http_options = ( _BaseJobServiceRestTransport._BaseCreateHyperparameterTuningJob._get_http_options() ) + ( request, metadata, @@ -2538,6 +2946,33 @@ async 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.aiplatform_v1beta1.JobServiceClient.CreateHyperparameterTuningJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "CreateHyperparameterTuningJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncJobServiceRestTransport._CreateHyperparameterTuningJob._get_response( self._host, @@ -2566,6 +3001,32 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_create_hyperparameter_tuning_job(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + gca_hyperparameter_tuning_job.HyperparameterTuningJob.to_json( + response + ) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.JobServiceAsyncClient.create_hyperparameter_tuning_job", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "CreateHyperparameterTuningJob", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _CreateModelDeploymentMonitoringJob( @@ -2607,7 +3068,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> gca_model_deployment_monitoring_job.ModelDeploymentMonitoringJob: r"""Call the create model deployment monitoring job method over HTTP. @@ -2619,8 +3080,10 @@ async def __call__( 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: ~.gca_model_deployment_monitoring_job.ModelDeploymentMonitoringJob: @@ -2635,6 +3098,7 @@ async def __call__( http_options = ( _BaseJobServiceRestTransport._BaseCreateModelDeploymentMonitoringJob._get_http_options() ) + ( request, metadata, @@ -2654,6 +3118,33 @@ async 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.aiplatform_v1beta1.JobServiceClient.CreateModelDeploymentMonitoringJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "CreateModelDeploymentMonitoringJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncJobServiceRestTransport._CreateModelDeploymentMonitoringJob._get_response( self._host, @@ -2688,6 +3179,30 @@ async def __call__( resp = await self._interceptor.post_create_model_deployment_monitoring_job( resp ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gca_model_deployment_monitoring_job.ModelDeploymentMonitoringJob.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.JobServiceAsyncClient.create_model_deployment_monitoring_job", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "CreateModelDeploymentMonitoringJob", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _CreateNasJob( @@ -2726,7 +3241,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> gca_nas_job.NasJob: r"""Call the create nas job method over HTTP. @@ -2737,8 +3252,10 @@ async def __call__( 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: ~.gca_nas_job.NasJob: @@ -2750,6 +3267,7 @@ async def __call__( http_options = ( _BaseJobServiceRestTransport._BaseCreateNasJob._get_http_options() ) + request, metadata = await self._interceptor.pre_create_nas_job( request, metadata ) @@ -2772,6 +3290,33 @@ async 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 = 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.aiplatform_v1beta1.JobServiceClient.CreateNasJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "CreateNasJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncJobServiceRestTransport._CreateNasJob._get_response( self._host, @@ -2800,6 +3345,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_create_nas_job(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gca_nas_job.NasJob.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.JobServiceAsyncClient.create_nas_job", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "CreateNasJob", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _DeleteBatchPredictionJob( @@ -2838,7 +3405,7 @@ async 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 batch prediction job method over HTTP. @@ -2850,8 +3417,10 @@ async def __call__( 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: @@ -2864,6 +3433,7 @@ async def __call__( http_options = ( _BaseJobServiceRestTransport._BaseDeleteBatchPredictionJob._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_batch_prediction_job( request, metadata ) @@ -2876,6 +3446,33 @@ async 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.aiplatform_v1beta1.JobServiceClient.DeleteBatchPredictionJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "DeleteBatchPredictionJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncJobServiceRestTransport._DeleteBatchPredictionJob._get_response( self._host, @@ -2903,6 +3500,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_delete_batch_prediction_job(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.JobServiceAsyncClient.delete_batch_prediction_job", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "DeleteBatchPredictionJob", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _DeleteCustomJob( @@ -2940,7 +3559,7 @@ async 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 custom job method over HTTP. @@ -2951,8 +3570,10 @@ async def __call__( 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: @@ -2965,6 +3586,7 @@ async def __call__( http_options = ( _BaseJobServiceRestTransport._BaseDeleteCustomJob._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_custom_job( request, metadata ) @@ -2977,6 +3599,33 @@ async 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.aiplatform_v1beta1.JobServiceClient.DeleteCustomJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "DeleteCustomJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncJobServiceRestTransport._DeleteCustomJob._get_response( @@ -3006,6 +3655,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_delete_custom_job(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.JobServiceAsyncClient.delete_custom_job", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "DeleteCustomJob", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _DeleteDataLabelingJob( @@ -3043,7 +3714,7 @@ async 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 data labeling job method over HTTP. @@ -3054,8 +3725,10 @@ async def __call__( 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: @@ -3068,6 +3741,7 @@ async def __call__( http_options = ( _BaseJobServiceRestTransport._BaseDeleteDataLabelingJob._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_data_labeling_job( request, metadata ) @@ -3080,6 +3754,33 @@ async 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.aiplatform_v1beta1.JobServiceClient.DeleteDataLabelingJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "DeleteDataLabelingJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncJobServiceRestTransport._DeleteDataLabelingJob._get_response( @@ -3109,6 +3810,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_delete_data_labeling_job(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.JobServiceAsyncClient.delete_data_labeling_job", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "DeleteDataLabelingJob", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _DeleteHyperparameterTuningJob( @@ -3147,7 +3870,7 @@ async 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 hyperparameter tuning job method over HTTP. @@ -3159,8 +3882,10 @@ async def __call__( 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: @@ -3173,6 +3898,7 @@ async def __call__( http_options = ( _BaseJobServiceRestTransport._BaseDeleteHyperparameterTuningJob._get_http_options() ) + ( request, metadata, @@ -3188,6 +3914,33 @@ async 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.aiplatform_v1beta1.JobServiceClient.DeleteHyperparameterTuningJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "DeleteHyperparameterTuningJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncJobServiceRestTransport._DeleteHyperparameterTuningJob._get_response( self._host, @@ -3215,6 +3968,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_delete_hyperparameter_tuning_job(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.JobServiceAsyncClient.delete_hyperparameter_tuning_job", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "DeleteHyperparameterTuningJob", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _DeleteModelDeploymentMonitoringJob( @@ -3255,7 +4030,7 @@ async 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 model deployment monitoring job method over HTTP. @@ -3267,8 +4042,10 @@ async def __call__( 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: @@ -3281,6 +4058,7 @@ async def __call__( http_options = ( _BaseJobServiceRestTransport._BaseDeleteModelDeploymentMonitoringJob._get_http_options() ) + ( request, metadata, @@ -3296,6 +4074,33 @@ async 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.aiplatform_v1beta1.JobServiceClient.DeleteModelDeploymentMonitoringJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "DeleteModelDeploymentMonitoringJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncJobServiceRestTransport._DeleteModelDeploymentMonitoringJob._get_response( self._host, @@ -3325,6 +4130,28 @@ async def __call__( resp = await self._interceptor.post_delete_model_deployment_monitoring_job( 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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.JobServiceAsyncClient.delete_model_deployment_monitoring_job", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "DeleteModelDeploymentMonitoringJob", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _DeleteNasJob( @@ -3362,7 +4189,7 @@ async 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 nas job method over HTTP. @@ -3373,8 +4200,10 @@ async def __call__( 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: @@ -3387,6 +4216,7 @@ async def __call__( http_options = ( _BaseJobServiceRestTransport._BaseDeleteNasJob._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_nas_job( request, metadata ) @@ -3403,6 +4233,33 @@ async 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.aiplatform_v1beta1.JobServiceClient.DeleteNasJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "DeleteNasJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncJobServiceRestTransport._DeleteNasJob._get_response( self._host, @@ -3430,6 +4287,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_delete_nas_job(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.JobServiceAsyncClient.delete_nas_job", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "DeleteNasJob", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _GetBatchPredictionJob( @@ -3467,7 +4346,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> batch_prediction_job.BatchPredictionJob: r"""Call the get batch prediction job method over HTTP. @@ -3478,8 +4357,10 @@ async def __call__( 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: ~.batch_prediction_job.BatchPredictionJob: @@ -3496,6 +4377,7 @@ async def __call__( http_options = ( _BaseJobServiceRestTransport._BaseGetBatchPredictionJob._get_http_options() ) + request, metadata = await self._interceptor.pre_get_batch_prediction_job( request, metadata ) @@ -3508,6 +4390,33 @@ async 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.aiplatform_v1beta1.JobServiceClient.GetBatchPredictionJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "GetBatchPredictionJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncJobServiceRestTransport._GetBatchPredictionJob._get_response( @@ -3537,6 +4446,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_get_batch_prediction_job(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = batch_prediction_job.BatchPredictionJob.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.JobServiceAsyncClient.get_batch_prediction_job", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "GetBatchPredictionJob", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _GetCustomJob( @@ -3574,7 +4507,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> custom_job.CustomJob: r"""Call the get custom job method over HTTP. @@ -3585,8 +4518,10 @@ async def __call__( 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: ~.custom_job.CustomJob: @@ -3604,6 +4539,7 @@ async def __call__( http_options = ( _BaseJobServiceRestTransport._BaseGetCustomJob._get_http_options() ) + request, metadata = await self._interceptor.pre_get_custom_job( request, metadata ) @@ -3620,6 +4556,33 @@ async 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 = 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.aiplatform_v1beta1.JobServiceClient.GetCustomJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "GetCustomJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncJobServiceRestTransport._GetCustomJob._get_response( self._host, @@ -3647,6 +4610,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_get_custom_job(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = custom_job.CustomJob.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.JobServiceAsyncClient.get_custom_job", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "GetCustomJob", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _GetDataLabelingJob( @@ -3684,7 +4669,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> data_labeling_job.DataLabelingJob: r"""Call the get data labeling job method over HTTP. @@ -3695,8 +4680,10 @@ async def __call__( 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: ~.data_labeling_job.DataLabelingJob: @@ -3709,6 +4696,7 @@ async def __call__( http_options = ( _BaseJobServiceRestTransport._BaseGetDataLabelingJob._get_http_options() ) + request, metadata = await self._interceptor.pre_get_data_labeling_job( request, metadata ) @@ -3721,6 +4709,33 @@ async 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.aiplatform_v1beta1.JobServiceClient.GetDataLabelingJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "GetDataLabelingJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncJobServiceRestTransport._GetDataLabelingJob._get_response( @@ -3750,6 +4765,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_get_data_labeling_job(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = data_labeling_job.DataLabelingJob.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.JobServiceAsyncClient.get_data_labeling_job", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "GetDataLabelingJob", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _GetHyperparameterTuningJob( @@ -3788,7 +4827,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> hyperparameter_tuning_job.HyperparameterTuningJob: r"""Call the get hyperparameter tuning job method over HTTP. @@ -3800,8 +4839,10 @@ async def __call__( 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: ~.hyperparameter_tuning_job.HyperparameterTuningJob: @@ -3815,6 +4856,7 @@ async def __call__( http_options = ( _BaseJobServiceRestTransport._BaseGetHyperparameterTuningJob._get_http_options() ) + ( request, metadata, @@ -3830,6 +4872,33 @@ async 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.aiplatform_v1beta1.JobServiceClient.GetHyperparameterTuningJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "GetHyperparameterTuningJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncJobServiceRestTransport._GetHyperparameterTuningJob._get_response( self._host, @@ -3857,6 +4926,32 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_get_hyperparameter_tuning_job(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + hyperparameter_tuning_job.HyperparameterTuningJob.to_json( + response + ) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.JobServiceAsyncClient.get_hyperparameter_tuning_job", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "GetHyperparameterTuningJob", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _GetModelDeploymentMonitoringJob( @@ -3895,7 +4990,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> model_deployment_monitoring_job.ModelDeploymentMonitoringJob: r"""Call the get model deployment monitoring job method over HTTP. @@ -3907,8 +5002,10 @@ async def __call__( 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: ~.model_deployment_monitoring_job.ModelDeploymentMonitoringJob: @@ -3923,6 +5020,7 @@ async def __call__( http_options = ( _BaseJobServiceRestTransport._BaseGetModelDeploymentMonitoringJob._get_http_options() ) + ( request, metadata, @@ -3938,6 +5036,33 @@ async 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.aiplatform_v1beta1.JobServiceClient.GetModelDeploymentMonitoringJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "GetModelDeploymentMonitoringJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncJobServiceRestTransport._GetModelDeploymentMonitoringJob._get_response( self._host, @@ -3969,6 +5094,30 @@ async def __call__( resp = await self._interceptor.post_get_model_deployment_monitoring_job( resp ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = model_deployment_monitoring_job.ModelDeploymentMonitoringJob.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.JobServiceAsyncClient.get_model_deployment_monitoring_job", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "GetModelDeploymentMonitoringJob", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _GetNasJob( @@ -4006,7 +5155,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> nas_job.NasJob: r"""Call the get nas job method over HTTP. @@ -4017,8 +5166,10 @@ async def __call__( 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: ~.nas_job.NasJob: @@ -4030,6 +5181,7 @@ async def __call__( http_options = ( _BaseJobServiceRestTransport._BaseGetNasJob._get_http_options() ) + request, metadata = await self._interceptor.pre_get_nas_job( request, metadata ) @@ -4046,6 +5198,33 @@ async 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 = 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.aiplatform_v1beta1.JobServiceClient.GetNasJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "GetNasJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncJobServiceRestTransport._GetNasJob._get_response( self._host, @@ -4073,6 +5252,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_get_nas_job(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = nas_job.NasJob.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.JobServiceAsyncClient.get_nas_job", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "GetNasJob", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _GetNasTrialDetail( @@ -4110,7 +5311,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> nas_job.NasTrialDetail: r"""Call the get nas trial detail method over HTTP. @@ -4121,8 +5322,10 @@ async def __call__( 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: ~.nas_job.NasTrialDetail: @@ -4136,6 +5339,7 @@ async def __call__( http_options = ( _BaseJobServiceRestTransport._BaseGetNasTrialDetail._get_http_options() ) + request, metadata = await self._interceptor.pre_get_nas_trial_detail( request, metadata ) @@ -4148,6 +5352,33 @@ async 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.aiplatform_v1beta1.JobServiceClient.GetNasTrialDetail", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "GetNasTrialDetail", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncJobServiceRestTransport._GetNasTrialDetail._get_response( @@ -4177,6 +5408,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_get_nas_trial_detail(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = nas_job.NasTrialDetail.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.JobServiceAsyncClient.get_nas_trial_detail", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "GetNasTrialDetail", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ListBatchPredictionJobs( @@ -4215,7 +5468,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> job_service.ListBatchPredictionJobsResponse: r"""Call the list batch prediction jobs method over HTTP. @@ -4227,8 +5480,10 @@ async def __call__( 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: ~.job_service.ListBatchPredictionJobsResponse: @@ -4240,6 +5495,7 @@ async def __call__( http_options = ( _BaseJobServiceRestTransport._BaseListBatchPredictionJobs._get_http_options() ) + request, metadata = await self._interceptor.pre_list_batch_prediction_jobs( request, metadata ) @@ -4252,6 +5508,33 @@ async 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.aiplatform_v1beta1.JobServiceClient.ListBatchPredictionJobs", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "ListBatchPredictionJobs", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncJobServiceRestTransport._ListBatchPredictionJobs._get_response( self._host, @@ -4279,6 +5562,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_list_batch_prediction_jobs(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + job_service.ListBatchPredictionJobsResponse.to_json(response) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.JobServiceAsyncClient.list_batch_prediction_jobs", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "ListBatchPredictionJobs", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ListCustomJobs( @@ -4316,7 +5623,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> job_service.ListCustomJobsResponse: r"""Call the list custom jobs method over HTTP. @@ -4327,8 +5634,10 @@ async def __call__( 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: ~.job_service.ListCustomJobsResponse: @@ -4340,6 +5649,7 @@ async def __call__( http_options = ( _BaseJobServiceRestTransport._BaseListCustomJobs._get_http_options() ) + request, metadata = await self._interceptor.pre_list_custom_jobs( request, metadata ) @@ -4354,6 +5664,33 @@ async 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 = 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.aiplatform_v1beta1.JobServiceClient.ListCustomJobs", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "ListCustomJobs", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncJobServiceRestTransport._ListCustomJobs._get_response( self._host, @@ -4381,6 +5718,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_list_custom_jobs(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = job_service.ListCustomJobsResponse.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.JobServiceAsyncClient.list_custom_jobs", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "ListCustomJobs", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ListDataLabelingJobs( @@ -4418,7 +5779,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> job_service.ListDataLabelingJobsResponse: r"""Call the list data labeling jobs method over HTTP. @@ -4429,8 +5790,10 @@ async def __call__( 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: ~.job_service.ListDataLabelingJobsResponse: @@ -4442,6 +5805,7 @@ async def __call__( http_options = ( _BaseJobServiceRestTransport._BaseListDataLabelingJobs._get_http_options() ) + request, metadata = await self._interceptor.pre_list_data_labeling_jobs( request, metadata ) @@ -4454,6 +5818,33 @@ async 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.aiplatform_v1beta1.JobServiceClient.ListDataLabelingJobs", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "ListDataLabelingJobs", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncJobServiceRestTransport._ListDataLabelingJobs._get_response( @@ -4483,6 +5874,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_list_data_labeling_jobs(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = job_service.ListDataLabelingJobsResponse.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.JobServiceAsyncClient.list_data_labeling_jobs", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "ListDataLabelingJobs", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ListHyperparameterTuningJobs( @@ -4521,7 +5936,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> job_service.ListHyperparameterTuningJobsResponse: r"""Call the list hyperparameter tuning jobs method over HTTP. @@ -4533,8 +5948,10 @@ async def __call__( 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: ~.job_service.ListHyperparameterTuningJobsResponse: @@ -4546,6 +5963,7 @@ async def __call__( http_options = ( _BaseJobServiceRestTransport._BaseListHyperparameterTuningJobs._get_http_options() ) + ( request, metadata, @@ -4561,6 +5979,33 @@ async 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.aiplatform_v1beta1.JobServiceClient.ListHyperparameterTuningJobs", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "ListHyperparameterTuningJobs", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncJobServiceRestTransport._ListHyperparameterTuningJobs._get_response( self._host, @@ -4588,6 +6033,32 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_list_hyperparameter_tuning_jobs(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + job_service.ListHyperparameterTuningJobsResponse.to_json( + response + ) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.JobServiceAsyncClient.list_hyperparameter_tuning_jobs", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "ListHyperparameterTuningJobs", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ListModelDeploymentMonitoringJobs( @@ -4628,7 +6099,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> job_service.ListModelDeploymentMonitoringJobsResponse: r"""Call the list model deployment monitoring jobs method over HTTP. @@ -4640,8 +6111,10 @@ async def __call__( 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: ~.job_service.ListModelDeploymentMonitoringJobsResponse: @@ -4653,6 +6126,7 @@ async def __call__( http_options = ( _BaseJobServiceRestTransport._BaseListModelDeploymentMonitoringJobs._get_http_options() ) + ( request, metadata, @@ -4668,6 +6142,33 @@ async 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.aiplatform_v1beta1.JobServiceClient.ListModelDeploymentMonitoringJobs", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "ListModelDeploymentMonitoringJobs", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncJobServiceRestTransport._ListModelDeploymentMonitoringJobs._get_response( self._host, @@ -4697,6 +6198,32 @@ async def __call__( resp = await self._interceptor.post_list_model_deployment_monitoring_jobs( resp ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + job_service.ListModelDeploymentMonitoringJobsResponse.to_json( + response + ) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.JobServiceAsyncClient.list_model_deployment_monitoring_jobs", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "ListModelDeploymentMonitoringJobs", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ListNasJobs( @@ -4734,7 +6261,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> job_service.ListNasJobsResponse: r"""Call the list nas jobs method over HTTP. @@ -4745,8 +6272,10 @@ async def __call__( 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: ~.job_service.ListNasJobsResponse: @@ -4758,6 +6287,7 @@ async def __call__( http_options = ( _BaseJobServiceRestTransport._BaseListNasJobs._get_http_options() ) + request, metadata = await self._interceptor.pre_list_nas_jobs( request, metadata ) @@ -4774,6 +6304,33 @@ async 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 = 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.aiplatform_v1beta1.JobServiceClient.ListNasJobs", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "ListNasJobs", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncJobServiceRestTransport._ListNasJobs._get_response( self._host, @@ -4801,6 +6358,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_list_nas_jobs(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = job_service.ListNasJobsResponse.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.JobServiceAsyncClient.list_nas_jobs", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "ListNasJobs", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ListNasTrialDetails( @@ -4838,7 +6417,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> job_service.ListNasTrialDetailsResponse: r"""Call the list nas trial details method over HTTP. @@ -4849,8 +6428,10 @@ async def __call__( 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: ~.job_service.ListNasTrialDetailsResponse: @@ -4862,6 +6443,7 @@ async def __call__( http_options = ( _BaseJobServiceRestTransport._BaseListNasTrialDetails._get_http_options() ) + request, metadata = await self._interceptor.pre_list_nas_trial_details( request, metadata ) @@ -4874,6 +6456,33 @@ async 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.aiplatform_v1beta1.JobServiceClient.ListNasTrialDetails", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "ListNasTrialDetails", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncJobServiceRestTransport._ListNasTrialDetails._get_response( @@ -4903,6 +6512,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_list_nas_trial_details(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = job_service.ListNasTrialDetailsResponse.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.JobServiceAsyncClient.list_nas_trial_details", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "ListNasTrialDetails", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _PauseModelDeploymentMonitoringJob( @@ -4944,7 +6577,7 @@ async 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 pause model deployment monitoring job method over HTTP. @@ -4956,13 +6589,16 @@ async def __call__( 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`. """ http_options = ( _BaseJobServiceRestTransport._BasePauseModelDeploymentMonitoringJob._get_http_options() ) + ( request, metadata, @@ -4982,6 +6618,33 @@ async 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.aiplatform_v1beta1.JobServiceClient.PauseModelDeploymentMonitoringJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "PauseModelDeploymentMonitoringJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncJobServiceRestTransport._PauseModelDeploymentMonitoringJob._get_response( self._host, @@ -5043,7 +6706,7 @@ async 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 resume model deployment monitoring job method over HTTP. @@ -5055,13 +6718,16 @@ async def __call__( 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`. """ http_options = ( _BaseJobServiceRestTransport._BaseResumeModelDeploymentMonitoringJob._get_http_options() ) + ( request, metadata, @@ -5081,6 +6747,33 @@ async 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.aiplatform_v1beta1.JobServiceClient.ResumeModelDeploymentMonitoringJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "ResumeModelDeploymentMonitoringJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncJobServiceRestTransport._ResumeModelDeploymentMonitoringJob._get_response( self._host, @@ -5142,7 +6835,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> job_service.SearchModelDeploymentMonitoringStatsAnomaliesResponse: r"""Call the search model deployment monitoring stats anomalies method over HTTP. @@ -5154,8 +6847,10 @@ async def __call__( 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: ~.job_service.SearchModelDeploymentMonitoringStatsAnomaliesResponse: @@ -5167,6 +6862,7 @@ async def __call__( http_options = ( _BaseJobServiceRestTransport._BaseSearchModelDeploymentMonitoringStatsAnomalies._get_http_options() ) + ( request, metadata, @@ -5186,6 +6882,33 @@ async 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.aiplatform_v1beta1.JobServiceClient.SearchModelDeploymentMonitoringStatsAnomalies", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "SearchModelDeploymentMonitoringStatsAnomalies", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncJobServiceRestTransport._SearchModelDeploymentMonitoringStatsAnomalies._get_response( self._host, @@ -5220,6 +6943,30 @@ async def __call__( resp = await self._interceptor.post_search_model_deployment_monitoring_stats_anomalies( resp ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = job_service.SearchModelDeploymentMonitoringStatsAnomaliesResponse.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.JobServiceAsyncClient.search_model_deployment_monitoring_stats_anomalies", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "SearchModelDeploymentMonitoringStatsAnomalies", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _UpdateModelDeploymentMonitoringJob( @@ -5261,7 +7008,7 @@ async 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 model deployment monitoring job method over HTTP. @@ -5273,8 +7020,10 @@ async def __call__( 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: @@ -5287,6 +7036,7 @@ async def __call__( http_options = ( _BaseJobServiceRestTransport._BaseUpdateModelDeploymentMonitoringJob._get_http_options() ) + ( request, metadata, @@ -5306,6 +7056,33 @@ async 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.aiplatform_v1beta1.JobServiceClient.UpdateModelDeploymentMonitoringJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "UpdateModelDeploymentMonitoringJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncJobServiceRestTransport._UpdateModelDeploymentMonitoringJob._get_response( self._host, @@ -5336,6 +7113,28 @@ async def __call__( resp = await self._interceptor.post_update_model_deployment_monitoring_job( 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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.JobServiceAsyncClient.update_model_deployment_monitoring_job", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "UpdateModelDeploymentMonitoringJob", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp @property @@ -5911,6 +7710,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -6127,6 +7930,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -6333,6 +8140,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}", @@ -6549,6 +8360,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, ], "google.longrunning.Operations.ListOperations": [ { @@ -6747,6 +8562,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*}/operations", @@ -6963,6 +8782,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*}/operations", + }, ], "google.longrunning.Operations.WaitOperation": [ { @@ -7161,6 +8984,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "post", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}:wait", @@ -7373,6 +9200,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, ], } @@ -7695,7 +9526,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -7706,8 +9537,10 @@ async def __call__( 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: locations_pb2.Location: Response from GetLocation method. @@ -7716,6 +9549,7 @@ async def __call__( http_options = ( _BaseJobServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_location( request, metadata ) @@ -7732,6 +9566,33 @@ async 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.aiplatform_v1beta1.JobServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncJobServiceRestTransport._GetLocation._get_response( self._host, @@ -7757,6 +9618,27 @@ async def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_location(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.aiplatform_v1beta1.JobServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -7798,7 +9680,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -7809,8 +9691,10 @@ async def __call__( 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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -7819,6 +9703,7 @@ async def __call__( http_options = ( _BaseJobServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_locations( request, metadata ) @@ -7835,6 +9720,33 @@ async 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.aiplatform_v1beta1.JobServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncJobServiceRestTransport._ListLocations._get_response( self._host, @@ -7860,6 +9772,27 @@ async def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_list_locations(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.aiplatform_v1beta1.JobServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -7902,7 +9835,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -7913,8 +9846,10 @@ async def __call__( 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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -7923,6 +9858,7 @@ async def __call__( http_options = ( _BaseJobServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_get_iam_policy( request, metadata ) @@ -7945,6 +9881,33 @@ async 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.aiplatform_v1beta1.JobServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncJobServiceRestTransport._GetIamPolicy._get_response( self._host, @@ -7971,6 +9934,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_iam_policy(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.aiplatform_v1beta1.JobServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -8013,7 +9997,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -8024,8 +10008,10 @@ async def __call__( 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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -8034,6 +10020,7 @@ async def __call__( http_options = ( _BaseJobServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_set_iam_policy( request, metadata ) @@ -8056,6 +10043,33 @@ async 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.aiplatform_v1beta1.JobServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncJobServiceRestTransport._SetIamPolicy._get_response( self._host, @@ -8082,6 +10096,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_set_iam_policy(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.aiplatform_v1beta1.JobServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -8124,7 +10159,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -8135,8 +10170,10 @@ async def __call__( 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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -8145,6 +10182,7 @@ async def __call__( http_options = ( _BaseJobServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = await self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -8161,6 +10199,33 @@ async 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.aiplatform_v1beta1.JobServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncJobServiceRestTransport._TestIamPermissions._get_response( @@ -8189,6 +10254,27 @@ async def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_test_iam_permissions(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.aiplatform_v1beta1.JobServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -8230,7 +10316,7 @@ async 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 cancel operation method over HTTP. @@ -8241,13 +10327,16 @@ async def __call__( 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`. """ http_options = ( _BaseJobServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_cancel_operation( request, metadata ) @@ -8260,6 +10349,33 @@ async 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.aiplatform_v1beta1.JobServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncJobServiceRestTransport._CancelOperation._get_response( @@ -8324,7 +10440,7 @@ async 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. @@ -8335,13 +10451,16 @@ async def __call__( 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`. """ http_options = ( _BaseJobServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_operation( request, metadata ) @@ -8354,6 +10473,33 @@ async 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.aiplatform_v1beta1.JobServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncJobServiceRestTransport._DeleteOperation._get_response( @@ -8418,7 +10564,7 @@ async 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. @@ -8429,8 +10575,10 @@ async def __call__( 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: Response from GetOperation method. @@ -8439,6 +10587,7 @@ async def __call__( http_options = ( _BaseJobServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_operation( request, metadata ) @@ -8455,6 +10604,33 @@ async 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.aiplatform_v1beta1.JobServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncJobServiceRestTransport._GetOperation._get_response( self._host, @@ -8480,6 +10656,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1beta1.JobServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -8521,7 +10718,7 @@ async 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. @@ -8532,8 +10729,10 @@ async def __call__( 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 from ListOperations method. @@ -8542,6 +10741,7 @@ async def __call__( http_options = ( _BaseJobServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_operations( request, metadata ) @@ -8556,6 +10756,33 @@ async 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.aiplatform_v1beta1.JobServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncJobServiceRestTransport._ListOperations._get_response( self._host, @@ -8581,6 +10808,27 @@ async def __call__( resp = operations_pb2.ListOperationsResponse() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1beta1.JobServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -8622,7 +10870,7 @@ async 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 wait operation method over HTTP. @@ -8633,8 +10881,10 @@ async def __call__( 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: Response from WaitOperation method. @@ -8643,6 +10893,7 @@ async def __call__( http_options = ( _BaseJobServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_wait_operation( request, metadata ) @@ -8659,6 +10910,33 @@ async 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.aiplatform_v1beta1.JobServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncJobServiceRestTransport._WaitOperation._get_response( self._host, @@ -8684,6 +10962,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_wait_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.aiplatform_v1beta1.JobServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.JobService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1beta1/services/job_service/transports/rest_base.py b/google/cloud/aiplatform_v1beta1/services/job_service/transports/rest_base.py index 693f6efa34..1158ac0008 100644 --- a/google/cloud/aiplatform_v1beta1/services/job_service/transports/rest_base.py +++ b/google/cloud/aiplatform_v1beta1/services/job_service/transports/rest_base.py @@ -2843,6 +2843,10 @@ def _get_http_options(): "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -3059,6 +3063,10 @@ def _get_http_options(): "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -3284,6 +3292,10 @@ def _get_http_options(): "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}", @@ -3500,6 +3512,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, ] return http_options @@ -3717,6 +3733,10 @@ def _get_http_options(): "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*}/operations", @@ -3933,6 +3953,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*}/operations", + }, ] return http_options @@ -4150,6 +4174,10 @@ def _get_http_options(): "method": "post", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}:wait", @@ -4362,6 +4390,10 @@ def _get_http_options(): "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, ] return http_options diff --git a/google/cloud/aiplatform_v1beta1/services/llm_utility_service/async_client.py b/google/cloud/aiplatform_v1beta1/services/llm_utility_service/async_client.py index ca01aa7187..4f0a43b8cd 100644 --- a/google/cloud/aiplatform_v1beta1/services/llm_utility_service/async_client.py +++ b/google/cloud/aiplatform_v1beta1/services/llm_utility_service/async_client.py @@ -13,6 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging as std_logging from collections import OrderedDict import re from typing import ( @@ -53,6 +54,15 @@ from .transports.grpc_asyncio import LlmUtilityServiceGrpcAsyncIOTransport from .client import LlmUtilityServiceClient +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 LlmUtilityServiceAsyncClient: """Service for LLM related utility functions.""" @@ -262,6 +272,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.aiplatform_v1beta1.LlmUtilityServiceAsyncClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.LlmUtilityService", + "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.aiplatform.v1beta1.LlmUtilityService", + "credentialsType": None, + }, + ) + async def compute_tokens( self, request: Optional[Union[llm_utility_service.ComputeTokensRequest, dict]] = None, @@ -270,7 +302,7 @@ async def compute_tokens( instances: Optional[MutableSequence[struct_pb2.Value]] = 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]]] = (), ) -> llm_utility_service.ComputeTokensResponse: r"""Return a list of tokens based on the input text. @@ -326,8 +358,10 @@ async def sample_compute_tokens(): 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.aiplatform_v1beta1.types.ComputeTokensResponse: @@ -389,7 +423,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. @@ -400,8 +434,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. @@ -442,7 +478,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. @@ -453,8 +489,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. @@ -495,7 +533,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. @@ -511,8 +549,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 """ @@ -549,7 +589,7 @@ async def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -564,8 +604,10 @@ async def cancel_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 """ @@ -602,7 +644,7 @@ async def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -619,8 +661,10 @@ async def wait_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. @@ -661,7 +705,7 @@ async def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -674,8 +718,10 @@ async def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -780,7 +826,7 @@ async def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -794,8 +840,10 @@ async def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -900,7 +948,7 @@ async def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -915,8 +963,10 @@ async def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -960,7 +1010,7 @@ async def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -971,8 +1021,10 @@ async def get_location( 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: ~.location_pb2.Location: Location object. @@ -1013,7 +1065,7 @@ async def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -1024,8 +1076,10 @@ async def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1beta1/services/llm_utility_service/client.py b/google/cloud/aiplatform_v1beta1/services/llm_utility_service/client.py index 536c584e28..d01a5f351c 100644 --- a/google/cloud/aiplatform_v1beta1/services/llm_utility_service/client.py +++ b/google/cloud/aiplatform_v1beta1/services/llm_utility_service/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 ( @@ -48,6 +49,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.cloud.aiplatform_v1beta1.types import llm_utility_service from google.cloud.location import locations_pb2 # type: ignore from google.iam.v1 import iam_policy_pb2 # type: ignore @@ -599,6 +609,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( @@ -690,6 +704,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.aiplatform_v1beta1.LlmUtilityServiceClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.LlmUtilityService", + "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.aiplatform.v1beta1.LlmUtilityService", + "credentialsType": None, + }, + ) + def compute_tokens( self, request: Optional[Union[llm_utility_service.ComputeTokensRequest, dict]] = None, @@ -698,7 +735,7 @@ def compute_tokens( instances: Optional[MutableSequence[struct_pb2.Value]] = 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]]] = (), ) -> llm_utility_service.ComputeTokensResponse: r"""Return a list of tokens based on the input text. @@ -754,8 +791,10 @@ def sample_compute_tokens(): 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.aiplatform_v1beta1.types.ComputeTokensResponse: @@ -827,7 +866,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. @@ -838,8 +877,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. @@ -880,7 +921,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. @@ -891,8 +932,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. @@ -933,7 +976,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. @@ -949,8 +992,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 """ @@ -987,7 +1032,7 @@ def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -1002,8 +1047,10 @@ def cancel_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 """ @@ -1040,7 +1087,7 @@ def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -1057,8 +1104,10 @@ def wait_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. @@ -1099,7 +1148,7 @@ def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -1112,8 +1161,10 @@ def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -1218,7 +1269,7 @@ def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -1232,8 +1283,10 @@ def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -1338,7 +1391,7 @@ def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -1353,8 +1406,10 @@ def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -1396,7 +1451,7 @@ def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -1407,8 +1462,10 @@ def get_location( 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: ~.location_pb2.Location: Location object. @@ -1449,7 +1506,7 @@ def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -1460,8 +1517,10 @@ def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1beta1/services/llm_utility_service/transports/grpc.py b/google/cloud/aiplatform_v1beta1/services/llm_utility_service/transports/grpc.py index e81fba8b46..85f85ccb0a 100644 --- a/google/cloud/aiplatform_v1beta1/services/llm_utility_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1beta1/services/llm_utility_service/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 import warnings from typing import Callable, Dict, Optional, Sequence, Tuple, Union @@ -21,8 +24,11 @@ import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from google.cloud.aiplatform_v1beta1.types import llm_utility_service from google.cloud.location import locations_pb2 # type: ignore @@ -31,6 +37,81 @@ from google.longrunning import operations_pb2 # type: ignore from .base import LlmUtilityServiceTransport, DEFAULT_CLIENT_INFO +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.aiplatform.v1beta1.LlmUtilityService", + "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.aiplatform.v1beta1.LlmUtilityService", + "rpcName": client_call_details.method, + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class LlmUtilityServiceGrpcTransport(LlmUtilityServiceTransport): """gRPC backend transport for LlmUtilityService. @@ -184,7 +265,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 @@ -261,7 +347,7 @@ def compute_tokens( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "compute_tokens" not in self._stubs: - self._stubs["compute_tokens"] = self.grpc_channel.unary_unary( + self._stubs["compute_tokens"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.LlmUtilityService/ComputeTokens", request_serializer=llm_utility_service.ComputeTokensRequest.serialize, response_deserializer=llm_utility_service.ComputeTokensResponse.deserialize, @@ -269,7 +355,7 @@ def compute_tokens( return self._stubs["compute_tokens"] def close(self): - self.grpc_channel.close() + self._logged_channel.close() @property def delete_operation( @@ -281,7 +367,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, @@ -298,7 +384,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -315,7 +401,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -332,7 +418,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, @@ -351,7 +437,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, @@ -370,7 +456,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -387,7 +473,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -412,7 +498,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -438,7 +524,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -467,7 +553,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1beta1/services/llm_utility_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1beta1/services/llm_utility_service/transports/grpc_asyncio.py index 91aedd5125..99118d452f 100644 --- a/google/cloud/aiplatform_v1beta1/services/llm_utility_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/llm_utility_service/transports/grpc_asyncio.py @@ -14,6 +14,9 @@ # limitations under the License. # import inspect +import json +import pickle +import logging as std_logging import warnings from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union @@ -23,8 +26,11 @@ from google.api_core import retry_async as retries from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from grpc.experimental import aio # type: ignore from google.cloud.aiplatform_v1beta1.types import llm_utility_service @@ -35,6 +41,82 @@ from .base import LlmUtilityServiceTransport, DEFAULT_CLIENT_INFO from .grpc import LlmUtilityServiceGrpcTransport +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.aiplatform.v1beta1.LlmUtilityService", + "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.aiplatform.v1beta1.LlmUtilityService", + "rpcName": str(client_call_details.method), + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class LlmUtilityServiceGrpcAsyncIOTransport(LlmUtilityServiceTransport): """gRPC AsyncIO backend transport for LlmUtilityService. @@ -231,10 +313,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 @@ -269,7 +354,7 @@ def compute_tokens( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "compute_tokens" not in self._stubs: - self._stubs["compute_tokens"] = self.grpc_channel.unary_unary( + self._stubs["compute_tokens"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.LlmUtilityService/ComputeTokens", request_serializer=llm_utility_service.ComputeTokensRequest.serialize, response_deserializer=llm_utility_service.ComputeTokensResponse.deserialize, @@ -342,7 +427,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: @@ -358,7 +443,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, @@ -375,7 +460,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -392,7 +477,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -409,7 +494,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, @@ -428,7 +513,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, @@ -447,7 +532,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -464,7 +549,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -489,7 +574,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -515,7 +600,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -544,7 +629,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1beta1/services/llm_utility_service/transports/rest.py b/google/cloud/aiplatform_v1beta1/services/llm_utility_service/transports/rest.py index 6dcb3fe6c6..51369f2ba5 100644 --- a/google/cloud/aiplatform_v1beta1/services/llm_utility_service/transports/rest.py +++ b/google/cloud/aiplatform_v1beta1/services/llm_utility_service/transports/rest.py @@ -13,9 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging +import json # type: ignore from google.auth.transport.requests import AuthorizedSession # type: ignore -import json # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.api_core import exceptions as core_exceptions from google.api_core import retry as retries @@ -46,6 +47,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, @@ -86,8 +95,11 @@ def post_compute_tokens(self, response): def pre_compute_tokens( self, request: llm_utility_service.ComputeTokensRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[llm_utility_service.ComputeTokensRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + llm_utility_service.ComputeTokensRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for compute_tokens Override in a subclass to manipulate the request or metadata @@ -109,8 +121,10 @@ def post_compute_tokens( def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -132,8 +146,10 @@ def post_get_location( def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -155,8 +171,10 @@ def post_list_locations( def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -176,8 +194,10 @@ def post_get_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -197,8 +217,11 @@ def post_set_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -220,8 +243,10 @@ def post_test_iam_permissions( def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -241,8 +266,10 @@ def post_cancel_operation(self, response: None) -> None: 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 @@ -262,8 +289,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 @@ -285,8 +314,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 @@ -308,8 +339,10 @@ def post_list_operations( def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -452,7 +485,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]]] = (), ) -> llm_utility_service.ComputeTokensResponse: r"""Call the compute tokens method over HTTP. @@ -463,8 +496,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: ~.llm_utility_service.ComputeTokensResponse: @@ -476,6 +511,7 @@ def __call__( http_options = ( _BaseLlmUtilityServiceRestTransport._BaseComputeTokens._get_http_options() ) + request, metadata = self._interceptor.pre_compute_tokens(request, metadata) transcoded_request = _BaseLlmUtilityServiceRestTransport._BaseComputeTokens._get_transcoded_request( http_options, request @@ -490,6 +526,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.aiplatform_v1beta1.LlmUtilityServiceClient.ComputeTokens", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.LlmUtilityService", + "rpcName": "ComputeTokens", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = LlmUtilityServiceRestTransport._ComputeTokens._get_response( self._host, @@ -511,7 +574,31 @@ def __call__( pb_resp = llm_utility_service.ComputeTokensResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_compute_tokens(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + llm_utility_service.ComputeTokensResponse.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.aiplatform_v1beta1.LlmUtilityServiceClient.compute_tokens", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.LlmUtilityService", + "rpcName": "ComputeTokens", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp @property @@ -564,7 +651,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]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -575,8 +662,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: locations_pb2.Location: Response from GetLocation method. @@ -585,6 +674,7 @@ def __call__( http_options = ( _BaseLlmUtilityServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = self._interceptor.pre_get_location(request, metadata) transcoded_request = _BaseLlmUtilityServiceRestTransport._BaseGetLocation._get_transcoded_request( http_options, request @@ -595,6 +685,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.aiplatform_v1beta1.LlmUtilityServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.LlmUtilityService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = LlmUtilityServiceRestTransport._GetLocation._get_response( self._host, @@ -614,6 +731,27 @@ def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_location(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.aiplatform_v1beta1.LlmUtilityServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.LlmUtilityService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -656,7 +794,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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -667,8 +805,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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -677,6 +817,7 @@ def __call__( http_options = ( _BaseLlmUtilityServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = self._interceptor.pre_list_locations(request, metadata) transcoded_request = _BaseLlmUtilityServiceRestTransport._BaseListLocations._get_transcoded_request( http_options, request @@ -687,6 +828,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.aiplatform_v1beta1.LlmUtilityServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.LlmUtilityService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = LlmUtilityServiceRestTransport._ListLocations._get_response( self._host, @@ -706,6 +874,27 @@ def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_list_locations(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.aiplatform_v1beta1.LlmUtilityServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.LlmUtilityService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -748,7 +937,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]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -759,8 +948,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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -769,6 +960,7 @@ def __call__( http_options = ( _BaseLlmUtilityServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_get_iam_policy(request, metadata) transcoded_request = _BaseLlmUtilityServiceRestTransport._BaseGetIamPolicy._get_transcoded_request( http_options, request @@ -783,6 +975,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.aiplatform_v1beta1.LlmUtilityServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.LlmUtilityService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = LlmUtilityServiceRestTransport._GetIamPolicy._get_response( self._host, @@ -803,6 +1022,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_iam_policy(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.aiplatform_v1beta1.LlmUtilityServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.LlmUtilityService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -845,7 +1085,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]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -856,8 +1096,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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -866,6 +1108,7 @@ def __call__( http_options = ( _BaseLlmUtilityServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_set_iam_policy(request, metadata) transcoded_request = _BaseLlmUtilityServiceRestTransport._BaseSetIamPolicy._get_transcoded_request( http_options, request @@ -880,6 +1123,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.aiplatform_v1beta1.LlmUtilityServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.LlmUtilityService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = LlmUtilityServiceRestTransport._SetIamPolicy._get_response( self._host, @@ -900,6 +1170,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_set_iam_policy(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.aiplatform_v1beta1.LlmUtilityServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.LlmUtilityService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -943,7 +1234,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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -954,8 +1245,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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -964,6 +1257,7 @@ def __call__( http_options = ( _BaseLlmUtilityServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -980,6 +1274,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.aiplatform_v1beta1.LlmUtilityServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.LlmUtilityService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = LlmUtilityServiceRestTransport._TestIamPermissions._get_response( self._host, @@ -1000,6 +1321,27 @@ def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_test_iam_permissions(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.aiplatform_v1beta1.LlmUtilityServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.LlmUtilityService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1042,7 +1384,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 cancel operation method over HTTP. @@ -1053,13 +1395,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 = ( _BaseLlmUtilityServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = self._interceptor.pre_cancel_operation( request, metadata ) @@ -1072,6 +1417,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.aiplatform_v1beta1.LlmUtilityServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.LlmUtilityService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = LlmUtilityServiceRestTransport._CancelOperation._get_response( self._host, @@ -1129,7 +1501,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. @@ -1140,13 +1512,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 = ( _BaseLlmUtilityServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = self._interceptor.pre_delete_operation( request, metadata ) @@ -1159,6 +1534,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.aiplatform_v1beta1.LlmUtilityServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.LlmUtilityService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = LlmUtilityServiceRestTransport._DeleteOperation._get_response( self._host, @@ -1215,7 +1617,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. @@ -1226,8 +1628,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. @@ -1236,6 +1640,7 @@ def __call__( http_options = ( _BaseLlmUtilityServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = self._interceptor.pre_get_operation(request, metadata) transcoded_request = _BaseLlmUtilityServiceRestTransport._BaseGetOperation._get_transcoded_request( http_options, request @@ -1246,6 +1651,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.aiplatform_v1beta1.LlmUtilityServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.LlmUtilityService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = LlmUtilityServiceRestTransport._GetOperation._get_response( self._host, @@ -1265,6 +1697,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.aiplatform_v1beta1.LlmUtilityServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.LlmUtilityService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1307,7 +1760,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. @@ -1318,8 +1771,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. @@ -1328,6 +1783,7 @@ def __call__( http_options = ( _BaseLlmUtilityServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = self._interceptor.pre_list_operations(request, metadata) transcoded_request = _BaseLlmUtilityServiceRestTransport._BaseListOperations._get_transcoded_request( http_options, request @@ -1338,6 +1794,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.aiplatform_v1beta1.LlmUtilityServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.LlmUtilityService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = LlmUtilityServiceRestTransport._ListOperations._get_response( self._host, @@ -1357,6 +1840,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.aiplatform_v1beta1.LlmUtilityServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.LlmUtilityService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1399,7 +1903,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 wait operation method over HTTP. @@ -1410,8 +1914,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 WaitOperation method. @@ -1420,6 +1926,7 @@ def __call__( http_options = ( _BaseLlmUtilityServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = self._interceptor.pre_wait_operation(request, metadata) transcoded_request = _BaseLlmUtilityServiceRestTransport._BaseWaitOperation._get_transcoded_request( http_options, request @@ -1430,6 +1937,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.aiplatform_v1beta1.LlmUtilityServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.LlmUtilityService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = LlmUtilityServiceRestTransport._WaitOperation._get_response( self._host, @@ -1449,6 +1983,27 @@ def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = self._interceptor.post_wait_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.aiplatform_v1beta1.LlmUtilityServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.LlmUtilityService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1beta1/services/llm_utility_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1beta1/services/llm_utility_service/transports/rest_asyncio.py index d9e8832faa..482aa238ae 100644 --- a/google/cloud/aiplatform_v1beta1/services/llm_utility_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/llm_utility_service/transports/rest_asyncio.py @@ -56,6 +56,18 @@ from .base import DEFAULT_CLIENT_INFO as BASE_DEFAULT_CLIENT_INFO + +import logging + +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__) + try: OptionalRetry = Union[retries.AsyncRetry, gapic_v1.method._MethodDefault, None] except AttributeError: # pragma: NO COVER @@ -100,8 +112,11 @@ async def post_compute_tokens(self, response): async def pre_compute_tokens( self, request: llm_utility_service.ComputeTokensRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[llm_utility_service.ComputeTokensRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + llm_utility_service.ComputeTokensRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for compute_tokens Override in a subclass to manipulate the request or metadata @@ -123,8 +138,10 @@ async def post_compute_tokens( async def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -146,8 +163,10 @@ async def post_get_location( async def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -169,8 +188,10 @@ async def post_list_locations( async def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -192,8 +213,10 @@ async def post_get_iam_policy( async def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -215,8 +238,11 @@ async def post_set_iam_policy( async def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -238,8 +264,10 @@ async def post_test_iam_permissions( async def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -259,8 +287,10 @@ async def post_cancel_operation(self, response: None) -> None: async 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 @@ -280,8 +310,10 @@ async def post_delete_operation(self, response: None) -> None: async 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 @@ -303,8 +335,10 @@ async def post_get_operation( async 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 @@ -326,8 +360,10 @@ async def post_list_operations( async def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -510,7 +546,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> llm_utility_service.ComputeTokensResponse: r"""Call the compute tokens method over HTTP. @@ -521,8 +557,10 @@ async def __call__( 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: ~.llm_utility_service.ComputeTokensResponse: @@ -534,6 +572,7 @@ async def __call__( http_options = ( _BaseLlmUtilityServiceRestTransport._BaseComputeTokens._get_http_options() ) + request, metadata = await self._interceptor.pre_compute_tokens( request, metadata ) @@ -550,6 +589,33 @@ async 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.aiplatform_v1beta1.LlmUtilityServiceClient.ComputeTokens", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.LlmUtilityService", + "rpcName": "ComputeTokens", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncLlmUtilityServiceRestTransport._ComputeTokens._get_response( @@ -580,6 +646,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_compute_tokens(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + llm_utility_service.ComputeTokensResponse.to_json(response) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.LlmUtilityServiceAsyncClient.compute_tokens", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.LlmUtilityService", + "rpcName": "ComputeTokens", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp @property @@ -631,7 +721,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -642,8 +732,10 @@ async def __call__( 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: locations_pb2.Location: Response from GetLocation method. @@ -652,6 +744,7 @@ async def __call__( http_options = ( _BaseLlmUtilityServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_location( request, metadata ) @@ -664,6 +757,33 @@ async 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.aiplatform_v1beta1.LlmUtilityServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.LlmUtilityService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncLlmUtilityServiceRestTransport._GetLocation._get_response( @@ -691,6 +811,27 @@ async def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_location(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.aiplatform_v1beta1.LlmUtilityServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.LlmUtilityService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -733,7 +874,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -744,8 +885,10 @@ async def __call__( 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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -754,6 +897,7 @@ async def __call__( http_options = ( _BaseLlmUtilityServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_locations( request, metadata ) @@ -766,6 +910,33 @@ async 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.aiplatform_v1beta1.LlmUtilityServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.LlmUtilityService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncLlmUtilityServiceRestTransport._ListLocations._get_response( @@ -793,6 +964,27 @@ async def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_list_locations(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.aiplatform_v1beta1.LlmUtilityServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.LlmUtilityService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -836,7 +1028,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -847,8 +1039,10 @@ async def __call__( 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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -857,6 +1051,7 @@ async def __call__( http_options = ( _BaseLlmUtilityServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_get_iam_policy( request, metadata ) @@ -873,6 +1068,33 @@ async 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.aiplatform_v1beta1.LlmUtilityServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.LlmUtilityService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncLlmUtilityServiceRestTransport._GetIamPolicy._get_response( @@ -901,6 +1123,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_iam_policy(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.aiplatform_v1beta1.LlmUtilityServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.LlmUtilityService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -944,7 +1187,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -955,8 +1198,10 @@ async def __call__( 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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -965,6 +1210,7 @@ async def __call__( http_options = ( _BaseLlmUtilityServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_set_iam_policy( request, metadata ) @@ -981,6 +1227,33 @@ async 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.aiplatform_v1beta1.LlmUtilityServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.LlmUtilityService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncLlmUtilityServiceRestTransport._SetIamPolicy._get_response( @@ -1009,6 +1282,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_set_iam_policy(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.aiplatform_v1beta1.LlmUtilityServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.LlmUtilityService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1052,7 +1346,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -1063,8 +1357,10 @@ async def __call__( 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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -1073,6 +1369,7 @@ async def __call__( http_options = ( _BaseLlmUtilityServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = await self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -1089,6 +1386,33 @@ async 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.aiplatform_v1beta1.LlmUtilityServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.LlmUtilityService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncLlmUtilityServiceRestTransport._TestIamPermissions._get_response( self._host, @@ -1115,6 +1439,27 @@ async def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_test_iam_permissions(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.aiplatform_v1beta1.LlmUtilityServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.LlmUtilityService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1157,7 +1502,7 @@ async 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 cancel operation method over HTTP. @@ -1168,13 +1513,16 @@ async def __call__( 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`. """ http_options = ( _BaseLlmUtilityServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_cancel_operation( request, metadata ) @@ -1187,6 +1535,33 @@ async 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.aiplatform_v1beta1.LlmUtilityServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.LlmUtilityService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncLlmUtilityServiceRestTransport._CancelOperation._get_response( self._host, @@ -1250,7 +1625,7 @@ async 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. @@ -1261,13 +1636,16 @@ async def __call__( 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`. """ http_options = ( _BaseLlmUtilityServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_operation( request, metadata ) @@ -1280,6 +1658,33 @@ async 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.aiplatform_v1beta1.LlmUtilityServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.LlmUtilityService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncLlmUtilityServiceRestTransport._DeleteOperation._get_response( self._host, @@ -1343,7 +1748,7 @@ async 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. @@ -1354,8 +1759,10 @@ async def __call__( 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: Response from GetOperation method. @@ -1364,6 +1771,7 @@ async def __call__( http_options = ( _BaseLlmUtilityServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_operation( request, metadata ) @@ -1376,6 +1784,33 @@ async 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.aiplatform_v1beta1.LlmUtilityServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.LlmUtilityService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncLlmUtilityServiceRestTransport._GetOperation._get_response( @@ -1403,6 +1838,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1beta1.LlmUtilityServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.LlmUtilityService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1445,7 +1901,7 @@ async 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. @@ -1456,8 +1912,10 @@ async def __call__( 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 from ListOperations method. @@ -1466,6 +1924,7 @@ async def __call__( http_options = ( _BaseLlmUtilityServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_operations( request, metadata ) @@ -1478,6 +1937,33 @@ async 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.aiplatform_v1beta1.LlmUtilityServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.LlmUtilityService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncLlmUtilityServiceRestTransport._ListOperations._get_response( @@ -1505,6 +1991,27 @@ async def __call__( resp = operations_pb2.ListOperationsResponse() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1beta1.LlmUtilityServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.LlmUtilityService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1547,7 +2054,7 @@ async 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 wait operation method over HTTP. @@ -1558,8 +2065,10 @@ async def __call__( 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: Response from WaitOperation method. @@ -1568,6 +2077,7 @@ async def __call__( http_options = ( _BaseLlmUtilityServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_wait_operation( request, metadata ) @@ -1580,6 +2090,33 @@ async 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.aiplatform_v1beta1.LlmUtilityServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.LlmUtilityService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncLlmUtilityServiceRestTransport._WaitOperation._get_response( @@ -1607,6 +2144,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_wait_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.aiplatform_v1beta1.LlmUtilityServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.LlmUtilityService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1beta1/services/llm_utility_service/transports/rest_base.py b/google/cloud/aiplatform_v1beta1/services/llm_utility_service/transports/rest_base.py index 38a92ef85b..0cd26d2ad4 100644 --- a/google/cloud/aiplatform_v1beta1/services/llm_utility_service/transports/rest_base.py +++ b/google/cloud/aiplatform_v1beta1/services/llm_utility_service/transports/rest_base.py @@ -1081,6 +1081,10 @@ def _get_http_options(): "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -1297,6 +1301,10 @@ def _get_http_options(): "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -1522,6 +1530,10 @@ def _get_http_options(): "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}", @@ -1738,6 +1750,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, ] return http_options @@ -1955,6 +1971,10 @@ def _get_http_options(): "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*}/operations", @@ -2171,6 +2191,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*}/operations", + }, ] return http_options @@ -2388,6 +2412,10 @@ def _get_http_options(): "method": "post", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}:wait", @@ -2600,6 +2628,10 @@ def _get_http_options(): "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, ] return http_options diff --git a/google/cloud/aiplatform_v1beta1/services/match_service/async_client.py b/google/cloud/aiplatform_v1beta1/services/match_service/async_client.py index 61839c40fb..0995c3dad0 100644 --- a/google/cloud/aiplatform_v1beta1/services/match_service/async_client.py +++ b/google/cloud/aiplatform_v1beta1/services/match_service/async_client.py @@ -13,6 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging as std_logging from collections import OrderedDict import re from typing import ( @@ -53,6 +54,15 @@ from .transports.grpc_asyncio import MatchServiceGrpcAsyncIOTransport from .client import MatchServiceClient +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 MatchServiceAsyncClient: """MatchService is a Google managed service for efficient vector @@ -258,13 +268,35 @@ 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.aiplatform_v1beta1.MatchServiceAsyncClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MatchService", + "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.aiplatform.v1beta1.MatchService", + "credentialsType": None, + }, + ) + async def find_neighbors( self, request: Optional[Union[match_service.FindNeighborsRequest, dict]] = 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]]] = (), ) -> match_service.FindNeighborsResponse: r"""Finds the nearest neighbors of each vector within the request. @@ -302,8 +334,10 @@ async def sample_find_neighbors(): 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.aiplatform_v1beta1.types.FindNeighborsResponse: @@ -351,7 +385,7 @@ async def read_index_datapoints( *, 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]]] = (), ) -> match_service.ReadIndexDatapointsResponse: r"""Reads the datapoints/vectors of the given IDs. A maximum of 1000 datapoints can be retrieved in a @@ -390,8 +424,10 @@ async def sample_read_index_datapoints(): 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.aiplatform_v1beta1.types.ReadIndexDatapointsResponse: @@ -439,7 +475,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. @@ -450,8 +486,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. @@ -492,7 +530,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. @@ -503,8 +541,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. @@ -545,7 +585,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. @@ -561,8 +601,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 """ @@ -599,7 +641,7 @@ async def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -614,8 +656,10 @@ async def cancel_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 """ @@ -652,7 +696,7 @@ async def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -669,8 +713,10 @@ async def wait_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. @@ -711,7 +757,7 @@ async def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -724,8 +770,10 @@ async def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -830,7 +878,7 @@ async def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -844,8 +892,10 @@ async def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -950,7 +1000,7 @@ async def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -965,8 +1015,10 @@ async def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -1010,7 +1062,7 @@ async def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -1021,8 +1073,10 @@ async def get_location( 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: ~.location_pb2.Location: Location object. @@ -1063,7 +1117,7 @@ async def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -1074,8 +1128,10 @@ async def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1beta1/services/match_service/client.py b/google/cloud/aiplatform_v1beta1/services/match_service/client.py index 1642137d8c..eff1ed6d61 100644 --- a/google/cloud/aiplatform_v1beta1/services/match_service/client.py +++ b/google/cloud/aiplatform_v1beta1/services/match_service/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 ( @@ -48,6 +49,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.cloud.aiplatform_v1beta1.types import index from google.cloud.aiplatform_v1beta1.types import match_service from google.cloud.location import locations_pb2 # type: ignore @@ -595,6 +605,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( @@ -682,13 +696,36 @@ 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.aiplatform_v1beta1.MatchServiceClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MatchService", + "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.aiplatform.v1beta1.MatchService", + "credentialsType": None, + }, + ) + def find_neighbors( self, request: Optional[Union[match_service.FindNeighborsRequest, dict]] = 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]]] = (), ) -> match_service.FindNeighborsResponse: r"""Finds the nearest neighbors of each vector within the request. @@ -726,8 +763,10 @@ def sample_find_neighbors(): 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.aiplatform_v1beta1.types.FindNeighborsResponse: @@ -773,7 +812,7 @@ def read_index_datapoints( *, 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]]] = (), ) -> match_service.ReadIndexDatapointsResponse: r"""Reads the datapoints/vectors of the given IDs. A maximum of 1000 datapoints can be retrieved in a @@ -812,8 +851,10 @@ def sample_read_index_datapoints(): 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.aiplatform_v1beta1.types.ReadIndexDatapointsResponse: @@ -872,7 +913,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. @@ -883,8 +924,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. @@ -925,7 +968,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. @@ -936,8 +979,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. @@ -978,7 +1023,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. @@ -994,8 +1039,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 """ @@ -1032,7 +1079,7 @@ def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -1047,8 +1094,10 @@ def cancel_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 """ @@ -1085,7 +1134,7 @@ def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -1102,8 +1151,10 @@ def wait_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. @@ -1144,7 +1195,7 @@ def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -1157,8 +1208,10 @@ def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -1263,7 +1316,7 @@ def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -1277,8 +1330,10 @@ def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -1383,7 +1438,7 @@ def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -1398,8 +1453,10 @@ def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -1441,7 +1498,7 @@ def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -1452,8 +1509,10 @@ def get_location( 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: ~.location_pb2.Location: Location object. @@ -1494,7 +1553,7 @@ def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -1505,8 +1564,10 @@ def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1beta1/services/match_service/transports/grpc.py b/google/cloud/aiplatform_v1beta1/services/match_service/transports/grpc.py index 0679db0fe7..235c722392 100644 --- a/google/cloud/aiplatform_v1beta1/services/match_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1beta1/services/match_service/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 import warnings from typing import Callable, Dict, Optional, Sequence, Tuple, Union @@ -21,8 +24,11 @@ import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from google.cloud.aiplatform_v1beta1.types import match_service from google.cloud.location import locations_pb2 # type: ignore @@ -31,6 +37,81 @@ from google.longrunning import operations_pb2 # type: ignore from .base import MatchServiceTransport, DEFAULT_CLIENT_INFO +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.aiplatform.v1beta1.MatchService", + "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.aiplatform.v1beta1.MatchService", + "rpcName": client_call_details.method, + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class MatchServiceGrpcTransport(MatchServiceTransport): """gRPC backend transport for MatchService. @@ -185,7 +266,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 @@ -262,7 +348,7 @@ def find_neighbors( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "find_neighbors" not in self._stubs: - self._stubs["find_neighbors"] = self.grpc_channel.unary_unary( + self._stubs["find_neighbors"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.MatchService/FindNeighbors", request_serializer=match_service.FindNeighborsRequest.serialize, response_deserializer=match_service.FindNeighborsResponse.deserialize, @@ -293,7 +379,7 @@ def read_index_datapoints( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "read_index_datapoints" not in self._stubs: - self._stubs["read_index_datapoints"] = self.grpc_channel.unary_unary( + self._stubs["read_index_datapoints"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.MatchService/ReadIndexDatapoints", request_serializer=match_service.ReadIndexDatapointsRequest.serialize, response_deserializer=match_service.ReadIndexDatapointsResponse.deserialize, @@ -301,7 +387,7 @@ def read_index_datapoints( return self._stubs["read_index_datapoints"] def close(self): - self.grpc_channel.close() + self._logged_channel.close() @property def delete_operation( @@ -313,7 +399,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, @@ -330,7 +416,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -347,7 +433,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -364,7 +450,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, @@ -383,7 +469,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, @@ -402,7 +488,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -419,7 +505,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -444,7 +530,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -470,7 +556,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -499,7 +585,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1beta1/services/match_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1beta1/services/match_service/transports/grpc_asyncio.py index 8708611c81..686f9cc500 100644 --- a/google/cloud/aiplatform_v1beta1/services/match_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/match_service/transports/grpc_asyncio.py @@ -14,6 +14,9 @@ # limitations under the License. # import inspect +import json +import pickle +import logging as std_logging import warnings from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union @@ -23,8 +26,11 @@ from google.api_core import retry_async as retries from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from grpc.experimental import aio # type: ignore from google.cloud.aiplatform_v1beta1.types import match_service @@ -35,6 +41,82 @@ from .base import MatchServiceTransport, DEFAULT_CLIENT_INFO from .grpc import MatchServiceGrpcTransport +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.aiplatform.v1beta1.MatchService", + "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.aiplatform.v1beta1.MatchService", + "rpcName": str(client_call_details.method), + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class MatchServiceGrpcAsyncIOTransport(MatchServiceTransport): """gRPC AsyncIO backend transport for MatchService. @@ -232,10 +314,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 @@ -271,7 +356,7 @@ def find_neighbors( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "find_neighbors" not in self._stubs: - self._stubs["find_neighbors"] = self.grpc_channel.unary_unary( + self._stubs["find_neighbors"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.MatchService/FindNeighbors", request_serializer=match_service.FindNeighborsRequest.serialize, response_deserializer=match_service.FindNeighborsResponse.deserialize, @@ -302,7 +387,7 @@ def read_index_datapoints( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "read_index_datapoints" not in self._stubs: - self._stubs["read_index_datapoints"] = self.grpc_channel.unary_unary( + self._stubs["read_index_datapoints"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.MatchService/ReadIndexDatapoints", request_serializer=match_service.ReadIndexDatapointsRequest.serialize, response_deserializer=match_service.ReadIndexDatapointsResponse.deserialize, @@ -380,7 +465,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: @@ -396,7 +481,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, @@ -413,7 +498,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -430,7 +515,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -447,7 +532,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, @@ -466,7 +551,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, @@ -485,7 +570,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -502,7 +587,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -527,7 +612,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -553,7 +638,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -582,7 +667,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1beta1/services/match_service/transports/rest.py b/google/cloud/aiplatform_v1beta1/services/match_service/transports/rest.py index 6128f6f0c6..9a6fc58b0e 100644 --- a/google/cloud/aiplatform_v1beta1/services/match_service/transports/rest.py +++ b/google/cloud/aiplatform_v1beta1/services/match_service/transports/rest.py @@ -13,9 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging +import json # type: ignore from google.auth.transport.requests import AuthorizedSession # type: ignore -import json # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.api_core import exceptions as core_exceptions from google.api_core import retry as retries @@ -46,6 +47,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, @@ -94,8 +103,10 @@ def post_read_index_datapoints(self, response): def pre_find_neighbors( self, request: match_service.FindNeighborsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[match_service.FindNeighborsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + match_service.FindNeighborsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for find_neighbors Override in a subclass to manipulate the request or metadata @@ -117,8 +128,11 @@ def post_find_neighbors( def pre_read_index_datapoints( self, request: match_service.ReadIndexDatapointsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[match_service.ReadIndexDatapointsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + match_service.ReadIndexDatapointsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for read_index_datapoints Override in a subclass to manipulate the request or metadata @@ -140,8 +154,10 @@ def post_read_index_datapoints( def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -163,8 +179,10 @@ def post_get_location( def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -186,8 +204,10 @@ def post_list_locations( def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -207,8 +227,10 @@ def post_get_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -228,8 +250,11 @@ def post_set_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -251,8 +276,10 @@ def post_test_iam_permissions( def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -272,8 +299,10 @@ def post_cancel_operation(self, response: None) -> None: 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 @@ -293,8 +322,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 @@ -316,8 +347,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 @@ -339,8 +372,10 @@ def post_list_operations( def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -483,7 +518,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]]] = (), ) -> match_service.FindNeighborsResponse: r"""Call the find neighbors method over HTTP. @@ -494,8 +529,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: ~.match_service.FindNeighborsResponse: @@ -507,6 +544,7 @@ def __call__( http_options = ( _BaseMatchServiceRestTransport._BaseFindNeighbors._get_http_options() ) + request, metadata = self._interceptor.pre_find_neighbors(request, metadata) transcoded_request = _BaseMatchServiceRestTransport._BaseFindNeighbors._get_transcoded_request( http_options, request @@ -521,6 +559,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.aiplatform_v1beta1.MatchServiceClient.FindNeighbors", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MatchService", + "rpcName": "FindNeighbors", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MatchServiceRestTransport._FindNeighbors._get_response( self._host, @@ -542,7 +607,31 @@ def __call__( pb_resp = match_service.FindNeighborsResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_find_neighbors(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = match_service.FindNeighborsResponse.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.aiplatform_v1beta1.MatchServiceClient.find_neighbors", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MatchService", + "rpcName": "FindNeighbors", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ReadIndexDatapoints( @@ -581,7 +670,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]]] = (), ) -> match_service.ReadIndexDatapointsResponse: r"""Call the read index datapoints method over HTTP. @@ -592,8 +681,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: ~.match_service.ReadIndexDatapointsResponse: @@ -605,6 +696,7 @@ def __call__( http_options = ( _BaseMatchServiceRestTransport._BaseReadIndexDatapoints._get_http_options() ) + request, metadata = self._interceptor.pre_read_index_datapoints( request, metadata ) @@ -621,6 +713,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.aiplatform_v1beta1.MatchServiceClient.ReadIndexDatapoints", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MatchService", + "rpcName": "ReadIndexDatapoints", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MatchServiceRestTransport._ReadIndexDatapoints._get_response( self._host, @@ -642,7 +761,31 @@ def __call__( pb_resp = match_service.ReadIndexDatapointsResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_read_index_datapoints(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + match_service.ReadIndexDatapointsResponse.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.aiplatform_v1beta1.MatchServiceClient.read_index_datapoints", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MatchService", + "rpcName": "ReadIndexDatapoints", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp @property @@ -705,7 +848,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]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -716,8 +859,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: locations_pb2.Location: Response from GetLocation method. @@ -726,6 +871,7 @@ def __call__( http_options = ( _BaseMatchServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = self._interceptor.pre_get_location(request, metadata) transcoded_request = ( _BaseMatchServiceRestTransport._BaseGetLocation._get_transcoded_request( @@ -740,6 +886,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.aiplatform_v1beta1.MatchServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MatchService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MatchServiceRestTransport._GetLocation._get_response( self._host, @@ -759,6 +932,27 @@ def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_location(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.aiplatform_v1beta1.MatchServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MatchService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -800,7 +994,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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -811,8 +1005,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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -821,6 +1017,7 @@ def __call__( http_options = ( _BaseMatchServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = self._interceptor.pre_list_locations(request, metadata) transcoded_request = _BaseMatchServiceRestTransport._BaseListLocations._get_transcoded_request( http_options, request @@ -831,6 +1028,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.aiplatform_v1beta1.MatchServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MatchService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MatchServiceRestTransport._ListLocations._get_response( self._host, @@ -850,6 +1074,27 @@ def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_list_locations(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.aiplatform_v1beta1.MatchServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MatchService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -892,7 +1137,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]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -903,8 +1148,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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -913,6 +1160,7 @@ def __call__( http_options = ( _BaseMatchServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_get_iam_policy(request, metadata) transcoded_request = _BaseMatchServiceRestTransport._BaseGetIamPolicy._get_transcoded_request( http_options, request @@ -931,6 +1179,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.aiplatform_v1beta1.MatchServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MatchService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MatchServiceRestTransport._GetIamPolicy._get_response( self._host, @@ -951,6 +1226,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_iam_policy(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.aiplatform_v1beta1.MatchServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MatchService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -993,7 +1289,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]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -1004,8 +1300,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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -1014,6 +1312,7 @@ def __call__( http_options = ( _BaseMatchServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_set_iam_policy(request, metadata) transcoded_request = _BaseMatchServiceRestTransport._BaseSetIamPolicy._get_transcoded_request( http_options, request @@ -1032,6 +1331,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.aiplatform_v1beta1.MatchServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MatchService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MatchServiceRestTransport._SetIamPolicy._get_response( self._host, @@ -1052,6 +1378,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_set_iam_policy(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.aiplatform_v1beta1.MatchServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MatchService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1094,7 +1441,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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -1105,8 +1452,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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -1115,6 +1464,7 @@ def __call__( http_options = ( _BaseMatchServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -1131,6 +1481,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.aiplatform_v1beta1.MatchServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MatchService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MatchServiceRestTransport._TestIamPermissions._get_response( self._host, @@ -1151,6 +1528,27 @@ def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_test_iam_permissions(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.aiplatform_v1beta1.MatchServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MatchService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1192,7 +1590,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 cancel operation method over HTTP. @@ -1203,13 +1601,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 = ( _BaseMatchServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = self._interceptor.pre_cancel_operation( request, metadata ) @@ -1222,6 +1623,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.aiplatform_v1beta1.MatchServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MatchService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MatchServiceRestTransport._CancelOperation._get_response( self._host, @@ -1278,7 +1706,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. @@ -1289,13 +1717,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 = ( _BaseMatchServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = self._interceptor.pre_delete_operation( request, metadata ) @@ -1308,6 +1739,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.aiplatform_v1beta1.MatchServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MatchService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MatchServiceRestTransport._DeleteOperation._get_response( self._host, @@ -1364,7 +1822,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. @@ -1375,8 +1833,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. @@ -1385,6 +1845,7 @@ def __call__( http_options = ( _BaseMatchServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = self._interceptor.pre_get_operation(request, metadata) transcoded_request = _BaseMatchServiceRestTransport._BaseGetOperation._get_transcoded_request( http_options, request @@ -1397,6 +1858,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.aiplatform_v1beta1.MatchServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MatchService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MatchServiceRestTransport._GetOperation._get_response( self._host, @@ -1416,6 +1904,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.aiplatform_v1beta1.MatchServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MatchService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1457,7 +1966,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. @@ -1468,8 +1977,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. @@ -1478,6 +1989,7 @@ def __call__( http_options = ( _BaseMatchServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = self._interceptor.pre_list_operations(request, metadata) transcoded_request = _BaseMatchServiceRestTransport._BaseListOperations._get_transcoded_request( http_options, request @@ -1488,6 +2000,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.aiplatform_v1beta1.MatchServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MatchService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MatchServiceRestTransport._ListOperations._get_response( self._host, @@ -1507,6 +2046,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.aiplatform_v1beta1.MatchServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MatchService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1548,7 +2108,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 wait operation method over HTTP. @@ -1559,8 +2119,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 WaitOperation method. @@ -1569,6 +2131,7 @@ def __call__( http_options = ( _BaseMatchServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = self._interceptor.pre_wait_operation(request, metadata) transcoded_request = _BaseMatchServiceRestTransport._BaseWaitOperation._get_transcoded_request( http_options, request @@ -1579,6 +2142,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.aiplatform_v1beta1.MatchServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MatchService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MatchServiceRestTransport._WaitOperation._get_response( self._host, @@ -1598,6 +2188,27 @@ def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = self._interceptor.post_wait_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.aiplatform_v1beta1.MatchServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MatchService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1beta1/services/match_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1beta1/services/match_service/transports/rest_asyncio.py index d9e0483ebb..e150d8d6a6 100644 --- a/google/cloud/aiplatform_v1beta1/services/match_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/match_service/transports/rest_asyncio.py @@ -56,6 +56,18 @@ from .base import DEFAULT_CLIENT_INFO as BASE_DEFAULT_CLIENT_INFO + +import logging + +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__) + try: OptionalRetry = Union[retries.AsyncRetry, gapic_v1.method._MethodDefault, None] except AttributeError: # pragma: NO COVER @@ -108,8 +120,10 @@ async def post_read_index_datapoints(self, response): async def pre_find_neighbors( self, request: match_service.FindNeighborsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[match_service.FindNeighborsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + match_service.FindNeighborsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for find_neighbors Override in a subclass to manipulate the request or metadata @@ -131,8 +145,11 @@ async def post_find_neighbors( async def pre_read_index_datapoints( self, request: match_service.ReadIndexDatapointsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[match_service.ReadIndexDatapointsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + match_service.ReadIndexDatapointsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for read_index_datapoints Override in a subclass to manipulate the request or metadata @@ -154,8 +171,10 @@ async def post_read_index_datapoints( async def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -177,8 +196,10 @@ async def post_get_location( async def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -200,8 +221,10 @@ async def post_list_locations( async def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -223,8 +246,10 @@ async def post_get_iam_policy( async def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -246,8 +271,11 @@ async def post_set_iam_policy( async def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -269,8 +297,10 @@ async def post_test_iam_permissions( async def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -290,8 +320,10 @@ async def post_cancel_operation(self, response: None) -> None: async 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 @@ -311,8 +343,10 @@ async def post_delete_operation(self, response: None) -> None: async 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 @@ -334,8 +368,10 @@ async def post_get_operation( async 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 @@ -357,8 +393,10 @@ async def post_list_operations( async def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -546,7 +584,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> match_service.FindNeighborsResponse: r"""Call the find neighbors method over HTTP. @@ -557,8 +595,10 @@ async def __call__( 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: ~.match_service.FindNeighborsResponse: @@ -570,6 +610,7 @@ async def __call__( http_options = ( _BaseMatchServiceRestTransport._BaseFindNeighbors._get_http_options() ) + request, metadata = await self._interceptor.pre_find_neighbors( request, metadata ) @@ -586,6 +627,33 @@ async 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.aiplatform_v1beta1.MatchServiceClient.FindNeighbors", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MatchService", + "rpcName": "FindNeighbors", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncMatchServiceRestTransport._FindNeighbors._get_response( @@ -616,6 +684,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_find_neighbors(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = match_service.FindNeighborsResponse.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.MatchServiceAsyncClient.find_neighbors", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MatchService", + "rpcName": "FindNeighbors", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ReadIndexDatapoints( @@ -655,7 +747,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> match_service.ReadIndexDatapointsResponse: r"""Call the read index datapoints method over HTTP. @@ -666,8 +758,10 @@ async def __call__( 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: ~.match_service.ReadIndexDatapointsResponse: @@ -679,6 +773,7 @@ async def __call__( http_options = ( _BaseMatchServiceRestTransport._BaseReadIndexDatapoints._get_http_options() ) + request, metadata = await self._interceptor.pre_read_index_datapoints( request, metadata ) @@ -695,6 +790,33 @@ async 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.aiplatform_v1beta1.MatchServiceClient.ReadIndexDatapoints", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MatchService", + "rpcName": "ReadIndexDatapoints", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncMatchServiceRestTransport._ReadIndexDatapoints._get_response( @@ -725,6 +847,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_read_index_datapoints(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + match_service.ReadIndexDatapointsResponse.to_json(response) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.MatchServiceAsyncClient.read_index_datapoints", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MatchService", + "rpcName": "ReadIndexDatapoints", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp @property @@ -783,7 +929,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -794,8 +940,10 @@ async def __call__( 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: locations_pb2.Location: Response from GetLocation method. @@ -804,6 +952,7 @@ async def __call__( http_options = ( _BaseMatchServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_location( request, metadata ) @@ -820,6 +969,33 @@ async 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.aiplatform_v1beta1.MatchServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MatchService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncMatchServiceRestTransport._GetLocation._get_response( self._host, @@ -845,6 +1021,27 @@ async def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_location(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.aiplatform_v1beta1.MatchServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MatchService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -886,7 +1083,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -897,8 +1094,10 @@ async def __call__( 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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -907,6 +1106,7 @@ async def __call__( http_options = ( _BaseMatchServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_locations( request, metadata ) @@ -919,6 +1119,33 @@ async 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.aiplatform_v1beta1.MatchServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MatchService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncMatchServiceRestTransport._ListLocations._get_response( @@ -946,6 +1173,27 @@ async def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_list_locations(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.aiplatform_v1beta1.MatchServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MatchService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -988,7 +1236,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -999,8 +1247,10 @@ async def __call__( 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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -1009,6 +1259,7 @@ async def __call__( http_options = ( _BaseMatchServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_get_iam_policy( request, metadata ) @@ -1029,6 +1280,33 @@ async 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.aiplatform_v1beta1.MatchServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MatchService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncMatchServiceRestTransport._GetIamPolicy._get_response( self._host, @@ -1055,6 +1333,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_iam_policy(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.aiplatform_v1beta1.MatchServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MatchService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1097,7 +1396,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -1108,8 +1407,10 @@ async def __call__( 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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -1118,6 +1419,7 @@ async def __call__( http_options = ( _BaseMatchServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_set_iam_policy( request, metadata ) @@ -1138,6 +1440,33 @@ async 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.aiplatform_v1beta1.MatchServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MatchService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncMatchServiceRestTransport._SetIamPolicy._get_response( self._host, @@ -1164,6 +1493,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_set_iam_policy(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.aiplatform_v1beta1.MatchServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MatchService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1207,7 +1557,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -1218,8 +1568,10 @@ async def __call__( 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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -1228,6 +1580,7 @@ async def __call__( http_options = ( _BaseMatchServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = await self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -1244,6 +1597,33 @@ async 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.aiplatform_v1beta1.MatchServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MatchService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncMatchServiceRestTransport._TestIamPermissions._get_response( @@ -1272,6 +1652,27 @@ async def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_test_iam_permissions(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.aiplatform_v1beta1.MatchServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MatchService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1313,7 +1714,7 @@ async 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 cancel operation method over HTTP. @@ -1324,13 +1725,16 @@ async def __call__( 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`. """ http_options = ( _BaseMatchServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_cancel_operation( request, metadata ) @@ -1343,6 +1747,33 @@ async 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.aiplatform_v1beta1.MatchServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MatchService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncMatchServiceRestTransport._CancelOperation._get_response( @@ -1407,7 +1838,7 @@ async 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. @@ -1418,13 +1849,16 @@ async def __call__( 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`. """ http_options = ( _BaseMatchServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_operation( request, metadata ) @@ -1437,6 +1871,33 @@ async 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.aiplatform_v1beta1.MatchServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MatchService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncMatchServiceRestTransport._DeleteOperation._get_response( @@ -1501,7 +1962,7 @@ async 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. @@ -1512,8 +1973,10 @@ async def __call__( 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: Response from GetOperation method. @@ -1522,6 +1985,7 @@ async def __call__( http_options = ( _BaseMatchServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_operation( request, metadata ) @@ -1536,6 +2000,33 @@ async 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.aiplatform_v1beta1.MatchServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MatchService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncMatchServiceRestTransport._GetOperation._get_response( self._host, @@ -1561,6 +2052,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1beta1.MatchServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MatchService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1602,7 +2114,7 @@ async 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. @@ -1613,8 +2125,10 @@ async def __call__( 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 from ListOperations method. @@ -1623,6 +2137,7 @@ async def __call__( http_options = ( _BaseMatchServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_operations( request, metadata ) @@ -1635,6 +2150,33 @@ async 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.aiplatform_v1beta1.MatchServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MatchService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncMatchServiceRestTransport._ListOperations._get_response( @@ -1662,6 +2204,27 @@ async def __call__( resp = operations_pb2.ListOperationsResponse() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1beta1.MatchServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MatchService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1703,7 +2266,7 @@ async 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 wait operation method over HTTP. @@ -1714,8 +2277,10 @@ async def __call__( 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: Response from WaitOperation method. @@ -1724,6 +2289,7 @@ async def __call__( http_options = ( _BaseMatchServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_wait_operation( request, metadata ) @@ -1736,6 +2302,33 @@ async 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.aiplatform_v1beta1.MatchServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MatchService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncMatchServiceRestTransport._WaitOperation._get_response( @@ -1763,6 +2356,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_wait_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.aiplatform_v1beta1.MatchServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MatchService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1beta1/services/match_service/transports/rest_base.py b/google/cloud/aiplatform_v1beta1/services/match_service/transports/rest_base.py index 37e88549ae..efce4d2dfe 100644 --- a/google/cloud/aiplatform_v1beta1/services/match_service/transports/rest_base.py +++ b/google/cloud/aiplatform_v1beta1/services/match_service/transports/rest_base.py @@ -1123,6 +1123,10 @@ def _get_http_options(): "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -1339,6 +1343,10 @@ def _get_http_options(): "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -1564,6 +1572,10 @@ def _get_http_options(): "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}", @@ -1780,6 +1792,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, ] return http_options @@ -1997,6 +2013,10 @@ def _get_http_options(): "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*}/operations", @@ -2213,6 +2233,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*}/operations", + }, ] return http_options @@ -2430,6 +2454,10 @@ def _get_http_options(): "method": "post", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}:wait", @@ -2642,6 +2670,10 @@ def _get_http_options(): "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, ] return http_options diff --git a/google/cloud/aiplatform_v1beta1/services/metadata_service/async_client.py b/google/cloud/aiplatform_v1beta1/services/metadata_service/async_client.py index 2d4490b4b2..56b06f836c 100644 --- a/google/cloud/aiplatform_v1beta1/services/metadata_service/async_client.py +++ b/google/cloud/aiplatform_v1beta1/services/metadata_service/async_client.py @@ -13,6 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging as std_logging from collections import OrderedDict import re from typing import ( @@ -73,6 +74,15 @@ from .transports.grpc_asyncio import MetadataServiceGrpcAsyncIOTransport from .client import MetadataServiceClient +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 MetadataServiceAsyncClient: """Service for reading and writing metadata entries.""" @@ -292,6 +302,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.aiplatform_v1beta1.MetadataServiceAsyncClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "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.aiplatform.v1beta1.MetadataService", + "credentialsType": None, + }, + ) + async def create_metadata_store( self, request: Optional[ @@ -303,7 +335,7 @@ async def create_metadata_store( metadata_store_id: 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"""Initializes a MetadataStore, including allocation of resources. @@ -375,8 +407,10 @@ async def sample_create_metadata_store(): 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: @@ -451,7 +485,7 @@ async def get_metadata_store( 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]]] = (), ) -> metadata_store.MetadataStore: r"""Retrieves a specific MetadataStore. @@ -496,8 +530,10 @@ async def sample_get_metadata_store(): 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.aiplatform_v1beta1.types.MetadataStore: @@ -561,7 +597,7 @@ async def list_metadata_stores( 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.ListMetadataStoresAsyncPager: r"""Lists MetadataStores for a Location. @@ -607,8 +643,10 @@ async def sample_list_metadata_stores(): 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.aiplatform_v1beta1.services.metadata_service.pagers.ListMetadataStoresAsyncPager: @@ -685,7 +723,7 @@ async def delete_metadata_store( 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"""Deletes a single MetadataStore and all its child resources (Artifacts, Executions, and Contexts). @@ -735,8 +773,10 @@ async def sample_delete_metadata_store(): 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: @@ -817,7 +857,7 @@ async def create_artifact( artifact_id: 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]]] = (), ) -> gca_artifact.Artifact: r"""Creates an Artifact associated with a MetadataStore. @@ -882,8 +922,10 @@ async def sample_create_artifact(): 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.aiplatform_v1beta1.types.Artifact: @@ -946,7 +988,7 @@ async def get_artifact( 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]]] = (), ) -> artifact.Artifact: r"""Retrieves a specific Artifact. @@ -991,8 +1033,10 @@ async def sample_get_artifact(): 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.aiplatform_v1beta1.types.Artifact: @@ -1051,7 +1095,7 @@ async def list_artifacts( 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.ListArtifactsAsyncPager: r"""Lists Artifacts in the MetadataStore. @@ -1097,8 +1141,10 @@ async def sample_list_artifacts(): 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.aiplatform_v1beta1.services.metadata_service.pagers.ListArtifactsAsyncPager: @@ -1174,7 +1220,7 @@ async def update_artifact( 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]]] = (), ) -> gca_artifact.Artifact: r"""Updates a stored Artifact. @@ -1228,8 +1274,10 @@ async def sample_update_artifact(): 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.aiplatform_v1beta1.types.Artifact: @@ -1292,7 +1340,7 @@ async def delete_artifact( 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"""Deletes an Artifact. @@ -1341,8 +1389,10 @@ async def sample_delete_artifact(): 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: @@ -1421,7 +1471,7 @@ async def purge_artifacts( 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]]] = (), ) -> operation_async.AsyncOperation: r"""Purges Artifacts. @@ -1471,8 +1521,10 @@ async def sample_purge_artifacts(): 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: @@ -1545,7 +1597,7 @@ async def create_context( context_id: 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]]] = (), ) -> gca_context.Context: r"""Creates a Context associated with a MetadataStore. @@ -1610,8 +1662,10 @@ async def sample_create_context(): 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.aiplatform_v1beta1.types.Context: @@ -1674,7 +1728,7 @@ async def get_context( 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]]] = (), ) -> context.Context: r"""Retrieves a specific Context. @@ -1719,8 +1773,10 @@ async def sample_get_context(): 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.aiplatform_v1beta1.types.Context: @@ -1779,7 +1835,7 @@ async def list_contexts( 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.ListContextsAsyncPager: r"""Lists Contexts on the MetadataStore. @@ -1825,8 +1881,10 @@ async def sample_list_contexts(): 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.aiplatform_v1beta1.services.metadata_service.pagers.ListContextsAsyncPager: @@ -1902,7 +1960,7 @@ async def update_context( 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]]] = (), ) -> gca_context.Context: r"""Updates a stored Context. @@ -1955,8 +2013,10 @@ async def sample_update_context(): 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.aiplatform_v1beta1.types.Context: @@ -2019,7 +2079,7 @@ async def delete_context( 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"""Deletes a stored Context. @@ -2068,8 +2128,10 @@ async def sample_delete_context(): 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: @@ -2148,7 +2210,7 @@ async def purge_contexts( 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]]] = (), ) -> operation_async.AsyncOperation: r"""Purges Contexts. @@ -2198,8 +2260,10 @@ async def sample_purge_contexts(): 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: @@ -2274,7 +2338,7 @@ async def add_context_artifacts_and_executions( executions: Optional[MutableSequence[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]]] = (), ) -> metadata_service.AddContextArtifactsAndExecutionsResponse: r"""Adds a set of Artifacts and Executions to a Context. If any of the Artifacts or Executions have already been @@ -2341,8 +2405,10 @@ async def sample_add_context_artifacts_and_executions(): 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.aiplatform_v1beta1.types.AddContextArtifactsAndExecutionsResponse: @@ -2412,7 +2478,7 @@ async def add_context_children( child_contexts: Optional[MutableSequence[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]]] = (), ) -> metadata_service.AddContextChildrenResponse: r"""Adds a set of Contexts as children to a parent Context. If any of the child Contexts have already been added to the parent @@ -2469,8 +2535,10 @@ async def sample_add_context_children(): 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.aiplatform_v1beta1.types.AddContextChildrenResponse: @@ -2536,7 +2604,7 @@ async def remove_context_children( child_contexts: Optional[MutableSequence[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]]] = (), ) -> metadata_service.RemoveContextChildrenResponse: r"""Remove a set of children contexts from a parent Context. If any of the child Contexts were NOT added to @@ -2591,8 +2659,10 @@ async def sample_remove_context_children(): 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.aiplatform_v1beta1.types.RemoveContextChildrenResponse: @@ -2657,7 +2727,7 @@ async def query_context_lineage_subgraph( context: 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]]] = (), ) -> lineage_subgraph.LineageSubgraph: r"""Retrieves Artifacts and Executions within the specified Context, connected by Event edges and returned @@ -2710,8 +2780,10 @@ async def sample_query_context_lineage_subgraph(): 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.aiplatform_v1beta1.types.LineageSubgraph: @@ -2775,7 +2847,7 @@ async def create_execution( execution_id: 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]]] = (), ) -> gca_execution.Execution: r"""Creates an Execution associated with a MetadataStore. @@ -2840,8 +2912,10 @@ async def sample_create_execution(): 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.aiplatform_v1beta1.types.Execution: @@ -2904,7 +2978,7 @@ async def get_execution( 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]]] = (), ) -> execution.Execution: r"""Retrieves a specific Execution. @@ -2949,8 +3023,10 @@ async def sample_get_execution(): 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.aiplatform_v1beta1.types.Execution: @@ -3009,7 +3085,7 @@ async def list_executions( 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.ListExecutionsAsyncPager: r"""Lists Executions in the MetadataStore. @@ -3055,8 +3131,10 @@ async def sample_list_executions(): 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.aiplatform_v1beta1.services.metadata_service.pagers.ListExecutionsAsyncPager: @@ -3132,7 +3210,7 @@ async def update_execution( 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]]] = (), ) -> gca_execution.Execution: r"""Updates a stored Execution. @@ -3186,8 +3264,10 @@ async def sample_update_execution(): 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.aiplatform_v1beta1.types.Execution: @@ -3250,7 +3330,7 @@ async def delete_execution( 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"""Deletes an Execution. @@ -3299,8 +3379,10 @@ async def sample_delete_execution(): 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: @@ -3379,7 +3461,7 @@ async def purge_executions( 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]]] = (), ) -> operation_async.AsyncOperation: r"""Purges Executions. @@ -3429,8 +3511,10 @@ async def sample_purge_executions(): 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: @@ -3504,7 +3588,7 @@ async def add_execution_events( events: Optional[MutableSequence[event.Event]] = 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]]] = (), ) -> metadata_service.AddExecutionEventsResponse: r"""Adds Events to the specified Execution. An Event indicates whether an Artifact was used as an input or @@ -3558,8 +3642,10 @@ async def sample_add_execution_events(): 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.aiplatform_v1beta1.types.AddExecutionEventsResponse: @@ -3626,7 +3712,7 @@ async def query_execution_inputs_and_outputs( execution: 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]]] = (), ) -> lineage_subgraph.LineageSubgraph: r"""Obtains the set of input and output Artifacts for this Execution, in the form of LineageSubgraph that also @@ -3674,8 +3760,10 @@ async def sample_query_execution_inputs_and_outputs(): 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.aiplatform_v1beta1.types.LineageSubgraph: @@ -3745,7 +3833,7 @@ async def create_metadata_schema( metadata_schema_id: 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]]] = (), ) -> gca_metadata_schema.MetadataSchema: r"""Creates a MetadataSchema. @@ -3816,8 +3904,10 @@ async def sample_create_metadata_schema(): 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.aiplatform_v1beta1.types.MetadataSchema: @@ -3882,7 +3972,7 @@ async def get_metadata_schema( 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]]] = (), ) -> metadata_schema.MetadataSchema: r"""Retrieves a specific MetadataSchema. @@ -3927,8 +4017,10 @@ async def sample_get_metadata_schema(): 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.aiplatform_v1beta1.types.MetadataSchema: @@ -3989,7 +4081,7 @@ async def list_metadata_schemas( 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.ListMetadataSchemasAsyncPager: r"""Lists MetadataSchemas. @@ -4035,8 +4127,10 @@ async def sample_list_metadata_schemas(): 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.aiplatform_v1beta1.services.metadata_service.pagers.ListMetadataSchemasAsyncPager: @@ -4113,7 +4207,7 @@ async def query_artifact_lineage_subgraph( artifact: 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]]] = (), ) -> lineage_subgraph.LineageSubgraph: r"""Retrieves lineage of an Artifact represented through Artifacts and Executions connected by Event edges and @@ -4166,8 +4260,10 @@ async def sample_query_artifact_lineage_subgraph(): 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.aiplatform_v1beta1.types.LineageSubgraph: @@ -4230,7 +4326,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. @@ -4241,8 +4337,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. @@ -4283,7 +4381,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. @@ -4294,8 +4392,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. @@ -4336,7 +4436,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. @@ -4352,8 +4452,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 """ @@ -4390,7 +4492,7 @@ async def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -4405,8 +4507,10 @@ async def cancel_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 """ @@ -4443,7 +4547,7 @@ async def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -4460,8 +4564,10 @@ async def wait_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. @@ -4502,7 +4608,7 @@ async def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -4515,8 +4621,10 @@ async def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -4621,7 +4729,7 @@ async def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -4635,8 +4743,10 @@ async def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -4741,7 +4851,7 @@ async def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -4756,8 +4866,10 @@ async def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -4801,7 +4913,7 @@ async def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -4812,8 +4924,10 @@ async def get_location( 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: ~.location_pb2.Location: Location object. @@ -4854,7 +4968,7 @@ async def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -4865,8 +4979,10 @@ async def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1beta1/services/metadata_service/client.py b/google/cloud/aiplatform_v1beta1/services/metadata_service/client.py index 160def604f..5f4263d71f 100644 --- a/google/cloud/aiplatform_v1beta1/services/metadata_service/client.py +++ b/google/cloud/aiplatform_v1beta1/services/metadata_service/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 ( @@ -48,6 +49,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 as gac_operation # type: ignore from google.api_core import operation_async # type: ignore from google.cloud.aiplatform_v1beta1.services.metadata_service import pagers @@ -713,6 +723,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( @@ -803,6 +817,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.aiplatform_v1beta1.MetadataServiceClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "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.aiplatform.v1beta1.MetadataService", + "credentialsType": None, + }, + ) + def create_metadata_store( self, request: Optional[ @@ -814,7 +851,7 @@ def create_metadata_store( metadata_store_id: 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]]] = (), ) -> gac_operation.Operation: r"""Initializes a MetadataStore, including allocation of resources. @@ -886,8 +923,10 @@ def sample_create_metadata_store(): 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: @@ -959,7 +998,7 @@ def get_metadata_store( 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]]] = (), ) -> metadata_store.MetadataStore: r"""Retrieves a specific MetadataStore. @@ -1004,8 +1043,10 @@ def sample_get_metadata_store(): 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.aiplatform_v1beta1.types.MetadataStore: @@ -1066,7 +1107,7 @@ def list_metadata_stores( 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.ListMetadataStoresPager: r"""Lists MetadataStores for a Location. @@ -1112,8 +1153,10 @@ def sample_list_metadata_stores(): 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.aiplatform_v1beta1.services.metadata_service.pagers.ListMetadataStoresPager: @@ -1187,7 +1230,7 @@ def delete_metadata_store( 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]]] = (), ) -> gac_operation.Operation: r"""Deletes a single MetadataStore and all its child resources (Artifacts, Executions, and Contexts). @@ -1237,8 +1280,10 @@ def sample_delete_metadata_store(): 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: @@ -1316,7 +1361,7 @@ def create_artifact( artifact_id: 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]]] = (), ) -> gca_artifact.Artifact: r"""Creates an Artifact associated with a MetadataStore. @@ -1381,8 +1426,10 @@ def sample_create_artifact(): 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.aiplatform_v1beta1.types.Artifact: @@ -1442,7 +1489,7 @@ def get_artifact( 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]]] = (), ) -> artifact.Artifact: r"""Retrieves a specific Artifact. @@ -1487,8 +1534,10 @@ def sample_get_artifact(): 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.aiplatform_v1beta1.types.Artifact: @@ -1544,7 +1593,7 @@ def list_artifacts( 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.ListArtifactsPager: r"""Lists Artifacts in the MetadataStore. @@ -1590,8 +1639,10 @@ def sample_list_artifacts(): 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.aiplatform_v1beta1.services.metadata_service.pagers.ListArtifactsPager: @@ -1664,7 +1715,7 @@ def update_artifact( 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]]] = (), ) -> gca_artifact.Artifact: r"""Updates a stored Artifact. @@ -1718,8 +1769,10 @@ def sample_update_artifact(): 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.aiplatform_v1beta1.types.Artifact: @@ -1779,7 +1832,7 @@ def delete_artifact( 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]]] = (), ) -> gac_operation.Operation: r"""Deletes an Artifact. @@ -1828,8 +1881,10 @@ def sample_delete_artifact(): 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: @@ -1905,7 +1960,7 @@ def purge_artifacts( 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]]] = (), ) -> gac_operation.Operation: r"""Purges Artifacts. @@ -1955,8 +2010,10 @@ def sample_purge_artifacts(): 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: @@ -2026,7 +2083,7 @@ def create_context( context_id: 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]]] = (), ) -> gca_context.Context: r"""Creates a Context associated with a MetadataStore. @@ -2091,8 +2148,10 @@ def sample_create_context(): 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.aiplatform_v1beta1.types.Context: @@ -2152,7 +2211,7 @@ def get_context( 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]]] = (), ) -> context.Context: r"""Retrieves a specific Context. @@ -2197,8 +2256,10 @@ def sample_get_context(): 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.aiplatform_v1beta1.types.Context: @@ -2254,7 +2315,7 @@ def list_contexts( 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.ListContextsPager: r"""Lists Contexts on the MetadataStore. @@ -2300,8 +2361,10 @@ def sample_list_contexts(): 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.aiplatform_v1beta1.services.metadata_service.pagers.ListContextsPager: @@ -2374,7 +2437,7 @@ def update_context( 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]]] = (), ) -> gca_context.Context: r"""Updates a stored Context. @@ -2427,8 +2490,10 @@ def sample_update_context(): 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.aiplatform_v1beta1.types.Context: @@ -2488,7 +2553,7 @@ def delete_context( 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]]] = (), ) -> gac_operation.Operation: r"""Deletes a stored Context. @@ -2537,8 +2602,10 @@ def sample_delete_context(): 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: @@ -2614,7 +2681,7 @@ def purge_contexts( 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]]] = (), ) -> gac_operation.Operation: r"""Purges Contexts. @@ -2664,8 +2731,10 @@ def sample_purge_contexts(): 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: @@ -2737,7 +2806,7 @@ def add_context_artifacts_and_executions( executions: Optional[MutableSequence[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]]] = (), ) -> metadata_service.AddContextArtifactsAndExecutionsResponse: r"""Adds a set of Artifacts and Executions to a Context. If any of the Artifacts or Executions have already been @@ -2804,8 +2873,10 @@ def sample_add_context_artifacts_and_executions(): 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.aiplatform_v1beta1.types.AddContextArtifactsAndExecutionsResponse: @@ -2874,7 +2945,7 @@ def add_context_children( child_contexts: Optional[MutableSequence[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]]] = (), ) -> metadata_service.AddContextChildrenResponse: r"""Adds a set of Contexts as children to a parent Context. If any of the child Contexts have already been added to the parent @@ -2931,8 +3002,10 @@ def sample_add_context_children(): 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.aiplatform_v1beta1.types.AddContextChildrenResponse: @@ -2995,7 +3068,7 @@ def remove_context_children( child_contexts: Optional[MutableSequence[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]]] = (), ) -> metadata_service.RemoveContextChildrenResponse: r"""Remove a set of children contexts from a parent Context. If any of the child Contexts were NOT added to @@ -3050,8 +3123,10 @@ def sample_remove_context_children(): 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.aiplatform_v1beta1.types.RemoveContextChildrenResponse: @@ -3113,7 +3188,7 @@ def query_context_lineage_subgraph( context: 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]]] = (), ) -> lineage_subgraph.LineageSubgraph: r"""Retrieves Artifacts and Executions within the specified Context, connected by Event edges and returned @@ -3166,8 +3241,10 @@ def sample_query_context_lineage_subgraph(): 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.aiplatform_v1beta1.types.LineageSubgraph: @@ -3230,7 +3307,7 @@ def create_execution( execution_id: 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]]] = (), ) -> gca_execution.Execution: r"""Creates an Execution associated with a MetadataStore. @@ -3295,8 +3372,10 @@ def sample_create_execution(): 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.aiplatform_v1beta1.types.Execution: @@ -3356,7 +3435,7 @@ def get_execution( 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]]] = (), ) -> execution.Execution: r"""Retrieves a specific Execution. @@ -3401,8 +3480,10 @@ def sample_get_execution(): 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.aiplatform_v1beta1.types.Execution: @@ -3458,7 +3539,7 @@ def list_executions( 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.ListExecutionsPager: r"""Lists Executions in the MetadataStore. @@ -3504,8 +3585,10 @@ def sample_list_executions(): 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.aiplatform_v1beta1.services.metadata_service.pagers.ListExecutionsPager: @@ -3578,7 +3661,7 @@ def update_execution( 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]]] = (), ) -> gca_execution.Execution: r"""Updates a stored Execution. @@ -3632,8 +3715,10 @@ def sample_update_execution(): 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.aiplatform_v1beta1.types.Execution: @@ -3693,7 +3778,7 @@ def delete_execution( 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]]] = (), ) -> gac_operation.Operation: r"""Deletes an Execution. @@ -3742,8 +3827,10 @@ def sample_delete_execution(): 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: @@ -3819,7 +3906,7 @@ def purge_executions( 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]]] = (), ) -> gac_operation.Operation: r"""Purges Executions. @@ -3869,8 +3956,10 @@ def sample_purge_executions(): 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: @@ -3941,7 +4030,7 @@ def add_execution_events( events: Optional[MutableSequence[event.Event]] = 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]]] = (), ) -> metadata_service.AddExecutionEventsResponse: r"""Adds Events to the specified Execution. An Event indicates whether an Artifact was used as an input or @@ -3995,8 +4084,10 @@ def sample_add_execution_events(): 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.aiplatform_v1beta1.types.AddExecutionEventsResponse: @@ -4060,7 +4151,7 @@ def query_execution_inputs_and_outputs( execution: 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]]] = (), ) -> lineage_subgraph.LineageSubgraph: r"""Obtains the set of input and output Artifacts for this Execution, in the form of LineageSubgraph that also @@ -4108,8 +4199,10 @@ def sample_query_execution_inputs_and_outputs(): 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.aiplatform_v1beta1.types.LineageSubgraph: @@ -4178,7 +4271,7 @@ def create_metadata_schema( metadata_schema_id: 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]]] = (), ) -> gca_metadata_schema.MetadataSchema: r"""Creates a MetadataSchema. @@ -4249,8 +4342,10 @@ def sample_create_metadata_schema(): 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.aiplatform_v1beta1.types.MetadataSchema: @@ -4312,7 +4407,7 @@ def get_metadata_schema( 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]]] = (), ) -> metadata_schema.MetadataSchema: r"""Retrieves a specific MetadataSchema. @@ -4357,8 +4452,10 @@ def sample_get_metadata_schema(): 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.aiplatform_v1beta1.types.MetadataSchema: @@ -4416,7 +4513,7 @@ def list_metadata_schemas( 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.ListMetadataSchemasPager: r"""Lists MetadataSchemas. @@ -4462,8 +4559,10 @@ def sample_list_metadata_schemas(): 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.aiplatform_v1beta1.services.metadata_service.pagers.ListMetadataSchemasPager: @@ -4537,7 +4636,7 @@ def query_artifact_lineage_subgraph( artifact: 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]]] = (), ) -> lineage_subgraph.LineageSubgraph: r"""Retrieves lineage of an Artifact represented through Artifacts and Executions connected by Event edges and @@ -4590,8 +4689,10 @@ def sample_query_artifact_lineage_subgraph(): 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.aiplatform_v1beta1.types.LineageSubgraph: @@ -4666,7 +4767,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. @@ -4677,8 +4778,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. @@ -4719,7 +4822,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. @@ -4730,8 +4833,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. @@ -4772,7 +4877,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. @@ -4788,8 +4893,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 """ @@ -4826,7 +4933,7 @@ def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -4841,8 +4948,10 @@ def cancel_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 """ @@ -4879,7 +4988,7 @@ def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -4896,8 +5005,10 @@ def wait_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. @@ -4938,7 +5049,7 @@ def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -4951,8 +5062,10 @@ def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -5057,7 +5170,7 @@ def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -5071,8 +5184,10 @@ def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -5177,7 +5292,7 @@ def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -5192,8 +5307,10 @@ def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -5235,7 +5352,7 @@ def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -5246,8 +5363,10 @@ def get_location( 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: ~.location_pb2.Location: Location object. @@ -5288,7 +5407,7 @@ def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -5299,8 +5418,10 @@ def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1beta1/services/metadata_service/pagers.py b/google/cloud/aiplatform_v1beta1/services/metadata_service/pagers.py index 0b9886e0ce..35f7f7e53b 100644 --- a/google/cloud/aiplatform_v1beta1/services/metadata_service/pagers.py +++ b/google/cloud/aiplatform_v1beta1/services/metadata_service/pagers.py @@ -71,7 +71,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. @@ -85,8 +85,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 = metadata_service.ListMetadataStoresRequest(request) @@ -145,7 +147,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. @@ -159,8 +161,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 = metadata_service.ListMetadataStoresRequest(request) @@ -223,7 +227,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. @@ -237,8 +241,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 = metadata_service.ListArtifactsRequest(request) @@ -297,7 +303,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. @@ -311,8 +317,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 = metadata_service.ListArtifactsRequest(request) @@ -375,7 +383,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. @@ -389,8 +397,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 = metadata_service.ListContextsRequest(request) @@ -449,7 +459,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. @@ -463,8 +473,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 = metadata_service.ListContextsRequest(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 = metadata_service.ListExecutionsRequest(request) @@ -601,7 +615,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. @@ -615,8 +629,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 = metadata_service.ListExecutionsRequest(request) @@ -679,7 +695,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. @@ -693,8 +709,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 = metadata_service.ListMetadataSchemasRequest(request) @@ -753,7 +771,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. @@ -767,8 +785,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 = metadata_service.ListMetadataSchemasRequest(request) diff --git a/google/cloud/aiplatform_v1beta1/services/metadata_service/transports/grpc.py b/google/cloud/aiplatform_v1beta1/services/metadata_service/transports/grpc.py index 2a2114e1f3..5081f445e2 100644 --- a/google/cloud/aiplatform_v1beta1/services/metadata_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1beta1/services/metadata_service/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 import warnings from typing import Callable, Dict, Optional, Sequence, Tuple, Union @@ -22,8 +25,11 @@ import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from google.cloud.aiplatform_v1beta1.types import artifact from google.cloud.aiplatform_v1beta1.types import artifact as gca_artifact @@ -42,6 +48,81 @@ from google.longrunning import operations_pb2 # type: ignore from .base import MetadataServiceTransport, DEFAULT_CLIENT_INFO +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.aiplatform.v1beta1.MetadataService", + "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.aiplatform.v1beta1.MetadataService", + "rpcName": client_call_details.method, + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class MetadataServiceGrpcTransport(MetadataServiceTransport): """gRPC backend transport for MetadataService. @@ -196,7 +277,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 @@ -260,7 +346,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 @@ -287,7 +375,7 @@ def create_metadata_store( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_metadata_store" not in self._stubs: - self._stubs["create_metadata_store"] = self.grpc_channel.unary_unary( + self._stubs["create_metadata_store"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.MetadataService/CreateMetadataStore", request_serializer=metadata_service.CreateMetadataStoreRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -315,7 +403,7 @@ def get_metadata_store( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_metadata_store" not in self._stubs: - self._stubs["get_metadata_store"] = self.grpc_channel.unary_unary( + self._stubs["get_metadata_store"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.MetadataService/GetMetadataStore", request_serializer=metadata_service.GetMetadataStoreRequest.serialize, response_deserializer=metadata_store.MetadataStore.deserialize, @@ -344,7 +432,7 @@ def list_metadata_stores( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_metadata_stores" not in self._stubs: - self._stubs["list_metadata_stores"] = self.grpc_channel.unary_unary( + self._stubs["list_metadata_stores"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.MetadataService/ListMetadataStores", request_serializer=metadata_service.ListMetadataStoresRequest.serialize, response_deserializer=metadata_service.ListMetadataStoresResponse.deserialize, @@ -373,7 +461,7 @@ def delete_metadata_store( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_metadata_store" not in self._stubs: - self._stubs["delete_metadata_store"] = self.grpc_channel.unary_unary( + self._stubs["delete_metadata_store"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.MetadataService/DeleteMetadataStore", request_serializer=metadata_service.DeleteMetadataStoreRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -399,7 +487,7 @@ def create_artifact( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_artifact" not in self._stubs: - self._stubs["create_artifact"] = self.grpc_channel.unary_unary( + self._stubs["create_artifact"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.MetadataService/CreateArtifact", request_serializer=metadata_service.CreateArtifactRequest.serialize, response_deserializer=gca_artifact.Artifact.deserialize, @@ -425,7 +513,7 @@ def get_artifact( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_artifact" not in self._stubs: - self._stubs["get_artifact"] = self.grpc_channel.unary_unary( + self._stubs["get_artifact"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.MetadataService/GetArtifact", request_serializer=metadata_service.GetArtifactRequest.serialize, response_deserializer=artifact.Artifact.deserialize, @@ -453,7 +541,7 @@ def list_artifacts( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_artifacts" not in self._stubs: - self._stubs["list_artifacts"] = self.grpc_channel.unary_unary( + self._stubs["list_artifacts"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.MetadataService/ListArtifacts", request_serializer=metadata_service.ListArtifactsRequest.serialize, response_deserializer=metadata_service.ListArtifactsResponse.deserialize, @@ -479,7 +567,7 @@ def update_artifact( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_artifact" not in self._stubs: - self._stubs["update_artifact"] = self.grpc_channel.unary_unary( + self._stubs["update_artifact"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.MetadataService/UpdateArtifact", request_serializer=metadata_service.UpdateArtifactRequest.serialize, response_deserializer=gca_artifact.Artifact.deserialize, @@ -505,7 +593,7 @@ def delete_artifact( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_artifact" not in self._stubs: - self._stubs["delete_artifact"] = self.grpc_channel.unary_unary( + self._stubs["delete_artifact"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.MetadataService/DeleteArtifact", request_serializer=metadata_service.DeleteArtifactRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -531,7 +619,7 @@ def purge_artifacts( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "purge_artifacts" not in self._stubs: - self._stubs["purge_artifacts"] = self.grpc_channel.unary_unary( + self._stubs["purge_artifacts"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.MetadataService/PurgeArtifacts", request_serializer=metadata_service.PurgeArtifactsRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -557,7 +645,7 @@ def create_context( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_context" not in self._stubs: - self._stubs["create_context"] = self.grpc_channel.unary_unary( + self._stubs["create_context"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.MetadataService/CreateContext", request_serializer=metadata_service.CreateContextRequest.serialize, response_deserializer=gca_context.Context.deserialize, @@ -583,7 +671,7 @@ def get_context( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_context" not in self._stubs: - self._stubs["get_context"] = self.grpc_channel.unary_unary( + self._stubs["get_context"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.MetadataService/GetContext", request_serializer=metadata_service.GetContextRequest.serialize, response_deserializer=context.Context.deserialize, @@ -611,7 +699,7 @@ def list_contexts( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_contexts" not in self._stubs: - self._stubs["list_contexts"] = self.grpc_channel.unary_unary( + self._stubs["list_contexts"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.MetadataService/ListContexts", request_serializer=metadata_service.ListContextsRequest.serialize, response_deserializer=metadata_service.ListContextsResponse.deserialize, @@ -637,7 +725,7 @@ def update_context( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_context" not in self._stubs: - self._stubs["update_context"] = self.grpc_channel.unary_unary( + self._stubs["update_context"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.MetadataService/UpdateContext", request_serializer=metadata_service.UpdateContextRequest.serialize, response_deserializer=gca_context.Context.deserialize, @@ -663,7 +751,7 @@ def delete_context( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_context" not in self._stubs: - self._stubs["delete_context"] = self.grpc_channel.unary_unary( + self._stubs["delete_context"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.MetadataService/DeleteContext", request_serializer=metadata_service.DeleteContextRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -689,7 +777,7 @@ def purge_contexts( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "purge_contexts" not in self._stubs: - self._stubs["purge_contexts"] = self.grpc_channel.unary_unary( + self._stubs["purge_contexts"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.MetadataService/PurgeContexts", request_serializer=metadata_service.PurgeContextsRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -723,7 +811,7 @@ def add_context_artifacts_and_executions( if "add_context_artifacts_and_executions" not in self._stubs: self._stubs[ "add_context_artifacts_and_executions" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.MetadataService/AddContextArtifactsAndExecutions", request_serializer=metadata_service.AddContextArtifactsAndExecutionsRequest.serialize, response_deserializer=metadata_service.AddContextArtifactsAndExecutionsResponse.deserialize, @@ -756,7 +844,7 @@ def add_context_children( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "add_context_children" not in self._stubs: - self._stubs["add_context_children"] = self.grpc_channel.unary_unary( + self._stubs["add_context_children"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.MetadataService/AddContextChildren", request_serializer=metadata_service.AddContextChildrenRequest.serialize, response_deserializer=metadata_service.AddContextChildrenResponse.deserialize, @@ -787,7 +875,7 @@ def remove_context_children( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "remove_context_children" not in self._stubs: - self._stubs["remove_context_children"] = self.grpc_channel.unary_unary( + self._stubs["remove_context_children"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.MetadataService/RemoveContextChildren", request_serializer=metadata_service.RemoveContextChildrenRequest.serialize, response_deserializer=metadata_service.RemoveContextChildrenResponse.deserialize, @@ -820,7 +908,7 @@ def query_context_lineage_subgraph( if "query_context_lineage_subgraph" not in self._stubs: self._stubs[ "query_context_lineage_subgraph" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.MetadataService/QueryContextLineageSubgraph", request_serializer=metadata_service.QueryContextLineageSubgraphRequest.serialize, response_deserializer=lineage_subgraph.LineageSubgraph.deserialize, @@ -846,7 +934,7 @@ def create_execution( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_execution" not in self._stubs: - self._stubs["create_execution"] = self.grpc_channel.unary_unary( + self._stubs["create_execution"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.MetadataService/CreateExecution", request_serializer=metadata_service.CreateExecutionRequest.serialize, response_deserializer=gca_execution.Execution.deserialize, @@ -872,7 +960,7 @@ def get_execution( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_execution" not in self._stubs: - self._stubs["get_execution"] = self.grpc_channel.unary_unary( + self._stubs["get_execution"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.MetadataService/GetExecution", request_serializer=metadata_service.GetExecutionRequest.serialize, response_deserializer=execution.Execution.deserialize, @@ -901,7 +989,7 @@ def list_executions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_executions" not in self._stubs: - self._stubs["list_executions"] = self.grpc_channel.unary_unary( + self._stubs["list_executions"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.MetadataService/ListExecutions", request_serializer=metadata_service.ListExecutionsRequest.serialize, response_deserializer=metadata_service.ListExecutionsResponse.deserialize, @@ -927,7 +1015,7 @@ def update_execution( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_execution" not in self._stubs: - self._stubs["update_execution"] = self.grpc_channel.unary_unary( + self._stubs["update_execution"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.MetadataService/UpdateExecution", request_serializer=metadata_service.UpdateExecutionRequest.serialize, response_deserializer=gca_execution.Execution.deserialize, @@ -953,7 +1041,7 @@ def delete_execution( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_execution" not in self._stubs: - self._stubs["delete_execution"] = self.grpc_channel.unary_unary( + self._stubs["delete_execution"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.MetadataService/DeleteExecution", request_serializer=metadata_service.DeleteExecutionRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -979,7 +1067,7 @@ def purge_executions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "purge_executions" not in self._stubs: - self._stubs["purge_executions"] = self.grpc_channel.unary_unary( + self._stubs["purge_executions"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.MetadataService/PurgeExecutions", request_serializer=metadata_service.PurgeExecutionsRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -1012,7 +1100,7 @@ def add_execution_events( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "add_execution_events" not in self._stubs: - self._stubs["add_execution_events"] = self.grpc_channel.unary_unary( + self._stubs["add_execution_events"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.MetadataService/AddExecutionEvents", request_serializer=metadata_service.AddExecutionEventsRequest.serialize, response_deserializer=metadata_service.AddExecutionEventsResponse.deserialize, @@ -1046,7 +1134,7 @@ def query_execution_inputs_and_outputs( if "query_execution_inputs_and_outputs" not in self._stubs: self._stubs[ "query_execution_inputs_and_outputs" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.MetadataService/QueryExecutionInputsAndOutputs", request_serializer=metadata_service.QueryExecutionInputsAndOutputsRequest.serialize, response_deserializer=lineage_subgraph.LineageSubgraph.deserialize, @@ -1075,7 +1163,7 @@ def create_metadata_schema( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_metadata_schema" not in self._stubs: - self._stubs["create_metadata_schema"] = self.grpc_channel.unary_unary( + self._stubs["create_metadata_schema"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.MetadataService/CreateMetadataSchema", request_serializer=metadata_service.CreateMetadataSchemaRequest.serialize, response_deserializer=gca_metadata_schema.MetadataSchema.deserialize, @@ -1103,7 +1191,7 @@ def get_metadata_schema( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_metadata_schema" not in self._stubs: - self._stubs["get_metadata_schema"] = self.grpc_channel.unary_unary( + self._stubs["get_metadata_schema"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.MetadataService/GetMetadataSchema", request_serializer=metadata_service.GetMetadataSchemaRequest.serialize, response_deserializer=metadata_schema.MetadataSchema.deserialize, @@ -1132,7 +1220,7 @@ def list_metadata_schemas( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_metadata_schemas" not in self._stubs: - self._stubs["list_metadata_schemas"] = self.grpc_channel.unary_unary( + self._stubs["list_metadata_schemas"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.MetadataService/ListMetadataSchemas", request_serializer=metadata_service.ListMetadataSchemasRequest.serialize, response_deserializer=metadata_service.ListMetadataSchemasResponse.deserialize, @@ -1166,7 +1254,7 @@ def query_artifact_lineage_subgraph( if "query_artifact_lineage_subgraph" not in self._stubs: self._stubs[ "query_artifact_lineage_subgraph" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.MetadataService/QueryArtifactLineageSubgraph", request_serializer=metadata_service.QueryArtifactLineageSubgraphRequest.serialize, response_deserializer=lineage_subgraph.LineageSubgraph.deserialize, @@ -1174,7 +1262,7 @@ def query_artifact_lineage_subgraph( return self._stubs["query_artifact_lineage_subgraph"] def close(self): - self.grpc_channel.close() + self._logged_channel.close() @property def delete_operation( @@ -1186,7 +1274,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, @@ -1203,7 +1291,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -1220,7 +1308,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -1237,7 +1325,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, @@ -1256,7 +1344,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, @@ -1275,7 +1363,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -1292,7 +1380,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -1317,7 +1405,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -1343,7 +1431,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -1372,7 +1460,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1beta1/services/metadata_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1beta1/services/metadata_service/transports/grpc_asyncio.py index 3ed53c1f0c..350f681032 100644 --- a/google/cloud/aiplatform_v1beta1/services/metadata_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/metadata_service/transports/grpc_asyncio.py @@ -14,6 +14,9 @@ # limitations under the License. # import inspect +import json +import pickle +import logging as std_logging import warnings from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union @@ -24,8 +27,11 @@ from google.api_core import operations_v1 from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from grpc.experimental import aio # type: ignore from google.cloud.aiplatform_v1beta1.types import artifact @@ -46,6 +52,82 @@ from .base import MetadataServiceTransport, DEFAULT_CLIENT_INFO from .grpc import MetadataServiceGrpcTransport +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.aiplatform.v1beta1.MetadataService", + "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.aiplatform.v1beta1.MetadataService", + "rpcName": str(client_call_details.method), + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class MetadataServiceGrpcAsyncIOTransport(MetadataServiceTransport): """gRPC AsyncIO backend transport for MetadataService. @@ -243,10 +325,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 @@ -269,7 +354,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. @@ -298,7 +383,7 @@ def create_metadata_store( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_metadata_store" not in self._stubs: - self._stubs["create_metadata_store"] = self.grpc_channel.unary_unary( + self._stubs["create_metadata_store"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.MetadataService/CreateMetadataStore", request_serializer=metadata_service.CreateMetadataStoreRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -327,7 +412,7 @@ def get_metadata_store( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_metadata_store" not in self._stubs: - self._stubs["get_metadata_store"] = self.grpc_channel.unary_unary( + self._stubs["get_metadata_store"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.MetadataService/GetMetadataStore", request_serializer=metadata_service.GetMetadataStoreRequest.serialize, response_deserializer=metadata_store.MetadataStore.deserialize, @@ -356,7 +441,7 @@ def list_metadata_stores( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_metadata_stores" not in self._stubs: - self._stubs["list_metadata_stores"] = self.grpc_channel.unary_unary( + self._stubs["list_metadata_stores"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.MetadataService/ListMetadataStores", request_serializer=metadata_service.ListMetadataStoresRequest.serialize, response_deserializer=metadata_service.ListMetadataStoresResponse.deserialize, @@ -386,7 +471,7 @@ def delete_metadata_store( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_metadata_store" not in self._stubs: - self._stubs["delete_metadata_store"] = self.grpc_channel.unary_unary( + self._stubs["delete_metadata_store"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.MetadataService/DeleteMetadataStore", request_serializer=metadata_service.DeleteMetadataStoreRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -414,7 +499,7 @@ def create_artifact( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_artifact" not in self._stubs: - self._stubs["create_artifact"] = self.grpc_channel.unary_unary( + self._stubs["create_artifact"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.MetadataService/CreateArtifact", request_serializer=metadata_service.CreateArtifactRequest.serialize, response_deserializer=gca_artifact.Artifact.deserialize, @@ -440,7 +525,7 @@ def get_artifact( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_artifact" not in self._stubs: - self._stubs["get_artifact"] = self.grpc_channel.unary_unary( + self._stubs["get_artifact"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.MetadataService/GetArtifact", request_serializer=metadata_service.GetArtifactRequest.serialize, response_deserializer=artifact.Artifact.deserialize, @@ -469,7 +554,7 @@ def list_artifacts( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_artifacts" not in self._stubs: - self._stubs["list_artifacts"] = self.grpc_channel.unary_unary( + self._stubs["list_artifacts"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.MetadataService/ListArtifacts", request_serializer=metadata_service.ListArtifactsRequest.serialize, response_deserializer=metadata_service.ListArtifactsResponse.deserialize, @@ -497,7 +582,7 @@ def update_artifact( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_artifact" not in self._stubs: - self._stubs["update_artifact"] = self.grpc_channel.unary_unary( + self._stubs["update_artifact"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.MetadataService/UpdateArtifact", request_serializer=metadata_service.UpdateArtifactRequest.serialize, response_deserializer=gca_artifact.Artifact.deserialize, @@ -525,7 +610,7 @@ def delete_artifact( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_artifact" not in self._stubs: - self._stubs["delete_artifact"] = self.grpc_channel.unary_unary( + self._stubs["delete_artifact"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.MetadataService/DeleteArtifact", request_serializer=metadata_service.DeleteArtifactRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -553,7 +638,7 @@ def purge_artifacts( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "purge_artifacts" not in self._stubs: - self._stubs["purge_artifacts"] = self.grpc_channel.unary_unary( + self._stubs["purge_artifacts"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.MetadataService/PurgeArtifacts", request_serializer=metadata_service.PurgeArtifactsRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -581,7 +666,7 @@ def create_context( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_context" not in self._stubs: - self._stubs["create_context"] = self.grpc_channel.unary_unary( + self._stubs["create_context"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.MetadataService/CreateContext", request_serializer=metadata_service.CreateContextRequest.serialize, response_deserializer=gca_context.Context.deserialize, @@ -607,7 +692,7 @@ def get_context( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_context" not in self._stubs: - self._stubs["get_context"] = self.grpc_channel.unary_unary( + self._stubs["get_context"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.MetadataService/GetContext", request_serializer=metadata_service.GetContextRequest.serialize, response_deserializer=context.Context.deserialize, @@ -636,7 +721,7 @@ def list_contexts( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_contexts" not in self._stubs: - self._stubs["list_contexts"] = self.grpc_channel.unary_unary( + self._stubs["list_contexts"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.MetadataService/ListContexts", request_serializer=metadata_service.ListContextsRequest.serialize, response_deserializer=metadata_service.ListContextsResponse.deserialize, @@ -664,7 +749,7 @@ def update_context( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_context" not in self._stubs: - self._stubs["update_context"] = self.grpc_channel.unary_unary( + self._stubs["update_context"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.MetadataService/UpdateContext", request_serializer=metadata_service.UpdateContextRequest.serialize, response_deserializer=gca_context.Context.deserialize, @@ -692,7 +777,7 @@ def delete_context( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_context" not in self._stubs: - self._stubs["delete_context"] = self.grpc_channel.unary_unary( + self._stubs["delete_context"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.MetadataService/DeleteContext", request_serializer=metadata_service.DeleteContextRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -720,7 +805,7 @@ def purge_contexts( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "purge_contexts" not in self._stubs: - self._stubs["purge_contexts"] = self.grpc_channel.unary_unary( + self._stubs["purge_contexts"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.MetadataService/PurgeContexts", request_serializer=metadata_service.PurgeContextsRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -754,7 +839,7 @@ def add_context_artifacts_and_executions( if "add_context_artifacts_and_executions" not in self._stubs: self._stubs[ "add_context_artifacts_and_executions" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.MetadataService/AddContextArtifactsAndExecutions", request_serializer=metadata_service.AddContextArtifactsAndExecutionsRequest.serialize, response_deserializer=metadata_service.AddContextArtifactsAndExecutionsResponse.deserialize, @@ -787,7 +872,7 @@ def add_context_children( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "add_context_children" not in self._stubs: - self._stubs["add_context_children"] = self.grpc_channel.unary_unary( + self._stubs["add_context_children"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.MetadataService/AddContextChildren", request_serializer=metadata_service.AddContextChildrenRequest.serialize, response_deserializer=metadata_service.AddContextChildrenResponse.deserialize, @@ -818,7 +903,7 @@ def remove_context_children( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "remove_context_children" not in self._stubs: - self._stubs["remove_context_children"] = self.grpc_channel.unary_unary( + self._stubs["remove_context_children"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.MetadataService/RemoveContextChildren", request_serializer=metadata_service.RemoveContextChildrenRequest.serialize, response_deserializer=metadata_service.RemoveContextChildrenResponse.deserialize, @@ -851,7 +936,7 @@ def query_context_lineage_subgraph( if "query_context_lineage_subgraph" not in self._stubs: self._stubs[ "query_context_lineage_subgraph" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.MetadataService/QueryContextLineageSubgraph", request_serializer=metadata_service.QueryContextLineageSubgraphRequest.serialize, response_deserializer=lineage_subgraph.LineageSubgraph.deserialize, @@ -879,7 +964,7 @@ def create_execution( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_execution" not in self._stubs: - self._stubs["create_execution"] = self.grpc_channel.unary_unary( + self._stubs["create_execution"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.MetadataService/CreateExecution", request_serializer=metadata_service.CreateExecutionRequest.serialize, response_deserializer=gca_execution.Execution.deserialize, @@ -907,7 +992,7 @@ def get_execution( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_execution" not in self._stubs: - self._stubs["get_execution"] = self.grpc_channel.unary_unary( + self._stubs["get_execution"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.MetadataService/GetExecution", request_serializer=metadata_service.GetExecutionRequest.serialize, response_deserializer=execution.Execution.deserialize, @@ -936,7 +1021,7 @@ def list_executions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_executions" not in self._stubs: - self._stubs["list_executions"] = self.grpc_channel.unary_unary( + self._stubs["list_executions"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.MetadataService/ListExecutions", request_serializer=metadata_service.ListExecutionsRequest.serialize, response_deserializer=metadata_service.ListExecutionsResponse.deserialize, @@ -964,7 +1049,7 @@ def update_execution( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_execution" not in self._stubs: - self._stubs["update_execution"] = self.grpc_channel.unary_unary( + self._stubs["update_execution"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.MetadataService/UpdateExecution", request_serializer=metadata_service.UpdateExecutionRequest.serialize, response_deserializer=gca_execution.Execution.deserialize, @@ -992,7 +1077,7 @@ def delete_execution( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_execution" not in self._stubs: - self._stubs["delete_execution"] = self.grpc_channel.unary_unary( + self._stubs["delete_execution"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.MetadataService/DeleteExecution", request_serializer=metadata_service.DeleteExecutionRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -1020,7 +1105,7 @@ def purge_executions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "purge_executions" not in self._stubs: - self._stubs["purge_executions"] = self.grpc_channel.unary_unary( + self._stubs["purge_executions"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.MetadataService/PurgeExecutions", request_serializer=metadata_service.PurgeExecutionsRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -1053,7 +1138,7 @@ def add_execution_events( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "add_execution_events" not in self._stubs: - self._stubs["add_execution_events"] = self.grpc_channel.unary_unary( + self._stubs["add_execution_events"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.MetadataService/AddExecutionEvents", request_serializer=metadata_service.AddExecutionEventsRequest.serialize, response_deserializer=metadata_service.AddExecutionEventsResponse.deserialize, @@ -1087,7 +1172,7 @@ def query_execution_inputs_and_outputs( if "query_execution_inputs_and_outputs" not in self._stubs: self._stubs[ "query_execution_inputs_and_outputs" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.MetadataService/QueryExecutionInputsAndOutputs", request_serializer=metadata_service.QueryExecutionInputsAndOutputsRequest.serialize, response_deserializer=lineage_subgraph.LineageSubgraph.deserialize, @@ -1116,7 +1201,7 @@ def create_metadata_schema( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_metadata_schema" not in self._stubs: - self._stubs["create_metadata_schema"] = self.grpc_channel.unary_unary( + self._stubs["create_metadata_schema"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.MetadataService/CreateMetadataSchema", request_serializer=metadata_service.CreateMetadataSchemaRequest.serialize, response_deserializer=gca_metadata_schema.MetadataSchema.deserialize, @@ -1145,7 +1230,7 @@ def get_metadata_schema( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_metadata_schema" not in self._stubs: - self._stubs["get_metadata_schema"] = self.grpc_channel.unary_unary( + self._stubs["get_metadata_schema"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.MetadataService/GetMetadataSchema", request_serializer=metadata_service.GetMetadataSchemaRequest.serialize, response_deserializer=metadata_schema.MetadataSchema.deserialize, @@ -1174,7 +1259,7 @@ def list_metadata_schemas( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_metadata_schemas" not in self._stubs: - self._stubs["list_metadata_schemas"] = self.grpc_channel.unary_unary( + self._stubs["list_metadata_schemas"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.MetadataService/ListMetadataSchemas", request_serializer=metadata_service.ListMetadataSchemasRequest.serialize, response_deserializer=metadata_service.ListMetadataSchemasResponse.deserialize, @@ -1208,7 +1293,7 @@ def query_artifact_lineage_subgraph( if "query_artifact_lineage_subgraph" not in self._stubs: self._stubs[ "query_artifact_lineage_subgraph" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.MetadataService/QueryArtifactLineageSubgraph", request_serializer=metadata_service.QueryArtifactLineageSubgraphRequest.serialize, response_deserializer=lineage_subgraph.LineageSubgraph.deserialize, @@ -1436,7 +1521,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: @@ -1452,7 +1537,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, @@ -1469,7 +1554,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -1486,7 +1571,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -1503,7 +1588,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, @@ -1522,7 +1607,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, @@ -1541,7 +1626,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -1558,7 +1643,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -1583,7 +1668,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -1609,7 +1694,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -1638,7 +1723,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1beta1/services/metadata_service/transports/rest.py b/google/cloud/aiplatform_v1beta1/services/metadata_service/transports/rest.py index ab7cf682d3..22f073ffba 100644 --- a/google/cloud/aiplatform_v1beta1/services/metadata_service/transports/rest.py +++ b/google/cloud/aiplatform_v1beta1/services/metadata_service/transports/rest.py @@ -13,9 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging +import json # type: ignore from google.auth.transport.requests import AuthorizedSession # type: ignore -import json # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.api_core import exceptions as core_exceptions from google.api_core import retry as retries @@ -57,6 +58,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, @@ -345,10 +354,10 @@ def post_update_execution(self, response): def pre_add_context_artifacts_and_executions( self, request: metadata_service.AddContextArtifactsAndExecutionsRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ metadata_service.AddContextArtifactsAndExecutionsRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for add_context_artifacts_and_executions @@ -371,8 +380,11 @@ def post_add_context_artifacts_and_executions( def pre_add_context_children( self, request: metadata_service.AddContextChildrenRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[metadata_service.AddContextChildrenRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + metadata_service.AddContextChildrenRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for add_context_children Override in a subclass to manipulate the request or metadata @@ -394,8 +406,11 @@ def post_add_context_children( def pre_add_execution_events( self, request: metadata_service.AddExecutionEventsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[metadata_service.AddExecutionEventsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + metadata_service.AddExecutionEventsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for add_execution_events Override in a subclass to manipulate the request or metadata @@ -417,8 +432,10 @@ def post_add_execution_events( def pre_create_artifact( self, request: metadata_service.CreateArtifactRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[metadata_service.CreateArtifactRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + metadata_service.CreateArtifactRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for create_artifact Override in a subclass to manipulate the request or metadata @@ -440,8 +457,10 @@ def post_create_artifact( def pre_create_context( self, request: metadata_service.CreateContextRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[metadata_service.CreateContextRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + metadata_service.CreateContextRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for create_context Override in a subclass to manipulate the request or metadata @@ -461,8 +480,10 @@ def post_create_context(self, response: gca_context.Context) -> gca_context.Cont def pre_create_execution( self, request: metadata_service.CreateExecutionRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[metadata_service.CreateExecutionRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + metadata_service.CreateExecutionRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for create_execution Override in a subclass to manipulate the request or metadata @@ -484,8 +505,11 @@ def post_create_execution( def pre_create_metadata_schema( self, request: metadata_service.CreateMetadataSchemaRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[metadata_service.CreateMetadataSchemaRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + metadata_service.CreateMetadataSchemaRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for create_metadata_schema Override in a subclass to manipulate the request or metadata @@ -507,8 +531,11 @@ def post_create_metadata_schema( def pre_create_metadata_store( self, request: metadata_service.CreateMetadataStoreRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[metadata_service.CreateMetadataStoreRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + metadata_service.CreateMetadataStoreRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for create_metadata_store Override in a subclass to manipulate the request or metadata @@ -530,8 +557,10 @@ def post_create_metadata_store( def pre_delete_artifact( self, request: metadata_service.DeleteArtifactRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[metadata_service.DeleteArtifactRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + metadata_service.DeleteArtifactRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for delete_artifact Override in a subclass to manipulate the request or metadata @@ -553,8 +582,10 @@ def post_delete_artifact( def pre_delete_context( self, request: metadata_service.DeleteContextRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[metadata_service.DeleteContextRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + metadata_service.DeleteContextRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for delete_context Override in a subclass to manipulate the request or metadata @@ -576,8 +607,10 @@ def post_delete_context( def pre_delete_execution( self, request: metadata_service.DeleteExecutionRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[metadata_service.DeleteExecutionRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + metadata_service.DeleteExecutionRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for delete_execution Override in a subclass to manipulate the request or metadata @@ -599,8 +632,11 @@ def post_delete_execution( def pre_delete_metadata_store( self, request: metadata_service.DeleteMetadataStoreRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[metadata_service.DeleteMetadataStoreRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + metadata_service.DeleteMetadataStoreRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for delete_metadata_store Override in a subclass to manipulate the request or metadata @@ -622,8 +658,10 @@ def post_delete_metadata_store( def pre_get_artifact( self, request: metadata_service.GetArtifactRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[metadata_service.GetArtifactRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + metadata_service.GetArtifactRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_artifact Override in a subclass to manipulate the request or metadata @@ -643,8 +681,10 @@ def post_get_artifact(self, response: artifact.Artifact) -> artifact.Artifact: def pre_get_context( self, request: metadata_service.GetContextRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[metadata_service.GetContextRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + metadata_service.GetContextRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_context Override in a subclass to manipulate the request or metadata @@ -664,8 +704,10 @@ def post_get_context(self, response: context.Context) -> context.Context: def pre_get_execution( self, request: metadata_service.GetExecutionRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[metadata_service.GetExecutionRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + metadata_service.GetExecutionRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_execution Override in a subclass to manipulate the request or metadata @@ -685,8 +727,11 @@ def post_get_execution(self, response: execution.Execution) -> execution.Executi def pre_get_metadata_schema( self, request: metadata_service.GetMetadataSchemaRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[metadata_service.GetMetadataSchemaRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + metadata_service.GetMetadataSchemaRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for get_metadata_schema Override in a subclass to manipulate the request or metadata @@ -708,8 +753,11 @@ def post_get_metadata_schema( def pre_get_metadata_store( self, request: metadata_service.GetMetadataStoreRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[metadata_service.GetMetadataStoreRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + metadata_service.GetMetadataStoreRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for get_metadata_store Override in a subclass to manipulate the request or metadata @@ -731,8 +779,10 @@ def post_get_metadata_store( def pre_list_artifacts( self, request: metadata_service.ListArtifactsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[metadata_service.ListArtifactsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + metadata_service.ListArtifactsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_artifacts Override in a subclass to manipulate the request or metadata @@ -754,8 +804,10 @@ def post_list_artifacts( def pre_list_contexts( self, request: metadata_service.ListContextsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[metadata_service.ListContextsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + metadata_service.ListContextsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_contexts Override in a subclass to manipulate the request or metadata @@ -777,8 +829,10 @@ def post_list_contexts( def pre_list_executions( self, request: metadata_service.ListExecutionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[metadata_service.ListExecutionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + metadata_service.ListExecutionsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_executions Override in a subclass to manipulate the request or metadata @@ -800,8 +854,11 @@ def post_list_executions( def pre_list_metadata_schemas( self, request: metadata_service.ListMetadataSchemasRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[metadata_service.ListMetadataSchemasRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + metadata_service.ListMetadataSchemasRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for list_metadata_schemas Override in a subclass to manipulate the request or metadata @@ -823,8 +880,11 @@ def post_list_metadata_schemas( def pre_list_metadata_stores( self, request: metadata_service.ListMetadataStoresRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[metadata_service.ListMetadataStoresRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + metadata_service.ListMetadataStoresRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for list_metadata_stores Override in a subclass to manipulate the request or metadata @@ -846,8 +906,10 @@ def post_list_metadata_stores( def pre_purge_artifacts( self, request: metadata_service.PurgeArtifactsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[metadata_service.PurgeArtifactsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + metadata_service.PurgeArtifactsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for purge_artifacts Override in a subclass to manipulate the request or metadata @@ -869,8 +931,10 @@ def post_purge_artifacts( def pre_purge_contexts( self, request: metadata_service.PurgeContextsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[metadata_service.PurgeContextsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + metadata_service.PurgeContextsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for purge_contexts Override in a subclass to manipulate the request or metadata @@ -892,8 +956,10 @@ def post_purge_contexts( def pre_purge_executions( self, request: metadata_service.PurgeExecutionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[metadata_service.PurgeExecutionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + metadata_service.PurgeExecutionsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for purge_executions Override in a subclass to manipulate the request or metadata @@ -915,9 +981,10 @@ def post_purge_executions( def pre_query_artifact_lineage_subgraph( self, request: metadata_service.QueryArtifactLineageSubgraphRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - metadata_service.QueryArtifactLineageSubgraphRequest, Sequence[Tuple[str, str]] + metadata_service.QueryArtifactLineageSubgraphRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for query_artifact_lineage_subgraph @@ -940,9 +1007,10 @@ def post_query_artifact_lineage_subgraph( def pre_query_context_lineage_subgraph( self, request: metadata_service.QueryContextLineageSubgraphRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - metadata_service.QueryContextLineageSubgraphRequest, Sequence[Tuple[str, str]] + metadata_service.QueryContextLineageSubgraphRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for query_context_lineage_subgraph @@ -965,10 +1033,10 @@ def post_query_context_lineage_subgraph( def pre_query_execution_inputs_and_outputs( self, request: metadata_service.QueryExecutionInputsAndOutputsRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ metadata_service.QueryExecutionInputsAndOutputsRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for query_execution_inputs_and_outputs @@ -991,9 +1059,10 @@ def post_query_execution_inputs_and_outputs( def pre_remove_context_children( self, request: metadata_service.RemoveContextChildrenRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - metadata_service.RemoveContextChildrenRequest, Sequence[Tuple[str, str]] + metadata_service.RemoveContextChildrenRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for remove_context_children @@ -1016,8 +1085,10 @@ def post_remove_context_children( def pre_update_artifact( self, request: metadata_service.UpdateArtifactRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[metadata_service.UpdateArtifactRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + metadata_service.UpdateArtifactRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for update_artifact Override in a subclass to manipulate the request or metadata @@ -1039,8 +1110,10 @@ def post_update_artifact( def pre_update_context( self, request: metadata_service.UpdateContextRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[metadata_service.UpdateContextRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + metadata_service.UpdateContextRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for update_context Override in a subclass to manipulate the request or metadata @@ -1060,8 +1133,10 @@ def post_update_context(self, response: gca_context.Context) -> gca_context.Cont def pre_update_execution( self, request: metadata_service.UpdateExecutionRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[metadata_service.UpdateExecutionRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + metadata_service.UpdateExecutionRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for update_execution Override in a subclass to manipulate the request or metadata @@ -1083,8 +1158,10 @@ def post_update_execution( def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -1106,8 +1183,10 @@ def post_get_location( def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -1129,8 +1208,10 @@ def post_list_locations( def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -1150,8 +1231,10 @@ def post_get_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -1171,8 +1254,11 @@ def post_set_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -1194,8 +1280,10 @@ def post_test_iam_permissions( def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -1215,8 +1303,10 @@ def post_cancel_operation(self, response: None) -> None: 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 @@ -1236,8 +1326,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 @@ -1259,8 +1351,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 @@ -1282,8 +1376,10 @@ def post_list_operations( def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -1963,6 +2059,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -2179,6 +2279,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -2385,6 +2489,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}", @@ -2601,6 +2709,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, ], "google.longrunning.Operations.ListOperations": [ { @@ -2799,6 +2911,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*}/operations", @@ -3015,6 +3131,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*}/operations", + }, ], "google.longrunning.Operations.WaitOperation": [ { @@ -3213,6 +3333,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "post", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}:wait", @@ -3425,6 +3549,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, ], } @@ -3481,7 +3609,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]]] = (), ) -> metadata_service.AddContextArtifactsAndExecutionsResponse: r"""Call the add context artifacts and executions method over HTTP. @@ -3493,8 +3621,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: ~.metadata_service.AddContextArtifactsAndExecutionsResponse: @@ -3506,6 +3636,7 @@ def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseAddContextArtifactsAndExecutions._get_http_options() ) + ( request, metadata, @@ -3525,6 +3656,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.aiplatform_v1beta1.MetadataServiceClient.AddContextArtifactsAndExecutions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "AddContextArtifactsAndExecutions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MetadataServiceRestTransport._AddContextArtifactsAndExecutions._get_response( self._host, @@ -3546,7 +3704,31 @@ def __call__( pb_resp = metadata_service.AddContextArtifactsAndExecutionsResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_add_context_artifacts_and_executions(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = metadata_service.AddContextArtifactsAndExecutionsResponse.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.aiplatform_v1beta1.MetadataServiceClient.add_context_artifacts_and_executions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "AddContextArtifactsAndExecutions", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _AddContextChildren( @@ -3586,7 +3768,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]]] = (), ) -> metadata_service.AddContextChildrenResponse: r"""Call the add context children method over HTTP. @@ -3597,8 +3779,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: ~.metadata_service.AddContextChildrenResponse: @@ -3610,6 +3794,7 @@ def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseAddContextChildren._get_http_options() ) + request, metadata = self._interceptor.pre_add_context_children( request, metadata ) @@ -3626,6 +3811,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.aiplatform_v1beta1.MetadataServiceClient.AddContextChildren", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "AddContextChildren", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MetadataServiceRestTransport._AddContextChildren._get_response( self._host, @@ -3647,7 +3859,31 @@ def __call__( pb_resp = metadata_service.AddContextChildrenResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_add_context_children(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + metadata_service.AddContextChildrenResponse.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.aiplatform_v1beta1.MetadataServiceClient.add_context_children", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "AddContextChildren", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _AddExecutionEvents( @@ -3687,7 +3923,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]]] = (), ) -> metadata_service.AddExecutionEventsResponse: r"""Call the add execution events method over HTTP. @@ -3698,8 +3934,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: ~.metadata_service.AddExecutionEventsResponse: @@ -3711,6 +3949,7 @@ def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseAddExecutionEvents._get_http_options() ) + request, metadata = self._interceptor.pre_add_execution_events( request, metadata ) @@ -3727,6 +3966,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.aiplatform_v1beta1.MetadataServiceClient.AddExecutionEvents", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "AddExecutionEvents", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MetadataServiceRestTransport._AddExecutionEvents._get_response( self._host, @@ -3748,7 +4014,31 @@ def __call__( pb_resp = metadata_service.AddExecutionEventsResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_add_execution_events(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + metadata_service.AddExecutionEventsResponse.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.aiplatform_v1beta1.MetadataServiceClient.add_execution_events", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "AddExecutionEvents", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _CreateArtifact( @@ -3787,7 +4077,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]]] = (), ) -> gca_artifact.Artifact: r"""Call the create artifact method over HTTP. @@ -3798,8 +4088,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: ~.gca_artifact.Artifact: @@ -3809,6 +4101,7 @@ def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseCreateArtifact._get_http_options() ) + request, metadata = self._interceptor.pre_create_artifact(request, metadata) transcoded_request = _BaseMetadataServiceRestTransport._BaseCreateArtifact._get_transcoded_request( http_options, request @@ -3823,6 +4116,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.aiplatform_v1beta1.MetadataServiceClient.CreateArtifact", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "CreateArtifact", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MetadataServiceRestTransport._CreateArtifact._get_response( self._host, @@ -3844,7 +4164,29 @@ def __call__( pb_resp = gca_artifact.Artifact.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_create_artifact(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gca_artifact.Artifact.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.aiplatform_v1beta1.MetadataServiceClient.create_artifact", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "CreateArtifact", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _CreateContext( @@ -3883,7 +4225,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]]] = (), ) -> gca_context.Context: r"""Call the create context method over HTTP. @@ -3894,8 +4236,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: ~.gca_context.Context: @@ -3905,6 +4249,7 @@ def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseCreateContext._get_http_options() ) + request, metadata = self._interceptor.pre_create_context(request, metadata) transcoded_request = _BaseMetadataServiceRestTransport._BaseCreateContext._get_transcoded_request( http_options, request @@ -3919,6 +4264,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.aiplatform_v1beta1.MetadataServiceClient.CreateContext", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "CreateContext", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MetadataServiceRestTransport._CreateContext._get_response( self._host, @@ -3940,7 +4312,29 @@ def __call__( pb_resp = gca_context.Context.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_create_context(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gca_context.Context.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.aiplatform_v1beta1.MetadataServiceClient.create_context", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "CreateContext", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _CreateExecution( @@ -3979,7 +4373,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]]] = (), ) -> gca_execution.Execution: r"""Call the create execution method over HTTP. @@ -3990,8 +4384,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: ~.gca_execution.Execution: @@ -4001,6 +4397,7 @@ def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseCreateExecution._get_http_options() ) + request, metadata = self._interceptor.pre_create_execution( request, metadata ) @@ -4017,6 +4414,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.aiplatform_v1beta1.MetadataServiceClient.CreateExecution", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "CreateExecution", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MetadataServiceRestTransport._CreateExecution._get_response( self._host, @@ -4038,7 +4462,29 @@ def __call__( pb_resp = gca_execution.Execution.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_create_execution(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gca_execution.Execution.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.aiplatform_v1beta1.MetadataServiceClient.create_execution", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "CreateExecution", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _CreateMetadataSchema( @@ -4078,7 +4524,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]]] = (), ) -> gca_metadata_schema.MetadataSchema: r"""Call the create metadata schema method over HTTP. @@ -4089,8 +4535,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: ~.gca_metadata_schema.MetadataSchema: @@ -4100,6 +4548,7 @@ def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseCreateMetadataSchema._get_http_options() ) + request, metadata = self._interceptor.pre_create_metadata_schema( request, metadata ) @@ -4116,6 +4565,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.aiplatform_v1beta1.MetadataServiceClient.CreateMetadataSchema", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "CreateMetadataSchema", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MetadataServiceRestTransport._CreateMetadataSchema._get_response( self._host, @@ -4137,7 +4613,31 @@ def __call__( pb_resp = gca_metadata_schema.MetadataSchema.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_create_metadata_schema(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gca_metadata_schema.MetadataSchema.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.aiplatform_v1beta1.MetadataServiceClient.create_metadata_schema", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "CreateMetadataSchema", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _CreateMetadataStore( @@ -4177,7 +4677,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 metadata store method over HTTP. @@ -4188,8 +4688,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: @@ -4202,6 +4704,7 @@ def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseCreateMetadataStore._get_http_options() ) + request, metadata = self._interceptor.pre_create_metadata_store( request, metadata ) @@ -4218,6 +4721,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.aiplatform_v1beta1.MetadataServiceClient.CreateMetadataStore", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "CreateMetadataStore", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MetadataServiceRestTransport._CreateMetadataStore._get_response( self._host, @@ -4237,7 +4767,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_metadata_store(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.aiplatform_v1beta1.MetadataServiceClient.create_metadata_store", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "CreateMetadataStore", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _DeleteArtifact( @@ -4275,7 +4827,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 artifact method over HTTP. @@ -4286,8 +4838,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: @@ -4300,6 +4854,7 @@ def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseDeleteArtifact._get_http_options() ) + request, metadata = self._interceptor.pre_delete_artifact(request, metadata) transcoded_request = _BaseMetadataServiceRestTransport._BaseDeleteArtifact._get_transcoded_request( http_options, request @@ -4310,6 +4865,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.aiplatform_v1beta1.MetadataServiceClient.DeleteArtifact", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "DeleteArtifact", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MetadataServiceRestTransport._DeleteArtifact._get_response( self._host, @@ -4328,7 +4910,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_artifact(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.aiplatform_v1beta1.MetadataServiceClient.delete_artifact", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "DeleteArtifact", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _DeleteContext( @@ -4366,7 +4970,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 context method over HTTP. @@ -4377,8 +4981,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: @@ -4391,6 +4997,7 @@ def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseDeleteContext._get_http_options() ) + request, metadata = self._interceptor.pre_delete_context(request, metadata) transcoded_request = _BaseMetadataServiceRestTransport._BaseDeleteContext._get_transcoded_request( http_options, request @@ -4401,6 +5008,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.aiplatform_v1beta1.MetadataServiceClient.DeleteContext", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "DeleteContext", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MetadataServiceRestTransport._DeleteContext._get_response( self._host, @@ -4419,7 +5053,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_context(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.aiplatform_v1beta1.MetadataServiceClient.delete_context", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "DeleteContext", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _DeleteExecution( @@ -4457,7 +5113,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 execution method over HTTP. @@ -4468,8 +5124,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: @@ -4482,6 +5140,7 @@ def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseDeleteExecution._get_http_options() ) + request, metadata = self._interceptor.pre_delete_execution( request, metadata ) @@ -4494,6 +5153,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.aiplatform_v1beta1.MetadataServiceClient.DeleteExecution", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "DeleteExecution", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MetadataServiceRestTransport._DeleteExecution._get_response( self._host, @@ -4512,7 +5198,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_execution(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.aiplatform_v1beta1.MetadataServiceClient.delete_execution", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "DeleteExecution", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _DeleteMetadataStore( @@ -4551,7 +5259,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 metadata store method over HTTP. @@ -4562,8 +5270,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: @@ -4576,6 +5286,7 @@ def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseDeleteMetadataStore._get_http_options() ) + request, metadata = self._interceptor.pre_delete_metadata_store( request, metadata ) @@ -4588,6 +5299,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.aiplatform_v1beta1.MetadataServiceClient.DeleteMetadataStore", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "DeleteMetadataStore", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MetadataServiceRestTransport._DeleteMetadataStore._get_response( self._host, @@ -4606,7 +5344,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_metadata_store(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.aiplatform_v1beta1.MetadataServiceClient.delete_metadata_store", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "DeleteMetadataStore", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _GetArtifact( @@ -4644,7 +5404,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]]] = (), ) -> artifact.Artifact: r"""Call the get artifact method over HTTP. @@ -4655,8 +5415,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: ~.artifact.Artifact: @@ -4666,6 +5428,7 @@ def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseGetArtifact._get_http_options() ) + request, metadata = self._interceptor.pre_get_artifact(request, metadata) transcoded_request = _BaseMetadataServiceRestTransport._BaseGetArtifact._get_transcoded_request( http_options, request @@ -4676,6 +5439,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.aiplatform_v1beta1.MetadataServiceClient.GetArtifact", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "GetArtifact", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MetadataServiceRestTransport._GetArtifact._get_response( self._host, @@ -4696,7 +5486,29 @@ def __call__( pb_resp = artifact.Artifact.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_artifact(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = artifact.Artifact.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.aiplatform_v1beta1.MetadataServiceClient.get_artifact", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "GetArtifact", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _GetContext( @@ -4734,7 +5546,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]]] = (), ) -> context.Context: r"""Call the get context method over HTTP. @@ -4745,8 +5557,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: ~.context.Context: @@ -4756,6 +5570,7 @@ def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseGetContext._get_http_options() ) + request, metadata = self._interceptor.pre_get_context(request, metadata) transcoded_request = _BaseMetadataServiceRestTransport._BaseGetContext._get_transcoded_request( http_options, request @@ -4766,6 +5581,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.aiplatform_v1beta1.MetadataServiceClient.GetContext", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "GetContext", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MetadataServiceRestTransport._GetContext._get_response( self._host, @@ -4786,7 +5628,29 @@ def __call__( pb_resp = context.Context.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_context(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = context.Context.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.aiplatform_v1beta1.MetadataServiceClient.get_context", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "GetContext", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _GetExecution( @@ -4824,7 +5688,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]]] = (), ) -> execution.Execution: r"""Call the get execution method over HTTP. @@ -4835,8 +5699,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: ~.execution.Execution: @@ -4846,6 +5712,7 @@ def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseGetExecution._get_http_options() ) + request, metadata = self._interceptor.pre_get_execution(request, metadata) transcoded_request = _BaseMetadataServiceRestTransport._BaseGetExecution._get_transcoded_request( http_options, request @@ -4856,6 +5723,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.aiplatform_v1beta1.MetadataServiceClient.GetExecution", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "GetExecution", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MetadataServiceRestTransport._GetExecution._get_response( self._host, @@ -4876,7 +5770,29 @@ def __call__( pb_resp = execution.Execution.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_execution(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = execution.Execution.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.aiplatform_v1beta1.MetadataServiceClient.get_execution", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "GetExecution", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _GetMetadataSchema( @@ -4915,7 +5831,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]]] = (), ) -> metadata_schema.MetadataSchema: r"""Call the get metadata schema method over HTTP. @@ -4926,8 +5842,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: ~.metadata_schema.MetadataSchema: @@ -4937,6 +5855,7 @@ def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseGetMetadataSchema._get_http_options() ) + request, metadata = self._interceptor.pre_get_metadata_schema( request, metadata ) @@ -4949,6 +5868,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.aiplatform_v1beta1.MetadataServiceClient.GetMetadataSchema", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "GetMetadataSchema", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MetadataServiceRestTransport._GetMetadataSchema._get_response( self._host, @@ -4969,7 +5915,29 @@ def __call__( pb_resp = metadata_schema.MetadataSchema.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_metadata_schema(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = metadata_schema.MetadataSchema.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.aiplatform_v1beta1.MetadataServiceClient.get_metadata_schema", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "GetMetadataSchema", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _GetMetadataStore( @@ -5007,7 +5975,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]]] = (), ) -> metadata_store.MetadataStore: r"""Call the get metadata store method over HTTP. @@ -5018,8 +5986,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: ~.metadata_store.MetadataStore: @@ -5032,6 +6002,7 @@ def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseGetMetadataStore._get_http_options() ) + request, metadata = self._interceptor.pre_get_metadata_store( request, metadata ) @@ -5044,6 +6015,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.aiplatform_v1beta1.MetadataServiceClient.GetMetadataStore", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "GetMetadataStore", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MetadataServiceRestTransport._GetMetadataStore._get_response( self._host, @@ -5064,7 +6062,29 @@ def __call__( pb_resp = metadata_store.MetadataStore.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_metadata_store(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = metadata_store.MetadataStore.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.aiplatform_v1beta1.MetadataServiceClient.get_metadata_store", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "GetMetadataStore", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListArtifacts( @@ -5102,7 +6122,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]]] = (), ) -> metadata_service.ListArtifactsResponse: r"""Call the list artifacts method over HTTP. @@ -5113,8 +6133,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: ~.metadata_service.ListArtifactsResponse: @@ -5126,6 +6148,7 @@ def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseListArtifacts._get_http_options() ) + request, metadata = self._interceptor.pre_list_artifacts(request, metadata) transcoded_request = _BaseMetadataServiceRestTransport._BaseListArtifacts._get_transcoded_request( http_options, request @@ -5136,6 +6159,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.aiplatform_v1beta1.MetadataServiceClient.ListArtifacts", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "ListArtifacts", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MetadataServiceRestTransport._ListArtifacts._get_response( self._host, @@ -5156,7 +6206,31 @@ def __call__( pb_resp = metadata_service.ListArtifactsResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_artifacts(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = metadata_service.ListArtifactsResponse.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.aiplatform_v1beta1.MetadataServiceClient.list_artifacts", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "ListArtifacts", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListContexts( @@ -5194,7 +6268,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]]] = (), ) -> metadata_service.ListContextsResponse: r"""Call the list contexts method over HTTP. @@ -5205,8 +6279,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: ~.metadata_service.ListContextsResponse: @@ -5218,6 +6294,7 @@ def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseListContexts._get_http_options() ) + request, metadata = self._interceptor.pre_list_contexts(request, metadata) transcoded_request = _BaseMetadataServiceRestTransport._BaseListContexts._get_transcoded_request( http_options, request @@ -5228,6 +6305,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.aiplatform_v1beta1.MetadataServiceClient.ListContexts", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "ListContexts", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MetadataServiceRestTransport._ListContexts._get_response( self._host, @@ -5248,7 +6352,31 @@ def __call__( pb_resp = metadata_service.ListContextsResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_contexts(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = metadata_service.ListContextsResponse.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.aiplatform_v1beta1.MetadataServiceClient.list_contexts", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "ListContexts", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListExecutions( @@ -5286,7 +6414,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]]] = (), ) -> metadata_service.ListExecutionsResponse: r"""Call the list executions method over HTTP. @@ -5297,8 +6425,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: ~.metadata_service.ListExecutionsResponse: @@ -5310,6 +6440,7 @@ def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseListExecutions._get_http_options() ) + request, metadata = self._interceptor.pre_list_executions(request, metadata) transcoded_request = _BaseMetadataServiceRestTransport._BaseListExecutions._get_transcoded_request( http_options, request @@ -5320,6 +6451,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.aiplatform_v1beta1.MetadataServiceClient.ListExecutions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "ListExecutions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MetadataServiceRestTransport._ListExecutions._get_response( self._host, @@ -5340,7 +6498,31 @@ def __call__( pb_resp = metadata_service.ListExecutionsResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_executions(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = metadata_service.ListExecutionsResponse.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.aiplatform_v1beta1.MetadataServiceClient.list_executions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "ListExecutions", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListMetadataSchemas( @@ -5379,7 +6561,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]]] = (), ) -> metadata_service.ListMetadataSchemasResponse: r"""Call the list metadata schemas method over HTTP. @@ -5390,8 +6572,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: ~.metadata_service.ListMetadataSchemasResponse: @@ -5403,6 +6587,7 @@ def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseListMetadataSchemas._get_http_options() ) + request, metadata = self._interceptor.pre_list_metadata_schemas( request, metadata ) @@ -5415,6 +6600,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.aiplatform_v1beta1.MetadataServiceClient.ListMetadataSchemas", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "ListMetadataSchemas", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MetadataServiceRestTransport._ListMetadataSchemas._get_response( self._host, @@ -5435,7 +6647,31 @@ def __call__( pb_resp = metadata_service.ListMetadataSchemasResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_metadata_schemas(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + metadata_service.ListMetadataSchemasResponse.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.aiplatform_v1beta1.MetadataServiceClient.list_metadata_schemas", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "ListMetadataSchemas", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListMetadataStores( @@ -5474,7 +6710,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]]] = (), ) -> metadata_service.ListMetadataStoresResponse: r"""Call the list metadata stores method over HTTP. @@ -5485,8 +6721,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: ~.metadata_service.ListMetadataStoresResponse: @@ -5498,6 +6736,7 @@ def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseListMetadataStores._get_http_options() ) + request, metadata = self._interceptor.pre_list_metadata_stores( request, metadata ) @@ -5510,6 +6749,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.aiplatform_v1beta1.MetadataServiceClient.ListMetadataStores", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "ListMetadataStores", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MetadataServiceRestTransport._ListMetadataStores._get_response( self._host, @@ -5530,7 +6796,31 @@ def __call__( pb_resp = metadata_service.ListMetadataStoresResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_metadata_stores(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + metadata_service.ListMetadataStoresResponse.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.aiplatform_v1beta1.MetadataServiceClient.list_metadata_stores", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "ListMetadataStores", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _PurgeArtifacts( @@ -5569,7 +6859,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 purge artifacts method over HTTP. @@ -5580,8 +6870,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: @@ -5594,6 +6886,7 @@ def __call__( http_options = ( _BaseMetadataServiceRestTransport._BasePurgeArtifacts._get_http_options() ) + request, metadata = self._interceptor.pre_purge_artifacts(request, metadata) transcoded_request = _BaseMetadataServiceRestTransport._BasePurgeArtifacts._get_transcoded_request( http_options, request @@ -5608,6 +6901,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.aiplatform_v1beta1.MetadataServiceClient.PurgeArtifacts", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "PurgeArtifacts", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MetadataServiceRestTransport._PurgeArtifacts._get_response( self._host, @@ -5627,7 +6947,29 @@ def __call__( # Return the response resp = operations_pb2.Operation() json_format.Parse(response.content, resp, ignore_unknown_fields=True) + resp = self._interceptor.post_purge_artifacts(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.aiplatform_v1beta1.MetadataServiceClient.purge_artifacts", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "PurgeArtifacts", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _PurgeContexts( @@ -5666,7 +7008,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 purge contexts method over HTTP. @@ -5677,8 +7019,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: @@ -5691,6 +7035,7 @@ def __call__( http_options = ( _BaseMetadataServiceRestTransport._BasePurgeContexts._get_http_options() ) + request, metadata = self._interceptor.pre_purge_contexts(request, metadata) transcoded_request = _BaseMetadataServiceRestTransport._BasePurgeContexts._get_transcoded_request( http_options, request @@ -5705,6 +7050,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.aiplatform_v1beta1.MetadataServiceClient.PurgeContexts", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "PurgeContexts", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MetadataServiceRestTransport._PurgeContexts._get_response( self._host, @@ -5724,7 +7096,29 @@ def __call__( # Return the response resp = operations_pb2.Operation() json_format.Parse(response.content, resp, ignore_unknown_fields=True) + resp = self._interceptor.post_purge_contexts(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.aiplatform_v1beta1.MetadataServiceClient.purge_contexts", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "PurgeContexts", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _PurgeExecutions( @@ -5763,7 +7157,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 purge executions method over HTTP. @@ -5774,8 +7168,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: @@ -5788,6 +7184,7 @@ def __call__( http_options = ( _BaseMetadataServiceRestTransport._BasePurgeExecutions._get_http_options() ) + request, metadata = self._interceptor.pre_purge_executions( request, metadata ) @@ -5804,6 +7201,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.aiplatform_v1beta1.MetadataServiceClient.PurgeExecutions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "PurgeExecutions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MetadataServiceRestTransport._PurgeExecutions._get_response( self._host, @@ -5823,7 +7247,29 @@ def __call__( # Return the response resp = operations_pb2.Operation() json_format.Parse(response.content, resp, ignore_unknown_fields=True) + resp = self._interceptor.post_purge_executions(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.aiplatform_v1beta1.MetadataServiceClient.purge_executions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "PurgeExecutions", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _QueryArtifactLineageSubgraph( @@ -5862,7 +7308,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]]] = (), ) -> lineage_subgraph.LineageSubgraph: r"""Call the query artifact lineage subgraph method over HTTP. @@ -5874,8 +7320,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: ~.lineage_subgraph.LineageSubgraph: @@ -5888,6 +7336,7 @@ def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseQueryArtifactLineageSubgraph._get_http_options() ) + request, metadata = self._interceptor.pre_query_artifact_lineage_subgraph( request, metadata ) @@ -5900,6 +7349,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.aiplatform_v1beta1.MetadataServiceClient.QueryArtifactLineageSubgraph", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "QueryArtifactLineageSubgraph", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MetadataServiceRestTransport._QueryArtifactLineageSubgraph._get_response( self._host, @@ -5920,7 +7396,31 @@ def __call__( pb_resp = lineage_subgraph.LineageSubgraph.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_query_artifact_lineage_subgraph(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = lineage_subgraph.LineageSubgraph.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.aiplatform_v1beta1.MetadataServiceClient.query_artifact_lineage_subgraph", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "QueryArtifactLineageSubgraph", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _QueryContextLineageSubgraph( @@ -5959,7 +7459,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]]] = (), ) -> lineage_subgraph.LineageSubgraph: r"""Call the query context lineage subgraph method over HTTP. @@ -5971,8 +7471,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: ~.lineage_subgraph.LineageSubgraph: @@ -5985,6 +7487,7 @@ def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseQueryContextLineageSubgraph._get_http_options() ) + request, metadata = self._interceptor.pre_query_context_lineage_subgraph( request, metadata ) @@ -5997,6 +7500,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.aiplatform_v1beta1.MetadataServiceClient.QueryContextLineageSubgraph", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "QueryContextLineageSubgraph", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( MetadataServiceRestTransport._QueryContextLineageSubgraph._get_response( @@ -6019,7 +7549,31 @@ def __call__( pb_resp = lineage_subgraph.LineageSubgraph.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_query_context_lineage_subgraph(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = lineage_subgraph.LineageSubgraph.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.aiplatform_v1beta1.MetadataServiceClient.query_context_lineage_subgraph", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "QueryContextLineageSubgraph", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _QueryExecutionInputsAndOutputs( @@ -6058,7 +7612,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]]] = (), ) -> lineage_subgraph.LineageSubgraph: r"""Call the query execution inputs and outputs method over HTTP. @@ -6070,8 +7624,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: ~.lineage_subgraph.LineageSubgraph: @@ -6084,6 +7640,7 @@ def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseQueryExecutionInputsAndOutputs._get_http_options() ) + ( request, metadata, @@ -6099,6 +7656,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.aiplatform_v1beta1.MetadataServiceClient.QueryExecutionInputsAndOutputs", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "QueryExecutionInputsAndOutputs", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MetadataServiceRestTransport._QueryExecutionInputsAndOutputs._get_response( self._host, @@ -6119,7 +7703,31 @@ def __call__( pb_resp = lineage_subgraph.LineageSubgraph.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_query_execution_inputs_and_outputs(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = lineage_subgraph.LineageSubgraph.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.aiplatform_v1beta1.MetadataServiceClient.query_execution_inputs_and_outputs", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "QueryExecutionInputsAndOutputs", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _RemoveContextChildren( @@ -6159,7 +7767,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]]] = (), ) -> metadata_service.RemoveContextChildrenResponse: r"""Call the remove context children method over HTTP. @@ -6170,8 +7778,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: ~.metadata_service.RemoveContextChildrenResponse: @@ -6183,6 +7793,7 @@ def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseRemoveContextChildren._get_http_options() ) + request, metadata = self._interceptor.pre_remove_context_children( request, metadata ) @@ -6199,6 +7810,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.aiplatform_v1beta1.MetadataServiceClient.RemoveContextChildren", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "RemoveContextChildren", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( MetadataServiceRestTransport._RemoveContextChildren._get_response( @@ -6222,7 +7860,31 @@ def __call__( pb_resp = metadata_service.RemoveContextChildrenResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_remove_context_children(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + metadata_service.RemoveContextChildrenResponse.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.aiplatform_v1beta1.MetadataServiceClient.remove_context_children", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "RemoveContextChildren", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _UpdateArtifact( @@ -6261,7 +7923,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]]] = (), ) -> gca_artifact.Artifact: r"""Call the update artifact method over HTTP. @@ -6272,8 +7934,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: ~.gca_artifact.Artifact: @@ -6283,6 +7947,7 @@ def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseUpdateArtifact._get_http_options() ) + request, metadata = self._interceptor.pre_update_artifact(request, metadata) transcoded_request = _BaseMetadataServiceRestTransport._BaseUpdateArtifact._get_transcoded_request( http_options, request @@ -6297,6 +7962,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.aiplatform_v1beta1.MetadataServiceClient.UpdateArtifact", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "UpdateArtifact", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MetadataServiceRestTransport._UpdateArtifact._get_response( self._host, @@ -6318,7 +8010,29 @@ def __call__( pb_resp = gca_artifact.Artifact.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_update_artifact(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gca_artifact.Artifact.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.aiplatform_v1beta1.MetadataServiceClient.update_artifact", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "UpdateArtifact", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _UpdateContext( @@ -6357,7 +8071,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]]] = (), ) -> gca_context.Context: r"""Call the update context method over HTTP. @@ -6368,8 +8082,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: ~.gca_context.Context: @@ -6379,6 +8095,7 @@ def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseUpdateContext._get_http_options() ) + request, metadata = self._interceptor.pre_update_context(request, metadata) transcoded_request = _BaseMetadataServiceRestTransport._BaseUpdateContext._get_transcoded_request( http_options, request @@ -6393,6 +8110,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.aiplatform_v1beta1.MetadataServiceClient.UpdateContext", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "UpdateContext", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MetadataServiceRestTransport._UpdateContext._get_response( self._host, @@ -6414,7 +8158,29 @@ def __call__( pb_resp = gca_context.Context.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_update_context(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gca_context.Context.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.aiplatform_v1beta1.MetadataServiceClient.update_context", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "UpdateContext", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _UpdateExecution( @@ -6453,7 +8219,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]]] = (), ) -> gca_execution.Execution: r"""Call the update execution method over HTTP. @@ -6464,8 +8230,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: ~.gca_execution.Execution: @@ -6475,6 +8243,7 @@ def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseUpdateExecution._get_http_options() ) + request, metadata = self._interceptor.pre_update_execution( request, metadata ) @@ -6491,6 +8260,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.aiplatform_v1beta1.MetadataServiceClient.UpdateExecution", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "UpdateExecution", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MetadataServiceRestTransport._UpdateExecution._get_response( self._host, @@ -6512,7 +8308,29 @@ def __call__( pb_resp = gca_execution.Execution.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_update_execution(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gca_execution.Execution.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.aiplatform_v1beta1.MetadataServiceClient.update_execution", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "UpdateExecution", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp @property @@ -6855,7 +8673,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]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -6866,8 +8684,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: locations_pb2.Location: Response from GetLocation method. @@ -6876,6 +8696,7 @@ def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = self._interceptor.pre_get_location(request, metadata) transcoded_request = _BaseMetadataServiceRestTransport._BaseGetLocation._get_transcoded_request( http_options, request @@ -6886,6 +8707,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.aiplatform_v1beta1.MetadataServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MetadataServiceRestTransport._GetLocation._get_response( self._host, @@ -6905,6 +8753,27 @@ def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_location(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.aiplatform_v1beta1.MetadataServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -6946,7 +8815,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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -6957,8 +8826,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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -6967,6 +8838,7 @@ def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = self._interceptor.pre_list_locations(request, metadata) transcoded_request = _BaseMetadataServiceRestTransport._BaseListLocations._get_transcoded_request( http_options, request @@ -6977,6 +8849,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.aiplatform_v1beta1.MetadataServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MetadataServiceRestTransport._ListLocations._get_response( self._host, @@ -6996,6 +8895,27 @@ def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_list_locations(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.aiplatform_v1beta1.MetadataServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -7038,7 +8958,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]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -7049,8 +8969,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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -7059,6 +8981,7 @@ def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_get_iam_policy(request, metadata) transcoded_request = _BaseMetadataServiceRestTransport._BaseGetIamPolicy._get_transcoded_request( http_options, request @@ -7073,6 +8996,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.aiplatform_v1beta1.MetadataServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MetadataServiceRestTransport._GetIamPolicy._get_response( self._host, @@ -7093,6 +9043,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_iam_policy(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.aiplatform_v1beta1.MetadataServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -7135,7 +9106,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]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -7146,8 +9117,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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -7156,6 +9129,7 @@ def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_set_iam_policy(request, metadata) transcoded_request = _BaseMetadataServiceRestTransport._BaseSetIamPolicy._get_transcoded_request( http_options, request @@ -7170,6 +9144,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.aiplatform_v1beta1.MetadataServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MetadataServiceRestTransport._SetIamPolicy._get_response( self._host, @@ -7190,6 +9191,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_set_iam_policy(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.aiplatform_v1beta1.MetadataServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -7233,7 +9255,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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -7244,8 +9266,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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -7254,6 +9278,7 @@ def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -7270,6 +9295,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.aiplatform_v1beta1.MetadataServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MetadataServiceRestTransport._TestIamPermissions._get_response( self._host, @@ -7290,6 +9342,27 @@ def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_test_iam_permissions(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.aiplatform_v1beta1.MetadataServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -7331,7 +9404,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 cancel operation method over HTTP. @@ -7342,13 +9415,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 = ( _BaseMetadataServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = self._interceptor.pre_cancel_operation( request, metadata ) @@ -7361,6 +9437,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.aiplatform_v1beta1.MetadataServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MetadataServiceRestTransport._CancelOperation._get_response( self._host, @@ -7417,7 +9520,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. @@ -7428,13 +9531,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 = ( _BaseMetadataServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = self._interceptor.pre_delete_operation( request, metadata ) @@ -7447,6 +9553,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.aiplatform_v1beta1.MetadataServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MetadataServiceRestTransport._DeleteOperation._get_response( self._host, @@ -7503,7 +9636,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. @@ -7514,8 +9647,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. @@ -7524,6 +9659,7 @@ def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = self._interceptor.pre_get_operation(request, metadata) transcoded_request = _BaseMetadataServiceRestTransport._BaseGetOperation._get_transcoded_request( http_options, request @@ -7534,6 +9670,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.aiplatform_v1beta1.MetadataServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MetadataServiceRestTransport._GetOperation._get_response( self._host, @@ -7553,6 +9716,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.aiplatform_v1beta1.MetadataServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -7594,7 +9778,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. @@ -7605,8 +9789,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. @@ -7615,6 +9801,7 @@ def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = self._interceptor.pre_list_operations(request, metadata) transcoded_request = _BaseMetadataServiceRestTransport._BaseListOperations._get_transcoded_request( http_options, request @@ -7625,6 +9812,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.aiplatform_v1beta1.MetadataServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MetadataServiceRestTransport._ListOperations._get_response( self._host, @@ -7644,6 +9858,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.aiplatform_v1beta1.MetadataServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -7685,7 +9920,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 wait operation method over HTTP. @@ -7696,8 +9931,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 WaitOperation method. @@ -7706,6 +9943,7 @@ def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = self._interceptor.pre_wait_operation(request, metadata) transcoded_request = _BaseMetadataServiceRestTransport._BaseWaitOperation._get_transcoded_request( http_options, request @@ -7716,6 +9954,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.aiplatform_v1beta1.MetadataServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MetadataServiceRestTransport._WaitOperation._get_response( self._host, @@ -7735,6 +10000,27 @@ def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = self._interceptor.post_wait_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.aiplatform_v1beta1.MetadataServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1beta1/services/metadata_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1beta1/services/metadata_service/transports/rest_asyncio.py index a59962edd3..54f3f59975 100644 --- a/google/cloud/aiplatform_v1beta1/services/metadata_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/metadata_service/transports/rest_asyncio.py @@ -68,6 +68,18 @@ from .base import DEFAULT_CLIENT_INFO as BASE_DEFAULT_CLIENT_INFO + +import logging + +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__) + try: OptionalRetry = Union[retries.AsyncRetry, gapic_v1.method._MethodDefault, None] except AttributeError: # pragma: NO COVER @@ -360,10 +372,10 @@ async def post_update_execution(self, response): async def pre_add_context_artifacts_and_executions( self, request: metadata_service.AddContextArtifactsAndExecutionsRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ metadata_service.AddContextArtifactsAndExecutionsRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for add_context_artifacts_and_executions @@ -386,8 +398,11 @@ async def post_add_context_artifacts_and_executions( async def pre_add_context_children( self, request: metadata_service.AddContextChildrenRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[metadata_service.AddContextChildrenRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + metadata_service.AddContextChildrenRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for add_context_children Override in a subclass to manipulate the request or metadata @@ -409,8 +424,11 @@ async def post_add_context_children( async def pre_add_execution_events( self, request: metadata_service.AddExecutionEventsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[metadata_service.AddExecutionEventsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + metadata_service.AddExecutionEventsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for add_execution_events Override in a subclass to manipulate the request or metadata @@ -432,8 +450,10 @@ async def post_add_execution_events( async def pre_create_artifact( self, request: metadata_service.CreateArtifactRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[metadata_service.CreateArtifactRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + metadata_service.CreateArtifactRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for create_artifact Override in a subclass to manipulate the request or metadata @@ -455,8 +475,10 @@ async def post_create_artifact( async def pre_create_context( self, request: metadata_service.CreateContextRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[metadata_service.CreateContextRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + metadata_service.CreateContextRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for create_context Override in a subclass to manipulate the request or metadata @@ -478,8 +500,10 @@ async def post_create_context( async def pre_create_execution( self, request: metadata_service.CreateExecutionRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[metadata_service.CreateExecutionRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + metadata_service.CreateExecutionRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for create_execution Override in a subclass to manipulate the request or metadata @@ -501,8 +525,11 @@ async def post_create_execution( async def pre_create_metadata_schema( self, request: metadata_service.CreateMetadataSchemaRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[metadata_service.CreateMetadataSchemaRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + metadata_service.CreateMetadataSchemaRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for create_metadata_schema Override in a subclass to manipulate the request or metadata @@ -524,8 +551,11 @@ async def post_create_metadata_schema( async def pre_create_metadata_store( self, request: metadata_service.CreateMetadataStoreRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[metadata_service.CreateMetadataStoreRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + metadata_service.CreateMetadataStoreRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for create_metadata_store Override in a subclass to manipulate the request or metadata @@ -547,8 +577,10 @@ async def post_create_metadata_store( async def pre_delete_artifact( self, request: metadata_service.DeleteArtifactRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[metadata_service.DeleteArtifactRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + metadata_service.DeleteArtifactRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for delete_artifact Override in a subclass to manipulate the request or metadata @@ -570,8 +602,10 @@ async def post_delete_artifact( async def pre_delete_context( self, request: metadata_service.DeleteContextRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[metadata_service.DeleteContextRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + metadata_service.DeleteContextRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for delete_context Override in a subclass to manipulate the request or metadata @@ -593,8 +627,10 @@ async def post_delete_context( async def pre_delete_execution( self, request: metadata_service.DeleteExecutionRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[metadata_service.DeleteExecutionRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + metadata_service.DeleteExecutionRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for delete_execution Override in a subclass to manipulate the request or metadata @@ -616,8 +652,11 @@ async def post_delete_execution( async def pre_delete_metadata_store( self, request: metadata_service.DeleteMetadataStoreRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[metadata_service.DeleteMetadataStoreRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + metadata_service.DeleteMetadataStoreRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for delete_metadata_store Override in a subclass to manipulate the request or metadata @@ -639,8 +678,10 @@ async def post_delete_metadata_store( async def pre_get_artifact( self, request: metadata_service.GetArtifactRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[metadata_service.GetArtifactRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + metadata_service.GetArtifactRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_artifact Override in a subclass to manipulate the request or metadata @@ -660,8 +701,10 @@ async def post_get_artifact(self, response: artifact.Artifact) -> artifact.Artif async def pre_get_context( self, request: metadata_service.GetContextRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[metadata_service.GetContextRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + metadata_service.GetContextRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_context Override in a subclass to manipulate the request or metadata @@ -681,8 +724,10 @@ async def post_get_context(self, response: context.Context) -> context.Context: async def pre_get_execution( self, request: metadata_service.GetExecutionRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[metadata_service.GetExecutionRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + metadata_service.GetExecutionRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_execution Override in a subclass to manipulate the request or metadata @@ -704,8 +749,11 @@ async def post_get_execution( async def pre_get_metadata_schema( self, request: metadata_service.GetMetadataSchemaRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[metadata_service.GetMetadataSchemaRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + metadata_service.GetMetadataSchemaRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for get_metadata_schema Override in a subclass to manipulate the request or metadata @@ -727,8 +775,11 @@ async def post_get_metadata_schema( async def pre_get_metadata_store( self, request: metadata_service.GetMetadataStoreRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[metadata_service.GetMetadataStoreRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + metadata_service.GetMetadataStoreRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for get_metadata_store Override in a subclass to manipulate the request or metadata @@ -750,8 +801,10 @@ async def post_get_metadata_store( async def pre_list_artifacts( self, request: metadata_service.ListArtifactsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[metadata_service.ListArtifactsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + metadata_service.ListArtifactsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_artifacts Override in a subclass to manipulate the request or metadata @@ -773,8 +826,10 @@ async def post_list_artifacts( async def pre_list_contexts( self, request: metadata_service.ListContextsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[metadata_service.ListContextsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + metadata_service.ListContextsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_contexts Override in a subclass to manipulate the request or metadata @@ -796,8 +851,10 @@ async def post_list_contexts( async def pre_list_executions( self, request: metadata_service.ListExecutionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[metadata_service.ListExecutionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + metadata_service.ListExecutionsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_executions Override in a subclass to manipulate the request or metadata @@ -819,8 +876,11 @@ async def post_list_executions( async def pre_list_metadata_schemas( self, request: metadata_service.ListMetadataSchemasRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[metadata_service.ListMetadataSchemasRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + metadata_service.ListMetadataSchemasRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for list_metadata_schemas Override in a subclass to manipulate the request or metadata @@ -842,8 +902,11 @@ async def post_list_metadata_schemas( async def pre_list_metadata_stores( self, request: metadata_service.ListMetadataStoresRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[metadata_service.ListMetadataStoresRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + metadata_service.ListMetadataStoresRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for list_metadata_stores Override in a subclass to manipulate the request or metadata @@ -865,8 +928,10 @@ async def post_list_metadata_stores( async def pre_purge_artifacts( self, request: metadata_service.PurgeArtifactsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[metadata_service.PurgeArtifactsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + metadata_service.PurgeArtifactsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for purge_artifacts Override in a subclass to manipulate the request or metadata @@ -888,8 +953,10 @@ async def post_purge_artifacts( async def pre_purge_contexts( self, request: metadata_service.PurgeContextsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[metadata_service.PurgeContextsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + metadata_service.PurgeContextsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for purge_contexts Override in a subclass to manipulate the request or metadata @@ -911,8 +978,10 @@ async def post_purge_contexts( async def pre_purge_executions( self, request: metadata_service.PurgeExecutionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[metadata_service.PurgeExecutionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + metadata_service.PurgeExecutionsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for purge_executions Override in a subclass to manipulate the request or metadata @@ -934,9 +1003,10 @@ async def post_purge_executions( async def pre_query_artifact_lineage_subgraph( self, request: metadata_service.QueryArtifactLineageSubgraphRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - metadata_service.QueryArtifactLineageSubgraphRequest, Sequence[Tuple[str, str]] + metadata_service.QueryArtifactLineageSubgraphRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for query_artifact_lineage_subgraph @@ -959,9 +1029,10 @@ async def post_query_artifact_lineage_subgraph( async def pre_query_context_lineage_subgraph( self, request: metadata_service.QueryContextLineageSubgraphRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - metadata_service.QueryContextLineageSubgraphRequest, Sequence[Tuple[str, str]] + metadata_service.QueryContextLineageSubgraphRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for query_context_lineage_subgraph @@ -984,10 +1055,10 @@ async def post_query_context_lineage_subgraph( async def pre_query_execution_inputs_and_outputs( self, request: metadata_service.QueryExecutionInputsAndOutputsRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ metadata_service.QueryExecutionInputsAndOutputsRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for query_execution_inputs_and_outputs @@ -1010,9 +1081,10 @@ async def post_query_execution_inputs_and_outputs( async def pre_remove_context_children( self, request: metadata_service.RemoveContextChildrenRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - metadata_service.RemoveContextChildrenRequest, Sequence[Tuple[str, str]] + metadata_service.RemoveContextChildrenRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for remove_context_children @@ -1035,8 +1107,10 @@ async def post_remove_context_children( async def pre_update_artifact( self, request: metadata_service.UpdateArtifactRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[metadata_service.UpdateArtifactRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + metadata_service.UpdateArtifactRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for update_artifact Override in a subclass to manipulate the request or metadata @@ -1058,8 +1132,10 @@ async def post_update_artifact( async def pre_update_context( self, request: metadata_service.UpdateContextRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[metadata_service.UpdateContextRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + metadata_service.UpdateContextRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for update_context Override in a subclass to manipulate the request or metadata @@ -1081,8 +1157,10 @@ async def post_update_context( async def pre_update_execution( self, request: metadata_service.UpdateExecutionRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[metadata_service.UpdateExecutionRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + metadata_service.UpdateExecutionRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for update_execution Override in a subclass to manipulate the request or metadata @@ -1104,8 +1182,10 @@ async def post_update_execution( async def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -1127,8 +1207,10 @@ async def post_get_location( async def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -1150,8 +1232,10 @@ async def post_list_locations( async def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -1173,8 +1257,10 @@ async def post_get_iam_policy( async def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -1196,8 +1282,11 @@ async def post_set_iam_policy( async def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -1219,8 +1308,10 @@ async def post_test_iam_permissions( async def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -1240,8 +1331,10 @@ async def post_cancel_operation(self, response: None) -> None: async 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 @@ -1261,8 +1354,10 @@ async def post_delete_operation(self, response: None) -> None: async 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 @@ -1284,8 +1379,10 @@ async def post_get_operation( async 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 @@ -1307,8 +1404,10 @@ async def post_list_operations( async def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -1651,7 +1750,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> metadata_service.AddContextArtifactsAndExecutionsResponse: r"""Call the add context artifacts and executions method over HTTP. @@ -1663,8 +1762,10 @@ async def __call__( 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: ~.metadata_service.AddContextArtifactsAndExecutionsResponse: @@ -1676,6 +1777,7 @@ async def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseAddContextArtifactsAndExecutions._get_http_options() ) + ( request, metadata, @@ -1695,6 +1797,33 @@ async 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.aiplatform_v1beta1.MetadataServiceClient.AddContextArtifactsAndExecutions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "AddContextArtifactsAndExecutions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncMetadataServiceRestTransport._AddContextArtifactsAndExecutions._get_response( self._host, @@ -1725,6 +1854,30 @@ async def __call__( resp = await self._interceptor.post_add_context_artifacts_and_executions( resp ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = metadata_service.AddContextArtifactsAndExecutionsResponse.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.MetadataServiceAsyncClient.add_context_artifacts_and_executions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "AddContextArtifactsAndExecutions", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _AddContextChildren( @@ -1764,7 +1917,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> metadata_service.AddContextChildrenResponse: r"""Call the add context children method over HTTP. @@ -1775,8 +1928,10 @@ async def __call__( 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: ~.metadata_service.AddContextChildrenResponse: @@ -1788,6 +1943,7 @@ async def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseAddContextChildren._get_http_options() ) + request, metadata = await self._interceptor.pre_add_context_children( request, metadata ) @@ -1804,6 +1960,33 @@ async 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.aiplatform_v1beta1.MetadataServiceClient.AddContextChildren", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "AddContextChildren", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncMetadataServiceRestTransport._AddContextChildren._get_response( self._host, @@ -1832,6 +2015,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_add_context_children(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + metadata_service.AddContextChildrenResponse.to_json(response) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.MetadataServiceAsyncClient.add_context_children", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "AddContextChildren", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _AddExecutionEvents( @@ -1871,7 +2078,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> metadata_service.AddExecutionEventsResponse: r"""Call the add execution events method over HTTP. @@ -1882,8 +2089,10 @@ async def __call__( 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: ~.metadata_service.AddExecutionEventsResponse: @@ -1895,6 +2104,7 @@ async def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseAddExecutionEvents._get_http_options() ) + request, metadata = await self._interceptor.pre_add_execution_events( request, metadata ) @@ -1911,6 +2121,33 @@ async 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.aiplatform_v1beta1.MetadataServiceClient.AddExecutionEvents", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "AddExecutionEvents", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncMetadataServiceRestTransport._AddExecutionEvents._get_response( self._host, @@ -1939,6 +2176,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_add_execution_events(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + metadata_service.AddExecutionEventsResponse.to_json(response) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.MetadataServiceAsyncClient.add_execution_events", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "AddExecutionEvents", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _CreateArtifact( @@ -1978,7 +2239,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> gca_artifact.Artifact: r"""Call the create artifact method over HTTP. @@ -1989,8 +2250,10 @@ async def __call__( 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: ~.gca_artifact.Artifact: @@ -2000,6 +2263,7 @@ async def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseCreateArtifact._get_http_options() ) + request, metadata = await self._interceptor.pre_create_artifact( request, metadata ) @@ -2016,6 +2280,33 @@ async 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.aiplatform_v1beta1.MetadataServiceClient.CreateArtifact", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "CreateArtifact", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncMetadataServiceRestTransport._CreateArtifact._get_response( @@ -2046,6 +2337,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_create_artifact(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gca_artifact.Artifact.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.MetadataServiceAsyncClient.create_artifact", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "CreateArtifact", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _CreateContext( @@ -2085,7 +2398,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> gca_context.Context: r"""Call the create context method over HTTP. @@ -2096,8 +2409,10 @@ async def __call__( 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: ~.gca_context.Context: @@ -2107,6 +2422,7 @@ async def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseCreateContext._get_http_options() ) + request, metadata = await self._interceptor.pre_create_context( request, metadata ) @@ -2123,6 +2439,33 @@ async 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.aiplatform_v1beta1.MetadataServiceClient.CreateContext", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "CreateContext", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncMetadataServiceRestTransport._CreateContext._get_response( @@ -2153,6 +2496,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_create_context(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gca_context.Context.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.MetadataServiceAsyncClient.create_context", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "CreateContext", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _CreateExecution( @@ -2192,7 +2557,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> gca_execution.Execution: r"""Call the create execution method over HTTP. @@ -2203,8 +2568,10 @@ async def __call__( 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: ~.gca_execution.Execution: @@ -2214,6 +2581,7 @@ async def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseCreateExecution._get_http_options() ) + request, metadata = await self._interceptor.pre_create_execution( request, metadata ) @@ -2230,6 +2598,33 @@ async 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.aiplatform_v1beta1.MetadataServiceClient.CreateExecution", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "CreateExecution", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncMetadataServiceRestTransport._CreateExecution._get_response( @@ -2260,6 +2655,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_create_execution(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gca_execution.Execution.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.MetadataServiceAsyncClient.create_execution", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "CreateExecution", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _CreateMetadataSchema( @@ -2299,7 +2716,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> gca_metadata_schema.MetadataSchema: r"""Call the create metadata schema method over HTTP. @@ -2310,8 +2727,10 @@ async def __call__( 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: ~.gca_metadata_schema.MetadataSchema: @@ -2321,6 +2740,7 @@ async def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseCreateMetadataSchema._get_http_options() ) + request, metadata = await self._interceptor.pre_create_metadata_schema( request, metadata ) @@ -2337,6 +2757,33 @@ async 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.aiplatform_v1beta1.MetadataServiceClient.CreateMetadataSchema", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "CreateMetadataSchema", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncMetadataServiceRestTransport._CreateMetadataSchema._get_response( self._host, @@ -2365,6 +2812,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_create_metadata_schema(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gca_metadata_schema.MetadataSchema.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.MetadataServiceAsyncClient.create_metadata_schema", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "CreateMetadataSchema", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _CreateMetadataStore( @@ -2404,7 +2875,7 @@ async 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 metadata store method over HTTP. @@ -2415,8 +2886,10 @@ async def __call__( 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: @@ -2429,6 +2902,7 @@ async def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseCreateMetadataStore._get_http_options() ) + request, metadata = await self._interceptor.pre_create_metadata_store( request, metadata ) @@ -2445,6 +2919,33 @@ async 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.aiplatform_v1beta1.MetadataServiceClient.CreateMetadataStore", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "CreateMetadataStore", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncMetadataServiceRestTransport._CreateMetadataStore._get_response( self._host, @@ -2473,6 +2974,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_create_metadata_store(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.MetadataServiceAsyncClient.create_metadata_store", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "CreateMetadataStore", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _DeleteArtifact( @@ -2511,7 +3034,7 @@ async 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 artifact method over HTTP. @@ -2522,8 +3045,10 @@ async def __call__( 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: @@ -2536,6 +3061,7 @@ async def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseDeleteArtifact._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_artifact( request, metadata ) @@ -2548,6 +3074,33 @@ async 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.aiplatform_v1beta1.MetadataServiceClient.DeleteArtifact", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "DeleteArtifact", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncMetadataServiceRestTransport._DeleteArtifact._get_response( @@ -2577,6 +3130,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_delete_artifact(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.MetadataServiceAsyncClient.delete_artifact", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "DeleteArtifact", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _DeleteContext( @@ -2615,7 +3190,7 @@ async 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 context method over HTTP. @@ -2626,8 +3201,10 @@ async def __call__( 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: @@ -2640,6 +3217,7 @@ async def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseDeleteContext._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_context( request, metadata ) @@ -2652,6 +3230,33 @@ async 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.aiplatform_v1beta1.MetadataServiceClient.DeleteContext", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "DeleteContext", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncMetadataServiceRestTransport._DeleteContext._get_response( @@ -2681,6 +3286,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_delete_context(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.MetadataServiceAsyncClient.delete_context", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "DeleteContext", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _DeleteExecution( @@ -2719,7 +3346,7 @@ async 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 execution method over HTTP. @@ -2730,8 +3357,10 @@ async def __call__( 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: @@ -2744,6 +3373,7 @@ async def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseDeleteExecution._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_execution( request, metadata ) @@ -2756,6 +3386,33 @@ async 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.aiplatform_v1beta1.MetadataServiceClient.DeleteExecution", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "DeleteExecution", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncMetadataServiceRestTransport._DeleteExecution._get_response( @@ -2785,6 +3442,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_delete_execution(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.MetadataServiceAsyncClient.delete_execution", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "DeleteExecution", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _DeleteMetadataStore( @@ -2823,7 +3502,7 @@ async 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 metadata store method over HTTP. @@ -2834,8 +3513,10 @@ async def __call__( 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: @@ -2848,6 +3529,7 @@ async def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseDeleteMetadataStore._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_metadata_store( request, metadata ) @@ -2860,6 +3542,33 @@ async 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.aiplatform_v1beta1.MetadataServiceClient.DeleteMetadataStore", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "DeleteMetadataStore", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncMetadataServiceRestTransport._DeleteMetadataStore._get_response( self._host, @@ -2887,6 +3596,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_delete_metadata_store(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.MetadataServiceAsyncClient.delete_metadata_store", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "DeleteMetadataStore", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _GetArtifact( @@ -2924,7 +3655,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> artifact.Artifact: r"""Call the get artifact method over HTTP. @@ -2935,8 +3666,10 @@ async def __call__( 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: ~.artifact.Artifact: @@ -2946,6 +3679,7 @@ async def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseGetArtifact._get_http_options() ) + request, metadata = await self._interceptor.pre_get_artifact( request, metadata ) @@ -2958,6 +3692,33 @@ async 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.aiplatform_v1beta1.MetadataServiceClient.GetArtifact", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "GetArtifact", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncMetadataServiceRestTransport._GetArtifact._get_response( @@ -2987,6 +3748,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_get_artifact(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = artifact.Artifact.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.MetadataServiceAsyncClient.get_artifact", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "GetArtifact", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _GetContext( @@ -3024,7 +3807,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> context.Context: r"""Call the get context method over HTTP. @@ -3035,8 +3818,10 @@ async def __call__( 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: ~.context.Context: @@ -3046,6 +3831,7 @@ async def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseGetContext._get_http_options() ) + request, metadata = await self._interceptor.pre_get_context( request, metadata ) @@ -3058,6 +3844,33 @@ async 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.aiplatform_v1beta1.MetadataServiceClient.GetContext", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "GetContext", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncMetadataServiceRestTransport._GetContext._get_response( @@ -3087,6 +3900,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_get_context(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = context.Context.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.MetadataServiceAsyncClient.get_context", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "GetContext", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _GetExecution( @@ -3125,7 +3960,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> execution.Execution: r"""Call the get execution method over HTTP. @@ -3136,8 +3971,10 @@ async def __call__( 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: ~.execution.Execution: @@ -3147,6 +3984,7 @@ async def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseGetExecution._get_http_options() ) + request, metadata = await self._interceptor.pre_get_execution( request, metadata ) @@ -3159,6 +3997,33 @@ async 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.aiplatform_v1beta1.MetadataServiceClient.GetExecution", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "GetExecution", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncMetadataServiceRestTransport._GetExecution._get_response( @@ -3188,6 +4053,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_get_execution(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = execution.Execution.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.MetadataServiceAsyncClient.get_execution", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "GetExecution", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _GetMetadataSchema( @@ -3226,7 +4113,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> metadata_schema.MetadataSchema: r"""Call the get metadata schema method over HTTP. @@ -3237,8 +4124,10 @@ async def __call__( 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: ~.metadata_schema.MetadataSchema: @@ -3248,6 +4137,7 @@ async def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseGetMetadataSchema._get_http_options() ) + request, metadata = await self._interceptor.pre_get_metadata_schema( request, metadata ) @@ -3260,6 +4150,33 @@ async 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.aiplatform_v1beta1.MetadataServiceClient.GetMetadataSchema", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "GetMetadataSchema", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncMetadataServiceRestTransport._GetMetadataSchema._get_response( self._host, @@ -3287,6 +4204,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_get_metadata_schema(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = metadata_schema.MetadataSchema.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.MetadataServiceAsyncClient.get_metadata_schema", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "GetMetadataSchema", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _GetMetadataStore( @@ -3325,7 +4264,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> metadata_store.MetadataStore: r"""Call the get metadata store method over HTTP. @@ -3336,8 +4275,10 @@ async def __call__( 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: ~.metadata_store.MetadataStore: @@ -3350,6 +4291,7 @@ async def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseGetMetadataStore._get_http_options() ) + request, metadata = await self._interceptor.pre_get_metadata_store( request, metadata ) @@ -3362,6 +4304,33 @@ async 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.aiplatform_v1beta1.MetadataServiceClient.GetMetadataStore", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "GetMetadataStore", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncMetadataServiceRestTransport._GetMetadataStore._get_response( @@ -3391,6 +4360,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_get_metadata_store(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = metadata_store.MetadataStore.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.MetadataServiceAsyncClient.get_metadata_store", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "GetMetadataStore", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ListArtifacts( @@ -3429,7 +4420,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> metadata_service.ListArtifactsResponse: r"""Call the list artifacts method over HTTP. @@ -3440,8 +4431,10 @@ async def __call__( 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: ~.metadata_service.ListArtifactsResponse: @@ -3453,6 +4446,7 @@ async def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseListArtifacts._get_http_options() ) + request, metadata = await self._interceptor.pre_list_artifacts( request, metadata ) @@ -3465,6 +4459,33 @@ async 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.aiplatform_v1beta1.MetadataServiceClient.ListArtifacts", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "ListArtifacts", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncMetadataServiceRestTransport._ListArtifacts._get_response( @@ -3494,6 +4515,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_list_artifacts(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = metadata_service.ListArtifactsResponse.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.MetadataServiceAsyncClient.list_artifacts", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "ListArtifacts", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ListContexts( @@ -3532,7 +4577,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> metadata_service.ListContextsResponse: r"""Call the list contexts method over HTTP. @@ -3543,8 +4588,10 @@ async def __call__( 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: ~.metadata_service.ListContextsResponse: @@ -3556,6 +4603,7 @@ async def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseListContexts._get_http_options() ) + request, metadata = await self._interceptor.pre_list_contexts( request, metadata ) @@ -3568,6 +4616,33 @@ async 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.aiplatform_v1beta1.MetadataServiceClient.ListContexts", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "ListContexts", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncMetadataServiceRestTransport._ListContexts._get_response( @@ -3597,6 +4672,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_list_contexts(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = metadata_service.ListContextsResponse.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.MetadataServiceAsyncClient.list_contexts", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "ListContexts", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ListExecutions( @@ -3635,7 +4734,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> metadata_service.ListExecutionsResponse: r"""Call the list executions method over HTTP. @@ -3646,8 +4745,10 @@ async def __call__( 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: ~.metadata_service.ListExecutionsResponse: @@ -3659,6 +4760,7 @@ async def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseListExecutions._get_http_options() ) + request, metadata = await self._interceptor.pre_list_executions( request, metadata ) @@ -3671,6 +4773,33 @@ async 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.aiplatform_v1beta1.MetadataServiceClient.ListExecutions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "ListExecutions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncMetadataServiceRestTransport._ListExecutions._get_response( @@ -3700,6 +4829,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_list_executions(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = metadata_service.ListExecutionsResponse.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.MetadataServiceAsyncClient.list_executions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "ListExecutions", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ListMetadataSchemas( @@ -3738,7 +4891,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> metadata_service.ListMetadataSchemasResponse: r"""Call the list metadata schemas method over HTTP. @@ -3749,8 +4902,10 @@ async def __call__( 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: ~.metadata_service.ListMetadataSchemasResponse: @@ -3762,6 +4917,7 @@ async def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseListMetadataSchemas._get_http_options() ) + request, metadata = await self._interceptor.pre_list_metadata_schemas( request, metadata ) @@ -3774,6 +4930,33 @@ async 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.aiplatform_v1beta1.MetadataServiceClient.ListMetadataSchemas", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "ListMetadataSchemas", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncMetadataServiceRestTransport._ListMetadataSchemas._get_response( self._host, @@ -3801,6 +4984,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_list_metadata_schemas(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + metadata_service.ListMetadataSchemasResponse.to_json(response) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.MetadataServiceAsyncClient.list_metadata_schemas", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "ListMetadataSchemas", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ListMetadataStores( @@ -3839,7 +5046,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> metadata_service.ListMetadataStoresResponse: r"""Call the list metadata stores method over HTTP. @@ -3850,8 +5057,10 @@ async def __call__( 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: ~.metadata_service.ListMetadataStoresResponse: @@ -3863,6 +5072,7 @@ async def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseListMetadataStores._get_http_options() ) + request, metadata = await self._interceptor.pre_list_metadata_stores( request, metadata ) @@ -3875,6 +5085,33 @@ async 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.aiplatform_v1beta1.MetadataServiceClient.ListMetadataStores", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "ListMetadataStores", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncMetadataServiceRestTransport._ListMetadataStores._get_response( self._host, @@ -3902,6 +5139,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_list_metadata_stores(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + metadata_service.ListMetadataStoresResponse.to_json(response) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.MetadataServiceAsyncClient.list_metadata_stores", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "ListMetadataStores", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _PurgeArtifacts( @@ -3941,7 +5202,7 @@ async 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 purge artifacts method over HTTP. @@ -3952,8 +5213,10 @@ async def __call__( 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: @@ -3966,6 +5229,7 @@ async def __call__( http_options = ( _BaseMetadataServiceRestTransport._BasePurgeArtifacts._get_http_options() ) + request, metadata = await self._interceptor.pre_purge_artifacts( request, metadata ) @@ -3982,6 +5246,33 @@ async 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.aiplatform_v1beta1.MetadataServiceClient.PurgeArtifacts", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "PurgeArtifacts", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncMetadataServiceRestTransport._PurgeArtifacts._get_response( @@ -4012,6 +5303,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_purge_artifacts(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.MetadataServiceAsyncClient.purge_artifacts", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "PurgeArtifacts", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _PurgeContexts( @@ -4051,7 +5364,7 @@ async 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 purge contexts method over HTTP. @@ -4062,8 +5375,10 @@ async def __call__( 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: @@ -4076,6 +5391,7 @@ async def __call__( http_options = ( _BaseMetadataServiceRestTransport._BasePurgeContexts._get_http_options() ) + request, metadata = await self._interceptor.pre_purge_contexts( request, metadata ) @@ -4092,6 +5408,33 @@ async 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.aiplatform_v1beta1.MetadataServiceClient.PurgeContexts", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "PurgeContexts", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncMetadataServiceRestTransport._PurgeContexts._get_response( @@ -4122,6 +5465,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_purge_contexts(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.MetadataServiceAsyncClient.purge_contexts", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "PurgeContexts", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _PurgeExecutions( @@ -4161,7 +5526,7 @@ async 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 purge executions method over HTTP. @@ -4172,8 +5537,10 @@ async def __call__( 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: @@ -4186,6 +5553,7 @@ async def __call__( http_options = ( _BaseMetadataServiceRestTransport._BasePurgeExecutions._get_http_options() ) + request, metadata = await self._interceptor.pre_purge_executions( request, metadata ) @@ -4202,6 +5570,33 @@ async 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.aiplatform_v1beta1.MetadataServiceClient.PurgeExecutions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "PurgeExecutions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncMetadataServiceRestTransport._PurgeExecutions._get_response( @@ -4232,6 +5627,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_purge_executions(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.MetadataServiceAsyncClient.purge_executions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "PurgeExecutions", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _QueryArtifactLineageSubgraph( @@ -4272,7 +5689,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> lineage_subgraph.LineageSubgraph: r"""Call the query artifact lineage subgraph method over HTTP. @@ -4284,8 +5701,10 @@ async def __call__( 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: ~.lineage_subgraph.LineageSubgraph: @@ -4298,6 +5717,7 @@ async def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseQueryArtifactLineageSubgraph._get_http_options() ) + ( request, metadata, @@ -4313,6 +5733,33 @@ async 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.aiplatform_v1beta1.MetadataServiceClient.QueryArtifactLineageSubgraph", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "QueryArtifactLineageSubgraph", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncMetadataServiceRestTransport._QueryArtifactLineageSubgraph._get_response( self._host, @@ -4340,6 +5787,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_query_artifact_lineage_subgraph(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = lineage_subgraph.LineageSubgraph.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.MetadataServiceAsyncClient.query_artifact_lineage_subgraph", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "QueryArtifactLineageSubgraph", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _QueryContextLineageSubgraph( @@ -4378,7 +5849,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> lineage_subgraph.LineageSubgraph: r"""Call the query context lineage subgraph method over HTTP. @@ -4390,8 +5861,10 @@ async def __call__( 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: ~.lineage_subgraph.LineageSubgraph: @@ -4404,6 +5877,7 @@ async def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseQueryContextLineageSubgraph._get_http_options() ) + ( request, metadata, @@ -4419,6 +5893,33 @@ async 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.aiplatform_v1beta1.MetadataServiceClient.QueryContextLineageSubgraph", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "QueryContextLineageSubgraph", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncMetadataServiceRestTransport._QueryContextLineageSubgraph._get_response( self._host, @@ -4446,6 +5947,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_query_context_lineage_subgraph(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = lineage_subgraph.LineageSubgraph.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.MetadataServiceAsyncClient.query_context_lineage_subgraph", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "QueryContextLineageSubgraph", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _QueryExecutionInputsAndOutputs( @@ -4486,7 +6011,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> lineage_subgraph.LineageSubgraph: r"""Call the query execution inputs and outputs method over HTTP. @@ -4498,8 +6023,10 @@ async def __call__( 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: ~.lineage_subgraph.LineageSubgraph: @@ -4512,6 +6039,7 @@ async def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseQueryExecutionInputsAndOutputs._get_http_options() ) + ( request, metadata, @@ -4527,6 +6055,33 @@ async 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.aiplatform_v1beta1.MetadataServiceClient.QueryExecutionInputsAndOutputs", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "QueryExecutionInputsAndOutputs", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncMetadataServiceRestTransport._QueryExecutionInputsAndOutputs._get_response( self._host, @@ -4554,6 +6109,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_query_execution_inputs_and_outputs(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = lineage_subgraph.LineageSubgraph.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.MetadataServiceAsyncClient.query_execution_inputs_and_outputs", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "QueryExecutionInputsAndOutputs", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _RemoveContextChildren( @@ -4593,7 +6172,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> metadata_service.RemoveContextChildrenResponse: r"""Call the remove context children method over HTTP. @@ -4604,8 +6183,10 @@ async def __call__( 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: ~.metadata_service.RemoveContextChildrenResponse: @@ -4617,6 +6198,7 @@ async def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseRemoveContextChildren._get_http_options() ) + request, metadata = await self._interceptor.pre_remove_context_children( request, metadata ) @@ -4633,6 +6215,33 @@ async 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.aiplatform_v1beta1.MetadataServiceClient.RemoveContextChildren", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "RemoveContextChildren", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncMetadataServiceRestTransport._RemoveContextChildren._get_response( self._host, @@ -4661,6 +6270,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_remove_context_children(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + metadata_service.RemoveContextChildrenResponse.to_json(response) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.MetadataServiceAsyncClient.remove_context_children", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "RemoveContextChildren", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _UpdateArtifact( @@ -4700,7 +6333,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> gca_artifact.Artifact: r"""Call the update artifact method over HTTP. @@ -4711,8 +6344,10 @@ async def __call__( 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: ~.gca_artifact.Artifact: @@ -4722,6 +6357,7 @@ async def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseUpdateArtifact._get_http_options() ) + request, metadata = await self._interceptor.pre_update_artifact( request, metadata ) @@ -4738,6 +6374,33 @@ async 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.aiplatform_v1beta1.MetadataServiceClient.UpdateArtifact", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "UpdateArtifact", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncMetadataServiceRestTransport._UpdateArtifact._get_response( @@ -4768,6 +6431,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_update_artifact(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gca_artifact.Artifact.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.MetadataServiceAsyncClient.update_artifact", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "UpdateArtifact", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _UpdateContext( @@ -4807,7 +6492,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> gca_context.Context: r"""Call the update context method over HTTP. @@ -4818,8 +6503,10 @@ async def __call__( 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: ~.gca_context.Context: @@ -4829,6 +6516,7 @@ async def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseUpdateContext._get_http_options() ) + request, metadata = await self._interceptor.pre_update_context( request, metadata ) @@ -4845,6 +6533,33 @@ async 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.aiplatform_v1beta1.MetadataServiceClient.UpdateContext", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "UpdateContext", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncMetadataServiceRestTransport._UpdateContext._get_response( @@ -4875,6 +6590,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_update_context(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gca_context.Context.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.MetadataServiceAsyncClient.update_context", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "UpdateContext", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _UpdateExecution( @@ -4914,7 +6651,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> gca_execution.Execution: r"""Call the update execution method over HTTP. @@ -4925,8 +6662,10 @@ async def __call__( 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: ~.gca_execution.Execution: @@ -4936,6 +6675,7 @@ async def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseUpdateExecution._get_http_options() ) + request, metadata = await self._interceptor.pre_update_execution( request, metadata ) @@ -4952,6 +6692,33 @@ async 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.aiplatform_v1beta1.MetadataServiceClient.UpdateExecution", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "UpdateExecution", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncMetadataServiceRestTransport._UpdateExecution._get_response( @@ -4982,6 +6749,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_update_execution(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gca_execution.Execution.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.MetadataServiceAsyncClient.update_execution", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "UpdateExecution", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp @property @@ -5557,6 +7346,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -5773,6 +7566,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -5979,6 +7776,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}", @@ -6195,6 +7996,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, ], "google.longrunning.Operations.ListOperations": [ { @@ -6393,6 +8198,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*}/operations", @@ -6609,6 +8418,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*}/operations", + }, ], "google.longrunning.Operations.WaitOperation": [ { @@ -6807,6 +8620,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "post", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}:wait", @@ -7019,6 +8836,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, ], } @@ -7313,7 +9134,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -7324,8 +9145,10 @@ async def __call__( 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: locations_pb2.Location: Response from GetLocation method. @@ -7334,6 +9157,7 @@ async def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_location( request, metadata ) @@ -7346,6 +9170,33 @@ async 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.aiplatform_v1beta1.MetadataServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncMetadataServiceRestTransport._GetLocation._get_response( @@ -7373,6 +9224,27 @@ async def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_location(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.aiplatform_v1beta1.MetadataServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -7415,7 +9287,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -7426,8 +9298,10 @@ async def __call__( 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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -7436,6 +9310,7 @@ async def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_locations( request, metadata ) @@ -7448,6 +9323,33 @@ async 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.aiplatform_v1beta1.MetadataServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncMetadataServiceRestTransport._ListLocations._get_response( @@ -7475,6 +9377,27 @@ async def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_list_locations(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.aiplatform_v1beta1.MetadataServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -7518,7 +9441,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -7529,8 +9452,10 @@ async def __call__( 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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -7539,6 +9464,7 @@ async def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_get_iam_policy( request, metadata ) @@ -7555,6 +9481,33 @@ async 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.aiplatform_v1beta1.MetadataServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncMetadataServiceRestTransport._GetIamPolicy._get_response( @@ -7583,6 +9536,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_iam_policy(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.aiplatform_v1beta1.MetadataServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -7626,7 +9600,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -7637,8 +9611,10 @@ async def __call__( 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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -7647,6 +9623,7 @@ async def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_set_iam_policy( request, metadata ) @@ -7663,6 +9640,33 @@ async 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.aiplatform_v1beta1.MetadataServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncMetadataServiceRestTransport._SetIamPolicy._get_response( @@ -7691,6 +9695,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_set_iam_policy(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.aiplatform_v1beta1.MetadataServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -7734,7 +9759,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -7745,8 +9770,10 @@ async def __call__( 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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -7755,6 +9782,7 @@ async def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = await self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -7771,6 +9799,33 @@ async 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.aiplatform_v1beta1.MetadataServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncMetadataServiceRestTransport._TestIamPermissions._get_response( self._host, @@ -7797,6 +9852,27 @@ async def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_test_iam_permissions(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.aiplatform_v1beta1.MetadataServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -7839,7 +9915,7 @@ async 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 cancel operation method over HTTP. @@ -7850,13 +9926,16 @@ async def __call__( 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`. """ http_options = ( _BaseMetadataServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_cancel_operation( request, metadata ) @@ -7869,6 +9948,33 @@ async 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.aiplatform_v1beta1.MetadataServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncMetadataServiceRestTransport._CancelOperation._get_response( @@ -7934,7 +10040,7 @@ async 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. @@ -7945,13 +10051,16 @@ async def __call__( 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`. """ http_options = ( _BaseMetadataServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_operation( request, metadata ) @@ -7964,6 +10073,33 @@ async 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.aiplatform_v1beta1.MetadataServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncMetadataServiceRestTransport._DeleteOperation._get_response( @@ -8029,7 +10165,7 @@ async 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. @@ -8040,8 +10176,10 @@ async def __call__( 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: Response from GetOperation method. @@ -8050,6 +10188,7 @@ async def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_operation( request, metadata ) @@ -8062,6 +10201,33 @@ async 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.aiplatform_v1beta1.MetadataServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncMetadataServiceRestTransport._GetOperation._get_response( @@ -8089,6 +10255,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1beta1.MetadataServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -8131,7 +10318,7 @@ async 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. @@ -8142,8 +10329,10 @@ async def __call__( 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 from ListOperations method. @@ -8152,6 +10341,7 @@ async def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_operations( request, metadata ) @@ -8164,6 +10354,33 @@ async 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.aiplatform_v1beta1.MetadataServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncMetadataServiceRestTransport._ListOperations._get_response( @@ -8191,6 +10408,27 @@ async def __call__( resp = operations_pb2.ListOperationsResponse() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1beta1.MetadataServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -8233,7 +10471,7 @@ async 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 wait operation method over HTTP. @@ -8244,8 +10482,10 @@ async def __call__( 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: Response from WaitOperation method. @@ -8254,6 +10494,7 @@ async def __call__( http_options = ( _BaseMetadataServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_wait_operation( request, metadata ) @@ -8266,6 +10507,33 @@ async 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.aiplatform_v1beta1.MetadataServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncMetadataServiceRestTransport._WaitOperation._get_response( @@ -8293,6 +10561,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_wait_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.aiplatform_v1beta1.MetadataServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MetadataService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1beta1/services/metadata_service/transports/rest_base.py b/google/cloud/aiplatform_v1beta1/services/metadata_service/transports/rest_base.py index 1571fff6f2..d423cc3e6e 100644 --- a/google/cloud/aiplatform_v1beta1/services/metadata_service/transports/rest_base.py +++ b/google/cloud/aiplatform_v1beta1/services/metadata_service/transports/rest_base.py @@ -2679,6 +2679,10 @@ def _get_http_options(): "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -2895,6 +2899,10 @@ def _get_http_options(): "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -3120,6 +3128,10 @@ def _get_http_options(): "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}", @@ -3336,6 +3348,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, ] return http_options @@ -3553,6 +3569,10 @@ def _get_http_options(): "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*}/operations", @@ -3769,6 +3789,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*}/operations", + }, ] return http_options @@ -3986,6 +4010,10 @@ def _get_http_options(): "method": "post", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}:wait", @@ -4198,6 +4226,10 @@ def _get_http_options(): "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, ] return http_options diff --git a/google/cloud/aiplatform_v1beta1/services/migration_service/async_client.py b/google/cloud/aiplatform_v1beta1/services/migration_service/async_client.py index 6ef6f36320..93e0e34844 100644 --- a/google/cloud/aiplatform_v1beta1/services/migration_service/async_client.py +++ b/google/cloud/aiplatform_v1beta1/services/migration_service/async_client.py @@ -13,6 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging as std_logging from collections import OrderedDict import re from typing import ( @@ -56,6 +57,15 @@ from .transports.grpc_asyncio import MigrationServiceGrpcAsyncIOTransport from .client import MigrationServiceClient +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 MigrationServiceAsyncClient: """A service that migrates resources from automl.googleapis.com, @@ -279,6 +289,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.aiplatform_v1beta1.MigrationServiceAsyncClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MigrationService", + "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.aiplatform.v1beta1.MigrationService", + "credentialsType": None, + }, + ) + async def search_migratable_resources( self, request: Optional[ @@ -288,7 +320,7 @@ async def search_migratable_resources( 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.SearchMigratableResourcesAsyncPager: r"""Searches all of the resources in automl.googleapis.com, datalabeling.googleapis.com and @@ -339,8 +371,10 @@ async def sample_search_migratable_resources(): 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.aiplatform_v1beta1.services.migration_service.pagers.SearchMigratableResourcesAsyncPager: @@ -420,7 +454,7 @@ async def batch_migrate_resources( ] = 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"""Batch migrates resources from ml.googleapis.com, automl.googleapis.com, and datalabeling.googleapis.com @@ -487,8 +521,10 @@ async def sample_batch_migrate_resources(): 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: @@ -560,7 +596,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. @@ -571,8 +607,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. @@ -613,7 +651,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. @@ -624,8 +662,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. @@ -666,7 +706,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. @@ -682,8 +722,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 """ @@ -720,7 +762,7 @@ async def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -735,8 +777,10 @@ async def cancel_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 """ @@ -773,7 +817,7 @@ async def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -790,8 +834,10 @@ async def wait_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. @@ -832,7 +878,7 @@ async def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -845,8 +891,10 @@ async def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -951,7 +999,7 @@ async def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -965,8 +1013,10 @@ async def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -1071,7 +1121,7 @@ async def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -1086,8 +1136,10 @@ async def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -1131,7 +1183,7 @@ async def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -1142,8 +1194,10 @@ async def get_location( 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: ~.location_pb2.Location: Location object. @@ -1184,7 +1238,7 @@ async def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -1195,8 +1249,10 @@ async def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1beta1/services/migration_service/client.py b/google/cloud/aiplatform_v1beta1/services/migration_service/client.py index 6cca1c05e5..1e2591ba83 100644 --- a/google/cloud/aiplatform_v1beta1/services/migration_service/client.py +++ b/google/cloud/aiplatform_v1beta1/services/migration_service/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 ( @@ -48,6 +49,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.cloud.aiplatform_v1beta1.services.migration_service import pagers @@ -729,6 +739,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( @@ -820,6 +834,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.aiplatform_v1beta1.MigrationServiceClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MigrationService", + "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.aiplatform.v1beta1.MigrationService", + "credentialsType": None, + }, + ) + def search_migratable_resources( self, request: Optional[ @@ -829,7 +866,7 @@ def search_migratable_resources( 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.SearchMigratableResourcesPager: r"""Searches all of the resources in automl.googleapis.com, datalabeling.googleapis.com and @@ -880,8 +917,10 @@ def sample_search_migratable_resources(): 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.aiplatform_v1beta1.services.migration_service.pagers.SearchMigratableResourcesPager: @@ -960,7 +999,7 @@ def batch_migrate_resources( ] = 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"""Batch migrates resources from ml.googleapis.com, automl.googleapis.com, and datalabeling.googleapis.com @@ -1027,8 +1066,10 @@ def sample_batch_migrate_resources(): 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: @@ -1110,7 +1151,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. @@ -1121,8 +1162,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. @@ -1163,7 +1206,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. @@ -1174,8 +1217,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. @@ -1216,7 +1261,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. @@ -1232,8 +1277,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 """ @@ -1270,7 +1317,7 @@ def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -1285,8 +1332,10 @@ def cancel_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 """ @@ -1323,7 +1372,7 @@ def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -1340,8 +1389,10 @@ def wait_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. @@ -1382,7 +1433,7 @@ def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -1395,8 +1446,10 @@ def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -1501,7 +1554,7 @@ def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -1515,8 +1568,10 @@ def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -1621,7 +1676,7 @@ def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -1636,8 +1691,10 @@ def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -1679,7 +1736,7 @@ def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -1690,8 +1747,10 @@ def get_location( 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: ~.location_pb2.Location: Location object. @@ -1732,7 +1791,7 @@ def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -1743,8 +1802,10 @@ def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1beta1/services/migration_service/pagers.py b/google/cloud/aiplatform_v1beta1/services/migration_service/pagers.py index 73692a5dad..11f5cc22d9 100644 --- a/google/cloud/aiplatform_v1beta1/services/migration_service/pagers.py +++ b/google/cloud/aiplatform_v1beta1/services/migration_service/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 = migration_service.SearchMigratableResourcesRequest(request) @@ -143,7 +145,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. @@ -157,8 +159,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 = migration_service.SearchMigratableResourcesRequest(request) diff --git a/google/cloud/aiplatform_v1beta1/services/migration_service/transports/grpc.py b/google/cloud/aiplatform_v1beta1/services/migration_service/transports/grpc.py index 5fe7643d92..3a05d5db4f 100644 --- a/google/cloud/aiplatform_v1beta1/services/migration_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1beta1/services/migration_service/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 import warnings from typing import Callable, Dict, Optional, Sequence, Tuple, Union @@ -22,8 +25,11 @@ import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from google.cloud.aiplatform_v1beta1.types import migration_service from google.cloud.location import locations_pb2 # type: ignore @@ -32,6 +38,81 @@ from google.longrunning import operations_pb2 # type: ignore from .base import MigrationServiceTransport, DEFAULT_CLIENT_INFO +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.aiplatform.v1beta1.MigrationService", + "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.aiplatform.v1beta1.MigrationService", + "rpcName": client_call_details.method, + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class MigrationServiceGrpcTransport(MigrationServiceTransport): """gRPC backend transport for MigrationService. @@ -187,7 +268,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 @@ -251,7 +337,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 @@ -281,7 +369,9 @@ def search_migratable_resources( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "search_migratable_resources" not in self._stubs: - self._stubs["search_migratable_resources"] = self.grpc_channel.unary_unary( + self._stubs[ + "search_migratable_resources" + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.MigrationService/SearchMigratableResources", request_serializer=migration_service.SearchMigratableResourcesRequest.serialize, response_deserializer=migration_service.SearchMigratableResourcesResponse.deserialize, @@ -311,7 +401,7 @@ def batch_migrate_resources( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "batch_migrate_resources" not in self._stubs: - self._stubs["batch_migrate_resources"] = self.grpc_channel.unary_unary( + self._stubs["batch_migrate_resources"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.MigrationService/BatchMigrateResources", request_serializer=migration_service.BatchMigrateResourcesRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -319,7 +409,7 @@ def batch_migrate_resources( return self._stubs["batch_migrate_resources"] def close(self): - self.grpc_channel.close() + self._logged_channel.close() @property def delete_operation( @@ -331,7 +421,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, @@ -348,7 +438,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -365,7 +455,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -382,7 +472,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, @@ -401,7 +491,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, @@ -420,7 +510,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -437,7 +527,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -462,7 +552,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -488,7 +578,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -517,7 +607,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1beta1/services/migration_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1beta1/services/migration_service/transports/grpc_asyncio.py index 66e77aeb6c..301c80102d 100644 --- a/google/cloud/aiplatform_v1beta1/services/migration_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/migration_service/transports/grpc_asyncio.py @@ -14,6 +14,9 @@ # limitations under the License. # import inspect +import json +import pickle +import logging as std_logging import warnings from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union @@ -24,8 +27,11 @@ from google.api_core import operations_v1 from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from grpc.experimental import aio # type: ignore from google.cloud.aiplatform_v1beta1.types import migration_service @@ -36,6 +42,82 @@ from .base import MigrationServiceTransport, DEFAULT_CLIENT_INFO from .grpc import MigrationServiceGrpcTransport +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.aiplatform.v1beta1.MigrationService", + "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.aiplatform.v1beta1.MigrationService", + "rpcName": str(client_call_details.method), + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class MigrationServiceGrpcAsyncIOTransport(MigrationServiceTransport): """gRPC AsyncIO backend transport for MigrationService. @@ -234,10 +316,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 @@ -260,7 +345,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. @@ -291,7 +376,9 @@ def search_migratable_resources( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "search_migratable_resources" not in self._stubs: - self._stubs["search_migratable_resources"] = self.grpc_channel.unary_unary( + self._stubs[ + "search_migratable_resources" + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.MigrationService/SearchMigratableResources", request_serializer=migration_service.SearchMigratableResourcesRequest.serialize, response_deserializer=migration_service.SearchMigratableResourcesResponse.deserialize, @@ -322,7 +409,7 @@ def batch_migrate_resources( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "batch_migrate_resources" not in self._stubs: - self._stubs["batch_migrate_resources"] = self.grpc_channel.unary_unary( + self._stubs["batch_migrate_resources"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.MigrationService/BatchMigrateResources", request_serializer=migration_service.BatchMigrateResourcesRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -400,7 +487,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: @@ -416,7 +503,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, @@ -433,7 +520,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -450,7 +537,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -467,7 +554,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, @@ -486,7 +573,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, @@ -505,7 +592,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -522,7 +609,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -547,7 +634,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -573,7 +660,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -602,7 +689,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1beta1/services/migration_service/transports/rest.py b/google/cloud/aiplatform_v1beta1/services/migration_service/transports/rest.py index 7466ef588e..ad9cc51149 100644 --- a/google/cloud/aiplatform_v1beta1/services/migration_service/transports/rest.py +++ b/google/cloud/aiplatform_v1beta1/services/migration_service/transports/rest.py @@ -13,9 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging +import json # type: ignore from google.auth.transport.requests import AuthorizedSession # type: ignore -import json # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.api_core import exceptions as core_exceptions from google.api_core import retry as retries @@ -47,6 +48,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, @@ -95,9 +104,10 @@ def post_search_migratable_resources(self, response): def pre_batch_migrate_resources( self, request: migration_service.BatchMigrateResourcesRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - migration_service.BatchMigrateResourcesRequest, Sequence[Tuple[str, str]] + migration_service.BatchMigrateResourcesRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for batch_migrate_resources @@ -120,9 +130,10 @@ def post_batch_migrate_resources( def pre_search_migratable_resources( self, request: migration_service.SearchMigratableResourcesRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - migration_service.SearchMigratableResourcesRequest, Sequence[Tuple[str, str]] + migration_service.SearchMigratableResourcesRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for search_migratable_resources @@ -145,8 +156,10 @@ def post_search_migratable_resources( def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -168,8 +181,10 @@ def post_get_location( def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -191,8 +206,10 @@ def post_list_locations( def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -212,8 +229,10 @@ def post_get_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -233,8 +252,11 @@ def post_set_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -256,8 +278,10 @@ def post_test_iam_permissions( def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -277,8 +301,10 @@ def post_cancel_operation(self, response: None) -> None: 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 @@ -298,8 +324,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 @@ -321,8 +349,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 @@ -344,8 +374,10 @@ def post_list_operations( def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -1026,6 +1058,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -1242,6 +1278,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -1448,6 +1488,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}", @@ -1664,6 +1708,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, ], "google.longrunning.Operations.ListOperations": [ { @@ -1862,6 +1910,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*}/operations", @@ -2078,6 +2130,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*}/operations", + }, ], "google.longrunning.Operations.WaitOperation": [ { @@ -2276,6 +2332,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "post", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}:wait", @@ -2488,6 +2548,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, ], } @@ -2544,7 +2608,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 batch migrate resources method over HTTP. @@ -2555,8 +2619,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: @@ -2569,6 +2635,7 @@ def __call__( http_options = ( _BaseMigrationServiceRestTransport._BaseBatchMigrateResources._get_http_options() ) + request, metadata = self._interceptor.pre_batch_migrate_resources( request, metadata ) @@ -2585,6 +2652,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.aiplatform_v1beta1.MigrationServiceClient.BatchMigrateResources", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MigrationService", + "rpcName": "BatchMigrateResources", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( MigrationServiceRestTransport._BatchMigrateResources._get_response( @@ -2606,7 +2700,29 @@ def __call__( # Return the response resp = operations_pb2.Operation() json_format.Parse(response.content, resp, ignore_unknown_fields=True) + resp = self._interceptor.post_batch_migrate_resources(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.aiplatform_v1beta1.MigrationServiceClient.batch_migrate_resources", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MigrationService", + "rpcName": "BatchMigrateResources", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _SearchMigratableResources( @@ -2646,7 +2762,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]]] = (), ) -> migration_service.SearchMigratableResourcesResponse: r"""Call the search migratable resources method over HTTP. @@ -2658,8 +2774,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: ~.migration_service.SearchMigratableResourcesResponse: @@ -2671,6 +2789,7 @@ def __call__( http_options = ( _BaseMigrationServiceRestTransport._BaseSearchMigratableResources._get_http_options() ) + request, metadata = self._interceptor.pre_search_migratable_resources( request, metadata ) @@ -2687,6 +2806,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.aiplatform_v1beta1.MigrationServiceClient.SearchMigratableResources", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MigrationService", + "rpcName": "SearchMigratableResources", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( MigrationServiceRestTransport._SearchMigratableResources._get_response( @@ -2710,7 +2856,33 @@ def __call__( pb_resp = migration_service.SearchMigratableResourcesResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_search_migratable_resources(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + migration_service.SearchMigratableResourcesResponse.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.aiplatform_v1beta1.MigrationServiceClient.search_migratable_resources", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MigrationService", + "rpcName": "SearchMigratableResources", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp @property @@ -2773,7 +2945,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]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -2784,8 +2956,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: locations_pb2.Location: Response from GetLocation method. @@ -2794,6 +2968,7 @@ def __call__( http_options = ( _BaseMigrationServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = self._interceptor.pre_get_location(request, metadata) transcoded_request = _BaseMigrationServiceRestTransport._BaseGetLocation._get_transcoded_request( http_options, request @@ -2804,6 +2979,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.aiplatform_v1beta1.MigrationServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MigrationService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MigrationServiceRestTransport._GetLocation._get_response( self._host, @@ -2823,6 +3025,27 @@ def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_location(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.aiplatform_v1beta1.MigrationServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MigrationService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -2864,7 +3087,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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -2875,8 +3098,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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -2885,6 +3110,7 @@ def __call__( http_options = ( _BaseMigrationServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = self._interceptor.pre_list_locations(request, metadata) transcoded_request = _BaseMigrationServiceRestTransport._BaseListLocations._get_transcoded_request( http_options, request @@ -2895,6 +3121,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.aiplatform_v1beta1.MigrationServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MigrationService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MigrationServiceRestTransport._ListLocations._get_response( self._host, @@ -2914,6 +3167,27 @@ def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_list_locations(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.aiplatform_v1beta1.MigrationServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MigrationService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -2956,7 +3230,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]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -2967,8 +3241,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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -2977,6 +3253,7 @@ def __call__( http_options = ( _BaseMigrationServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_get_iam_policy(request, metadata) transcoded_request = _BaseMigrationServiceRestTransport._BaseGetIamPolicy._get_transcoded_request( http_options, request @@ -2991,6 +3268,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.aiplatform_v1beta1.MigrationServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MigrationService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MigrationServiceRestTransport._GetIamPolicy._get_response( self._host, @@ -3011,6 +3315,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_iam_policy(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.aiplatform_v1beta1.MigrationServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MigrationService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3053,7 +3378,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]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -3064,8 +3389,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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -3074,6 +3401,7 @@ def __call__( http_options = ( _BaseMigrationServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_set_iam_policy(request, metadata) transcoded_request = _BaseMigrationServiceRestTransport._BaseSetIamPolicy._get_transcoded_request( http_options, request @@ -3088,6 +3416,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.aiplatform_v1beta1.MigrationServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MigrationService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MigrationServiceRestTransport._SetIamPolicy._get_response( self._host, @@ -3108,6 +3463,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_set_iam_policy(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.aiplatform_v1beta1.MigrationServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MigrationService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3151,7 +3527,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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -3162,8 +3538,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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -3172,6 +3550,7 @@ def __call__( http_options = ( _BaseMigrationServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -3188,6 +3567,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.aiplatform_v1beta1.MigrationServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MigrationService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MigrationServiceRestTransport._TestIamPermissions._get_response( self._host, @@ -3208,6 +3614,27 @@ def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_test_iam_permissions(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.aiplatform_v1beta1.MigrationServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MigrationService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3250,7 +3677,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 cancel operation method over HTTP. @@ -3261,13 +3688,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 = ( _BaseMigrationServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = self._interceptor.pre_cancel_operation( request, metadata ) @@ -3280,6 +3710,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.aiplatform_v1beta1.MigrationServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MigrationService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MigrationServiceRestTransport._CancelOperation._get_response( self._host, @@ -3337,7 +3794,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. @@ -3348,13 +3805,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 = ( _BaseMigrationServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = self._interceptor.pre_delete_operation( request, metadata ) @@ -3367,6 +3827,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.aiplatform_v1beta1.MigrationServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MigrationService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MigrationServiceRestTransport._DeleteOperation._get_response( self._host, @@ -3423,7 +3910,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. @@ -3434,8 +3921,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. @@ -3444,6 +3933,7 @@ def __call__( http_options = ( _BaseMigrationServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = self._interceptor.pre_get_operation(request, metadata) transcoded_request = _BaseMigrationServiceRestTransport._BaseGetOperation._get_transcoded_request( http_options, request @@ -3454,6 +3944,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.aiplatform_v1beta1.MigrationServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MigrationService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MigrationServiceRestTransport._GetOperation._get_response( self._host, @@ -3473,6 +3990,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.aiplatform_v1beta1.MigrationServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MigrationService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3514,7 +4052,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. @@ -3525,8 +4063,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. @@ -3535,6 +4075,7 @@ def __call__( http_options = ( _BaseMigrationServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = self._interceptor.pre_list_operations(request, metadata) transcoded_request = _BaseMigrationServiceRestTransport._BaseListOperations._get_transcoded_request( http_options, request @@ -3545,6 +4086,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.aiplatform_v1beta1.MigrationServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MigrationService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MigrationServiceRestTransport._ListOperations._get_response( self._host, @@ -3564,6 +4132,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.aiplatform_v1beta1.MigrationServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MigrationService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3605,7 +4194,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 wait operation method over HTTP. @@ -3616,8 +4205,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 WaitOperation method. @@ -3626,6 +4217,7 @@ def __call__( http_options = ( _BaseMigrationServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = self._interceptor.pre_wait_operation(request, metadata) transcoded_request = _BaseMigrationServiceRestTransport._BaseWaitOperation._get_transcoded_request( http_options, request @@ -3636,6 +4228,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.aiplatform_v1beta1.MigrationServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MigrationService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = MigrationServiceRestTransport._WaitOperation._get_response( self._host, @@ -3655,6 +4274,27 @@ def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = self._interceptor.post_wait_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.aiplatform_v1beta1.MigrationServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MigrationService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1beta1/services/migration_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1beta1/services/migration_service/transports/rest_asyncio.py index f15e8b08cd..b621a19f2e 100644 --- a/google/cloud/aiplatform_v1beta1/services/migration_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/migration_service/transports/rest_asyncio.py @@ -58,6 +58,18 @@ from .base import DEFAULT_CLIENT_INFO as BASE_DEFAULT_CLIENT_INFO + +import logging + +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__) + try: OptionalRetry = Union[retries.AsyncRetry, gapic_v1.method._MethodDefault, None] except AttributeError: # pragma: NO COVER @@ -110,9 +122,10 @@ async def post_search_migratable_resources(self, response): async def pre_batch_migrate_resources( self, request: migration_service.BatchMigrateResourcesRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - migration_service.BatchMigrateResourcesRequest, Sequence[Tuple[str, str]] + migration_service.BatchMigrateResourcesRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for batch_migrate_resources @@ -135,9 +148,10 @@ async def post_batch_migrate_resources( async def pre_search_migratable_resources( self, request: migration_service.SearchMigratableResourcesRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - migration_service.SearchMigratableResourcesRequest, Sequence[Tuple[str, str]] + migration_service.SearchMigratableResourcesRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for search_migratable_resources @@ -160,8 +174,10 @@ async def post_search_migratable_resources( async def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -183,8 +199,10 @@ async def post_get_location( async def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -206,8 +224,10 @@ async def post_list_locations( async def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -229,8 +249,10 @@ async def post_get_iam_policy( async def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -252,8 +274,11 @@ async def post_set_iam_policy( async def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -275,8 +300,10 @@ async def post_test_iam_permissions( async def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -296,8 +323,10 @@ async def post_cancel_operation(self, response: None) -> None: async 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 @@ -317,8 +346,10 @@ async def post_delete_operation(self, response: None) -> None: async 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 @@ -340,8 +371,10 @@ async def post_get_operation( async 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 @@ -363,8 +396,10 @@ async def post_list_operations( async def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -556,7 +591,7 @@ async 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 batch migrate resources method over HTTP. @@ -567,8 +602,10 @@ async def __call__( 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: @@ -581,6 +618,7 @@ async def __call__( http_options = ( _BaseMigrationServiceRestTransport._BaseBatchMigrateResources._get_http_options() ) + request, metadata = await self._interceptor.pre_batch_migrate_resources( request, metadata ) @@ -597,6 +635,33 @@ async 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.aiplatform_v1beta1.MigrationServiceClient.BatchMigrateResources", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MigrationService", + "rpcName": "BatchMigrateResources", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncMigrationServiceRestTransport._BatchMigrateResources._get_response( self._host, @@ -625,6 +690,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_batch_migrate_resources(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.MigrationServiceAsyncClient.batch_migrate_resources", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MigrationService", + "rpcName": "BatchMigrateResources", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _SearchMigratableResources( @@ -664,7 +751,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> migration_service.SearchMigratableResourcesResponse: r"""Call the search migratable resources method over HTTP. @@ -676,8 +763,10 @@ async def __call__( 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: ~.migration_service.SearchMigratableResourcesResponse: @@ -689,6 +778,7 @@ async def __call__( http_options = ( _BaseMigrationServiceRestTransport._BaseSearchMigratableResources._get_http_options() ) + request, metadata = await self._interceptor.pre_search_migratable_resources( request, metadata ) @@ -705,6 +795,33 @@ async 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.aiplatform_v1beta1.MigrationServiceClient.SearchMigratableResources", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MigrationService", + "rpcName": "SearchMigratableResources", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncMigrationServiceRestTransport._SearchMigratableResources._get_response( self._host, @@ -733,6 +850,32 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_search_migratable_resources(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + migration_service.SearchMigratableResourcesResponse.to_json( + response + ) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.MigrationServiceAsyncClient.search_migratable_resources", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MigrationService", + "rpcName": "SearchMigratableResources", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp @property @@ -1308,6 +1451,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -1524,6 +1671,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -1730,6 +1881,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}", @@ -1946,6 +2101,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, ], "google.longrunning.Operations.ListOperations": [ { @@ -2144,6 +2303,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*}/operations", @@ -2360,6 +2523,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*}/operations", + }, ], "google.longrunning.Operations.WaitOperation": [ { @@ -2558,6 +2725,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "post", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}:wait", @@ -2770,6 +2941,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, ], } @@ -2845,7 +3020,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -2856,8 +3031,10 @@ async def __call__( 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: locations_pb2.Location: Response from GetLocation method. @@ -2866,6 +3043,7 @@ async def __call__( http_options = ( _BaseMigrationServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_location( request, metadata ) @@ -2878,6 +3056,33 @@ async 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.aiplatform_v1beta1.MigrationServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MigrationService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncMigrationServiceRestTransport._GetLocation._get_response( @@ -2905,6 +3110,27 @@ async def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_location(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.aiplatform_v1beta1.MigrationServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MigrationService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -2947,7 +3173,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -2958,8 +3184,10 @@ async def __call__( 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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -2968,6 +3196,7 @@ async def __call__( http_options = ( _BaseMigrationServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_locations( request, metadata ) @@ -2980,6 +3209,33 @@ async 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.aiplatform_v1beta1.MigrationServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MigrationService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncMigrationServiceRestTransport._ListLocations._get_response( @@ -3007,6 +3263,27 @@ async def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_list_locations(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.aiplatform_v1beta1.MigrationServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MigrationService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3050,7 +3327,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -3061,8 +3338,10 @@ async def __call__( 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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -3071,6 +3350,7 @@ async def __call__( http_options = ( _BaseMigrationServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_get_iam_policy( request, metadata ) @@ -3087,6 +3367,33 @@ async 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.aiplatform_v1beta1.MigrationServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MigrationService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncMigrationServiceRestTransport._GetIamPolicy._get_response( @@ -3115,6 +3422,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_iam_policy(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.aiplatform_v1beta1.MigrationServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MigrationService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3158,7 +3486,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -3169,8 +3497,10 @@ async def __call__( 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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -3179,6 +3509,7 @@ async def __call__( http_options = ( _BaseMigrationServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_set_iam_policy( request, metadata ) @@ -3195,6 +3526,33 @@ async 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.aiplatform_v1beta1.MigrationServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MigrationService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncMigrationServiceRestTransport._SetIamPolicy._get_response( @@ -3223,6 +3581,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_set_iam_policy(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.aiplatform_v1beta1.MigrationServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MigrationService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3266,7 +3645,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -3277,8 +3656,10 @@ async def __call__( 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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -3287,6 +3668,7 @@ async def __call__( http_options = ( _BaseMigrationServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = await self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -3303,6 +3685,33 @@ async 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.aiplatform_v1beta1.MigrationServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MigrationService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncMigrationServiceRestTransport._TestIamPermissions._get_response( self._host, @@ -3329,6 +3738,27 @@ async def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_test_iam_permissions(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.aiplatform_v1beta1.MigrationServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MigrationService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3371,7 +3801,7 @@ async 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 cancel operation method over HTTP. @@ -3382,13 +3812,16 @@ async def __call__( 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`. """ http_options = ( _BaseMigrationServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_cancel_operation( request, metadata ) @@ -3401,6 +3834,33 @@ async 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.aiplatform_v1beta1.MigrationServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MigrationService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncMigrationServiceRestTransport._CancelOperation._get_response( @@ -3466,7 +3926,7 @@ async 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. @@ -3477,13 +3937,16 @@ async def __call__( 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`. """ http_options = ( _BaseMigrationServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_operation( request, metadata ) @@ -3496,6 +3959,33 @@ async 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.aiplatform_v1beta1.MigrationServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MigrationService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncMigrationServiceRestTransport._DeleteOperation._get_response( @@ -3561,7 +4051,7 @@ async 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. @@ -3572,8 +4062,10 @@ async def __call__( 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: Response from GetOperation method. @@ -3582,6 +4074,7 @@ async def __call__( http_options = ( _BaseMigrationServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_operation( request, metadata ) @@ -3594,6 +4087,33 @@ async 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.aiplatform_v1beta1.MigrationServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MigrationService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncMigrationServiceRestTransport._GetOperation._get_response( @@ -3621,6 +4141,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1beta1.MigrationServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MigrationService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3663,7 +4204,7 @@ async 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. @@ -3674,8 +4215,10 @@ async def __call__( 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 from ListOperations method. @@ -3684,6 +4227,7 @@ async def __call__( http_options = ( _BaseMigrationServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_operations( request, metadata ) @@ -3696,6 +4240,33 @@ async 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.aiplatform_v1beta1.MigrationServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MigrationService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncMigrationServiceRestTransport._ListOperations._get_response( @@ -3723,6 +4294,27 @@ async def __call__( resp = operations_pb2.ListOperationsResponse() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1beta1.MigrationServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MigrationService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3765,7 +4357,7 @@ async 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 wait operation method over HTTP. @@ -3776,8 +4368,10 @@ async def __call__( 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: Response from WaitOperation method. @@ -3786,6 +4380,7 @@ async def __call__( http_options = ( _BaseMigrationServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_wait_operation( request, metadata ) @@ -3798,6 +4393,33 @@ async 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.aiplatform_v1beta1.MigrationServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MigrationService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncMigrationServiceRestTransport._WaitOperation._get_response( @@ -3825,6 +4447,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_wait_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.aiplatform_v1beta1.MigrationServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.MigrationService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1beta1/services/migration_service/transports/rest_base.py b/google/cloud/aiplatform_v1beta1/services/migration_service/transports/rest_base.py index 0a50b4638b..fa15f9d8e3 100644 --- a/google/cloud/aiplatform_v1beta1/services/migration_service/transports/rest_base.py +++ b/google/cloud/aiplatform_v1beta1/services/migration_service/transports/rest_base.py @@ -1123,6 +1123,10 @@ def _get_http_options(): "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -1339,6 +1343,10 @@ def _get_http_options(): "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -1564,6 +1572,10 @@ def _get_http_options(): "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}", @@ -1780,6 +1792,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, ] return http_options @@ -1997,6 +2013,10 @@ def _get_http_options(): "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*}/operations", @@ -2213,6 +2233,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*}/operations", + }, ] return http_options @@ -2430,6 +2454,10 @@ def _get_http_options(): "method": "post", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}:wait", @@ -2642,6 +2670,10 @@ def _get_http_options(): "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, ] return http_options diff --git a/google/cloud/aiplatform_v1beta1/services/model_garden_service/async_client.py b/google/cloud/aiplatform_v1beta1/services/model_garden_service/async_client.py index 52d5a978a2..47f4100dfd 100644 --- a/google/cloud/aiplatform_v1beta1/services/model_garden_service/async_client.py +++ b/google/cloud/aiplatform_v1beta1/services/model_garden_service/async_client.py @@ -13,6 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging as std_logging from collections import OrderedDict import re from typing import ( @@ -55,6 +56,15 @@ from .transports.grpc_asyncio import ModelGardenServiceGrpcAsyncIOTransport from .client import ModelGardenServiceClient +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 ModelGardenServiceAsyncClient: """The interface of Model Garden Service.""" @@ -270,6 +280,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.aiplatform_v1beta1.ModelGardenServiceAsyncClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelGardenService", + "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.aiplatform.v1beta1.ModelGardenService", + "credentialsType": None, + }, + ) + async def get_publisher_model( self, request: Optional[ @@ -279,7 +311,7 @@ async def get_publisher_model( 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]]] = (), ) -> publisher_model.PublisherModel: r"""Gets a Model Garden publisher model. @@ -324,8 +356,10 @@ async def sample_get_publisher_model(): 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.aiplatform_v1beta1.types.PublisherModel: @@ -386,7 +420,7 @@ async def list_publisher_models( 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.ListPublisherModelsAsyncPager: r"""Lists publisher models in Model Garden. @@ -431,8 +465,10 @@ async def sample_list_publisher_models(): 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.aiplatform_v1beta1.services.model_garden_service.pagers.ListPublisherModelsAsyncPager: @@ -506,7 +542,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. @@ -517,8 +553,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. @@ -559,7 +597,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. @@ -570,8 +608,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. @@ -612,7 +652,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. @@ -628,8 +668,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 """ @@ -666,7 +708,7 @@ async def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -681,8 +723,10 @@ async def cancel_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 """ @@ -719,7 +763,7 @@ async def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -736,8 +780,10 @@ async def wait_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. @@ -778,7 +824,7 @@ async def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -791,8 +837,10 @@ async def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -897,7 +945,7 @@ async def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -911,8 +959,10 @@ async def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -1017,7 +1067,7 @@ async def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -1032,8 +1082,10 @@ async def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -1077,7 +1129,7 @@ async def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -1088,8 +1140,10 @@ async def get_location( 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: ~.location_pb2.Location: Location object. @@ -1130,7 +1184,7 @@ async def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -1141,8 +1195,10 @@ async def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1beta1/services/model_garden_service/client.py b/google/cloud/aiplatform_v1beta1/services/model_garden_service/client.py index 7c2fa24a93..d355868dc2 100644 --- a/google/cloud/aiplatform_v1beta1/services/model_garden_service/client.py +++ b/google/cloud/aiplatform_v1beta1/services/model_garden_service/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 ( @@ -48,6 +49,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.cloud.aiplatform_v1beta1.services.model_garden_service import pagers from google.cloud.aiplatform_v1beta1.types import model from google.cloud.aiplatform_v1beta1.types import model_garden_service @@ -618,6 +628,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( @@ -709,6 +723,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.aiplatform_v1beta1.ModelGardenServiceClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelGardenService", + "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.aiplatform.v1beta1.ModelGardenService", + "credentialsType": None, + }, + ) + def get_publisher_model( self, request: Optional[ @@ -718,7 +755,7 @@ def get_publisher_model( 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]]] = (), ) -> publisher_model.PublisherModel: r"""Gets a Model Garden publisher model. @@ -763,8 +800,10 @@ def sample_get_publisher_model(): 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.aiplatform_v1beta1.types.PublisherModel: @@ -822,7 +861,7 @@ def list_publisher_models( 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.ListPublisherModelsPager: r"""Lists publisher models in Model Garden. @@ -867,8 +906,10 @@ def sample_list_publisher_models(): 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.aiplatform_v1beta1.services.model_garden_service.pagers.ListPublisherModelsPager: @@ -952,7 +993,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. @@ -963,8 +1004,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. @@ -1005,7 +1048,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. @@ -1016,8 +1059,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. @@ -1058,7 +1103,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. @@ -1074,8 +1119,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 """ @@ -1112,7 +1159,7 @@ def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -1127,8 +1174,10 @@ def cancel_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 """ @@ -1165,7 +1214,7 @@ def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -1182,8 +1231,10 @@ def wait_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. @@ -1224,7 +1275,7 @@ def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -1237,8 +1288,10 @@ def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -1343,7 +1396,7 @@ def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -1357,8 +1410,10 @@ def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -1463,7 +1518,7 @@ def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -1478,8 +1533,10 @@ def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -1521,7 +1578,7 @@ def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -1532,8 +1589,10 @@ def get_location( 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: ~.location_pb2.Location: Location object. @@ -1574,7 +1633,7 @@ def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -1585,8 +1644,10 @@ def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1beta1/services/model_garden_service/pagers.py b/google/cloud/aiplatform_v1beta1/services/model_garden_service/pagers.py index df4ff9eac9..4a514d8d28 100644 --- a/google/cloud/aiplatform_v1beta1/services/model_garden_service/pagers.py +++ b/google/cloud/aiplatform_v1beta1/services/model_garden_service/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 = model_garden_service.ListPublisherModelsRequest(request) @@ -143,7 +145,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. @@ -157,8 +159,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 = model_garden_service.ListPublisherModelsRequest(request) diff --git a/google/cloud/aiplatform_v1beta1/services/model_garden_service/transports/grpc.py b/google/cloud/aiplatform_v1beta1/services/model_garden_service/transports/grpc.py index 4581a5dba9..f8f18a27c1 100644 --- a/google/cloud/aiplatform_v1beta1/services/model_garden_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1beta1/services/model_garden_service/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 import warnings from typing import Callable, Dict, Optional, Sequence, Tuple, Union @@ -21,8 +24,11 @@ import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from google.cloud.aiplatform_v1beta1.types import model_garden_service from google.cloud.aiplatform_v1beta1.types import publisher_model @@ -32,6 +38,81 @@ from google.longrunning import operations_pb2 # type: ignore from .base import ModelGardenServiceTransport, DEFAULT_CLIENT_INFO +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.aiplatform.v1beta1.ModelGardenService", + "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.aiplatform.v1beta1.ModelGardenService", + "rpcName": client_call_details.method, + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class ModelGardenServiceGrpcTransport(ModelGardenServiceTransport): """gRPC backend transport for ModelGardenService. @@ -185,7 +266,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 @@ -261,7 +347,7 @@ def get_publisher_model( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_publisher_model" not in self._stubs: - self._stubs["get_publisher_model"] = self.grpc_channel.unary_unary( + self._stubs["get_publisher_model"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.ModelGardenService/GetPublisherModel", request_serializer=model_garden_service.GetPublisherModelRequest.serialize, response_deserializer=publisher_model.PublisherModel.deserialize, @@ -290,7 +376,7 @@ def list_publisher_models( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_publisher_models" not in self._stubs: - self._stubs["list_publisher_models"] = self.grpc_channel.unary_unary( + self._stubs["list_publisher_models"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.ModelGardenService/ListPublisherModels", request_serializer=model_garden_service.ListPublisherModelsRequest.serialize, response_deserializer=model_garden_service.ListPublisherModelsResponse.deserialize, @@ -298,7 +384,7 @@ def list_publisher_models( return self._stubs["list_publisher_models"] def close(self): - self.grpc_channel.close() + self._logged_channel.close() @property def delete_operation( @@ -310,7 +396,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, @@ -327,7 +413,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -344,7 +430,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -361,7 +447,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, @@ -380,7 +466,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, @@ -399,7 +485,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -416,7 +502,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -441,7 +527,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -467,7 +553,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -496,7 +582,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1beta1/services/model_garden_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1beta1/services/model_garden_service/transports/grpc_asyncio.py index 7dda6c718f..8b564025eb 100644 --- a/google/cloud/aiplatform_v1beta1/services/model_garden_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/model_garden_service/transports/grpc_asyncio.py @@ -14,6 +14,9 @@ # limitations under the License. # import inspect +import json +import pickle +import logging as std_logging import warnings from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union @@ -23,8 +26,11 @@ from google.api_core import retry_async as retries from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from grpc.experimental import aio # type: ignore from google.cloud.aiplatform_v1beta1.types import model_garden_service @@ -36,6 +42,82 @@ from .base import ModelGardenServiceTransport, DEFAULT_CLIENT_INFO from .grpc import ModelGardenServiceGrpcTransport +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.aiplatform.v1beta1.ModelGardenService", + "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.aiplatform.v1beta1.ModelGardenService", + "rpcName": str(client_call_details.method), + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class ModelGardenServiceGrpcAsyncIOTransport(ModelGardenServiceTransport): """gRPC AsyncIO backend transport for ModelGardenService. @@ -232,10 +314,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 @@ -270,7 +355,7 @@ def get_publisher_model( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_publisher_model" not in self._stubs: - self._stubs["get_publisher_model"] = self.grpc_channel.unary_unary( + self._stubs["get_publisher_model"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.ModelGardenService/GetPublisherModel", request_serializer=model_garden_service.GetPublisherModelRequest.serialize, response_deserializer=publisher_model.PublisherModel.deserialize, @@ -299,7 +384,7 @@ def list_publisher_models( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_publisher_models" not in self._stubs: - self._stubs["list_publisher_models"] = self.grpc_channel.unary_unary( + self._stubs["list_publisher_models"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.ModelGardenService/ListPublisherModels", request_serializer=model_garden_service.ListPublisherModelsRequest.serialize, response_deserializer=model_garden_service.ListPublisherModelsResponse.deserialize, @@ -377,7 +462,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: @@ -393,7 +478,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, @@ -410,7 +495,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -427,7 +512,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -444,7 +529,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, @@ -463,7 +548,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, @@ -482,7 +567,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -499,7 +584,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -524,7 +609,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -550,7 +635,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -579,7 +664,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1beta1/services/model_garden_service/transports/rest.py b/google/cloud/aiplatform_v1beta1/services/model_garden_service/transports/rest.py index 71532503ea..3ca14c87a3 100644 --- a/google/cloud/aiplatform_v1beta1/services/model_garden_service/transports/rest.py +++ b/google/cloud/aiplatform_v1beta1/services/model_garden_service/transports/rest.py @@ -13,9 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging +import json # type: ignore from google.auth.transport.requests import AuthorizedSession # type: ignore -import json # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.api_core import exceptions as core_exceptions from google.api_core import retry as retries @@ -47,6 +48,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, @@ -95,9 +104,10 @@ def post_list_publisher_models(self, response): def pre_get_publisher_model( self, request: model_garden_service.GetPublisherModelRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - model_garden_service.GetPublisherModelRequest, Sequence[Tuple[str, str]] + model_garden_service.GetPublisherModelRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for get_publisher_model @@ -120,9 +130,10 @@ def post_get_publisher_model( def pre_list_publisher_models( self, request: model_garden_service.ListPublisherModelsRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - model_garden_service.ListPublisherModelsRequest, Sequence[Tuple[str, str]] + model_garden_service.ListPublisherModelsRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for list_publisher_models @@ -145,8 +156,10 @@ def post_list_publisher_models( def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -168,8 +181,10 @@ def post_get_location( def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -191,8 +206,10 @@ def post_list_locations( def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -212,8 +229,10 @@ def post_get_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -233,8 +252,11 @@ def post_set_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -256,8 +278,10 @@ def post_test_iam_permissions( def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -277,8 +301,10 @@ def post_cancel_operation(self, response: None) -> None: 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 @@ -298,8 +324,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 @@ -321,8 +349,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 @@ -344,8 +374,10 @@ def post_list_operations( def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -487,7 +519,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]]] = (), ) -> publisher_model.PublisherModel: r"""Call the get publisher model method over HTTP. @@ -498,8 +530,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: ~.publisher_model.PublisherModel: @@ -509,6 +543,7 @@ def __call__( http_options = ( _BaseModelGardenServiceRestTransport._BaseGetPublisherModel._get_http_options() ) + request, metadata = self._interceptor.pre_get_publisher_model( request, metadata ) @@ -521,6 +556,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.aiplatform_v1beta1.ModelGardenServiceClient.GetPublisherModel", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelGardenService", + "rpcName": "GetPublisherModel", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ModelGardenServiceRestTransport._GetPublisherModel._get_response( self._host, @@ -541,7 +603,29 @@ def __call__( pb_resp = publisher_model.PublisherModel.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_publisher_model(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = publisher_model.PublisherModel.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.aiplatform_v1beta1.ModelGardenServiceClient.get_publisher_model", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelGardenService", + "rpcName": "GetPublisherModel", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListPublisherModels( @@ -580,7 +664,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]]] = (), ) -> model_garden_service.ListPublisherModelsResponse: r"""Call the list publisher models method over HTTP. @@ -591,8 +675,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: ~.model_garden_service.ListPublisherModelsResponse: @@ -604,6 +690,7 @@ def __call__( http_options = ( _BaseModelGardenServiceRestTransport._BaseListPublisherModels._get_http_options() ) + request, metadata = self._interceptor.pre_list_publisher_models( request, metadata ) @@ -616,6 +703,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.aiplatform_v1beta1.ModelGardenServiceClient.ListPublisherModels", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelGardenService", + "rpcName": "ListPublisherModels", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( ModelGardenServiceRestTransport._ListPublisherModels._get_response( @@ -638,7 +752,33 @@ def __call__( pb_resp = model_garden_service.ListPublisherModelsResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_publisher_models(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + model_garden_service.ListPublisherModelsResponse.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.aiplatform_v1beta1.ModelGardenServiceClient.list_publisher_models", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelGardenService", + "rpcName": "ListPublisherModels", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp @property @@ -702,7 +842,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]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -713,8 +853,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: locations_pb2.Location: Response from GetLocation method. @@ -723,6 +865,7 @@ def __call__( http_options = ( _BaseModelGardenServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = self._interceptor.pre_get_location(request, metadata) transcoded_request = _BaseModelGardenServiceRestTransport._BaseGetLocation._get_transcoded_request( http_options, request @@ -733,6 +876,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.aiplatform_v1beta1.ModelGardenServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelGardenService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ModelGardenServiceRestTransport._GetLocation._get_response( self._host, @@ -752,6 +922,27 @@ def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_location(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.aiplatform_v1beta1.ModelGardenServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelGardenService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -794,7 +985,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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -805,8 +996,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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -815,6 +1008,7 @@ def __call__( http_options = ( _BaseModelGardenServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = self._interceptor.pre_list_locations(request, metadata) transcoded_request = _BaseModelGardenServiceRestTransport._BaseListLocations._get_transcoded_request( http_options, request @@ -825,6 +1019,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.aiplatform_v1beta1.ModelGardenServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelGardenService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ModelGardenServiceRestTransport._ListLocations._get_response( self._host, @@ -844,6 +1065,27 @@ def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_list_locations(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.aiplatform_v1beta1.ModelGardenServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelGardenService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -887,7 +1129,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]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -898,8 +1140,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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -908,6 +1152,7 @@ def __call__( http_options = ( _BaseModelGardenServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_get_iam_policy(request, metadata) transcoded_request = _BaseModelGardenServiceRestTransport._BaseGetIamPolicy._get_transcoded_request( http_options, request @@ -922,6 +1167,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.aiplatform_v1beta1.ModelGardenServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelGardenService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ModelGardenServiceRestTransport._GetIamPolicy._get_response( self._host, @@ -942,6 +1214,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_iam_policy(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.aiplatform_v1beta1.ModelGardenServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelGardenService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -985,7 +1278,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]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -996,8 +1289,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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -1006,6 +1301,7 @@ def __call__( http_options = ( _BaseModelGardenServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_set_iam_policy(request, metadata) transcoded_request = _BaseModelGardenServiceRestTransport._BaseSetIamPolicy._get_transcoded_request( http_options, request @@ -1020,6 +1316,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.aiplatform_v1beta1.ModelGardenServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelGardenService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ModelGardenServiceRestTransport._SetIamPolicy._get_response( self._host, @@ -1040,6 +1363,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_set_iam_policy(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.aiplatform_v1beta1.ModelGardenServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelGardenService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1083,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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -1094,8 +1438,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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -1104,6 +1450,7 @@ def __call__( http_options = ( _BaseModelGardenServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -1120,6 +1467,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.aiplatform_v1beta1.ModelGardenServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelGardenService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( ModelGardenServiceRestTransport._TestIamPermissions._get_response( @@ -1142,6 +1516,27 @@ def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_test_iam_permissions(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.aiplatform_v1beta1.ModelGardenServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelGardenService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1184,7 +1579,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 cancel operation method over HTTP. @@ -1195,13 +1590,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 = ( _BaseModelGardenServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = self._interceptor.pre_cancel_operation( request, metadata ) @@ -1214,6 +1612,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.aiplatform_v1beta1.ModelGardenServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelGardenService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ModelGardenServiceRestTransport._CancelOperation._get_response( self._host, @@ -1271,7 +1696,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. @@ -1282,13 +1707,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 = ( _BaseModelGardenServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = self._interceptor.pre_delete_operation( request, metadata ) @@ -1301,6 +1729,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.aiplatform_v1beta1.ModelGardenServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelGardenService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ModelGardenServiceRestTransport._DeleteOperation._get_response( self._host, @@ -1358,7 +1813,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. @@ -1369,8 +1824,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. @@ -1379,6 +1836,7 @@ def __call__( http_options = ( _BaseModelGardenServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = self._interceptor.pre_get_operation(request, metadata) transcoded_request = _BaseModelGardenServiceRestTransport._BaseGetOperation._get_transcoded_request( http_options, request @@ -1389,6 +1847,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.aiplatform_v1beta1.ModelGardenServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelGardenService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ModelGardenServiceRestTransport._GetOperation._get_response( self._host, @@ -1408,6 +1893,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.aiplatform_v1beta1.ModelGardenServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelGardenService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1450,7 +1956,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. @@ -1461,8 +1967,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. @@ -1471,6 +1979,7 @@ def __call__( http_options = ( _BaseModelGardenServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = self._interceptor.pre_list_operations(request, metadata) transcoded_request = _BaseModelGardenServiceRestTransport._BaseListOperations._get_transcoded_request( http_options, request @@ -1481,6 +1990,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.aiplatform_v1beta1.ModelGardenServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelGardenService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ModelGardenServiceRestTransport._ListOperations._get_response( self._host, @@ -1500,6 +2036,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.aiplatform_v1beta1.ModelGardenServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelGardenService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1542,7 +2099,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 wait operation method over HTTP. @@ -1553,8 +2110,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 WaitOperation method. @@ -1563,6 +2122,7 @@ def __call__( http_options = ( _BaseModelGardenServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = self._interceptor.pre_wait_operation(request, metadata) transcoded_request = _BaseModelGardenServiceRestTransport._BaseWaitOperation._get_transcoded_request( http_options, request @@ -1573,6 +2133,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.aiplatform_v1beta1.ModelGardenServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelGardenService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ModelGardenServiceRestTransport._WaitOperation._get_response( self._host, @@ -1592,6 +2179,27 @@ def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = self._interceptor.post_wait_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.aiplatform_v1beta1.ModelGardenServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelGardenService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1beta1/services/model_garden_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1beta1/services/model_garden_service/transports/rest_asyncio.py index 4136c16cc0..f7c53ccca9 100644 --- a/google/cloud/aiplatform_v1beta1/services/model_garden_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/model_garden_service/transports/rest_asyncio.py @@ -57,6 +57,18 @@ from .base import DEFAULT_CLIENT_INFO as BASE_DEFAULT_CLIENT_INFO + +import logging + +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__) + try: OptionalRetry = Union[retries.AsyncRetry, gapic_v1.method._MethodDefault, None] except AttributeError: # pragma: NO COVER @@ -109,9 +121,10 @@ async def post_list_publisher_models(self, response): async def pre_get_publisher_model( self, request: model_garden_service.GetPublisherModelRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - model_garden_service.GetPublisherModelRequest, Sequence[Tuple[str, str]] + model_garden_service.GetPublisherModelRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for get_publisher_model @@ -134,9 +147,10 @@ async def post_get_publisher_model( async def pre_list_publisher_models( self, request: model_garden_service.ListPublisherModelsRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - model_garden_service.ListPublisherModelsRequest, Sequence[Tuple[str, str]] + model_garden_service.ListPublisherModelsRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for list_publisher_models @@ -159,8 +173,10 @@ async def post_list_publisher_models( async def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -182,8 +198,10 @@ async def post_get_location( async def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -205,8 +223,10 @@ async def post_list_locations( async def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -228,8 +248,10 @@ async def post_get_iam_policy( async def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -251,8 +273,11 @@ async def post_set_iam_policy( async def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -274,8 +299,10 @@ async def post_test_iam_permissions( async def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -295,8 +322,10 @@ async def post_cancel_operation(self, response: None) -> None: async 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 @@ -316,8 +345,10 @@ async def post_delete_operation(self, response: None) -> None: async 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 @@ -339,8 +370,10 @@ async def post_get_operation( async 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 @@ -362,8 +395,10 @@ async def post_list_operations( async def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -550,7 +585,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> publisher_model.PublisherModel: r"""Call the get publisher model method over HTTP. @@ -561,8 +596,10 @@ async def __call__( 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: ~.publisher_model.PublisherModel: @@ -572,6 +609,7 @@ async def __call__( http_options = ( _BaseModelGardenServiceRestTransport._BaseGetPublisherModel._get_http_options() ) + request, metadata = await self._interceptor.pre_get_publisher_model( request, metadata ) @@ -584,6 +622,33 @@ async 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.aiplatform_v1beta1.ModelGardenServiceClient.GetPublisherModel", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelGardenService", + "rpcName": "GetPublisherModel", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncModelGardenServiceRestTransport._GetPublisherModel._get_response( self._host, @@ -611,6 +676,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_get_publisher_model(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = publisher_model.PublisherModel.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.ModelGardenServiceAsyncClient.get_publisher_model", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelGardenService", + "rpcName": "GetPublisherModel", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ListPublisherModels( @@ -649,7 +736,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> model_garden_service.ListPublisherModelsResponse: r"""Call the list publisher models method over HTTP. @@ -660,8 +747,10 @@ async def __call__( 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: ~.model_garden_service.ListPublisherModelsResponse: @@ -673,6 +762,7 @@ async def __call__( http_options = ( _BaseModelGardenServiceRestTransport._BaseListPublisherModels._get_http_options() ) + request, metadata = await self._interceptor.pre_list_publisher_models( request, metadata ) @@ -685,6 +775,33 @@ async 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.aiplatform_v1beta1.ModelGardenServiceClient.ListPublisherModels", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelGardenService", + "rpcName": "ListPublisherModels", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncModelGardenServiceRestTransport._ListPublisherModels._get_response( self._host, @@ -712,6 +829,32 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_list_publisher_models(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + model_garden_service.ListPublisherModelsResponse.to_json( + response + ) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.ModelGardenServiceAsyncClient.list_publisher_models", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelGardenService", + "rpcName": "ListPublisherModels", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp @property @@ -771,7 +914,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -782,8 +925,10 @@ async def __call__( 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: locations_pb2.Location: Response from GetLocation method. @@ -792,6 +937,7 @@ async def __call__( http_options = ( _BaseModelGardenServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_location( request, metadata ) @@ -804,6 +950,33 @@ async 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.aiplatform_v1beta1.ModelGardenServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelGardenService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncModelGardenServiceRestTransport._GetLocation._get_response( @@ -831,6 +1004,27 @@ async def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_location(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.aiplatform_v1beta1.ModelGardenServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelGardenService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -873,7 +1067,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -884,8 +1078,10 @@ async def __call__( 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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -894,6 +1090,7 @@ async def __call__( http_options = ( _BaseModelGardenServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_locations( request, metadata ) @@ -906,6 +1103,33 @@ async 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.aiplatform_v1beta1.ModelGardenServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelGardenService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncModelGardenServiceRestTransport._ListLocations._get_response( @@ -933,6 +1157,27 @@ async def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_list_locations(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.aiplatform_v1beta1.ModelGardenServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelGardenService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -976,7 +1221,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -987,8 +1232,10 @@ async def __call__( 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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -997,6 +1244,7 @@ async def __call__( http_options = ( _BaseModelGardenServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_get_iam_policy( request, metadata ) @@ -1013,6 +1261,33 @@ async 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.aiplatform_v1beta1.ModelGardenServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelGardenService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncModelGardenServiceRestTransport._GetIamPolicy._get_response( @@ -1041,6 +1316,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_iam_policy(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.aiplatform_v1beta1.ModelGardenServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelGardenService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1084,7 +1380,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -1095,8 +1391,10 @@ async def __call__( 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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -1105,6 +1403,7 @@ async def __call__( http_options = ( _BaseModelGardenServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_set_iam_policy( request, metadata ) @@ -1121,6 +1420,33 @@ async 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.aiplatform_v1beta1.ModelGardenServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelGardenService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncModelGardenServiceRestTransport._SetIamPolicy._get_response( @@ -1149,6 +1475,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_set_iam_policy(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.aiplatform_v1beta1.ModelGardenServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelGardenService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1192,7 +1539,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -1203,8 +1550,10 @@ async def __call__( 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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -1213,6 +1562,7 @@ async def __call__( http_options = ( _BaseModelGardenServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = await self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -1229,6 +1579,33 @@ async 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.aiplatform_v1beta1.ModelGardenServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelGardenService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncModelGardenServiceRestTransport._TestIamPermissions._get_response( self._host, @@ -1255,6 +1632,27 @@ async def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_test_iam_permissions(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.aiplatform_v1beta1.ModelGardenServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelGardenService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1297,7 +1695,7 @@ async 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 cancel operation method over HTTP. @@ -1308,13 +1706,16 @@ async def __call__( 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`. """ http_options = ( _BaseModelGardenServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_cancel_operation( request, metadata ) @@ -1327,6 +1728,33 @@ async 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.aiplatform_v1beta1.ModelGardenServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelGardenService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncModelGardenServiceRestTransport._CancelOperation._get_response( self._host, @@ -1390,7 +1818,7 @@ async 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. @@ -1401,13 +1829,16 @@ async def __call__( 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`. """ http_options = ( _BaseModelGardenServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_operation( request, metadata ) @@ -1420,6 +1851,33 @@ async 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.aiplatform_v1beta1.ModelGardenServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelGardenService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncModelGardenServiceRestTransport._DeleteOperation._get_response( self._host, @@ -1483,7 +1941,7 @@ async 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. @@ -1494,8 +1952,10 @@ async def __call__( 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: Response from GetOperation method. @@ -1504,6 +1964,7 @@ async def __call__( http_options = ( _BaseModelGardenServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_operation( request, metadata ) @@ -1516,6 +1977,33 @@ async 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.aiplatform_v1beta1.ModelGardenServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelGardenService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncModelGardenServiceRestTransport._GetOperation._get_response( @@ -1543,6 +2031,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1beta1.ModelGardenServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelGardenService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1585,7 +2094,7 @@ async 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. @@ -1596,8 +2105,10 @@ async def __call__( 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 from ListOperations method. @@ -1606,6 +2117,7 @@ async def __call__( http_options = ( _BaseModelGardenServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_operations( request, metadata ) @@ -1618,6 +2130,33 @@ async 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.aiplatform_v1beta1.ModelGardenServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelGardenService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncModelGardenServiceRestTransport._ListOperations._get_response( self._host, @@ -1643,6 +2182,27 @@ async def __call__( resp = operations_pb2.ListOperationsResponse() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1beta1.ModelGardenServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelGardenService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1685,7 +2245,7 @@ async 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 wait operation method over HTTP. @@ -1696,8 +2256,10 @@ async def __call__( 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: Response from WaitOperation method. @@ -1706,6 +2268,7 @@ async def __call__( http_options = ( _BaseModelGardenServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_wait_operation( request, metadata ) @@ -1718,6 +2281,33 @@ async 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.aiplatform_v1beta1.ModelGardenServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelGardenService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncModelGardenServiceRestTransport._WaitOperation._get_response( @@ -1745,6 +2335,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_wait_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.aiplatform_v1beta1.ModelGardenServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelGardenService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1beta1/services/model_garden_service/transports/rest_base.py b/google/cloud/aiplatform_v1beta1/services/model_garden_service/transports/rest_base.py index 2d2a181d2e..9d0f165996 100644 --- a/google/cloud/aiplatform_v1beta1/services/model_garden_service/transports/rest_base.py +++ b/google/cloud/aiplatform_v1beta1/services/model_garden_service/transports/rest_base.py @@ -1104,6 +1104,10 @@ def _get_http_options(): "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -1320,6 +1324,10 @@ def _get_http_options(): "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -1545,6 +1553,10 @@ def _get_http_options(): "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}", @@ -1761,6 +1773,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, ] return http_options @@ -1978,6 +1994,10 @@ def _get_http_options(): "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*}/operations", @@ -2194,6 +2214,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*}/operations", + }, ] return http_options @@ -2411,6 +2435,10 @@ def _get_http_options(): "method": "post", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}:wait", @@ -2623,6 +2651,10 @@ def _get_http_options(): "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, ] return http_options diff --git a/google/cloud/aiplatform_v1beta1/services/model_monitoring_service/async_client.py b/google/cloud/aiplatform_v1beta1/services/model_monitoring_service/async_client.py index e6d9b940dd..5c50429b70 100644 --- a/google/cloud/aiplatform_v1beta1/services/model_monitoring_service/async_client.py +++ b/google/cloud/aiplatform_v1beta1/services/model_monitoring_service/async_client.py @@ -13,6 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging as std_logging from collections import OrderedDict import re from typing import ( @@ -70,6 +71,15 @@ from .transports.grpc_asyncio import ModelMonitoringServiceGrpcAsyncIOTransport from .client import ModelMonitoringServiceClient +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 ModelMonitoringServiceAsyncClient: """A service for creating and managing Vertex AI Model moitoring. This @@ -310,6 +320,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.aiplatform_v1beta1.ModelMonitoringServiceAsyncClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelMonitoringService", + "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.aiplatform.v1beta1.ModelMonitoringService", + "credentialsType": None, + }, + ) + async def create_model_monitor( self, request: Optional[ @@ -320,7 +352,7 @@ async def create_model_monitor( model_monitor: Optional[gca_model_monitor.ModelMonitor] = 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"""Creates a ModelMonitor. @@ -374,8 +406,10 @@ async def sample_create_model_monitor(): 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: @@ -453,7 +487,7 @@ async def update_model_monitor( 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"""Updates a ModelMonitor. @@ -508,8 +542,10 @@ async def sample_update_model_monitor(): 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: @@ -588,7 +624,7 @@ async def get_model_monitor( 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]]] = (), ) -> model_monitor.ModelMonitor: r"""Gets a ModelMonitor. @@ -632,8 +668,10 @@ async def sample_get_model_monitor(): 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.aiplatform_v1beta1.types.ModelMonitor: @@ -701,7 +739,7 @@ async def list_model_monitors( 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.ListModelMonitorsAsyncPager: r"""Lists ModelMonitors in a Location. @@ -747,8 +785,10 @@ async def sample_list_model_monitors(): 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.aiplatform_v1beta1.services.model_monitoring_service.pagers.ListModelMonitorsAsyncPager: @@ -825,7 +865,7 @@ async def delete_model_monitor( 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"""Deletes a ModelMonitor. @@ -874,8 +914,10 @@ async def sample_delete_model_monitor(): 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: @@ -959,7 +1001,7 @@ async def create_model_monitoring_job( ] = 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]]] = (), ) -> gca_model_monitoring_job.ModelMonitoringJob: r"""Creates a ModelMonitoringJob. @@ -1010,8 +1052,10 @@ async def sample_create_model_monitoring_job(): 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.aiplatform_v1beta1.types.ModelMonitoringJob: @@ -1079,7 +1123,7 @@ async def get_model_monitoring_job( 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]]] = (), ) -> model_monitoring_job.ModelMonitoringJob: r"""Gets a ModelMonitoringJob. @@ -1124,8 +1168,10 @@ async def sample_get_model_monitoring_job(): 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.aiplatform_v1beta1.types.ModelMonitoringJob: @@ -1191,7 +1237,7 @@ async def list_model_monitoring_jobs( 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.ListModelMonitoringJobsAsyncPager: r"""Lists ModelMonitoringJobs. Callers may choose to read across multiple Monitors as per @@ -1241,8 +1287,10 @@ async def sample_list_model_monitoring_jobs(): 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.aiplatform_v1beta1.services.model_monitoring_service.pagers.ListModelMonitoringJobsAsyncPager: @@ -1321,7 +1369,7 @@ async def delete_model_monitoring_job( 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"""Deletes a ModelMonitoringJob. @@ -1370,8 +1418,10 @@ async def sample_delete_model_monitoring_job(): 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: @@ -1454,7 +1504,7 @@ async def search_model_monitoring_stats( model_monitor: 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.SearchModelMonitoringStatsAsyncPager: r"""Searches Model Monitoring Stats generated within a given time window. @@ -1500,8 +1550,10 @@ async def sample_search_model_monitoring_stats(): 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.aiplatform_v1beta1.services.model_monitoring_service.pagers.SearchModelMonitoringStatsAsyncPager: @@ -1584,7 +1636,7 @@ async def search_model_monitoring_alerts( model_monitor: 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.SearchModelMonitoringAlertsAsyncPager: r"""Returns the Model Monitoring alerts. @@ -1629,8 +1681,10 @@ async def sample_search_model_monitoring_alerts(): 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.aiplatform_v1beta1.services.model_monitoring_service.pagers.SearchModelMonitoringAlertsAsyncPager: @@ -1710,7 +1764,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. @@ -1721,8 +1775,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. @@ -1763,7 +1819,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. @@ -1774,8 +1830,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. @@ -1816,7 +1874,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. @@ -1832,8 +1890,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 """ @@ -1870,7 +1930,7 @@ async def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -1885,8 +1945,10 @@ async def cancel_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 """ @@ -1923,7 +1985,7 @@ async def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -1940,8 +2002,10 @@ async def wait_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. @@ -1982,7 +2046,7 @@ async def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -1995,8 +2059,10 @@ async def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -2101,7 +2167,7 @@ async def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -2115,8 +2181,10 @@ async def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -2221,7 +2289,7 @@ async def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -2236,8 +2304,10 @@ async def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -2281,7 +2351,7 @@ async def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -2292,8 +2362,10 @@ async def get_location( 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: ~.location_pb2.Location: Location object. @@ -2334,7 +2406,7 @@ async def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -2345,8 +2417,10 @@ async def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1beta1/services/model_monitoring_service/client.py b/google/cloud/aiplatform_v1beta1/services/model_monitoring_service/client.py index 1c4b770b42..0fb844712d 100644 --- a/google/cloud/aiplatform_v1beta1/services/model_monitoring_service/client.py +++ b/google/cloud/aiplatform_v1beta1/services/model_monitoring_service/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 ( @@ -48,6 +49,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 as gac_operation # type: ignore from google.api_core import operation_async # type: ignore from google.cloud.aiplatform_v1beta1.services.model_monitoring_service import pagers @@ -777,6 +787,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( @@ -868,6 +882,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.aiplatform_v1beta1.ModelMonitoringServiceClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelMonitoringService", + "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.aiplatform.v1beta1.ModelMonitoringService", + "credentialsType": None, + }, + ) + def create_model_monitor( self, request: Optional[ @@ -878,7 +915,7 @@ def create_model_monitor( model_monitor: Optional[gca_model_monitor.ModelMonitor] = 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]]] = (), ) -> gac_operation.Operation: r"""Creates a ModelMonitor. @@ -932,8 +969,10 @@ def sample_create_model_monitor(): 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: @@ -1008,7 +1047,7 @@ def update_model_monitor( 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]]] = (), ) -> gac_operation.Operation: r"""Updates a ModelMonitor. @@ -1063,8 +1102,10 @@ def sample_update_model_monitor(): 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: @@ -1140,7 +1181,7 @@ def get_model_monitor( 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]]] = (), ) -> model_monitor.ModelMonitor: r"""Gets a ModelMonitor. @@ -1184,8 +1225,10 @@ def sample_get_model_monitor(): 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.aiplatform_v1beta1.types.ModelMonitor: @@ -1250,7 +1293,7 @@ def list_model_monitors( 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.ListModelMonitorsPager: r"""Lists ModelMonitors in a Location. @@ -1296,8 +1339,10 @@ def sample_list_model_monitors(): 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.aiplatform_v1beta1.services.model_monitoring_service.pagers.ListModelMonitorsPager: @@ -1371,7 +1416,7 @@ def delete_model_monitor( 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]]] = (), ) -> gac_operation.Operation: r"""Deletes a ModelMonitor. @@ -1420,8 +1465,10 @@ def sample_delete_model_monitor(): 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: @@ -1502,7 +1549,7 @@ def create_model_monitoring_job( ] = 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]]] = (), ) -> gca_model_monitoring_job.ModelMonitoringJob: r"""Creates a ModelMonitoringJob. @@ -1553,8 +1600,10 @@ def sample_create_model_monitoring_job(): 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.aiplatform_v1beta1.types.ModelMonitoringJob: @@ -1621,7 +1670,7 @@ def get_model_monitoring_job( 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]]] = (), ) -> model_monitoring_job.ModelMonitoringJob: r"""Gets a ModelMonitoringJob. @@ -1666,8 +1715,10 @@ def sample_get_model_monitoring_job(): 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.aiplatform_v1beta1.types.ModelMonitoringJob: @@ -1730,7 +1781,7 @@ def list_model_monitoring_jobs( 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.ListModelMonitoringJobsPager: r"""Lists ModelMonitoringJobs. Callers may choose to read across multiple Monitors as per @@ -1780,8 +1831,10 @@ def sample_list_model_monitoring_jobs(): 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.aiplatform_v1beta1.services.model_monitoring_service.pagers.ListModelMonitoringJobsPager: @@ -1859,7 +1912,7 @@ def delete_model_monitoring_job( 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]]] = (), ) -> gac_operation.Operation: r"""Deletes a ModelMonitoringJob. @@ -1908,8 +1961,10 @@ def sample_delete_model_monitoring_job(): 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: @@ -1991,7 +2046,7 @@ def search_model_monitoring_stats( model_monitor: 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.SearchModelMonitoringStatsPager: r"""Searches Model Monitoring Stats generated within a given time window. @@ -2037,8 +2092,10 @@ def sample_search_model_monitoring_stats(): 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.aiplatform_v1beta1.services.model_monitoring_service.pagers.SearchModelMonitoringStatsPager: @@ -2120,7 +2177,7 @@ def search_model_monitoring_alerts( model_monitor: 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.SearchModelMonitoringAlertsPager: r"""Returns the Model Monitoring alerts. @@ -2165,8 +2222,10 @@ def sample_search_model_monitoring_alerts(): 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.aiplatform_v1beta1.services.model_monitoring_service.pagers.SearchModelMonitoringAlertsPager: @@ -2258,7 +2317,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. @@ -2269,8 +2328,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. @@ -2311,7 +2372,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. @@ -2322,8 +2383,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. @@ -2364,7 +2427,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. @@ -2380,8 +2443,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 """ @@ -2418,7 +2483,7 @@ def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -2433,8 +2498,10 @@ def cancel_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 """ @@ -2471,7 +2538,7 @@ def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -2488,8 +2555,10 @@ def wait_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. @@ -2530,7 +2599,7 @@ def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -2543,8 +2612,10 @@ def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -2649,7 +2720,7 @@ def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -2663,8 +2734,10 @@ def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -2769,7 +2842,7 @@ def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -2784,8 +2857,10 @@ def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -2827,7 +2902,7 @@ def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -2838,8 +2913,10 @@ def get_location( 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: ~.location_pb2.Location: Location object. @@ -2880,7 +2957,7 @@ def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -2891,8 +2968,10 @@ def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1beta1/services/model_monitoring_service/pagers.py b/google/cloud/aiplatform_v1beta1/services/model_monitoring_service/pagers.py index 4531b433d7..a594c09c4a 100644 --- a/google/cloud/aiplatform_v1beta1/services/model_monitoring_service/pagers.py +++ b/google/cloud/aiplatform_v1beta1/services/model_monitoring_service/pagers.py @@ -70,7 +70,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. @@ -84,8 +84,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 = model_monitoring_service.ListModelMonitorsRequest(request) @@ -146,7 +148,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. @@ -160,8 +162,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 = model_monitoring_service.ListModelMonitorsRequest(request) @@ -226,7 +230,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. @@ -240,8 +244,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 = model_monitoring_service.ListModelMonitoringJobsRequest(request) @@ -304,7 +310,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. @@ -318,8 +324,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 = model_monitoring_service.ListModelMonitoringJobsRequest(request) @@ -386,7 +394,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. @@ -400,8 +408,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 = model_monitoring_service.SearchModelMonitoringStatsRequest( @@ -466,7 +476,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. @@ -480,8 +490,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 = model_monitoring_service.SearchModelMonitoringStatsRequest( @@ -550,7 +562,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. @@ -564,8 +576,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 = model_monitoring_service.SearchModelMonitoringAlertsRequest( @@ -630,7 +644,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. @@ -644,8 +658,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 = model_monitoring_service.SearchModelMonitoringAlertsRequest( diff --git a/google/cloud/aiplatform_v1beta1/services/model_monitoring_service/transports/grpc.py b/google/cloud/aiplatform_v1beta1/services/model_monitoring_service/transports/grpc.py index f2ce5e25df..47f3af27d6 100644 --- a/google/cloud/aiplatform_v1beta1/services/model_monitoring_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1beta1/services/model_monitoring_service/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 import warnings from typing import Callable, Dict, Optional, Sequence, Tuple, Union @@ -22,8 +25,11 @@ import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from google.cloud.aiplatform_v1beta1.types import model_monitor from google.cloud.aiplatform_v1beta1.types import model_monitoring_job @@ -37,6 +43,81 @@ from google.longrunning import operations_pb2 # type: ignore from .base import ModelMonitoringServiceTransport, DEFAULT_CLIENT_INFO +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.aiplatform.v1beta1.ModelMonitoringService", + "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.aiplatform.v1beta1.ModelMonitoringService", + "rpcName": client_call_details.method, + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class ModelMonitoringServiceGrpcTransport(ModelMonitoringServiceTransport): """gRPC backend transport for ModelMonitoringService. @@ -193,7 +274,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,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 @@ -283,7 +371,7 @@ def create_model_monitor( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_model_monitor" not in self._stubs: - self._stubs["create_model_monitor"] = self.grpc_channel.unary_unary( + self._stubs["create_model_monitor"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.ModelMonitoringService/CreateModelMonitor", request_serializer=model_monitoring_service.CreateModelMonitorRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -311,7 +399,7 @@ def update_model_monitor( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_model_monitor" not in self._stubs: - self._stubs["update_model_monitor"] = self.grpc_channel.unary_unary( + self._stubs["update_model_monitor"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.ModelMonitoringService/UpdateModelMonitor", request_serializer=model_monitoring_service.UpdateModelMonitorRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -339,7 +427,7 @@ def get_model_monitor( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_model_monitor" not in self._stubs: - self._stubs["get_model_monitor"] = self.grpc_channel.unary_unary( + self._stubs["get_model_monitor"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.ModelMonitoringService/GetModelMonitor", request_serializer=model_monitoring_service.GetModelMonitorRequest.serialize, response_deserializer=model_monitor.ModelMonitor.deserialize, @@ -368,7 +456,7 @@ def list_model_monitors( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_model_monitors" not in self._stubs: - self._stubs["list_model_monitors"] = self.grpc_channel.unary_unary( + self._stubs["list_model_monitors"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.ModelMonitoringService/ListModelMonitors", request_serializer=model_monitoring_service.ListModelMonitorsRequest.serialize, response_deserializer=model_monitoring_service.ListModelMonitorsResponse.deserialize, @@ -396,7 +484,7 @@ def delete_model_monitor( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_model_monitor" not in self._stubs: - self._stubs["delete_model_monitor"] = self.grpc_channel.unary_unary( + self._stubs["delete_model_monitor"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.ModelMonitoringService/DeleteModelMonitor", request_serializer=model_monitoring_service.DeleteModelMonitorRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -425,7 +513,9 @@ def create_model_monitoring_job( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_model_monitoring_job" not in self._stubs: - self._stubs["create_model_monitoring_job"] = self.grpc_channel.unary_unary( + self._stubs[ + "create_model_monitoring_job" + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.ModelMonitoringService/CreateModelMonitoringJob", request_serializer=model_monitoring_service.CreateModelMonitoringJobRequest.serialize, response_deserializer=gca_model_monitoring_job.ModelMonitoringJob.deserialize, @@ -454,7 +544,7 @@ def get_model_monitoring_job( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_model_monitoring_job" not in self._stubs: - self._stubs["get_model_monitoring_job"] = self.grpc_channel.unary_unary( + self._stubs["get_model_monitoring_job"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.ModelMonitoringService/GetModelMonitoringJob", request_serializer=model_monitoring_service.GetModelMonitoringJobRequest.serialize, response_deserializer=model_monitoring_job.ModelMonitoringJob.deserialize, @@ -488,7 +578,9 @@ def list_model_monitoring_jobs( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_model_monitoring_jobs" not in self._stubs: - self._stubs["list_model_monitoring_jobs"] = self.grpc_channel.unary_unary( + self._stubs[ + "list_model_monitoring_jobs" + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.ModelMonitoringService/ListModelMonitoringJobs", request_serializer=model_monitoring_service.ListModelMonitoringJobsRequest.serialize, response_deserializer=model_monitoring_service.ListModelMonitoringJobsResponse.deserialize, @@ -517,7 +609,9 @@ def delete_model_monitoring_job( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_model_monitoring_job" not in self._stubs: - self._stubs["delete_model_monitoring_job"] = self.grpc_channel.unary_unary( + self._stubs[ + "delete_model_monitoring_job" + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.ModelMonitoringService/DeleteModelMonitoringJob", request_serializer=model_monitoring_service.DeleteModelMonitoringJobRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -549,7 +643,7 @@ def search_model_monitoring_stats( if "search_model_monitoring_stats" not in self._stubs: self._stubs[ "search_model_monitoring_stats" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.ModelMonitoringService/SearchModelMonitoringStats", request_serializer=model_monitoring_service.SearchModelMonitoringStatsRequest.serialize, response_deserializer=model_monitoring_service.SearchModelMonitoringStatsResponse.deserialize, @@ -580,7 +674,7 @@ def search_model_monitoring_alerts( if "search_model_monitoring_alerts" not in self._stubs: self._stubs[ "search_model_monitoring_alerts" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.ModelMonitoringService/SearchModelMonitoringAlerts", request_serializer=model_monitoring_service.SearchModelMonitoringAlertsRequest.serialize, response_deserializer=model_monitoring_service.SearchModelMonitoringAlertsResponse.deserialize, @@ -588,7 +682,7 @@ def search_model_monitoring_alerts( return self._stubs["search_model_monitoring_alerts"] def close(self): - self.grpc_channel.close() + self._logged_channel.close() @property def delete_operation( @@ -600,7 +694,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, @@ -617,7 +711,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -634,7 +728,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -651,7 +745,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, @@ -670,7 +764,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, @@ -689,7 +783,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -706,7 +800,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -731,7 +825,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -757,7 +851,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -786,7 +880,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1beta1/services/model_monitoring_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1beta1/services/model_monitoring_service/transports/grpc_asyncio.py index d9dc088a62..14baf7132a 100644 --- a/google/cloud/aiplatform_v1beta1/services/model_monitoring_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/model_monitoring_service/transports/grpc_asyncio.py @@ -14,6 +14,9 @@ # limitations under the License. # import inspect +import json +import pickle +import logging as std_logging import warnings from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union @@ -24,8 +27,11 @@ from google.api_core import operations_v1 from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from grpc.experimental import aio # type: ignore from google.cloud.aiplatform_v1beta1.types import model_monitor @@ -41,6 +47,82 @@ from .base import ModelMonitoringServiceTransport, DEFAULT_CLIENT_INFO from .grpc import ModelMonitoringServiceGrpcTransport +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.aiplatform.v1beta1.ModelMonitoringService", + "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.aiplatform.v1beta1.ModelMonitoringService", + "rpcName": str(client_call_details.method), + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class ModelMonitoringServiceGrpcAsyncIOTransport(ModelMonitoringServiceTransport): """gRPC AsyncIO backend transport for ModelMonitoringService. @@ -240,10 +322,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 @@ -266,7 +351,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. @@ -294,7 +379,7 @@ def create_model_monitor( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_model_monitor" not in self._stubs: - self._stubs["create_model_monitor"] = self.grpc_channel.unary_unary( + self._stubs["create_model_monitor"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.ModelMonitoringService/CreateModelMonitor", request_serializer=model_monitoring_service.CreateModelMonitorRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -323,7 +408,7 @@ def update_model_monitor( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_model_monitor" not in self._stubs: - self._stubs["update_model_monitor"] = self.grpc_channel.unary_unary( + self._stubs["update_model_monitor"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.ModelMonitoringService/UpdateModelMonitor", request_serializer=model_monitoring_service.UpdateModelMonitorRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -352,7 +437,7 @@ def get_model_monitor( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_model_monitor" not in self._stubs: - self._stubs["get_model_monitor"] = self.grpc_channel.unary_unary( + self._stubs["get_model_monitor"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.ModelMonitoringService/GetModelMonitor", request_serializer=model_monitoring_service.GetModelMonitorRequest.serialize, response_deserializer=model_monitor.ModelMonitor.deserialize, @@ -381,7 +466,7 @@ def list_model_monitors( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_model_monitors" not in self._stubs: - self._stubs["list_model_monitors"] = self.grpc_channel.unary_unary( + self._stubs["list_model_monitors"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.ModelMonitoringService/ListModelMonitors", request_serializer=model_monitoring_service.ListModelMonitorsRequest.serialize, response_deserializer=model_monitoring_service.ListModelMonitorsResponse.deserialize, @@ -410,7 +495,7 @@ def delete_model_monitor( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_model_monitor" not in self._stubs: - self._stubs["delete_model_monitor"] = self.grpc_channel.unary_unary( + self._stubs["delete_model_monitor"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.ModelMonitoringService/DeleteModelMonitor", request_serializer=model_monitoring_service.DeleteModelMonitorRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -439,7 +524,9 @@ def create_model_monitoring_job( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_model_monitoring_job" not in self._stubs: - self._stubs["create_model_monitoring_job"] = self.grpc_channel.unary_unary( + self._stubs[ + "create_model_monitoring_job" + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.ModelMonitoringService/CreateModelMonitoringJob", request_serializer=model_monitoring_service.CreateModelMonitoringJobRequest.serialize, response_deserializer=gca_model_monitoring_job.ModelMonitoringJob.deserialize, @@ -468,7 +555,7 @@ def get_model_monitoring_job( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_model_monitoring_job" not in self._stubs: - self._stubs["get_model_monitoring_job"] = self.grpc_channel.unary_unary( + self._stubs["get_model_monitoring_job"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.ModelMonitoringService/GetModelMonitoringJob", request_serializer=model_monitoring_service.GetModelMonitoringJobRequest.serialize, response_deserializer=model_monitoring_job.ModelMonitoringJob.deserialize, @@ -502,7 +589,9 @@ def list_model_monitoring_jobs( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_model_monitoring_jobs" not in self._stubs: - self._stubs["list_model_monitoring_jobs"] = self.grpc_channel.unary_unary( + self._stubs[ + "list_model_monitoring_jobs" + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.ModelMonitoringService/ListModelMonitoringJobs", request_serializer=model_monitoring_service.ListModelMonitoringJobsRequest.serialize, response_deserializer=model_monitoring_service.ListModelMonitoringJobsResponse.deserialize, @@ -531,7 +620,9 @@ def delete_model_monitoring_job( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_model_monitoring_job" not in self._stubs: - self._stubs["delete_model_monitoring_job"] = self.grpc_channel.unary_unary( + self._stubs[ + "delete_model_monitoring_job" + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.ModelMonitoringService/DeleteModelMonitoringJob", request_serializer=model_monitoring_service.DeleteModelMonitoringJobRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -563,7 +654,7 @@ def search_model_monitoring_stats( if "search_model_monitoring_stats" not in self._stubs: self._stubs[ "search_model_monitoring_stats" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.ModelMonitoringService/SearchModelMonitoringStats", request_serializer=model_monitoring_service.SearchModelMonitoringStatsRequest.serialize, response_deserializer=model_monitoring_service.SearchModelMonitoringStatsResponse.deserialize, @@ -594,7 +685,7 @@ def search_model_monitoring_alerts( if "search_model_monitoring_alerts" not in self._stubs: self._stubs[ "search_model_monitoring_alerts" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.ModelMonitoringService/SearchModelMonitoringAlerts", request_serializer=model_monitoring_service.SearchModelMonitoringAlertsRequest.serialize, response_deserializer=model_monitoring_service.SearchModelMonitoringAlertsResponse.deserialize, @@ -717,7 +808,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: @@ -733,7 +824,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, @@ -750,7 +841,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -767,7 +858,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -784,7 +875,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, @@ -803,7 +894,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, @@ -822,7 +913,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -839,7 +930,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -864,7 +955,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -890,7 +981,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -919,7 +1010,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1beta1/services/model_monitoring_service/transports/rest.py b/google/cloud/aiplatform_v1beta1/services/model_monitoring_service/transports/rest.py index 9d484bc362..87835d8c18 100644 --- a/google/cloud/aiplatform_v1beta1/services/model_monitoring_service/transports/rest.py +++ b/google/cloud/aiplatform_v1beta1/services/model_monitoring_service/transports/rest.py @@ -13,9 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging +import json # type: ignore from google.auth.transport.requests import AuthorizedSession # type: ignore -import json # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.api_core import exceptions as core_exceptions from google.api_core import retry as retries @@ -52,6 +53,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, @@ -172,9 +181,10 @@ def post_update_model_monitor(self, response): def pre_create_model_monitor( self, request: model_monitoring_service.CreateModelMonitorRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - model_monitoring_service.CreateModelMonitorRequest, Sequence[Tuple[str, str]] + model_monitoring_service.CreateModelMonitorRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for create_model_monitor @@ -197,10 +207,10 @@ def post_create_model_monitor( def pre_create_model_monitoring_job( self, request: model_monitoring_service.CreateModelMonitoringJobRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ model_monitoring_service.CreateModelMonitoringJobRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for create_model_monitoring_job @@ -223,9 +233,10 @@ def post_create_model_monitoring_job( def pre_delete_model_monitor( self, request: model_monitoring_service.DeleteModelMonitorRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - model_monitoring_service.DeleteModelMonitorRequest, Sequence[Tuple[str, str]] + model_monitoring_service.DeleteModelMonitorRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for delete_model_monitor @@ -248,10 +259,10 @@ def post_delete_model_monitor( def pre_delete_model_monitoring_job( self, request: model_monitoring_service.DeleteModelMonitoringJobRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ model_monitoring_service.DeleteModelMonitoringJobRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for delete_model_monitoring_job @@ -274,9 +285,10 @@ def post_delete_model_monitoring_job( def pre_get_model_monitor( self, request: model_monitoring_service.GetModelMonitorRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - model_monitoring_service.GetModelMonitorRequest, Sequence[Tuple[str, str]] + model_monitoring_service.GetModelMonitorRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for get_model_monitor @@ -299,9 +311,10 @@ def post_get_model_monitor( def pre_get_model_monitoring_job( self, request: model_monitoring_service.GetModelMonitoringJobRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - model_monitoring_service.GetModelMonitoringJobRequest, Sequence[Tuple[str, str]] + model_monitoring_service.GetModelMonitoringJobRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for get_model_monitoring_job @@ -324,10 +337,10 @@ def post_get_model_monitoring_job( def pre_list_model_monitoring_jobs( self, request: model_monitoring_service.ListModelMonitoringJobsRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ model_monitoring_service.ListModelMonitoringJobsRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for list_model_monitoring_jobs @@ -350,9 +363,10 @@ def post_list_model_monitoring_jobs( def pre_list_model_monitors( self, request: model_monitoring_service.ListModelMonitorsRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - model_monitoring_service.ListModelMonitorsRequest, Sequence[Tuple[str, str]] + model_monitoring_service.ListModelMonitorsRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for list_model_monitors @@ -375,10 +389,10 @@ def post_list_model_monitors( def pre_search_model_monitoring_alerts( self, request: model_monitoring_service.SearchModelMonitoringAlertsRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ model_monitoring_service.SearchModelMonitoringAlertsRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for search_model_monitoring_alerts @@ -401,10 +415,10 @@ def post_search_model_monitoring_alerts( def pre_search_model_monitoring_stats( self, request: model_monitoring_service.SearchModelMonitoringStatsRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ model_monitoring_service.SearchModelMonitoringStatsRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for search_model_monitoring_stats @@ -427,9 +441,10 @@ def post_search_model_monitoring_stats( def pre_update_model_monitor( self, request: model_monitoring_service.UpdateModelMonitorRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - model_monitoring_service.UpdateModelMonitorRequest, Sequence[Tuple[str, str]] + model_monitoring_service.UpdateModelMonitorRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for update_model_monitor @@ -452,8 +467,10 @@ def post_update_model_monitor( def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -475,8 +492,10 @@ def post_get_location( def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -498,8 +517,10 @@ def post_list_locations( def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -519,8 +540,10 @@ def post_get_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -540,8 +563,11 @@ def post_set_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -563,8 +589,10 @@ def post_test_iam_permissions( def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -584,8 +612,10 @@ def post_cancel_operation(self, response: None) -> None: 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 @@ -605,8 +635,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 @@ -628,8 +660,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 @@ -651,8 +685,10 @@ def post_list_operations( def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -1334,6 +1370,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -1550,6 +1590,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -1756,6 +1800,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}", @@ -1972,6 +2020,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, ], "google.longrunning.Operations.ListOperations": [ { @@ -2170,6 +2222,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*}/operations", @@ -2386,6 +2442,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*}/operations", + }, ], "google.longrunning.Operations.WaitOperation": [ { @@ -2584,6 +2644,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "post", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}:wait", @@ -2796,6 +2860,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, ], } @@ -2852,7 +2920,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 model monitor method over HTTP. @@ -2863,8 +2931,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: @@ -2877,6 +2947,7 @@ def __call__( http_options = ( _BaseModelMonitoringServiceRestTransport._BaseCreateModelMonitor._get_http_options() ) + request, metadata = self._interceptor.pre_create_model_monitor( request, metadata ) @@ -2893,6 +2964,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.aiplatform_v1beta1.ModelMonitoringServiceClient.CreateModelMonitor", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelMonitoringService", + "rpcName": "CreateModelMonitor", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( ModelMonitoringServiceRestTransport._CreateModelMonitor._get_response( @@ -2914,7 +3012,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_model_monitor(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.aiplatform_v1beta1.ModelMonitoringServiceClient.create_model_monitor", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelMonitoringService", + "rpcName": "CreateModelMonitor", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _CreateModelMonitoringJob( @@ -2954,7 +3074,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]]] = (), ) -> gca_model_monitoring_job.ModelMonitoringJob: r"""Call the create model monitoring job method over HTTP. @@ -2966,8 +3086,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: ~.gca_model_monitoring_job.ModelMonitoringJob: @@ -2980,6 +3102,7 @@ def __call__( http_options = ( _BaseModelMonitoringServiceRestTransport._BaseCreateModelMonitoringJob._get_http_options() ) + request, metadata = self._interceptor.pre_create_model_monitoring_job( request, metadata ) @@ -2996,6 +3119,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.aiplatform_v1beta1.ModelMonitoringServiceClient.CreateModelMonitoringJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelMonitoringService", + "rpcName": "CreateModelMonitoringJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ModelMonitoringServiceRestTransport._CreateModelMonitoringJob._get_response( self._host, @@ -3017,7 +3167,31 @@ def __call__( pb_resp = gca_model_monitoring_job.ModelMonitoringJob.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_create_model_monitoring_job(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + gca_model_monitoring_job.ModelMonitoringJob.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.aiplatform_v1beta1.ModelMonitoringServiceClient.create_model_monitoring_job", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelMonitoringService", + "rpcName": "CreateModelMonitoringJob", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _DeleteModelMonitor( @@ -3056,7 +3230,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 model monitor method over HTTP. @@ -3067,8 +3241,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: @@ -3081,6 +3257,7 @@ def __call__( http_options = ( _BaseModelMonitoringServiceRestTransport._BaseDeleteModelMonitor._get_http_options() ) + request, metadata = self._interceptor.pre_delete_model_monitor( request, metadata ) @@ -3093,6 +3270,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.aiplatform_v1beta1.ModelMonitoringServiceClient.DeleteModelMonitor", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelMonitoringService", + "rpcName": "DeleteModelMonitor", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( ModelMonitoringServiceRestTransport._DeleteModelMonitor._get_response( @@ -3113,7 +3317,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_model_monitor(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.aiplatform_v1beta1.ModelMonitoringServiceClient.delete_model_monitor", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelMonitoringService", + "rpcName": "DeleteModelMonitor", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _DeleteModelMonitoringJob( @@ -3152,7 +3378,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 model monitoring job method over HTTP. @@ -3164,8 +3390,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: @@ -3178,6 +3406,7 @@ def __call__( http_options = ( _BaseModelMonitoringServiceRestTransport._BaseDeleteModelMonitoringJob._get_http_options() ) + request, metadata = self._interceptor.pre_delete_model_monitoring_job( request, metadata ) @@ -3190,6 +3419,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.aiplatform_v1beta1.ModelMonitoringServiceClient.DeleteModelMonitoringJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelMonitoringService", + "rpcName": "DeleteModelMonitoringJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ModelMonitoringServiceRestTransport._DeleteModelMonitoringJob._get_response( self._host, @@ -3208,7 +3464,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_model_monitoring_job(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.aiplatform_v1beta1.ModelMonitoringServiceClient.delete_model_monitoring_job", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelMonitoringService", + "rpcName": "DeleteModelMonitoringJob", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _GetModelMonitor( @@ -3247,7 +3525,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]]] = (), ) -> model_monitor.ModelMonitor: r"""Call the get model monitor method over HTTP. @@ -3258,8 +3536,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: ~.model_monitor.ModelMonitor: @@ -3276,6 +3556,7 @@ def __call__( http_options = ( _BaseModelMonitoringServiceRestTransport._BaseGetModelMonitor._get_http_options() ) + request, metadata = self._interceptor.pre_get_model_monitor( request, metadata ) @@ -3288,6 +3569,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.aiplatform_v1beta1.ModelMonitoringServiceClient.GetModelMonitor", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelMonitoringService", + "rpcName": "GetModelMonitor", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( ModelMonitoringServiceRestTransport._GetModelMonitor._get_response( @@ -3310,7 +3618,29 @@ def __call__( pb_resp = model_monitor.ModelMonitor.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_model_monitor(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = model_monitor.ModelMonitor.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.aiplatform_v1beta1.ModelMonitoringServiceClient.get_model_monitor", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelMonitoringService", + "rpcName": "GetModelMonitor", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _GetModelMonitoringJob( @@ -3349,7 +3679,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]]] = (), ) -> model_monitoring_job.ModelMonitoringJob: r"""Call the get model monitoring job method over HTTP. @@ -3360,8 +3690,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: ~.model_monitoring_job.ModelMonitoringJob: @@ -3374,6 +3706,7 @@ def __call__( http_options = ( _BaseModelMonitoringServiceRestTransport._BaseGetModelMonitoringJob._get_http_options() ) + request, metadata = self._interceptor.pre_get_model_monitoring_job( request, metadata ) @@ -3386,6 +3719,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.aiplatform_v1beta1.ModelMonitoringServiceClient.GetModelMonitoringJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelMonitoringService", + "rpcName": "GetModelMonitoringJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ModelMonitoringServiceRestTransport._GetModelMonitoringJob._get_response( self._host, @@ -3406,7 +3766,31 @@ def __call__( pb_resp = model_monitoring_job.ModelMonitoringJob.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_model_monitoring_job(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = model_monitoring_job.ModelMonitoringJob.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.aiplatform_v1beta1.ModelMonitoringServiceClient.get_model_monitoring_job", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelMonitoringService", + "rpcName": "GetModelMonitoringJob", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListModelMonitoringJobs( @@ -3445,7 +3829,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]]] = (), ) -> model_monitoring_service.ListModelMonitoringJobsResponse: r"""Call the list model monitoring jobs method over HTTP. @@ -3457,8 +3841,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: ~.model_monitoring_service.ListModelMonitoringJobsResponse: @@ -3470,6 +3856,7 @@ def __call__( http_options = ( _BaseModelMonitoringServiceRestTransport._BaseListModelMonitoringJobs._get_http_options() ) + request, metadata = self._interceptor.pre_list_model_monitoring_jobs( request, metadata ) @@ -3482,6 +3869,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.aiplatform_v1beta1.ModelMonitoringServiceClient.ListModelMonitoringJobs", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelMonitoringService", + "rpcName": "ListModelMonitoringJobs", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ModelMonitoringServiceRestTransport._ListModelMonitoringJobs._get_response( self._host, @@ -3502,7 +3916,31 @@ def __call__( pb_resp = model_monitoring_service.ListModelMonitoringJobsResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_model_monitoring_jobs(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = model_monitoring_service.ListModelMonitoringJobsResponse.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.aiplatform_v1beta1.ModelMonitoringServiceClient.list_model_monitoring_jobs", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelMonitoringService", + "rpcName": "ListModelMonitoringJobs", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListModelMonitors( @@ -3541,7 +3979,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]]] = (), ) -> model_monitoring_service.ListModelMonitorsResponse: r"""Call the list model monitors method over HTTP. @@ -3552,8 +3990,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: ~.model_monitoring_service.ListModelMonitorsResponse: @@ -3565,6 +4005,7 @@ def __call__( http_options = ( _BaseModelMonitoringServiceRestTransport._BaseListModelMonitors._get_http_options() ) + request, metadata = self._interceptor.pre_list_model_monitors( request, metadata ) @@ -3577,6 +4018,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.aiplatform_v1beta1.ModelMonitoringServiceClient.ListModelMonitors", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelMonitoringService", + "rpcName": "ListModelMonitors", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( ModelMonitoringServiceRestTransport._ListModelMonitors._get_response( @@ -3599,7 +4067,33 @@ def __call__( pb_resp = model_monitoring_service.ListModelMonitorsResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_model_monitors(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + model_monitoring_service.ListModelMonitorsResponse.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.aiplatform_v1beta1.ModelMonitoringServiceClient.list_model_monitors", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelMonitoringService", + "rpcName": "ListModelMonitors", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _SearchModelMonitoringAlerts( @@ -3641,7 +4135,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]]] = (), ) -> model_monitoring_service.SearchModelMonitoringAlertsResponse: r"""Call the search model monitoring alerts method over HTTP. @@ -3653,8 +4147,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: ~.model_monitoring_service.SearchModelMonitoringAlertsResponse: @@ -3666,6 +4162,7 @@ def __call__( http_options = ( _BaseModelMonitoringServiceRestTransport._BaseSearchModelMonitoringAlerts._get_http_options() ) + request, metadata = self._interceptor.pre_search_model_monitoring_alerts( request, metadata ) @@ -3682,6 +4179,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.aiplatform_v1beta1.ModelMonitoringServiceClient.SearchModelMonitoringAlerts", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelMonitoringService", + "rpcName": "SearchModelMonitoringAlerts", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ModelMonitoringServiceRestTransport._SearchModelMonitoringAlerts._get_response( self._host, @@ -3705,7 +4229,31 @@ def __call__( ) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_search_model_monitoring_alerts(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = model_monitoring_service.SearchModelMonitoringAlertsResponse.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.aiplatform_v1beta1.ModelMonitoringServiceClient.search_model_monitoring_alerts", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelMonitoringService", + "rpcName": "SearchModelMonitoringAlerts", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _SearchModelMonitoringStats( @@ -3747,7 +4295,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]]] = (), ) -> model_monitoring_service.SearchModelMonitoringStatsResponse: r"""Call the search model monitoring stats method over HTTP. @@ -3759,8 +4307,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: ~.model_monitoring_service.SearchModelMonitoringStatsResponse: @@ -3772,6 +4322,7 @@ def __call__( http_options = ( _BaseModelMonitoringServiceRestTransport._BaseSearchModelMonitoringStats._get_http_options() ) + request, metadata = self._interceptor.pre_search_model_monitoring_stats( request, metadata ) @@ -3788,6 +4339,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.aiplatform_v1beta1.ModelMonitoringServiceClient.SearchModelMonitoringStats", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelMonitoringService", + "rpcName": "SearchModelMonitoringStats", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ModelMonitoringServiceRestTransport._SearchModelMonitoringStats._get_response( self._host, @@ -3811,7 +4389,31 @@ def __call__( ) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_search_model_monitoring_stats(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = model_monitoring_service.SearchModelMonitoringStatsResponse.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.aiplatform_v1beta1.ModelMonitoringServiceClient.search_model_monitoring_stats", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelMonitoringService", + "rpcName": "SearchModelMonitoringStats", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _UpdateModelMonitor( @@ -3851,7 +4453,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 model monitor method over HTTP. @@ -3862,8 +4464,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: @@ -3876,6 +4480,7 @@ def __call__( http_options = ( _BaseModelMonitoringServiceRestTransport._BaseUpdateModelMonitor._get_http_options() ) + request, metadata = self._interceptor.pre_update_model_monitor( request, metadata ) @@ -3892,6 +4497,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.aiplatform_v1beta1.ModelMonitoringServiceClient.UpdateModelMonitor", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelMonitoringService", + "rpcName": "UpdateModelMonitor", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( ModelMonitoringServiceRestTransport._UpdateModelMonitor._get_response( @@ -3913,7 +4545,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_model_monitor(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.aiplatform_v1beta1.ModelMonitoringServiceClient.update_model_monitor", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelMonitoringService", + "rpcName": "UpdateModelMonitor", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp @property @@ -4073,7 +4727,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]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -4084,8 +4738,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: locations_pb2.Location: Response from GetLocation method. @@ -4094,6 +4750,7 @@ def __call__( http_options = ( _BaseModelMonitoringServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = self._interceptor.pre_get_location(request, metadata) transcoded_request = _BaseModelMonitoringServiceRestTransport._BaseGetLocation._get_transcoded_request( http_options, request @@ -4104,6 +4761,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.aiplatform_v1beta1.ModelMonitoringServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelMonitoringService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ModelMonitoringServiceRestTransport._GetLocation._get_response( self._host, @@ -4123,6 +4807,27 @@ def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_location(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.aiplatform_v1beta1.ModelMonitoringServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelMonitoringService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4165,7 +4870,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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -4176,8 +4881,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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -4186,6 +4893,7 @@ def __call__( http_options = ( _BaseModelMonitoringServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = self._interceptor.pre_list_locations(request, metadata) transcoded_request = _BaseModelMonitoringServiceRestTransport._BaseListLocations._get_transcoded_request( http_options, request @@ -4196,6 +4904,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.aiplatform_v1beta1.ModelMonitoringServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelMonitoringService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ModelMonitoringServiceRestTransport._ListLocations._get_response( self._host, @@ -4215,6 +4950,27 @@ def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_list_locations(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.aiplatform_v1beta1.ModelMonitoringServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelMonitoringService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4258,7 +5014,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]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -4269,8 +5025,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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -4279,6 +5037,7 @@ def __call__( http_options = ( _BaseModelMonitoringServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_get_iam_policy(request, metadata) transcoded_request = _BaseModelMonitoringServiceRestTransport._BaseGetIamPolicy._get_transcoded_request( http_options, request @@ -4293,6 +5052,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.aiplatform_v1beta1.ModelMonitoringServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelMonitoringService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ModelMonitoringServiceRestTransport._GetIamPolicy._get_response( self._host, @@ -4313,6 +5099,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_iam_policy(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.aiplatform_v1beta1.ModelMonitoringServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelMonitoringService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4356,7 +5163,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]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -4367,8 +5174,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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -4377,6 +5186,7 @@ def __call__( http_options = ( _BaseModelMonitoringServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_set_iam_policy(request, metadata) transcoded_request = _BaseModelMonitoringServiceRestTransport._BaseSetIamPolicy._get_transcoded_request( http_options, request @@ -4391,6 +5201,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.aiplatform_v1beta1.ModelMonitoringServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelMonitoringService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ModelMonitoringServiceRestTransport._SetIamPolicy._get_response( self._host, @@ -4411,6 +5248,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_set_iam_policy(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.aiplatform_v1beta1.ModelMonitoringServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelMonitoringService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4454,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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -4465,8 +5323,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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -4475,6 +5335,7 @@ def __call__( http_options = ( _BaseModelMonitoringServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -4491,6 +5352,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.aiplatform_v1beta1.ModelMonitoringServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelMonitoringService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( ModelMonitoringServiceRestTransport._TestIamPermissions._get_response( @@ -4513,6 +5401,27 @@ def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_test_iam_permissions(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.aiplatform_v1beta1.ModelMonitoringServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelMonitoringService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4555,7 +5464,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 cancel operation method over HTTP. @@ -4566,13 +5475,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 = ( _BaseModelMonitoringServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = self._interceptor.pre_cancel_operation( request, metadata ) @@ -4585,6 +5497,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.aiplatform_v1beta1.ModelMonitoringServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelMonitoringService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( ModelMonitoringServiceRestTransport._CancelOperation._get_response( @@ -4644,7 +5583,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. @@ -4655,13 +5594,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 = ( _BaseModelMonitoringServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = self._interceptor.pre_delete_operation( request, metadata ) @@ -4674,6 +5616,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.aiplatform_v1beta1.ModelMonitoringServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelMonitoringService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( ModelMonitoringServiceRestTransport._DeleteOperation._get_response( @@ -4733,7 +5702,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. @@ -4744,8 +5713,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. @@ -4754,6 +5725,7 @@ def __call__( http_options = ( _BaseModelMonitoringServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = self._interceptor.pre_get_operation(request, metadata) transcoded_request = _BaseModelMonitoringServiceRestTransport._BaseGetOperation._get_transcoded_request( http_options, request @@ -4764,6 +5736,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.aiplatform_v1beta1.ModelMonitoringServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelMonitoringService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ModelMonitoringServiceRestTransport._GetOperation._get_response( self._host, @@ -4783,6 +5782,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.aiplatform_v1beta1.ModelMonitoringServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelMonitoringService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4825,7 +5845,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. @@ -4836,8 +5856,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. @@ -4846,6 +5868,7 @@ def __call__( http_options = ( _BaseModelMonitoringServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = self._interceptor.pre_list_operations(request, metadata) transcoded_request = _BaseModelMonitoringServiceRestTransport._BaseListOperations._get_transcoded_request( http_options, request @@ -4856,6 +5879,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.aiplatform_v1beta1.ModelMonitoringServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelMonitoringService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( ModelMonitoringServiceRestTransport._ListOperations._get_response( @@ -4877,6 +5927,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.aiplatform_v1beta1.ModelMonitoringServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelMonitoringService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4919,7 +5990,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 wait operation method over HTTP. @@ -4930,8 +6001,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 WaitOperation method. @@ -4940,6 +6013,7 @@ def __call__( http_options = ( _BaseModelMonitoringServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = self._interceptor.pre_wait_operation(request, metadata) transcoded_request = _BaseModelMonitoringServiceRestTransport._BaseWaitOperation._get_transcoded_request( http_options, request @@ -4950,6 +6024,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.aiplatform_v1beta1.ModelMonitoringServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelMonitoringService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ModelMonitoringServiceRestTransport._WaitOperation._get_response( self._host, @@ -4969,6 +6070,27 @@ def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = self._interceptor.post_wait_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.aiplatform_v1beta1.ModelMonitoringServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelMonitoringService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1beta1/services/model_monitoring_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1beta1/services/model_monitoring_service/transports/rest_asyncio.py index f7aa636308..8063744467 100644 --- a/google/cloud/aiplatform_v1beta1/services/model_monitoring_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/model_monitoring_service/transports/rest_asyncio.py @@ -63,6 +63,18 @@ from .base import DEFAULT_CLIENT_INFO as BASE_DEFAULT_CLIENT_INFO + +import logging + +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__) + try: OptionalRetry = Union[retries.AsyncRetry, gapic_v1.method._MethodDefault, None] except AttributeError: # pragma: NO COVER @@ -187,9 +199,10 @@ async def post_update_model_monitor(self, response): async def pre_create_model_monitor( self, request: model_monitoring_service.CreateModelMonitorRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - model_monitoring_service.CreateModelMonitorRequest, Sequence[Tuple[str, str]] + model_monitoring_service.CreateModelMonitorRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for create_model_monitor @@ -212,10 +225,10 @@ async def post_create_model_monitor( async def pre_create_model_monitoring_job( self, request: model_monitoring_service.CreateModelMonitoringJobRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ model_monitoring_service.CreateModelMonitoringJobRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for create_model_monitoring_job @@ -238,9 +251,10 @@ async def post_create_model_monitoring_job( async def pre_delete_model_monitor( self, request: model_monitoring_service.DeleteModelMonitorRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - model_monitoring_service.DeleteModelMonitorRequest, Sequence[Tuple[str, str]] + model_monitoring_service.DeleteModelMonitorRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for delete_model_monitor @@ -263,10 +277,10 @@ async def post_delete_model_monitor( async def pre_delete_model_monitoring_job( self, request: model_monitoring_service.DeleteModelMonitoringJobRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ model_monitoring_service.DeleteModelMonitoringJobRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for delete_model_monitoring_job @@ -289,9 +303,10 @@ async def post_delete_model_monitoring_job( async def pre_get_model_monitor( self, request: model_monitoring_service.GetModelMonitorRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - model_monitoring_service.GetModelMonitorRequest, Sequence[Tuple[str, str]] + model_monitoring_service.GetModelMonitorRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for get_model_monitor @@ -314,9 +329,10 @@ async def post_get_model_monitor( async def pre_get_model_monitoring_job( self, request: model_monitoring_service.GetModelMonitoringJobRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - model_monitoring_service.GetModelMonitoringJobRequest, Sequence[Tuple[str, str]] + model_monitoring_service.GetModelMonitoringJobRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for get_model_monitoring_job @@ -339,10 +355,10 @@ async def post_get_model_monitoring_job( async def pre_list_model_monitoring_jobs( self, request: model_monitoring_service.ListModelMonitoringJobsRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ model_monitoring_service.ListModelMonitoringJobsRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for list_model_monitoring_jobs @@ -365,9 +381,10 @@ async def post_list_model_monitoring_jobs( async def pre_list_model_monitors( self, request: model_monitoring_service.ListModelMonitorsRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - model_monitoring_service.ListModelMonitorsRequest, Sequence[Tuple[str, str]] + model_monitoring_service.ListModelMonitorsRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for list_model_monitors @@ -390,10 +407,10 @@ async def post_list_model_monitors( async def pre_search_model_monitoring_alerts( self, request: model_monitoring_service.SearchModelMonitoringAlertsRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ model_monitoring_service.SearchModelMonitoringAlertsRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for search_model_monitoring_alerts @@ -416,10 +433,10 @@ async def post_search_model_monitoring_alerts( async def pre_search_model_monitoring_stats( self, request: model_monitoring_service.SearchModelMonitoringStatsRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ model_monitoring_service.SearchModelMonitoringStatsRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for search_model_monitoring_stats @@ -442,9 +459,10 @@ async def post_search_model_monitoring_stats( async def pre_update_model_monitor( self, request: model_monitoring_service.UpdateModelMonitorRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - model_monitoring_service.UpdateModelMonitorRequest, Sequence[Tuple[str, str]] + model_monitoring_service.UpdateModelMonitorRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for update_model_monitor @@ -467,8 +485,10 @@ async def post_update_model_monitor( async def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -490,8 +510,10 @@ async def post_get_location( async def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -513,8 +535,10 @@ async def post_list_locations( async def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -536,8 +560,10 @@ async def post_get_iam_policy( async def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -559,8 +585,11 @@ async def post_set_iam_policy( async def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -582,8 +611,10 @@ async def post_test_iam_permissions( async def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -603,8 +634,10 @@ async def post_cancel_operation(self, response: None) -> None: async 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 @@ -624,8 +657,10 @@ async def post_delete_operation(self, response: None) -> None: async 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 @@ -647,8 +682,10 @@ async def post_get_operation( async 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 @@ -670,8 +707,10 @@ async def post_list_operations( async def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -911,7 +950,7 @@ async 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 model monitor method over HTTP. @@ -922,8 +961,10 @@ async def __call__( 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: @@ -936,6 +977,7 @@ async def __call__( http_options = ( _BaseModelMonitoringServiceRestTransport._BaseCreateModelMonitor._get_http_options() ) + request, metadata = await self._interceptor.pre_create_model_monitor( request, metadata ) @@ -952,6 +994,33 @@ async 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.aiplatform_v1beta1.ModelMonitoringServiceClient.CreateModelMonitor", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelMonitoringService", + "rpcName": "CreateModelMonitor", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncModelMonitoringServiceRestTransport._CreateModelMonitor._get_response( self._host, @@ -980,6 +1049,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_create_model_monitor(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.ModelMonitoringServiceAsyncClient.create_model_monitor", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelMonitoringService", + "rpcName": "CreateModelMonitor", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _CreateModelMonitoringJob( @@ -1021,7 +1112,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> gca_model_monitoring_job.ModelMonitoringJob: r"""Call the create model monitoring job method over HTTP. @@ -1033,8 +1124,10 @@ async def __call__( 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: ~.gca_model_monitoring_job.ModelMonitoringJob: @@ -1047,6 +1140,7 @@ async def __call__( http_options = ( _BaseModelMonitoringServiceRestTransport._BaseCreateModelMonitoringJob._get_http_options() ) + request, metadata = await self._interceptor.pre_create_model_monitoring_job( request, metadata ) @@ -1063,6 +1157,33 @@ async 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.aiplatform_v1beta1.ModelMonitoringServiceClient.CreateModelMonitoringJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelMonitoringService", + "rpcName": "CreateModelMonitoringJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncModelMonitoringServiceRestTransport._CreateModelMonitoringJob._get_response( self._host, @@ -1091,6 +1212,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_create_model_monitoring_job(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + gca_model_monitoring_job.ModelMonitoringJob.to_json(response) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.ModelMonitoringServiceAsyncClient.create_model_monitoring_job", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelMonitoringService", + "rpcName": "CreateModelMonitoringJob", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _DeleteModelMonitor( @@ -1129,7 +1274,7 @@ async 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 model monitor method over HTTP. @@ -1140,8 +1285,10 @@ async def __call__( 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: @@ -1154,6 +1301,7 @@ async def __call__( http_options = ( _BaseModelMonitoringServiceRestTransport._BaseDeleteModelMonitor._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_model_monitor( request, metadata ) @@ -1166,6 +1314,33 @@ async 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.aiplatform_v1beta1.ModelMonitoringServiceClient.DeleteModelMonitor", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelMonitoringService", + "rpcName": "DeleteModelMonitor", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncModelMonitoringServiceRestTransport._DeleteModelMonitor._get_response( self._host, @@ -1193,6 +1368,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_delete_model_monitor(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.ModelMonitoringServiceAsyncClient.delete_model_monitor", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelMonitoringService", + "rpcName": "DeleteModelMonitor", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _DeleteModelMonitoringJob( @@ -1233,7 +1430,7 @@ async 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 model monitoring job method over HTTP. @@ -1245,8 +1442,10 @@ async def __call__( 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: @@ -1259,6 +1458,7 @@ async def __call__( http_options = ( _BaseModelMonitoringServiceRestTransport._BaseDeleteModelMonitoringJob._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_model_monitoring_job( request, metadata ) @@ -1271,6 +1471,33 @@ async 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.aiplatform_v1beta1.ModelMonitoringServiceClient.DeleteModelMonitoringJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelMonitoringService", + "rpcName": "DeleteModelMonitoringJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncModelMonitoringServiceRestTransport._DeleteModelMonitoringJob._get_response( self._host, @@ -1298,6 +1525,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_delete_model_monitoring_job(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.ModelMonitoringServiceAsyncClient.delete_model_monitoring_job", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelMonitoringService", + "rpcName": "DeleteModelMonitoringJob", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _GetModelMonitor( @@ -1336,7 +1585,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> model_monitor.ModelMonitor: r"""Call the get model monitor method over HTTP. @@ -1347,8 +1596,10 @@ async def __call__( 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: ~.model_monitor.ModelMonitor: @@ -1365,6 +1616,7 @@ async def __call__( http_options = ( _BaseModelMonitoringServiceRestTransport._BaseGetModelMonitor._get_http_options() ) + request, metadata = await self._interceptor.pre_get_model_monitor( request, metadata ) @@ -1377,6 +1629,33 @@ async 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.aiplatform_v1beta1.ModelMonitoringServiceClient.GetModelMonitor", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelMonitoringService", + "rpcName": "GetModelMonitor", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncModelMonitoringServiceRestTransport._GetModelMonitor._get_response( self._host, @@ -1404,6 +1683,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_get_model_monitor(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = model_monitor.ModelMonitor.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.ModelMonitoringServiceAsyncClient.get_model_monitor", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelMonitoringService", + "rpcName": "GetModelMonitor", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _GetModelMonitoringJob( @@ -1444,7 +1745,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> model_monitoring_job.ModelMonitoringJob: r"""Call the get model monitoring job method over HTTP. @@ -1455,8 +1756,10 @@ async def __call__( 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: ~.model_monitoring_job.ModelMonitoringJob: @@ -1469,6 +1772,7 @@ async def __call__( http_options = ( _BaseModelMonitoringServiceRestTransport._BaseGetModelMonitoringJob._get_http_options() ) + request, metadata = await self._interceptor.pre_get_model_monitoring_job( request, metadata ) @@ -1481,6 +1785,33 @@ async 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.aiplatform_v1beta1.ModelMonitoringServiceClient.GetModelMonitoringJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelMonitoringService", + "rpcName": "GetModelMonitoringJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncModelMonitoringServiceRestTransport._GetModelMonitoringJob._get_response( self._host, @@ -1508,6 +1839,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_get_model_monitoring_job(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = model_monitoring_job.ModelMonitoringJob.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.ModelMonitoringServiceAsyncClient.get_model_monitoring_job", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelMonitoringService", + "rpcName": "GetModelMonitoringJob", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ListModelMonitoringJobs( @@ -1548,7 +1903,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> model_monitoring_service.ListModelMonitoringJobsResponse: r"""Call the list model monitoring jobs method over HTTP. @@ -1560,8 +1915,10 @@ async def __call__( 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: ~.model_monitoring_service.ListModelMonitoringJobsResponse: @@ -1573,6 +1930,7 @@ async def __call__( http_options = ( _BaseModelMonitoringServiceRestTransport._BaseListModelMonitoringJobs._get_http_options() ) + request, metadata = await self._interceptor.pre_list_model_monitoring_jobs( request, metadata ) @@ -1585,6 +1943,33 @@ async 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.aiplatform_v1beta1.ModelMonitoringServiceClient.ListModelMonitoringJobs", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelMonitoringService", + "rpcName": "ListModelMonitoringJobs", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncModelMonitoringServiceRestTransport._ListModelMonitoringJobs._get_response( self._host, @@ -1612,6 +1997,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_list_model_monitoring_jobs(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = model_monitoring_service.ListModelMonitoringJobsResponse.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.ModelMonitoringServiceAsyncClient.list_model_monitoring_jobs", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelMonitoringService", + "rpcName": "ListModelMonitoringJobs", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ListModelMonitors( @@ -1650,7 +2059,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> model_monitoring_service.ListModelMonitorsResponse: r"""Call the list model monitors method over HTTP. @@ -1661,8 +2070,10 @@ async def __call__( 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: ~.model_monitoring_service.ListModelMonitorsResponse: @@ -1674,6 +2085,7 @@ async def __call__( http_options = ( _BaseModelMonitoringServiceRestTransport._BaseListModelMonitors._get_http_options() ) + request, metadata = await self._interceptor.pre_list_model_monitors( request, metadata ) @@ -1686,6 +2098,33 @@ async 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.aiplatform_v1beta1.ModelMonitoringServiceClient.ListModelMonitors", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelMonitoringService", + "rpcName": "ListModelMonitors", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncModelMonitoringServiceRestTransport._ListModelMonitors._get_response( self._host, @@ -1713,6 +2152,32 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_list_model_monitors(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + model_monitoring_service.ListModelMonitorsResponse.to_json( + response + ) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.ModelMonitoringServiceAsyncClient.list_model_monitors", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelMonitoringService", + "rpcName": "ListModelMonitors", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _SearchModelMonitoringAlerts( @@ -1754,7 +2219,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> model_monitoring_service.SearchModelMonitoringAlertsResponse: r"""Call the search model monitoring alerts method over HTTP. @@ -1766,8 +2231,10 @@ async def __call__( 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: ~.model_monitoring_service.SearchModelMonitoringAlertsResponse: @@ -1779,6 +2246,7 @@ async def __call__( http_options = ( _BaseModelMonitoringServiceRestTransport._BaseSearchModelMonitoringAlerts._get_http_options() ) + ( request, metadata, @@ -1798,6 +2266,33 @@ async 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.aiplatform_v1beta1.ModelMonitoringServiceClient.SearchModelMonitoringAlerts", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelMonitoringService", + "rpcName": "SearchModelMonitoringAlerts", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncModelMonitoringServiceRestTransport._SearchModelMonitoringAlerts._get_response( self._host, @@ -1828,6 +2323,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_search_model_monitoring_alerts(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = model_monitoring_service.SearchModelMonitoringAlertsResponse.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.ModelMonitoringServiceAsyncClient.search_model_monitoring_alerts", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelMonitoringService", + "rpcName": "SearchModelMonitoringAlerts", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _SearchModelMonitoringStats( @@ -1869,7 +2388,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> model_monitoring_service.SearchModelMonitoringStatsResponse: r"""Call the search model monitoring stats method over HTTP. @@ -1881,8 +2400,10 @@ async def __call__( 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: ~.model_monitoring_service.SearchModelMonitoringStatsResponse: @@ -1894,6 +2415,7 @@ async def __call__( http_options = ( _BaseModelMonitoringServiceRestTransport._BaseSearchModelMonitoringStats._get_http_options() ) + ( request, metadata, @@ -1913,6 +2435,33 @@ async 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.aiplatform_v1beta1.ModelMonitoringServiceClient.SearchModelMonitoringStats", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelMonitoringService", + "rpcName": "SearchModelMonitoringStats", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncModelMonitoringServiceRestTransport._SearchModelMonitoringStats._get_response( self._host, @@ -1943,6 +2492,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_search_model_monitoring_stats(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = model_monitoring_service.SearchModelMonitoringStatsResponse.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.ModelMonitoringServiceAsyncClient.search_model_monitoring_stats", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelMonitoringService", + "rpcName": "SearchModelMonitoringStats", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _UpdateModelMonitor( @@ -1982,7 +2555,7 @@ async 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 model monitor method over HTTP. @@ -1993,8 +2566,10 @@ async def __call__( 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: @@ -2007,6 +2582,7 @@ async def __call__( http_options = ( _BaseModelMonitoringServiceRestTransport._BaseUpdateModelMonitor._get_http_options() ) + request, metadata = await self._interceptor.pre_update_model_monitor( request, metadata ) @@ -2023,6 +2599,33 @@ async 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.aiplatform_v1beta1.ModelMonitoringServiceClient.UpdateModelMonitor", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelMonitoringService", + "rpcName": "UpdateModelMonitor", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncModelMonitoringServiceRestTransport._UpdateModelMonitor._get_response( self._host, @@ -2051,6 +2654,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_update_model_monitor(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.ModelMonitoringServiceAsyncClient.update_model_monitor", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelMonitoringService", + "rpcName": "UpdateModelMonitor", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp @property @@ -2626,6 +3251,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -2842,6 +3471,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -3048,6 +3681,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}", @@ -3264,6 +3901,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, ], "google.longrunning.Operations.ListOperations": [ { @@ -3462,6 +4103,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*}/operations", @@ -3678,6 +4323,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*}/operations", + }, ], "google.longrunning.Operations.WaitOperation": [ { @@ -3876,6 +4525,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "post", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}:wait", @@ -4088,6 +4741,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, ], } @@ -4241,7 +4898,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -4252,8 +4909,10 @@ async def __call__( 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: locations_pb2.Location: Response from GetLocation method. @@ -4262,6 +4921,7 @@ async def __call__( http_options = ( _BaseModelMonitoringServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_location( request, metadata ) @@ -4274,6 +4934,33 @@ async 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.aiplatform_v1beta1.ModelMonitoringServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelMonitoringService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncModelMonitoringServiceRestTransport._GetLocation._get_response( self._host, @@ -4299,6 +4986,27 @@ async def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_location(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.aiplatform_v1beta1.ModelMonitoringServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelMonitoringService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4341,7 +5049,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -4352,8 +5060,10 @@ async def __call__( 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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -4362,6 +5072,7 @@ async def __call__( http_options = ( _BaseModelMonitoringServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_locations( request, metadata ) @@ -4374,6 +5085,33 @@ async 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.aiplatform_v1beta1.ModelMonitoringServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelMonitoringService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncModelMonitoringServiceRestTransport._ListLocations._get_response( self._host, @@ -4399,6 +5137,27 @@ async def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_list_locations(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.aiplatform_v1beta1.ModelMonitoringServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelMonitoringService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4442,7 +5201,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -4453,8 +5212,10 @@ async def __call__( 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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -4463,6 +5224,7 @@ async def __call__( http_options = ( _BaseModelMonitoringServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_get_iam_policy( request, metadata ) @@ -4479,6 +5241,33 @@ async 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.aiplatform_v1beta1.ModelMonitoringServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelMonitoringService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncModelMonitoringServiceRestTransport._GetIamPolicy._get_response( self._host, @@ -4505,6 +5294,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_iam_policy(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.aiplatform_v1beta1.ModelMonitoringServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelMonitoringService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4548,7 +5358,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -4559,8 +5369,10 @@ async def __call__( 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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -4569,6 +5381,7 @@ async def __call__( http_options = ( _BaseModelMonitoringServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_set_iam_policy( request, metadata ) @@ -4585,6 +5398,33 @@ async 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.aiplatform_v1beta1.ModelMonitoringServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelMonitoringService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncModelMonitoringServiceRestTransport._SetIamPolicy._get_response( self._host, @@ -4611,6 +5451,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_set_iam_policy(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.aiplatform_v1beta1.ModelMonitoringServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelMonitoringService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4654,7 +5515,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -4665,8 +5526,10 @@ async def __call__( 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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -4675,6 +5538,7 @@ async def __call__( http_options = ( _BaseModelMonitoringServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = await self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -4691,6 +5555,33 @@ async 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.aiplatform_v1beta1.ModelMonitoringServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelMonitoringService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncModelMonitoringServiceRestTransport._TestIamPermissions._get_response( self._host, @@ -4717,6 +5608,27 @@ async def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_test_iam_permissions(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.aiplatform_v1beta1.ModelMonitoringServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelMonitoringService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4759,7 +5671,7 @@ async 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 cancel operation method over HTTP. @@ -4770,13 +5682,16 @@ async def __call__( 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`. """ http_options = ( _BaseModelMonitoringServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_cancel_operation( request, metadata ) @@ -4789,6 +5704,33 @@ async 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.aiplatform_v1beta1.ModelMonitoringServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelMonitoringService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncModelMonitoringServiceRestTransport._CancelOperation._get_response( self._host, @@ -4852,7 +5794,7 @@ async 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. @@ -4863,13 +5805,16 @@ async def __call__( 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`. """ http_options = ( _BaseModelMonitoringServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_operation( request, metadata ) @@ -4882,6 +5827,33 @@ async 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.aiplatform_v1beta1.ModelMonitoringServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelMonitoringService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncModelMonitoringServiceRestTransport._DeleteOperation._get_response( self._host, @@ -4945,7 +5917,7 @@ async 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. @@ -4956,8 +5928,10 @@ async def __call__( 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: Response from GetOperation method. @@ -4966,6 +5940,7 @@ async def __call__( http_options = ( _BaseModelMonitoringServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_operation( request, metadata ) @@ -4978,6 +5953,33 @@ async 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.aiplatform_v1beta1.ModelMonitoringServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelMonitoringService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncModelMonitoringServiceRestTransport._GetOperation._get_response( self._host, @@ -5003,6 +6005,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1beta1.ModelMonitoringServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelMonitoringService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5045,7 +6068,7 @@ async 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. @@ -5056,8 +6079,10 @@ async def __call__( 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 from ListOperations method. @@ -5066,6 +6091,7 @@ async def __call__( http_options = ( _BaseModelMonitoringServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_operations( request, metadata ) @@ -5078,6 +6104,33 @@ async 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.aiplatform_v1beta1.ModelMonitoringServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelMonitoringService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncModelMonitoringServiceRestTransport._ListOperations._get_response( self._host, @@ -5103,6 +6156,27 @@ async def __call__( resp = operations_pb2.ListOperationsResponse() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1beta1.ModelMonitoringServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelMonitoringService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5145,7 +6219,7 @@ async 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 wait operation method over HTTP. @@ -5156,8 +6230,10 @@ async def __call__( 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: Response from WaitOperation method. @@ -5166,6 +6242,7 @@ async def __call__( http_options = ( _BaseModelMonitoringServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_wait_operation( request, metadata ) @@ -5178,6 +6255,33 @@ async 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.aiplatform_v1beta1.ModelMonitoringServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelMonitoringService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncModelMonitoringServiceRestTransport._WaitOperation._get_response( self._host, @@ -5203,6 +6307,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_wait_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.aiplatform_v1beta1.ModelMonitoringServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelMonitoringService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1beta1/services/model_monitoring_service/transports/rest_base.py b/google/cloud/aiplatform_v1beta1/services/model_monitoring_service/transports/rest_base.py index 7ef81494f2..c40dcd4429 100644 --- a/google/cloud/aiplatform_v1beta1/services/model_monitoring_service/transports/rest_base.py +++ b/google/cloud/aiplatform_v1beta1/services/model_monitoring_service/transports/rest_base.py @@ -1595,6 +1595,10 @@ def _get_http_options(): "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -1811,6 +1815,10 @@ def _get_http_options(): "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -2036,6 +2044,10 @@ def _get_http_options(): "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}", @@ -2252,6 +2264,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, ] return http_options @@ -2469,6 +2485,10 @@ def _get_http_options(): "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*}/operations", @@ -2685,6 +2705,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*}/operations", + }, ] return http_options @@ -2902,6 +2926,10 @@ def _get_http_options(): "method": "post", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}:wait", @@ -3114,6 +3142,10 @@ def _get_http_options(): "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, ] return http_options diff --git a/google/cloud/aiplatform_v1beta1/services/model_service/async_client.py b/google/cloud/aiplatform_v1beta1/services/model_service/async_client.py index 5081dd18ac..266c7068af 100644 --- a/google/cloud/aiplatform_v1beta1/services/model_service/async_client.py +++ b/google/cloud/aiplatform_v1beta1/services/model_service/async_client.py @@ -13,6 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging as std_logging from collections import OrderedDict import re from typing import ( @@ -71,6 +72,15 @@ from .transports.grpc_asyncio import ModelServiceGrpcAsyncIOTransport from .client import ModelServiceClient +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 ModelServiceAsyncClient: """A service for managing Vertex AI's machine learning Models.""" @@ -288,6 +298,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.aiplatform_v1beta1.ModelServiceAsyncClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelService", + "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.aiplatform.v1beta1.ModelService", + "credentialsType": None, + }, + ) + async def upload_model( self, request: Optional[Union[model_service.UploadModelRequest, dict]] = None, @@ -296,7 +328,7 @@ async def upload_model( model: Optional[gca_model.Model] = 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"""Uploads a Model artifact into Vertex AI. @@ -354,8 +386,10 @@ async def sample_upload_model(): 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: @@ -429,7 +463,7 @@ async def get_model( 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]]] = (), ) -> model.Model: r"""Gets a Model. @@ -484,8 +518,10 @@ async def sample_get_model(): 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.aiplatform_v1beta1.types.Model: @@ -544,7 +580,7 @@ async def list_models( 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.ListModelsAsyncPager: r"""Lists Models in a Location. @@ -590,8 +626,10 @@ async def sample_list_models(): 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.aiplatform_v1beta1.services.model_service.pagers.ListModelsAsyncPager: @@ -666,7 +704,7 @@ async def list_model_versions( 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]]] = (), ) -> pagers.ListModelVersionsAsyncPager: r"""Lists versions of the specified model. @@ -711,8 +749,10 @@ async def sample_list_model_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.aiplatform_v1beta1.services.model_service.pagers.ListModelVersionsAsyncPager: @@ -788,7 +828,7 @@ async def update_model( 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]]] = (), ) -> gca_model.Model: r"""Updates a Model. @@ -864,8 +904,10 @@ async def sample_update_model(): 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.aiplatform_v1beta1.types.Model: @@ -930,7 +972,7 @@ async def update_explanation_dataset( model: 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"""Incrementally update the dataset used for an examples model. @@ -980,8 +1022,10 @@ async def sample_update_explanation_dataset(): 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: @@ -1053,7 +1097,7 @@ async def delete_model( 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"""Deletes a Model. @@ -1110,8 +1154,10 @@ async def sample_delete_model(): 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: @@ -1190,7 +1236,7 @@ async def delete_model_version( 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"""Deletes a Model version. @@ -1248,8 +1294,10 @@ async def sample_delete_model_version(): 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: @@ -1329,7 +1377,7 @@ async def merge_version_aliases( version_aliases: Optional[MutableSequence[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]]] = (), ) -> model.Model: r"""Merges a set of aliases for a Model version. @@ -1397,8 +1445,10 @@ async def sample_merge_version_aliases(): 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.aiplatform_v1beta1.types.Model: @@ -1460,7 +1510,7 @@ async def export_model( output_config: Optional[model_service.ExportModelRequest.OutputConfig] = 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"""Exports a trained, exportable Model to a location specified by the user. A Model is considered to be exportable if it has at @@ -1522,8 +1572,10 @@ async def sample_export_model(): 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: @@ -1598,7 +1650,7 @@ async def copy_model( source_model: 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"""Copies an already existing Vertex AI Model into the specified Location. The source Model must exist in the same Project. When @@ -1662,8 +1714,10 @@ async def sample_copy_model(): 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: @@ -1740,7 +1794,7 @@ async def import_model_evaluation( model_evaluation: Optional[gca_model_evaluation.ModelEvaluation] = 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]]] = (), ) -> gca_model_evaluation.ModelEvaluation: r"""Imports an externally generated ModelEvaluation. @@ -1791,8 +1845,10 @@ async def sample_import_model_evaluation(): 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.aiplatform_v1beta1.types.ModelEvaluation: @@ -1862,7 +1918,7 @@ async def batch_import_model_evaluation_slices( ] = 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]]] = (), ) -> model_service.BatchImportModelEvaluationSlicesResponse: r"""Imports a list of externally generated ModelEvaluationSlice. @@ -1915,8 +1971,10 @@ async def sample_batch_import_model_evaluation_slices(): 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.aiplatform_v1beta1.types.BatchImportModelEvaluationSlicesResponse: @@ -1986,7 +2044,7 @@ async def batch_import_evaluated_annotations( ] = 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]]] = (), ) -> model_service.BatchImportEvaluatedAnnotationsResponse: r"""Imports a list of externally generated EvaluatedAnnotations. @@ -2039,8 +2097,10 @@ async def sample_batch_import_evaluated_annotations(): 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.aiplatform_v1beta1.types.BatchImportEvaluatedAnnotationsResponse: @@ -2105,7 +2165,7 @@ async def get_model_evaluation( 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]]] = (), ) -> model_evaluation.ModelEvaluation: r"""Gets a ModelEvaluation. @@ -2150,8 +2210,10 @@ async def sample_get_model_evaluation(): 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.aiplatform_v1beta1.types.ModelEvaluation: @@ -2216,7 +2278,7 @@ async def list_model_evaluations( 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.ListModelEvaluationsAsyncPager: r"""Lists ModelEvaluations in a Model. @@ -2262,8 +2324,10 @@ async def sample_list_model_evaluations(): 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.aiplatform_v1beta1.services.model_service.pagers.ListModelEvaluationsAsyncPager: @@ -2340,7 +2404,7 @@ async def get_model_evaluation_slice( 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]]] = (), ) -> model_evaluation_slice.ModelEvaluationSlice: r"""Gets a ModelEvaluationSlice. @@ -2385,8 +2449,10 @@ async def sample_get_model_evaluation_slice(): 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.aiplatform_v1beta1.types.ModelEvaluationSlice: @@ -2451,7 +2517,7 @@ async def list_model_evaluation_slices( 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.ListModelEvaluationSlicesAsyncPager: r"""Lists ModelEvaluationSlices in a ModelEvaluation. @@ -2497,8 +2563,10 @@ async def sample_list_model_evaluation_slices(): 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.aiplatform_v1beta1.services.model_service.pagers.ListModelEvaluationSlicesAsyncPager: @@ -2572,7 +2640,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. @@ -2583,8 +2651,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. @@ -2625,7 +2695,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. @@ -2636,8 +2706,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. @@ -2678,7 +2750,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. @@ -2694,8 +2766,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 """ @@ -2732,7 +2806,7 @@ async def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -2747,8 +2821,10 @@ async def cancel_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 """ @@ -2785,7 +2861,7 @@ async def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -2802,8 +2878,10 @@ async def wait_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. @@ -2844,7 +2922,7 @@ async def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -2857,8 +2935,10 @@ async def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -2963,7 +3043,7 @@ async def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -2977,8 +3057,10 @@ async def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -3083,7 +3165,7 @@ async def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -3098,8 +3180,10 @@ async def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -3143,7 +3227,7 @@ async def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -3154,8 +3238,10 @@ async def get_location( 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: ~.location_pb2.Location: Location object. @@ -3196,7 +3282,7 @@ async def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -3207,8 +3293,10 @@ async def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1beta1/services/model_service/client.py b/google/cloud/aiplatform_v1beta1/services/model_service/client.py index 5e6552841d..c7d0c8a40c 100644 --- a/google/cloud/aiplatform_v1beta1/services/model_service/client.py +++ b/google/cloud/aiplatform_v1beta1/services/model_service/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 ( @@ -48,6 +49,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 as gac_operation # type: ignore from google.api_core import operation_async # type: ignore from google.cloud.aiplatform_v1beta1.services.model_service import pagers @@ -705,6 +715,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( @@ -792,6 +806,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.aiplatform_v1beta1.ModelServiceClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelService", + "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.aiplatform.v1beta1.ModelService", + "credentialsType": None, + }, + ) + def upload_model( self, request: Optional[Union[model_service.UploadModelRequest, dict]] = None, @@ -800,7 +837,7 @@ def upload_model( model: Optional[gca_model.Model] = 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]]] = (), ) -> gac_operation.Operation: r"""Uploads a Model artifact into Vertex AI. @@ -858,8 +895,10 @@ def sample_upload_model(): 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: @@ -930,7 +969,7 @@ def get_model( 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]]] = (), ) -> model.Model: r"""Gets a Model. @@ -985,8 +1024,10 @@ def sample_get_model(): 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.aiplatform_v1beta1.types.Model: @@ -1042,7 +1083,7 @@ def list_models( 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.ListModelsPager: r"""Lists Models in a Location. @@ -1088,8 +1129,10 @@ def sample_list_models(): 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.aiplatform_v1beta1.services.model_service.pagers.ListModelsPager: @@ -1161,7 +1204,7 @@ def list_model_versions( 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]]] = (), ) -> pagers.ListModelVersionsPager: r"""Lists versions of the specified model. @@ -1206,8 +1249,10 @@ def sample_list_model_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.aiplatform_v1beta1.services.model_service.pagers.ListModelVersionsPager: @@ -1280,7 +1325,7 @@ def update_model( 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]]] = (), ) -> gca_model.Model: r"""Updates a Model. @@ -1356,8 +1401,10 @@ def sample_update_model(): 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.aiplatform_v1beta1.types.Model: @@ -1419,7 +1466,7 @@ def update_explanation_dataset( model: 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]]] = (), ) -> gac_operation.Operation: r"""Incrementally update the dataset used for an examples model. @@ -1469,8 +1516,10 @@ def sample_update_explanation_dataset(): 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: @@ -1541,7 +1590,7 @@ def delete_model( 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]]] = (), ) -> gac_operation.Operation: r"""Deletes a Model. @@ -1598,8 +1647,10 @@ def sample_delete_model(): 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: @@ -1675,7 +1726,7 @@ def delete_model_version( 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]]] = (), ) -> gac_operation.Operation: r"""Deletes a Model version. @@ -1733,8 +1784,10 @@ def sample_delete_model_version(): 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: @@ -1811,7 +1864,7 @@ def merge_version_aliases( version_aliases: Optional[MutableSequence[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]]] = (), ) -> model.Model: r"""Merges a set of aliases for a Model version. @@ -1879,8 +1932,10 @@ def sample_merge_version_aliases(): 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.aiplatform_v1beta1.types.Model: @@ -1939,7 +1994,7 @@ def export_model( output_config: Optional[model_service.ExportModelRequest.OutputConfig] = 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]]] = (), ) -> gac_operation.Operation: r"""Exports a trained, exportable Model to a location specified by the user. A Model is considered to be exportable if it has at @@ -2001,8 +2056,10 @@ def sample_export_model(): 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: @@ -2074,7 +2131,7 @@ def copy_model( source_model: 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]]] = (), ) -> gac_operation.Operation: r"""Copies an already existing Vertex AI Model into the specified Location. The source Model must exist in the same Project. When @@ -2138,8 +2195,10 @@ def sample_copy_model(): 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: @@ -2213,7 +2272,7 @@ def import_model_evaluation( model_evaluation: Optional[gca_model_evaluation.ModelEvaluation] = 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]]] = (), ) -> gca_model_evaluation.ModelEvaluation: r"""Imports an externally generated ModelEvaluation. @@ -2264,8 +2323,10 @@ def sample_import_model_evaluation(): 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.aiplatform_v1beta1.types.ModelEvaluation: @@ -2332,7 +2393,7 @@ def batch_import_model_evaluation_slices( ] = 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]]] = (), ) -> model_service.BatchImportModelEvaluationSlicesResponse: r"""Imports a list of externally generated ModelEvaluationSlice. @@ -2385,8 +2446,10 @@ def sample_batch_import_model_evaluation_slices(): 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.aiplatform_v1beta1.types.BatchImportModelEvaluationSlicesResponse: @@ -2455,7 +2518,7 @@ def batch_import_evaluated_annotations( ] = 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]]] = (), ) -> model_service.BatchImportEvaluatedAnnotationsResponse: r"""Imports a list of externally generated EvaluatedAnnotations. @@ -2508,8 +2571,10 @@ def sample_batch_import_evaluated_annotations(): 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.aiplatform_v1beta1.types.BatchImportEvaluatedAnnotationsResponse: @@ -2573,7 +2638,7 @@ def get_model_evaluation( 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]]] = (), ) -> model_evaluation.ModelEvaluation: r"""Gets a ModelEvaluation. @@ -2618,8 +2683,10 @@ def sample_get_model_evaluation(): 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.aiplatform_v1beta1.types.ModelEvaluation: @@ -2681,7 +2748,7 @@ def list_model_evaluations( 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.ListModelEvaluationsPager: r"""Lists ModelEvaluations in a Model. @@ -2727,8 +2794,10 @@ def sample_list_model_evaluations(): 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.aiplatform_v1beta1.services.model_service.pagers.ListModelEvaluationsPager: @@ -2802,7 +2871,7 @@ def get_model_evaluation_slice( 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]]] = (), ) -> model_evaluation_slice.ModelEvaluationSlice: r"""Gets a ModelEvaluationSlice. @@ -2847,8 +2916,10 @@ def sample_get_model_evaluation_slice(): 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.aiplatform_v1beta1.types.ModelEvaluationSlice: @@ -2912,7 +2983,7 @@ def list_model_evaluation_slices( 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.ListModelEvaluationSlicesPager: r"""Lists ModelEvaluationSlices in a ModelEvaluation. @@ -2958,8 +3029,10 @@ def sample_list_model_evaluation_slices(): 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.aiplatform_v1beta1.services.model_service.pagers.ListModelEvaluationSlicesPager: @@ -3045,7 +3118,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. @@ -3056,8 +3129,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. @@ -3098,7 +3173,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. @@ -3109,8 +3184,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. @@ -3151,7 +3228,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. @@ -3167,8 +3244,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 """ @@ -3205,7 +3284,7 @@ def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -3220,8 +3299,10 @@ def cancel_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 """ @@ -3258,7 +3339,7 @@ def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -3275,8 +3356,10 @@ def wait_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. @@ -3317,7 +3400,7 @@ def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -3330,8 +3413,10 @@ def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -3436,7 +3521,7 @@ def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -3450,8 +3535,10 @@ def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -3556,7 +3643,7 @@ def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -3571,8 +3658,10 @@ def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -3614,7 +3703,7 @@ def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -3625,8 +3714,10 @@ def get_location( 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: ~.location_pb2.Location: Location object. @@ -3667,7 +3758,7 @@ def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -3678,8 +3769,10 @@ def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1beta1/services/model_service/pagers.py b/google/cloud/aiplatform_v1beta1/services/model_service/pagers.py index 19e04948b7..330f393a33 100644 --- a/google/cloud/aiplatform_v1beta1/services/model_service/pagers.py +++ b/google/cloud/aiplatform_v1beta1/services/model_service/pagers.py @@ -69,7 +69,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. @@ -83,8 +83,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 = model_service.ListModelsRequest(request) @@ -143,7 +145,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. @@ -157,8 +159,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 = model_service.ListModelsRequest(request) @@ -221,7 +225,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. @@ -235,8 +239,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 = model_service.ListModelVersionsRequest(request) @@ -295,7 +301,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. @@ -309,8 +315,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 = model_service.ListModelVersionsRequest(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 = model_service.ListModelEvaluationsRequest(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 = model_service.ListModelEvaluationsRequest(request) @@ -525,7 +537,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. @@ -539,8 +551,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 = model_service.ListModelEvaluationSlicesRequest(request) @@ -601,7 +615,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. @@ -615,8 +629,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 = model_service.ListModelEvaluationSlicesRequest(request) diff --git a/google/cloud/aiplatform_v1beta1/services/model_service/transports/grpc.py b/google/cloud/aiplatform_v1beta1/services/model_service/transports/grpc.py index f3d68bac85..f80f83e303 100644 --- a/google/cloud/aiplatform_v1beta1/services/model_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1beta1/services/model_service/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 import warnings from typing import Callable, Dict, Optional, Sequence, Tuple, Union @@ -22,8 +25,11 @@ import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from google.cloud.aiplatform_v1beta1.types import model from google.cloud.aiplatform_v1beta1.types import model as gca_model @@ -39,6 +45,81 @@ from google.longrunning import operations_pb2 # type: ignore from .base import ModelServiceTransport, DEFAULT_CLIENT_INFO +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.aiplatform.v1beta1.ModelService", + "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.aiplatform.v1beta1.ModelService", + "rpcName": client_call_details.method, + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class ModelServiceGrpcTransport(ModelServiceTransport): """gRPC backend transport for ModelService. @@ -193,7 +274,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,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 @@ -281,7 +369,7 @@ def upload_model( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "upload_model" not in self._stubs: - self._stubs["upload_model"] = self.grpc_channel.unary_unary( + self._stubs["upload_model"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.ModelService/UploadModel", request_serializer=model_service.UploadModelRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -305,7 +393,7 @@ def get_model(self) -> Callable[[model_service.GetModelRequest], model.Model]: # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_model" not in self._stubs: - self._stubs["get_model"] = self.grpc_channel.unary_unary( + self._stubs["get_model"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.ModelService/GetModel", request_serializer=model_service.GetModelRequest.serialize, response_deserializer=model.Model.deserialize, @@ -331,7 +419,7 @@ def list_models( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_models" not in self._stubs: - self._stubs["list_models"] = self.grpc_channel.unary_unary( + self._stubs["list_models"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.ModelService/ListModels", request_serializer=model_service.ListModelsRequest.serialize, response_deserializer=model_service.ListModelsResponse.deserialize, @@ -360,7 +448,7 @@ def list_model_versions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_model_versions" not in self._stubs: - self._stubs["list_model_versions"] = self.grpc_channel.unary_unary( + self._stubs["list_model_versions"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.ModelService/ListModelVersions", request_serializer=model_service.ListModelVersionsRequest.serialize, response_deserializer=model_service.ListModelVersionsResponse.deserialize, @@ -386,7 +474,7 @@ def update_model( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_model" not in self._stubs: - self._stubs["update_model"] = self.grpc_channel.unary_unary( + self._stubs["update_model"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.ModelService/UpdateModel", request_serializer=model_service.UpdateModelRequest.serialize, response_deserializer=gca_model.Model.deserialize, @@ -415,7 +503,9 @@ def update_explanation_dataset( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_explanation_dataset" not in self._stubs: - self._stubs["update_explanation_dataset"] = self.grpc_channel.unary_unary( + self._stubs[ + "update_explanation_dataset" + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.ModelService/UpdateExplanationDataset", request_serializer=model_service.UpdateExplanationDatasetRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -449,7 +539,7 @@ def delete_model( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_model" not in self._stubs: - self._stubs["delete_model"] = self.grpc_channel.unary_unary( + self._stubs["delete_model"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.ModelService/DeleteModel", request_serializer=model_service.DeleteModelRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -482,7 +572,7 @@ def delete_model_version( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_model_version" not in self._stubs: - self._stubs["delete_model_version"] = self.grpc_channel.unary_unary( + self._stubs["delete_model_version"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.ModelService/DeleteModelVersion", request_serializer=model_service.DeleteModelVersionRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -508,7 +598,7 @@ def merge_version_aliases( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "merge_version_aliases" not in self._stubs: - self._stubs["merge_version_aliases"] = self.grpc_channel.unary_unary( + self._stubs["merge_version_aliases"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.ModelService/MergeVersionAliases", request_serializer=model_service.MergeVersionAliasesRequest.serialize, response_deserializer=model.Model.deserialize, @@ -537,7 +627,7 @@ def export_model( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "export_model" not in self._stubs: - self._stubs["export_model"] = self.grpc_channel.unary_unary( + self._stubs["export_model"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.ModelService/ExportModel", request_serializer=model_service.ExportModelRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -568,7 +658,7 @@ def copy_model( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "copy_model" not in self._stubs: - self._stubs["copy_model"] = self.grpc_channel.unary_unary( + self._stubs["copy_model"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.ModelService/CopyModel", request_serializer=model_service.CopyModelRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -597,7 +687,7 @@ def import_model_evaluation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "import_model_evaluation" not in self._stubs: - self._stubs["import_model_evaluation"] = self.grpc_channel.unary_unary( + self._stubs["import_model_evaluation"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.ModelService/ImportModelEvaluation", request_serializer=model_service.ImportModelEvaluationRequest.serialize, response_deserializer=gca_model_evaluation.ModelEvaluation.deserialize, @@ -630,7 +720,7 @@ def batch_import_model_evaluation_slices( if "batch_import_model_evaluation_slices" not in self._stubs: self._stubs[ "batch_import_model_evaluation_slices" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.ModelService/BatchImportModelEvaluationSlices", request_serializer=model_service.BatchImportModelEvaluationSlicesRequest.serialize, response_deserializer=model_service.BatchImportModelEvaluationSlicesResponse.deserialize, @@ -663,7 +753,7 @@ def batch_import_evaluated_annotations( if "batch_import_evaluated_annotations" not in self._stubs: self._stubs[ "batch_import_evaluated_annotations" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.ModelService/BatchImportEvaluatedAnnotations", request_serializer=model_service.BatchImportEvaluatedAnnotationsRequest.serialize, response_deserializer=model_service.BatchImportEvaluatedAnnotationsResponse.deserialize, @@ -691,7 +781,7 @@ def get_model_evaluation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_model_evaluation" not in self._stubs: - self._stubs["get_model_evaluation"] = self.grpc_channel.unary_unary( + self._stubs["get_model_evaluation"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.ModelService/GetModelEvaluation", request_serializer=model_service.GetModelEvaluationRequest.serialize, response_deserializer=model_evaluation.ModelEvaluation.deserialize, @@ -720,7 +810,7 @@ def list_model_evaluations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_model_evaluations" not in self._stubs: - self._stubs["list_model_evaluations"] = self.grpc_channel.unary_unary( + self._stubs["list_model_evaluations"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.ModelService/ListModelEvaluations", request_serializer=model_service.ListModelEvaluationsRequest.serialize, response_deserializer=model_service.ListModelEvaluationsResponse.deserialize, @@ -749,7 +839,9 @@ def get_model_evaluation_slice( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_model_evaluation_slice" not in self._stubs: - self._stubs["get_model_evaluation_slice"] = self.grpc_channel.unary_unary( + self._stubs[ + "get_model_evaluation_slice" + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.ModelService/GetModelEvaluationSlice", request_serializer=model_service.GetModelEvaluationSliceRequest.serialize, response_deserializer=model_evaluation_slice.ModelEvaluationSlice.deserialize, @@ -778,7 +870,9 @@ def list_model_evaluation_slices( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_model_evaluation_slices" not in self._stubs: - self._stubs["list_model_evaluation_slices"] = self.grpc_channel.unary_unary( + self._stubs[ + "list_model_evaluation_slices" + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.ModelService/ListModelEvaluationSlices", request_serializer=model_service.ListModelEvaluationSlicesRequest.serialize, response_deserializer=model_service.ListModelEvaluationSlicesResponse.deserialize, @@ -786,7 +880,7 @@ def list_model_evaluation_slices( return self._stubs["list_model_evaluation_slices"] def close(self): - self.grpc_channel.close() + self._logged_channel.close() @property def delete_operation( @@ -798,7 +892,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, @@ -815,7 +909,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -832,7 +926,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -849,7 +943,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, @@ -868,7 +962,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, @@ -887,7 +981,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -904,7 +998,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -929,7 +1023,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -955,7 +1049,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -984,7 +1078,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1beta1/services/model_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1beta1/services/model_service/transports/grpc_asyncio.py index 85156520c0..bc51b7ed75 100644 --- a/google/cloud/aiplatform_v1beta1/services/model_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/model_service/transports/grpc_asyncio.py @@ -14,6 +14,9 @@ # limitations under the License. # import inspect +import json +import pickle +import logging as std_logging import warnings from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union @@ -24,8 +27,11 @@ from google.api_core import operations_v1 from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from grpc.experimental import aio # type: ignore from google.cloud.aiplatform_v1beta1.types import model @@ -43,6 +49,82 @@ from .base import ModelServiceTransport, DEFAULT_CLIENT_INFO from .grpc import ModelServiceGrpcTransport +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.aiplatform.v1beta1.ModelService", + "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.aiplatform.v1beta1.ModelService", + "rpcName": str(client_call_details.method), + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class ModelServiceGrpcAsyncIOTransport(ModelServiceTransport): """gRPC AsyncIO backend transport for ModelService. @@ -240,10 +322,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 @@ -266,7 +351,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. @@ -293,7 +378,7 @@ def upload_model( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "upload_model" not in self._stubs: - self._stubs["upload_model"] = self.grpc_channel.unary_unary( + self._stubs["upload_model"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.ModelService/UploadModel", request_serializer=model_service.UploadModelRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -319,7 +404,7 @@ def get_model( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_model" not in self._stubs: - self._stubs["get_model"] = self.grpc_channel.unary_unary( + self._stubs["get_model"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.ModelService/GetModel", request_serializer=model_service.GetModelRequest.serialize, response_deserializer=model.Model.deserialize, @@ -347,7 +432,7 @@ def list_models( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_models" not in self._stubs: - self._stubs["list_models"] = self.grpc_channel.unary_unary( + self._stubs["list_models"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.ModelService/ListModels", request_serializer=model_service.ListModelsRequest.serialize, response_deserializer=model_service.ListModelsResponse.deserialize, @@ -376,7 +461,7 @@ def list_model_versions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_model_versions" not in self._stubs: - self._stubs["list_model_versions"] = self.grpc_channel.unary_unary( + self._stubs["list_model_versions"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.ModelService/ListModelVersions", request_serializer=model_service.ListModelVersionsRequest.serialize, response_deserializer=model_service.ListModelVersionsResponse.deserialize, @@ -402,7 +487,7 @@ def update_model( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_model" not in self._stubs: - self._stubs["update_model"] = self.grpc_channel.unary_unary( + self._stubs["update_model"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.ModelService/UpdateModel", request_serializer=model_service.UpdateModelRequest.serialize, response_deserializer=gca_model.Model.deserialize, @@ -432,7 +517,9 @@ def update_explanation_dataset( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_explanation_dataset" not in self._stubs: - self._stubs["update_explanation_dataset"] = self.grpc_channel.unary_unary( + self._stubs[ + "update_explanation_dataset" + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.ModelService/UpdateExplanationDataset", request_serializer=model_service.UpdateExplanationDatasetRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -468,7 +555,7 @@ def delete_model( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_model" not in self._stubs: - self._stubs["delete_model"] = self.grpc_channel.unary_unary( + self._stubs["delete_model"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.ModelService/DeleteModel", request_serializer=model_service.DeleteModelRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -503,7 +590,7 @@ def delete_model_version( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_model_version" not in self._stubs: - self._stubs["delete_model_version"] = self.grpc_channel.unary_unary( + self._stubs["delete_model_version"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.ModelService/DeleteModelVersion", request_serializer=model_service.DeleteModelVersionRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -529,7 +616,7 @@ def merge_version_aliases( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "merge_version_aliases" not in self._stubs: - self._stubs["merge_version_aliases"] = self.grpc_channel.unary_unary( + self._stubs["merge_version_aliases"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.ModelService/MergeVersionAliases", request_serializer=model_service.MergeVersionAliasesRequest.serialize, response_deserializer=model.Model.deserialize, @@ -560,7 +647,7 @@ def export_model( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "export_model" not in self._stubs: - self._stubs["export_model"] = self.grpc_channel.unary_unary( + self._stubs["export_model"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.ModelService/ExportModel", request_serializer=model_service.ExportModelRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -593,7 +680,7 @@ def copy_model( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "copy_model" not in self._stubs: - self._stubs["copy_model"] = self.grpc_channel.unary_unary( + self._stubs["copy_model"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.ModelService/CopyModel", request_serializer=model_service.CopyModelRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -622,7 +709,7 @@ def import_model_evaluation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "import_model_evaluation" not in self._stubs: - self._stubs["import_model_evaluation"] = self.grpc_channel.unary_unary( + self._stubs["import_model_evaluation"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.ModelService/ImportModelEvaluation", request_serializer=model_service.ImportModelEvaluationRequest.serialize, response_deserializer=gca_model_evaluation.ModelEvaluation.deserialize, @@ -655,7 +742,7 @@ def batch_import_model_evaluation_slices( if "batch_import_model_evaluation_slices" not in self._stubs: self._stubs[ "batch_import_model_evaluation_slices" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.ModelService/BatchImportModelEvaluationSlices", request_serializer=model_service.BatchImportModelEvaluationSlicesRequest.serialize, response_deserializer=model_service.BatchImportModelEvaluationSlicesResponse.deserialize, @@ -688,7 +775,7 @@ def batch_import_evaluated_annotations( if "batch_import_evaluated_annotations" not in self._stubs: self._stubs[ "batch_import_evaluated_annotations" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.ModelService/BatchImportEvaluatedAnnotations", request_serializer=model_service.BatchImportEvaluatedAnnotationsRequest.serialize, response_deserializer=model_service.BatchImportEvaluatedAnnotationsResponse.deserialize, @@ -717,7 +804,7 @@ def get_model_evaluation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_model_evaluation" not in self._stubs: - self._stubs["get_model_evaluation"] = self.grpc_channel.unary_unary( + self._stubs["get_model_evaluation"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.ModelService/GetModelEvaluation", request_serializer=model_service.GetModelEvaluationRequest.serialize, response_deserializer=model_evaluation.ModelEvaluation.deserialize, @@ -746,7 +833,7 @@ def list_model_evaluations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_model_evaluations" not in self._stubs: - self._stubs["list_model_evaluations"] = self.grpc_channel.unary_unary( + self._stubs["list_model_evaluations"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.ModelService/ListModelEvaluations", request_serializer=model_service.ListModelEvaluationsRequest.serialize, response_deserializer=model_service.ListModelEvaluationsResponse.deserialize, @@ -775,7 +862,9 @@ def get_model_evaluation_slice( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_model_evaluation_slice" not in self._stubs: - self._stubs["get_model_evaluation_slice"] = self.grpc_channel.unary_unary( + self._stubs[ + "get_model_evaluation_slice" + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.ModelService/GetModelEvaluationSlice", request_serializer=model_service.GetModelEvaluationSliceRequest.serialize, response_deserializer=model_evaluation_slice.ModelEvaluationSlice.deserialize, @@ -804,7 +893,9 @@ def list_model_evaluation_slices( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_model_evaluation_slices" not in self._stubs: - self._stubs["list_model_evaluation_slices"] = self.grpc_channel.unary_unary( + self._stubs[ + "list_model_evaluation_slices" + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.ModelService/ListModelEvaluationSlices", request_serializer=model_service.ListModelEvaluationSlicesRequest.serialize, response_deserializer=model_service.ListModelEvaluationSlicesResponse.deserialize, @@ -962,7 +1053,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: @@ -978,7 +1069,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, @@ -995,7 +1086,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -1012,7 +1103,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -1029,7 +1120,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, @@ -1048,7 +1139,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, @@ -1067,7 +1158,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -1084,7 +1175,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -1109,7 +1200,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -1135,7 +1226,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -1164,7 +1255,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1beta1/services/model_service/transports/rest.py b/google/cloud/aiplatform_v1beta1/services/model_service/transports/rest.py index 08ed88b481..a00cabccaa 100644 --- a/google/cloud/aiplatform_v1beta1/services/model_service/transports/rest.py +++ b/google/cloud/aiplatform_v1beta1/services/model_service/transports/rest.py @@ -13,9 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging +import json # type: ignore from google.auth.transport.requests import AuthorizedSession # type: ignore -import json # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.api_core import exceptions as core_exceptions from google.api_core import retry as retries @@ -54,6 +55,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, @@ -230,9 +239,10 @@ def post_upload_model(self, response): def pre_batch_import_evaluated_annotations( self, request: model_service.BatchImportEvaluatedAnnotationsRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - model_service.BatchImportEvaluatedAnnotationsRequest, Sequence[Tuple[str, str]] + model_service.BatchImportEvaluatedAnnotationsRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for batch_import_evaluated_annotations @@ -255,9 +265,10 @@ def post_batch_import_evaluated_annotations( def pre_batch_import_model_evaluation_slices( self, request: model_service.BatchImportModelEvaluationSlicesRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - model_service.BatchImportModelEvaluationSlicesRequest, Sequence[Tuple[str, str]] + model_service.BatchImportModelEvaluationSlicesRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for batch_import_model_evaluation_slices @@ -280,8 +291,8 @@ def post_batch_import_model_evaluation_slices( def pre_copy_model( self, request: model_service.CopyModelRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[model_service.CopyModelRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[model_service.CopyModelRequest, Sequence[Tuple[str, Union[str, bytes]]]]: """Pre-rpc interceptor for copy_model Override in a subclass to manipulate the request or metadata @@ -303,8 +314,10 @@ def post_copy_model( def pre_delete_model( self, request: model_service.DeleteModelRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[model_service.DeleteModelRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + model_service.DeleteModelRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for delete_model Override in a subclass to manipulate the request or metadata @@ -326,8 +339,10 @@ def post_delete_model( def pre_delete_model_version( self, request: model_service.DeleteModelVersionRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[model_service.DeleteModelVersionRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + model_service.DeleteModelVersionRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for delete_model_version Override in a subclass to manipulate the request or metadata @@ -349,8 +364,10 @@ def post_delete_model_version( def pre_export_model( self, request: model_service.ExportModelRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[model_service.ExportModelRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + model_service.ExportModelRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for export_model Override in a subclass to manipulate the request or metadata @@ -372,8 +389,8 @@ def post_export_model( def pre_get_model( self, request: model_service.GetModelRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[model_service.GetModelRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[model_service.GetModelRequest, Sequence[Tuple[str, Union[str, bytes]]]]: """Pre-rpc interceptor for get_model Override in a subclass to manipulate the request or metadata @@ -393,8 +410,10 @@ def post_get_model(self, response: model.Model) -> model.Model: def pre_get_model_evaluation( self, request: model_service.GetModelEvaluationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[model_service.GetModelEvaluationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + model_service.GetModelEvaluationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_model_evaluation Override in a subclass to manipulate the request or metadata @@ -416,8 +435,11 @@ def post_get_model_evaluation( def pre_get_model_evaluation_slice( self, request: model_service.GetModelEvaluationSliceRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[model_service.GetModelEvaluationSliceRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + model_service.GetModelEvaluationSliceRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for get_model_evaluation_slice Override in a subclass to manipulate the request or metadata @@ -439,8 +461,11 @@ def post_get_model_evaluation_slice( def pre_import_model_evaluation( self, request: model_service.ImportModelEvaluationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[model_service.ImportModelEvaluationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + model_service.ImportModelEvaluationRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for import_model_evaluation Override in a subclass to manipulate the request or metadata @@ -462,8 +487,11 @@ def post_import_model_evaluation( def pre_list_model_evaluations( self, request: model_service.ListModelEvaluationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[model_service.ListModelEvaluationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + model_service.ListModelEvaluationsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for list_model_evaluations Override in a subclass to manipulate the request or metadata @@ -485,9 +513,10 @@ def post_list_model_evaluations( def pre_list_model_evaluation_slices( self, request: model_service.ListModelEvaluationSlicesRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - model_service.ListModelEvaluationSlicesRequest, Sequence[Tuple[str, str]] + model_service.ListModelEvaluationSlicesRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for list_model_evaluation_slices @@ -510,8 +539,10 @@ def post_list_model_evaluation_slices( def pre_list_models( self, request: model_service.ListModelsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[model_service.ListModelsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + model_service.ListModelsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_models Override in a subclass to manipulate the request or metadata @@ -533,8 +564,10 @@ def post_list_models( def pre_list_model_versions( self, request: model_service.ListModelVersionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[model_service.ListModelVersionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + model_service.ListModelVersionsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_model_versions Override in a subclass to manipulate the request or metadata @@ -556,8 +589,11 @@ def post_list_model_versions( def pre_merge_version_aliases( self, request: model_service.MergeVersionAliasesRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[model_service.MergeVersionAliasesRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + model_service.MergeVersionAliasesRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for merge_version_aliases Override in a subclass to manipulate the request or metadata @@ -577,9 +613,10 @@ def post_merge_version_aliases(self, response: model.Model) -> model.Model: def pre_update_explanation_dataset( self, request: model_service.UpdateExplanationDatasetRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - model_service.UpdateExplanationDatasetRequest, Sequence[Tuple[str, str]] + model_service.UpdateExplanationDatasetRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for update_explanation_dataset @@ -602,8 +639,10 @@ def post_update_explanation_dataset( def pre_update_model( self, request: model_service.UpdateModelRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[model_service.UpdateModelRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + model_service.UpdateModelRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for update_model Override in a subclass to manipulate the request or metadata @@ -623,8 +662,10 @@ def post_update_model(self, response: gca_model.Model) -> gca_model.Model: def pre_upload_model( self, request: model_service.UploadModelRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[model_service.UploadModelRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + model_service.UploadModelRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for upload_model Override in a subclass to manipulate the request or metadata @@ -646,8 +687,10 @@ def post_upload_model( def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -669,8 +712,10 @@ def post_get_location( def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -692,8 +737,10 @@ def post_list_locations( def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -713,8 +760,10 @@ def post_get_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -734,8 +783,11 @@ def post_set_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -757,8 +809,10 @@ def post_test_iam_permissions( def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -778,8 +832,10 @@ def post_cancel_operation(self, response: None) -> None: 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 @@ -799,8 +855,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 @@ -822,8 +880,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 @@ -845,8 +905,10 @@ def post_list_operations( def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -1526,6 +1588,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -1742,6 +1808,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -1948,6 +2018,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}", @@ -2164,6 +2238,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, ], "google.longrunning.Operations.ListOperations": [ { @@ -2362,6 +2440,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*}/operations", @@ -2578,6 +2660,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*}/operations", + }, ], "google.longrunning.Operations.WaitOperation": [ { @@ -2776,6 +2862,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "post", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}:wait", @@ -2988,6 +3078,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, ], } @@ -3044,7 +3138,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]]] = (), ) -> model_service.BatchImportEvaluatedAnnotationsResponse: r"""Call the batch import evaluated annotations method over HTTP. @@ -3056,8 +3150,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: ~.model_service.BatchImportEvaluatedAnnotationsResponse: @@ -3069,6 +3165,7 @@ def __call__( http_options = ( _BaseModelServiceRestTransport._BaseBatchImportEvaluatedAnnotations._get_http_options() ) + ( request, metadata, @@ -3088,6 +3185,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.aiplatform_v1beta1.ModelServiceClient.BatchImportEvaluatedAnnotations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelService", + "rpcName": "BatchImportEvaluatedAnnotations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ModelServiceRestTransport._BatchImportEvaluatedAnnotations._get_response( self._host, @@ -3109,7 +3233,33 @@ def __call__( pb_resp = model_service.BatchImportEvaluatedAnnotationsResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_batch_import_evaluated_annotations(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + model_service.BatchImportEvaluatedAnnotationsResponse.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.aiplatform_v1beta1.ModelServiceClient.batch_import_evaluated_annotations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelService", + "rpcName": "BatchImportEvaluatedAnnotations", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _BatchImportModelEvaluationSlices( @@ -3149,7 +3299,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]]] = (), ) -> model_service.BatchImportModelEvaluationSlicesResponse: r"""Call the batch import model evaluation slices method over HTTP. @@ -3161,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: ~.model_service.BatchImportModelEvaluationSlicesResponse: @@ -3174,6 +3326,7 @@ def __call__( http_options = ( _BaseModelServiceRestTransport._BaseBatchImportModelEvaluationSlices._get_http_options() ) + ( request, metadata, @@ -3193,6 +3346,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.aiplatform_v1beta1.ModelServiceClient.BatchImportModelEvaluationSlices", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelService", + "rpcName": "BatchImportModelEvaluationSlices", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ModelServiceRestTransport._BatchImportModelEvaluationSlices._get_response( self._host, @@ -3214,7 +3394,33 @@ def __call__( pb_resp = model_service.BatchImportModelEvaluationSlicesResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_batch_import_model_evaluation_slices(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + model_service.BatchImportModelEvaluationSlicesResponse.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.aiplatform_v1beta1.ModelServiceClient.batch_import_model_evaluation_slices", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelService", + "rpcName": "BatchImportModelEvaluationSlices", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _CopyModel( @@ -3253,7 +3459,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 copy model method over HTTP. @@ -3264,8 +3470,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: @@ -3278,6 +3486,7 @@ def __call__( http_options = ( _BaseModelServiceRestTransport._BaseCopyModel._get_http_options() ) + request, metadata = self._interceptor.pre_copy_model(request, metadata) transcoded_request = ( _BaseModelServiceRestTransport._BaseCopyModel._get_transcoded_request( @@ -3296,6 +3505,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.aiplatform_v1beta1.ModelServiceClient.CopyModel", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelService", + "rpcName": "CopyModel", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ModelServiceRestTransport._CopyModel._get_response( self._host, @@ -3315,7 +3551,29 @@ def __call__( # Return the response resp = operations_pb2.Operation() json_format.Parse(response.content, resp, ignore_unknown_fields=True) + resp = self._interceptor.post_copy_model(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.aiplatform_v1beta1.ModelServiceClient.copy_model", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelService", + "rpcName": "CopyModel", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _DeleteModel( @@ -3353,7 +3611,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 model method over HTTP. @@ -3364,8 +3622,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: @@ -3378,6 +3638,7 @@ def __call__( http_options = ( _BaseModelServiceRestTransport._BaseDeleteModel._get_http_options() ) + request, metadata = self._interceptor.pre_delete_model(request, metadata) transcoded_request = ( _BaseModelServiceRestTransport._BaseDeleteModel._get_transcoded_request( @@ -3392,6 +3653,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.aiplatform_v1beta1.ModelServiceClient.DeleteModel", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelService", + "rpcName": "DeleteModel", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ModelServiceRestTransport._DeleteModel._get_response( self._host, @@ -3410,7 +3698,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_model(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.aiplatform_v1beta1.ModelServiceClient.delete_model", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelService", + "rpcName": "DeleteModel", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _DeleteModelVersion( @@ -3448,7 +3758,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 model version method over HTTP. @@ -3459,8 +3769,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: @@ -3473,6 +3785,7 @@ def __call__( http_options = ( _BaseModelServiceRestTransport._BaseDeleteModelVersion._get_http_options() ) + request, metadata = self._interceptor.pre_delete_model_version( request, metadata ) @@ -3485,6 +3798,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.aiplatform_v1beta1.ModelServiceClient.DeleteModelVersion", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelService", + "rpcName": "DeleteModelVersion", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ModelServiceRestTransport._DeleteModelVersion._get_response( self._host, @@ -3503,7 +3843,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_model_version(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.aiplatform_v1beta1.ModelServiceClient.delete_model_version", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelService", + "rpcName": "DeleteModelVersion", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ExportModel( @@ -3542,7 +3904,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 export model method over HTTP. @@ -3553,8 +3915,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: @@ -3567,6 +3931,7 @@ def __call__( http_options = ( _BaseModelServiceRestTransport._BaseExportModel._get_http_options() ) + request, metadata = self._interceptor.pre_export_model(request, metadata) transcoded_request = ( _BaseModelServiceRestTransport._BaseExportModel._get_transcoded_request( @@ -3587,6 +3952,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.aiplatform_v1beta1.ModelServiceClient.ExportModel", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelService", + "rpcName": "ExportModel", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ModelServiceRestTransport._ExportModel._get_response( self._host, @@ -3606,7 +3998,29 @@ def __call__( # Return the response resp = operations_pb2.Operation() json_format.Parse(response.content, resp, ignore_unknown_fields=True) + resp = self._interceptor.post_export_model(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.aiplatform_v1beta1.ModelServiceClient.export_model", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelService", + "rpcName": "ExportModel", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _GetModel(_BaseModelServiceRestTransport._BaseGetModel, ModelServiceRestStub): @@ -3642,7 +4056,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]]] = (), ) -> model.Model: r"""Call the get model method over HTTP. @@ -3653,8 +4067,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: ~.model.Model: @@ -3664,6 +4080,7 @@ def __call__( http_options = ( _BaseModelServiceRestTransport._BaseGetModel._get_http_options() ) + request, metadata = self._interceptor.pre_get_model(request, metadata) transcoded_request = ( _BaseModelServiceRestTransport._BaseGetModel._get_transcoded_request( @@ -3678,6 +4095,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 = 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.aiplatform_v1beta1.ModelServiceClient.GetModel", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelService", + "rpcName": "GetModel", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ModelServiceRestTransport._GetModel._get_response( self._host, @@ -3698,7 +4142,29 @@ def __call__( pb_resp = model.Model.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_model(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = model.Model.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.aiplatform_v1beta1.ModelServiceClient.get_model", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelService", + "rpcName": "GetModel", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _GetModelEvaluation( @@ -3736,7 +4202,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]]] = (), ) -> model_evaluation.ModelEvaluation: r"""Call the get model evaluation method over HTTP. @@ -3747,8 +4213,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: ~.model_evaluation.ModelEvaluation: @@ -3762,6 +4230,7 @@ def __call__( http_options = ( _BaseModelServiceRestTransport._BaseGetModelEvaluation._get_http_options() ) + request, metadata = self._interceptor.pre_get_model_evaluation( request, metadata ) @@ -3774,6 +4243,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.aiplatform_v1beta1.ModelServiceClient.GetModelEvaluation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelService", + "rpcName": "GetModelEvaluation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ModelServiceRestTransport._GetModelEvaluation._get_response( self._host, @@ -3794,7 +4290,31 @@ def __call__( pb_resp = model_evaluation.ModelEvaluation.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_model_evaluation(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = model_evaluation.ModelEvaluation.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.aiplatform_v1beta1.ModelServiceClient.get_model_evaluation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelService", + "rpcName": "GetModelEvaluation", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _GetModelEvaluationSlice( @@ -3833,7 +4353,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]]] = (), ) -> model_evaluation_slice.ModelEvaluationSlice: r"""Call the get model evaluation slice method over HTTP. @@ -3845,8 +4365,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: ~.model_evaluation_slice.ModelEvaluationSlice: @@ -3860,6 +4382,7 @@ def __call__( http_options = ( _BaseModelServiceRestTransport._BaseGetModelEvaluationSlice._get_http_options() ) + request, metadata = self._interceptor.pre_get_model_evaluation_slice( request, metadata ) @@ -3872,6 +4395,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.aiplatform_v1beta1.ModelServiceClient.GetModelEvaluationSlice", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelService", + "rpcName": "GetModelEvaluationSlice", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ModelServiceRestTransport._GetModelEvaluationSlice._get_response( self._host, @@ -3892,7 +4442,31 @@ def __call__( pb_resp = model_evaluation_slice.ModelEvaluationSlice.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_model_evaluation_slice(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + model_evaluation_slice.ModelEvaluationSlice.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.aiplatform_v1beta1.ModelServiceClient.get_model_evaluation_slice", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelService", + "rpcName": "GetModelEvaluationSlice", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ImportModelEvaluation( @@ -3931,7 +4505,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]]] = (), ) -> gca_model_evaluation.ModelEvaluation: r"""Call the import model evaluation method over HTTP. @@ -3942,8 +4516,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: ~.gca_model_evaluation.ModelEvaluation: @@ -3957,6 +4533,7 @@ def __call__( http_options = ( _BaseModelServiceRestTransport._BaseImportModelEvaluation._get_http_options() ) + request, metadata = self._interceptor.pre_import_model_evaluation( request, metadata ) @@ -3973,6 +4550,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.aiplatform_v1beta1.ModelServiceClient.ImportModelEvaluation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelService", + "rpcName": "ImportModelEvaluation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ModelServiceRestTransport._ImportModelEvaluation._get_response( self._host, @@ -3994,7 +4598,31 @@ def __call__( pb_resp = gca_model_evaluation.ModelEvaluation.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_import_model_evaluation(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gca_model_evaluation.ModelEvaluation.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.aiplatform_v1beta1.ModelServiceClient.import_model_evaluation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelService", + "rpcName": "ImportModelEvaluation", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListModelEvaluations( @@ -4032,7 +4660,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]]] = (), ) -> model_service.ListModelEvaluationsResponse: r"""Call the list model evaluations method over HTTP. @@ -4043,8 +4671,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: ~.model_service.ListModelEvaluationsResponse: @@ -4056,6 +4686,7 @@ def __call__( http_options = ( _BaseModelServiceRestTransport._BaseListModelEvaluations._get_http_options() ) + request, metadata = self._interceptor.pre_list_model_evaluations( request, metadata ) @@ -4068,6 +4699,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.aiplatform_v1beta1.ModelServiceClient.ListModelEvaluations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelService", + "rpcName": "ListModelEvaluations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ModelServiceRestTransport._ListModelEvaluations._get_response( self._host, @@ -4088,7 +4746,31 @@ def __call__( pb_resp = model_service.ListModelEvaluationsResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_model_evaluations(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + model_service.ListModelEvaluationsResponse.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.aiplatform_v1beta1.ModelServiceClient.list_model_evaluations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelService", + "rpcName": "ListModelEvaluations", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListModelEvaluationSlices( @@ -4127,7 +4809,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]]] = (), ) -> model_service.ListModelEvaluationSlicesResponse: r"""Call the list model evaluation slices method over HTTP. @@ -4139,8 +4821,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: ~.model_service.ListModelEvaluationSlicesResponse: @@ -4152,6 +4836,7 @@ def __call__( http_options = ( _BaseModelServiceRestTransport._BaseListModelEvaluationSlices._get_http_options() ) + request, metadata = self._interceptor.pre_list_model_evaluation_slices( request, metadata ) @@ -4164,6 +4849,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.aiplatform_v1beta1.ModelServiceClient.ListModelEvaluationSlices", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelService", + "rpcName": "ListModelEvaluationSlices", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( ModelServiceRestTransport._ListModelEvaluationSlices._get_response( @@ -4186,7 +4898,33 @@ def __call__( pb_resp = model_service.ListModelEvaluationSlicesResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_model_evaluation_slices(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + model_service.ListModelEvaluationSlicesResponse.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.aiplatform_v1beta1.ModelServiceClient.list_model_evaluation_slices", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelService", + "rpcName": "ListModelEvaluationSlices", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListModels( @@ -4224,7 +4962,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]]] = (), ) -> model_service.ListModelsResponse: r"""Call the list models method over HTTP. @@ -4235,8 +4973,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: ~.model_service.ListModelsResponse: @@ -4248,6 +4988,7 @@ def __call__( http_options = ( _BaseModelServiceRestTransport._BaseListModels._get_http_options() ) + request, metadata = self._interceptor.pre_list_models(request, metadata) transcoded_request = ( _BaseModelServiceRestTransport._BaseListModels._get_transcoded_request( @@ -4262,6 +5003,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 = 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.aiplatform_v1beta1.ModelServiceClient.ListModels", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelService", + "rpcName": "ListModels", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ModelServiceRestTransport._ListModels._get_response( self._host, @@ -4282,7 +5050,31 @@ def __call__( pb_resp = model_service.ListModelsResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_models(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = model_service.ListModelsResponse.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.aiplatform_v1beta1.ModelServiceClient.list_models", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelService", + "rpcName": "ListModels", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListModelVersions( @@ -4320,7 +5112,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]]] = (), ) -> model_service.ListModelVersionsResponse: r"""Call the list model versions method over HTTP. @@ -4331,8 +5123,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: ~.model_service.ListModelVersionsResponse: @@ -4344,6 +5138,7 @@ def __call__( http_options = ( _BaseModelServiceRestTransport._BaseListModelVersions._get_http_options() ) + request, metadata = self._interceptor.pre_list_model_versions( request, metadata ) @@ -4356,6 +5151,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.aiplatform_v1beta1.ModelServiceClient.ListModelVersions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelService", + "rpcName": "ListModelVersions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ModelServiceRestTransport._ListModelVersions._get_response( self._host, @@ -4376,7 +5198,31 @@ def __call__( pb_resp = model_service.ListModelVersionsResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_model_versions(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = model_service.ListModelVersionsResponse.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.aiplatform_v1beta1.ModelServiceClient.list_model_versions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelService", + "rpcName": "ListModelVersions", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _MergeVersionAliases( @@ -4415,7 +5261,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]]] = (), ) -> model.Model: r"""Call the merge version aliases method over HTTP. @@ -4426,8 +5272,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: ~.model.Model: @@ -4437,6 +5285,7 @@ def __call__( http_options = ( _BaseModelServiceRestTransport._BaseMergeVersionAliases._get_http_options() ) + request, metadata = self._interceptor.pre_merge_version_aliases( request, metadata ) @@ -4453,6 +5302,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.aiplatform_v1beta1.ModelServiceClient.MergeVersionAliases", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelService", + "rpcName": "MergeVersionAliases", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ModelServiceRestTransport._MergeVersionAliases._get_response( self._host, @@ -4474,7 +5350,29 @@ def __call__( pb_resp = model.Model.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_merge_version_aliases(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = model.Model.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.aiplatform_v1beta1.ModelServiceClient.merge_version_aliases", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelService", + "rpcName": "MergeVersionAliases", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _UpdateExplanationDataset( @@ -4514,7 +5412,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 explanation dataset method over HTTP. @@ -4526,8 +5424,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: @@ -4540,6 +5440,7 @@ def __call__( http_options = ( _BaseModelServiceRestTransport._BaseUpdateExplanationDataset._get_http_options() ) + request, metadata = self._interceptor.pre_update_explanation_dataset( request, metadata ) @@ -4556,6 +5457,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.aiplatform_v1beta1.ModelServiceClient.UpdateExplanationDataset", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelService", + "rpcName": "UpdateExplanationDataset", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( ModelServiceRestTransport._UpdateExplanationDataset._get_response( @@ -4577,7 +5505,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_explanation_dataset(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.aiplatform_v1beta1.ModelServiceClient.update_explanation_dataset", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelService", + "rpcName": "UpdateExplanationDataset", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _UpdateModel( @@ -4616,7 +5566,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]]] = (), ) -> gca_model.Model: r"""Call the update model method over HTTP. @@ -4627,8 +5577,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: ~.gca_model.Model: @@ -4638,6 +5590,7 @@ def __call__( http_options = ( _BaseModelServiceRestTransport._BaseUpdateModel._get_http_options() ) + request, metadata = self._interceptor.pre_update_model(request, metadata) transcoded_request = ( _BaseModelServiceRestTransport._BaseUpdateModel._get_transcoded_request( @@ -4658,6 +5611,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 = 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.aiplatform_v1beta1.ModelServiceClient.UpdateModel", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelService", + "rpcName": "UpdateModel", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ModelServiceRestTransport._UpdateModel._get_response( self._host, @@ -4679,7 +5659,29 @@ def __call__( pb_resp = gca_model.Model.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_update_model(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gca_model.Model.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.aiplatform_v1beta1.ModelServiceClient.update_model", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelService", + "rpcName": "UpdateModel", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _UploadModel( @@ -4718,7 +5720,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 upload model method over HTTP. @@ -4729,8 +5731,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: @@ -4743,6 +5747,7 @@ def __call__( http_options = ( _BaseModelServiceRestTransport._BaseUploadModel._get_http_options() ) + request, metadata = self._interceptor.pre_upload_model(request, metadata) transcoded_request = ( _BaseModelServiceRestTransport._BaseUploadModel._get_transcoded_request( @@ -4763,6 +5768,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.aiplatform_v1beta1.ModelServiceClient.UploadModel", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelService", + "rpcName": "UploadModel", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ModelServiceRestTransport._UploadModel._get_response( self._host, @@ -4782,7 +5814,29 @@ def __call__( # Return the response resp = operations_pb2.Operation() json_format.Parse(response.content, resp, ignore_unknown_fields=True) + resp = self._interceptor.post_upload_model(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.aiplatform_v1beta1.ModelServiceClient.upload_model", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelService", + "rpcName": "UploadModel", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp @property @@ -4991,7 +6045,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]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -5002,8 +6056,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: locations_pb2.Location: Response from GetLocation method. @@ -5012,6 +6068,7 @@ def __call__( http_options = ( _BaseModelServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = self._interceptor.pre_get_location(request, metadata) transcoded_request = ( _BaseModelServiceRestTransport._BaseGetLocation._get_transcoded_request( @@ -5026,6 +6083,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.aiplatform_v1beta1.ModelServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ModelServiceRestTransport._GetLocation._get_response( self._host, @@ -5045,6 +6129,27 @@ def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_location(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.aiplatform_v1beta1.ModelServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5086,7 +6191,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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -5097,8 +6202,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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -5107,6 +6214,7 @@ def __call__( http_options = ( _BaseModelServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = self._interceptor.pre_list_locations(request, metadata) transcoded_request = _BaseModelServiceRestTransport._BaseListLocations._get_transcoded_request( http_options, request @@ -5117,6 +6225,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.aiplatform_v1beta1.ModelServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ModelServiceRestTransport._ListLocations._get_response( self._host, @@ -5136,6 +6271,27 @@ def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_list_locations(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.aiplatform_v1beta1.ModelServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5178,7 +6334,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]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -5189,8 +6345,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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -5199,6 +6357,7 @@ def __call__( http_options = ( _BaseModelServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_get_iam_policy(request, metadata) transcoded_request = _BaseModelServiceRestTransport._BaseGetIamPolicy._get_transcoded_request( http_options, request @@ -5217,6 +6376,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.aiplatform_v1beta1.ModelServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ModelServiceRestTransport._GetIamPolicy._get_response( self._host, @@ -5237,6 +6423,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_iam_policy(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.aiplatform_v1beta1.ModelServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5279,7 +6486,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]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -5290,8 +6497,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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -5300,6 +6509,7 @@ def __call__( http_options = ( _BaseModelServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_set_iam_policy(request, metadata) transcoded_request = _BaseModelServiceRestTransport._BaseSetIamPolicy._get_transcoded_request( http_options, request @@ -5318,6 +6528,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.aiplatform_v1beta1.ModelServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ModelServiceRestTransport._SetIamPolicy._get_response( self._host, @@ -5338,6 +6575,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_set_iam_policy(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.aiplatform_v1beta1.ModelServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5380,7 +6638,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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -5391,8 +6649,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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -5401,6 +6661,7 @@ def __call__( http_options = ( _BaseModelServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -5417,6 +6678,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.aiplatform_v1beta1.ModelServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ModelServiceRestTransport._TestIamPermissions._get_response( self._host, @@ -5437,6 +6725,27 @@ def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_test_iam_permissions(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.aiplatform_v1beta1.ModelServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5478,7 +6787,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 cancel operation method over HTTP. @@ -5489,13 +6798,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 = ( _BaseModelServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = self._interceptor.pre_cancel_operation( request, metadata ) @@ -5508,6 +6820,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.aiplatform_v1beta1.ModelServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ModelServiceRestTransport._CancelOperation._get_response( self._host, @@ -5564,7 +6903,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. @@ -5575,13 +6914,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 = ( _BaseModelServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = self._interceptor.pre_delete_operation( request, metadata ) @@ -5594,6 +6936,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.aiplatform_v1beta1.ModelServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ModelServiceRestTransport._DeleteOperation._get_response( self._host, @@ -5650,7 +7019,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. @@ -5661,8 +7030,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. @@ -5671,6 +7042,7 @@ def __call__( http_options = ( _BaseModelServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = self._interceptor.pre_get_operation(request, metadata) transcoded_request = _BaseModelServiceRestTransport._BaseGetOperation._get_transcoded_request( http_options, request @@ -5683,6 +7055,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.aiplatform_v1beta1.ModelServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ModelServiceRestTransport._GetOperation._get_response( self._host, @@ -5702,6 +7101,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.aiplatform_v1beta1.ModelServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5743,7 +7163,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. @@ -5754,8 +7174,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. @@ -5764,6 +7186,7 @@ def __call__( http_options = ( _BaseModelServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = self._interceptor.pre_list_operations(request, metadata) transcoded_request = _BaseModelServiceRestTransport._BaseListOperations._get_transcoded_request( http_options, request @@ -5774,6 +7197,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.aiplatform_v1beta1.ModelServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ModelServiceRestTransport._ListOperations._get_response( self._host, @@ -5793,6 +7243,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.aiplatform_v1beta1.ModelServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5834,7 +7305,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 wait operation method over HTTP. @@ -5845,8 +7316,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 WaitOperation method. @@ -5855,6 +7328,7 @@ def __call__( http_options = ( _BaseModelServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = self._interceptor.pre_wait_operation(request, metadata) transcoded_request = _BaseModelServiceRestTransport._BaseWaitOperation._get_transcoded_request( http_options, request @@ -5865,6 +7339,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.aiplatform_v1beta1.ModelServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ModelServiceRestTransport._WaitOperation._get_response( self._host, @@ -5884,6 +7385,27 @@ def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = self._interceptor.post_wait_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.aiplatform_v1beta1.ModelServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1beta1/services/model_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1beta1/services/model_service/transports/rest_asyncio.py index 903d10949b..5bbb83b666 100644 --- a/google/cloud/aiplatform_v1beta1/services/model_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/model_service/transports/rest_asyncio.py @@ -65,6 +65,18 @@ from .base import DEFAULT_CLIENT_INFO as BASE_DEFAULT_CLIENT_INFO + +import logging + +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__) + try: OptionalRetry = Union[retries.AsyncRetry, gapic_v1.method._MethodDefault, None] except AttributeError: # pragma: NO COVER @@ -245,9 +257,10 @@ async def post_upload_model(self, response): async def pre_batch_import_evaluated_annotations( self, request: model_service.BatchImportEvaluatedAnnotationsRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - model_service.BatchImportEvaluatedAnnotationsRequest, Sequence[Tuple[str, str]] + model_service.BatchImportEvaluatedAnnotationsRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for batch_import_evaluated_annotations @@ -270,9 +283,10 @@ async def post_batch_import_evaluated_annotations( async def pre_batch_import_model_evaluation_slices( self, request: model_service.BatchImportModelEvaluationSlicesRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - model_service.BatchImportModelEvaluationSlicesRequest, Sequence[Tuple[str, str]] + model_service.BatchImportModelEvaluationSlicesRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for batch_import_model_evaluation_slices @@ -295,8 +309,8 @@ async def post_batch_import_model_evaluation_slices( async def pre_copy_model( self, request: model_service.CopyModelRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[model_service.CopyModelRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[model_service.CopyModelRequest, Sequence[Tuple[str, Union[str, bytes]]]]: """Pre-rpc interceptor for copy_model Override in a subclass to manipulate the request or metadata @@ -318,8 +332,10 @@ async def post_copy_model( async def pre_delete_model( self, request: model_service.DeleteModelRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[model_service.DeleteModelRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + model_service.DeleteModelRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for delete_model Override in a subclass to manipulate the request or metadata @@ -341,8 +357,10 @@ async def post_delete_model( async def pre_delete_model_version( self, request: model_service.DeleteModelVersionRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[model_service.DeleteModelVersionRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + model_service.DeleteModelVersionRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for delete_model_version Override in a subclass to manipulate the request or metadata @@ -364,8 +382,10 @@ async def post_delete_model_version( async def pre_export_model( self, request: model_service.ExportModelRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[model_service.ExportModelRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + model_service.ExportModelRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for export_model Override in a subclass to manipulate the request or metadata @@ -387,8 +407,8 @@ async def post_export_model( async def pre_get_model( self, request: model_service.GetModelRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[model_service.GetModelRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[model_service.GetModelRequest, Sequence[Tuple[str, Union[str, bytes]]]]: """Pre-rpc interceptor for get_model Override in a subclass to manipulate the request or metadata @@ -408,8 +428,10 @@ async def post_get_model(self, response: model.Model) -> model.Model: async def pre_get_model_evaluation( self, request: model_service.GetModelEvaluationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[model_service.GetModelEvaluationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + model_service.GetModelEvaluationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_model_evaluation Override in a subclass to manipulate the request or metadata @@ -431,8 +453,11 @@ async def post_get_model_evaluation( async def pre_get_model_evaluation_slice( self, request: model_service.GetModelEvaluationSliceRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[model_service.GetModelEvaluationSliceRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + model_service.GetModelEvaluationSliceRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for get_model_evaluation_slice Override in a subclass to manipulate the request or metadata @@ -454,8 +479,11 @@ async def post_get_model_evaluation_slice( async def pre_import_model_evaluation( self, request: model_service.ImportModelEvaluationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[model_service.ImportModelEvaluationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + model_service.ImportModelEvaluationRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for import_model_evaluation Override in a subclass to manipulate the request or metadata @@ -477,8 +505,11 @@ async def post_import_model_evaluation( async def pre_list_model_evaluations( self, request: model_service.ListModelEvaluationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[model_service.ListModelEvaluationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + model_service.ListModelEvaluationsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for list_model_evaluations Override in a subclass to manipulate the request or metadata @@ -500,9 +531,10 @@ async def post_list_model_evaluations( async def pre_list_model_evaluation_slices( self, request: model_service.ListModelEvaluationSlicesRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - model_service.ListModelEvaluationSlicesRequest, Sequence[Tuple[str, str]] + model_service.ListModelEvaluationSlicesRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for list_model_evaluation_slices @@ -525,8 +557,10 @@ async def post_list_model_evaluation_slices( async def pre_list_models( self, request: model_service.ListModelsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[model_service.ListModelsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + model_service.ListModelsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_models Override in a subclass to manipulate the request or metadata @@ -548,8 +582,10 @@ async def post_list_models( async def pre_list_model_versions( self, request: model_service.ListModelVersionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[model_service.ListModelVersionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + model_service.ListModelVersionsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_model_versions Override in a subclass to manipulate the request or metadata @@ -571,8 +607,11 @@ async def post_list_model_versions( async def pre_merge_version_aliases( self, request: model_service.MergeVersionAliasesRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[model_service.MergeVersionAliasesRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + model_service.MergeVersionAliasesRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for merge_version_aliases Override in a subclass to manipulate the request or metadata @@ -592,9 +631,10 @@ async def post_merge_version_aliases(self, response: model.Model) -> model.Model async def pre_update_explanation_dataset( self, request: model_service.UpdateExplanationDatasetRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - model_service.UpdateExplanationDatasetRequest, Sequence[Tuple[str, str]] + model_service.UpdateExplanationDatasetRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for update_explanation_dataset @@ -617,8 +657,10 @@ async def post_update_explanation_dataset( async def pre_update_model( self, request: model_service.UpdateModelRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[model_service.UpdateModelRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + model_service.UpdateModelRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for update_model Override in a subclass to manipulate the request or metadata @@ -638,8 +680,10 @@ async def post_update_model(self, response: gca_model.Model) -> gca_model.Model: async def pre_upload_model( self, request: model_service.UploadModelRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[model_service.UploadModelRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + model_service.UploadModelRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for upload_model Override in a subclass to manipulate the request or metadata @@ -661,8 +705,10 @@ async def post_upload_model( async def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -684,8 +730,10 @@ async def post_get_location( async def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -707,8 +755,10 @@ async def post_list_locations( async def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -730,8 +780,10 @@ async def post_get_iam_policy( async def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -753,8 +805,11 @@ async def post_set_iam_policy( async def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -776,8 +831,10 @@ async def post_test_iam_permissions( async def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -797,8 +854,10 @@ async def post_cancel_operation(self, response: None) -> None: async 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 @@ -818,8 +877,10 @@ async def post_delete_operation(self, response: None) -> None: async 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 @@ -841,8 +902,10 @@ async def post_get_operation( async 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 @@ -864,8 +927,10 @@ async def post_list_operations( async def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -1138,7 +1203,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> model_service.BatchImportEvaluatedAnnotationsResponse: r"""Call the batch import evaluated annotations method over HTTP. @@ -1150,8 +1215,10 @@ async def __call__( 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: ~.model_service.BatchImportEvaluatedAnnotationsResponse: @@ -1163,6 +1230,7 @@ async def __call__( http_options = ( _BaseModelServiceRestTransport._BaseBatchImportEvaluatedAnnotations._get_http_options() ) + ( request, metadata, @@ -1182,6 +1250,33 @@ async 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.aiplatform_v1beta1.ModelServiceClient.BatchImportEvaluatedAnnotations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelService", + "rpcName": "BatchImportEvaluatedAnnotations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncModelServiceRestTransport._BatchImportEvaluatedAnnotations._get_response( self._host, @@ -1210,6 +1305,32 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_batch_import_evaluated_annotations(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + model_service.BatchImportEvaluatedAnnotationsResponse.to_json( + response + ) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.ModelServiceAsyncClient.batch_import_evaluated_annotations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelService", + "rpcName": "BatchImportEvaluatedAnnotations", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _BatchImportModelEvaluationSlices( @@ -1251,7 +1372,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> model_service.BatchImportModelEvaluationSlicesResponse: r"""Call the batch import model evaluation slices method over HTTP. @@ -1263,8 +1384,10 @@ async def __call__( 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: ~.model_service.BatchImportModelEvaluationSlicesResponse: @@ -1276,6 +1399,7 @@ async def __call__( http_options = ( _BaseModelServiceRestTransport._BaseBatchImportModelEvaluationSlices._get_http_options() ) + ( request, metadata, @@ -1295,6 +1419,33 @@ async 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.aiplatform_v1beta1.ModelServiceClient.BatchImportModelEvaluationSlices", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelService", + "rpcName": "BatchImportModelEvaluationSlices", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncModelServiceRestTransport._BatchImportModelEvaluationSlices._get_response( self._host, @@ -1325,6 +1476,32 @@ async def __call__( resp = await self._interceptor.post_batch_import_model_evaluation_slices( resp ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + model_service.BatchImportModelEvaluationSlicesResponse.to_json( + response + ) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.ModelServiceAsyncClient.batch_import_model_evaluation_slices", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelService", + "rpcName": "BatchImportModelEvaluationSlices", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _CopyModel( @@ -1363,7 +1540,7 @@ async 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 copy model method over HTTP. @@ -1374,8 +1551,10 @@ async def __call__( 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: @@ -1388,6 +1567,7 @@ async def __call__( http_options = ( _BaseModelServiceRestTransport._BaseCopyModel._get_http_options() ) + request, metadata = await self._interceptor.pre_copy_model( request, metadata ) @@ -1408,6 +1588,33 @@ async 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.aiplatform_v1beta1.ModelServiceClient.CopyModel", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelService", + "rpcName": "CopyModel", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncModelServiceRestTransport._CopyModel._get_response( self._host, @@ -1436,6 +1643,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_copy_model(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.ModelServiceAsyncClient.copy_model", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelService", + "rpcName": "CopyModel", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _DeleteModel( @@ -1473,7 +1702,7 @@ async 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 model method over HTTP. @@ -1484,8 +1713,10 @@ async def __call__( 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: @@ -1498,6 +1729,7 @@ async def __call__( http_options = ( _BaseModelServiceRestTransport._BaseDeleteModel._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_model( request, metadata ) @@ -1514,6 +1746,33 @@ async 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.aiplatform_v1beta1.ModelServiceClient.DeleteModel", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelService", + "rpcName": "DeleteModel", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncModelServiceRestTransport._DeleteModel._get_response( self._host, @@ -1541,6 +1800,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_delete_model(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.ModelServiceAsyncClient.delete_model", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelService", + "rpcName": "DeleteModel", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _DeleteModelVersion( @@ -1579,7 +1860,7 @@ async 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 model version method over HTTP. @@ -1590,8 +1871,10 @@ async def __call__( 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: @@ -1604,6 +1887,7 @@ async def __call__( http_options = ( _BaseModelServiceRestTransport._BaseDeleteModelVersion._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_model_version( request, metadata ) @@ -1616,6 +1900,33 @@ async 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.aiplatform_v1beta1.ModelServiceClient.DeleteModelVersion", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelService", + "rpcName": "DeleteModelVersion", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncModelServiceRestTransport._DeleteModelVersion._get_response( @@ -1645,6 +1956,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_delete_model_version(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.ModelServiceAsyncClient.delete_model_version", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelService", + "rpcName": "DeleteModelVersion", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ExportModel( @@ -1683,7 +2016,7 @@ async 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 export model method over HTTP. @@ -1694,8 +2027,10 @@ async def __call__( 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: @@ -1708,6 +2043,7 @@ async def __call__( http_options = ( _BaseModelServiceRestTransport._BaseExportModel._get_http_options() ) + request, metadata = await self._interceptor.pre_export_model( request, metadata ) @@ -1730,6 +2066,33 @@ async 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.aiplatform_v1beta1.ModelServiceClient.ExportModel", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelService", + "rpcName": "ExportModel", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncModelServiceRestTransport._ExportModel._get_response( self._host, @@ -1758,6 +2121,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_export_model(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.ModelServiceAsyncClient.export_model", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelService", + "rpcName": "ExportModel", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _GetModel( @@ -1795,7 +2180,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> model.Model: r"""Call the get model method over HTTP. @@ -1806,8 +2191,10 @@ async def __call__( 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: ~.model.Model: @@ -1817,6 +2204,7 @@ async def __call__( http_options = ( _BaseModelServiceRestTransport._BaseGetModel._get_http_options() ) + request, metadata = await self._interceptor.pre_get_model(request, metadata) transcoded_request = ( _BaseModelServiceRestTransport._BaseGetModel._get_transcoded_request( @@ -1831,6 +2219,33 @@ async 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 = 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.aiplatform_v1beta1.ModelServiceClient.GetModel", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelService", + "rpcName": "GetModel", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncModelServiceRestTransport._GetModel._get_response( self._host, @@ -1858,6 +2273,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_get_model(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = model.Model.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.ModelServiceAsyncClient.get_model", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelService", + "rpcName": "GetModel", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _GetModelEvaluation( @@ -1896,7 +2333,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> model_evaluation.ModelEvaluation: r"""Call the get model evaluation method over HTTP. @@ -1907,8 +2344,10 @@ async def __call__( 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: ~.model_evaluation.ModelEvaluation: @@ -1922,6 +2361,7 @@ async def __call__( http_options = ( _BaseModelServiceRestTransport._BaseGetModelEvaluation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_model_evaluation( request, metadata ) @@ -1934,6 +2374,33 @@ async 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.aiplatform_v1beta1.ModelServiceClient.GetModelEvaluation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelService", + "rpcName": "GetModelEvaluation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncModelServiceRestTransport._GetModelEvaluation._get_response( @@ -1963,6 +2430,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_get_model_evaluation(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = model_evaluation.ModelEvaluation.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.ModelServiceAsyncClient.get_model_evaluation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelService", + "rpcName": "GetModelEvaluation", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _GetModelEvaluationSlice( @@ -2001,7 +2492,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> model_evaluation_slice.ModelEvaluationSlice: r"""Call the get model evaluation slice method over HTTP. @@ -2013,8 +2504,10 @@ async def __call__( 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: ~.model_evaluation_slice.ModelEvaluationSlice: @@ -2028,6 +2521,7 @@ async def __call__( http_options = ( _BaseModelServiceRestTransport._BaseGetModelEvaluationSlice._get_http_options() ) + request, metadata = await self._interceptor.pre_get_model_evaluation_slice( request, metadata ) @@ -2040,6 +2534,33 @@ async 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.aiplatform_v1beta1.ModelServiceClient.GetModelEvaluationSlice", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelService", + "rpcName": "GetModelEvaluationSlice", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncModelServiceRestTransport._GetModelEvaluationSlice._get_response( self._host, @@ -2067,6 +2588,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_get_model_evaluation_slice(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + model_evaluation_slice.ModelEvaluationSlice.to_json(response) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.ModelServiceAsyncClient.get_model_evaluation_slice", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelService", + "rpcName": "GetModelEvaluationSlice", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ImportModelEvaluation( @@ -2106,7 +2651,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> gca_model_evaluation.ModelEvaluation: r"""Call the import model evaluation method over HTTP. @@ -2117,8 +2662,10 @@ async def __call__( 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: ~.gca_model_evaluation.ModelEvaluation: @@ -2132,6 +2679,7 @@ async def __call__( http_options = ( _BaseModelServiceRestTransport._BaseImportModelEvaluation._get_http_options() ) + request, metadata = await self._interceptor.pre_import_model_evaluation( request, metadata ) @@ -2148,6 +2696,33 @@ async 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.aiplatform_v1beta1.ModelServiceClient.ImportModelEvaluation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelService", + "rpcName": "ImportModelEvaluation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncModelServiceRestTransport._ImportModelEvaluation._get_response( self._host, @@ -2176,6 +2751,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_import_model_evaluation(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gca_model_evaluation.ModelEvaluation.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.ModelServiceAsyncClient.import_model_evaluation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelService", + "rpcName": "ImportModelEvaluation", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ListModelEvaluations( @@ -2214,7 +2813,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> model_service.ListModelEvaluationsResponse: r"""Call the list model evaluations method over HTTP. @@ -2225,8 +2824,10 @@ async def __call__( 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: ~.model_service.ListModelEvaluationsResponse: @@ -2238,6 +2839,7 @@ async def __call__( http_options = ( _BaseModelServiceRestTransport._BaseListModelEvaluations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_model_evaluations( request, metadata ) @@ -2250,6 +2852,33 @@ async 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.aiplatform_v1beta1.ModelServiceClient.ListModelEvaluations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelService", + "rpcName": "ListModelEvaluations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncModelServiceRestTransport._ListModelEvaluations._get_response( self._host, @@ -2277,6 +2906,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_list_model_evaluations(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + model_service.ListModelEvaluationsResponse.to_json(response) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.ModelServiceAsyncClient.list_model_evaluations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelService", + "rpcName": "ListModelEvaluations", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ListModelEvaluationSlices( @@ -2315,7 +2968,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> model_service.ListModelEvaluationSlicesResponse: r"""Call the list model evaluation slices method over HTTP. @@ -2327,8 +2980,10 @@ async def __call__( 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: ~.model_service.ListModelEvaluationSlicesResponse: @@ -2340,6 +2995,7 @@ async def __call__( http_options = ( _BaseModelServiceRestTransport._BaseListModelEvaluationSlices._get_http_options() ) + ( request, metadata, @@ -2355,6 +3011,33 @@ async 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.aiplatform_v1beta1.ModelServiceClient.ListModelEvaluationSlices", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelService", + "rpcName": "ListModelEvaluationSlices", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncModelServiceRestTransport._ListModelEvaluationSlices._get_response( self._host, @@ -2382,6 +3065,32 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_list_model_evaluation_slices(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + model_service.ListModelEvaluationSlicesResponse.to_json( + response + ) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.ModelServiceAsyncClient.list_model_evaluation_slices", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelService", + "rpcName": "ListModelEvaluationSlices", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ListModels( @@ -2419,7 +3128,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> model_service.ListModelsResponse: r"""Call the list models method over HTTP. @@ -2430,8 +3139,10 @@ async def __call__( 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: ~.model_service.ListModelsResponse: @@ -2443,6 +3154,7 @@ async def __call__( http_options = ( _BaseModelServiceRestTransport._BaseListModels._get_http_options() ) + request, metadata = await self._interceptor.pre_list_models( request, metadata ) @@ -2459,6 +3171,33 @@ async 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 = 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.aiplatform_v1beta1.ModelServiceClient.ListModels", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelService", + "rpcName": "ListModels", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncModelServiceRestTransport._ListModels._get_response( self._host, @@ -2486,6 +3225,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_list_models(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = model_service.ListModelsResponse.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.ModelServiceAsyncClient.list_models", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelService", + "rpcName": "ListModels", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ListModelVersions( @@ -2523,7 +3286,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> model_service.ListModelVersionsResponse: r"""Call the list model versions method over HTTP. @@ -2534,8 +3297,10 @@ async def __call__( 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: ~.model_service.ListModelVersionsResponse: @@ -2547,6 +3312,7 @@ async def __call__( http_options = ( _BaseModelServiceRestTransport._BaseListModelVersions._get_http_options() ) + request, metadata = await self._interceptor.pre_list_model_versions( request, metadata ) @@ -2559,6 +3325,33 @@ async 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.aiplatform_v1beta1.ModelServiceClient.ListModelVersions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelService", + "rpcName": "ListModelVersions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncModelServiceRestTransport._ListModelVersions._get_response( @@ -2588,6 +3381,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_list_model_versions(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = model_service.ListModelVersionsResponse.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.ModelServiceAsyncClient.list_model_versions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelService", + "rpcName": "ListModelVersions", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _MergeVersionAliases( @@ -2627,7 +3444,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> model.Model: r"""Call the merge version aliases method over HTTP. @@ -2638,8 +3455,10 @@ async def __call__( 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: ~.model.Model: @@ -2649,6 +3468,7 @@ async def __call__( http_options = ( _BaseModelServiceRestTransport._BaseMergeVersionAliases._get_http_options() ) + request, metadata = await self._interceptor.pre_merge_version_aliases( request, metadata ) @@ -2665,6 +3485,33 @@ async 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.aiplatform_v1beta1.ModelServiceClient.MergeVersionAliases", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelService", + "rpcName": "MergeVersionAliases", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncModelServiceRestTransport._MergeVersionAliases._get_response( @@ -2695,6 +3542,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_merge_version_aliases(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = model.Model.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.ModelServiceAsyncClient.merge_version_aliases", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelService", + "rpcName": "MergeVersionAliases", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _UpdateExplanationDataset( @@ -2734,7 +3603,7 @@ async 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 explanation dataset method over HTTP. @@ -2746,8 +3615,10 @@ async def __call__( 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: @@ -2760,6 +3631,7 @@ async def __call__( http_options = ( _BaseModelServiceRestTransport._BaseUpdateExplanationDataset._get_http_options() ) + request, metadata = await self._interceptor.pre_update_explanation_dataset( request, metadata ) @@ -2776,6 +3648,33 @@ async 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.aiplatform_v1beta1.ModelServiceClient.UpdateExplanationDataset", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelService", + "rpcName": "UpdateExplanationDataset", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncModelServiceRestTransport._UpdateExplanationDataset._get_response( self._host, @@ -2804,6 +3703,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_update_explanation_dataset(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.ModelServiceAsyncClient.update_explanation_dataset", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelService", + "rpcName": "UpdateExplanationDataset", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _UpdateModel( @@ -2842,7 +3763,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> gca_model.Model: r"""Call the update model method over HTTP. @@ -2853,8 +3774,10 @@ async def __call__( 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: ~.gca_model.Model: @@ -2864,6 +3787,7 @@ async def __call__( http_options = ( _BaseModelServiceRestTransport._BaseUpdateModel._get_http_options() ) + request, metadata = await self._interceptor.pre_update_model( request, metadata ) @@ -2886,6 +3810,33 @@ async 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 = 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.aiplatform_v1beta1.ModelServiceClient.UpdateModel", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelService", + "rpcName": "UpdateModel", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncModelServiceRestTransport._UpdateModel._get_response( self._host, @@ -2914,6 +3865,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_update_model(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gca_model.Model.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.ModelServiceAsyncClient.update_model", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelService", + "rpcName": "UpdateModel", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _UploadModel( @@ -2952,7 +3925,7 @@ async 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 upload model method over HTTP. @@ -2963,8 +3936,10 @@ async def __call__( 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: @@ -2977,6 +3952,7 @@ async def __call__( http_options = ( _BaseModelServiceRestTransport._BaseUploadModel._get_http_options() ) + request, metadata = await self._interceptor.pre_upload_model( request, metadata ) @@ -2999,6 +3975,33 @@ async 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.aiplatform_v1beta1.ModelServiceClient.UploadModel", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelService", + "rpcName": "UploadModel", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncModelServiceRestTransport._UploadModel._get_response( self._host, @@ -3027,6 +4030,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_upload_model(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.ModelServiceAsyncClient.upload_model", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelService", + "rpcName": "UploadModel", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp @property @@ -3602,6 +4627,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -3818,6 +4847,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -4024,6 +5057,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}", @@ -4240,6 +5277,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, ], "google.longrunning.Operations.ListOperations": [ { @@ -4438,6 +5479,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*}/operations", @@ -4654,6 +5699,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*}/operations", + }, ], "google.longrunning.Operations.WaitOperation": [ { @@ -4852,6 +5901,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "post", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}:wait", @@ -5064,6 +6117,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, ], } @@ -5252,7 +6309,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -5263,8 +6320,10 @@ async def __call__( 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: locations_pb2.Location: Response from GetLocation method. @@ -5273,6 +6332,7 @@ async def __call__( http_options = ( _BaseModelServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_location( request, metadata ) @@ -5289,6 +6349,33 @@ async 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.aiplatform_v1beta1.ModelServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncModelServiceRestTransport._GetLocation._get_response( self._host, @@ -5314,6 +6401,27 @@ async def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_location(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.aiplatform_v1beta1.ModelServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5355,7 +6463,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -5366,8 +6474,10 @@ async def __call__( 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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -5376,6 +6486,7 @@ async def __call__( http_options = ( _BaseModelServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_locations( request, metadata ) @@ -5388,6 +6499,33 @@ async 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.aiplatform_v1beta1.ModelServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncModelServiceRestTransport._ListLocations._get_response( @@ -5415,6 +6553,27 @@ async def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_list_locations(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.aiplatform_v1beta1.ModelServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5457,7 +6616,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -5468,8 +6627,10 @@ async def __call__( 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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -5478,6 +6639,7 @@ async def __call__( http_options = ( _BaseModelServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_get_iam_policy( request, metadata ) @@ -5498,6 +6660,33 @@ async 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.aiplatform_v1beta1.ModelServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncModelServiceRestTransport._GetIamPolicy._get_response( self._host, @@ -5524,6 +6713,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_iam_policy(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.aiplatform_v1beta1.ModelServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5566,7 +6776,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -5577,8 +6787,10 @@ async def __call__( 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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -5587,6 +6799,7 @@ async def __call__( http_options = ( _BaseModelServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_set_iam_policy( request, metadata ) @@ -5607,6 +6820,33 @@ async 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.aiplatform_v1beta1.ModelServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncModelServiceRestTransport._SetIamPolicy._get_response( self._host, @@ -5633,6 +6873,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_set_iam_policy(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.aiplatform_v1beta1.ModelServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5676,7 +6937,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -5687,8 +6948,10 @@ async def __call__( 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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -5697,6 +6960,7 @@ async def __call__( http_options = ( _BaseModelServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = await self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -5713,6 +6977,33 @@ async 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.aiplatform_v1beta1.ModelServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncModelServiceRestTransport._TestIamPermissions._get_response( @@ -5741,6 +7032,27 @@ async def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_test_iam_permissions(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.aiplatform_v1beta1.ModelServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5782,7 +7094,7 @@ async 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 cancel operation method over HTTP. @@ -5793,13 +7105,16 @@ async def __call__( 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`. """ http_options = ( _BaseModelServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_cancel_operation( request, metadata ) @@ -5812,6 +7127,33 @@ async 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.aiplatform_v1beta1.ModelServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncModelServiceRestTransport._CancelOperation._get_response( @@ -5876,7 +7218,7 @@ async 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. @@ -5887,13 +7229,16 @@ async def __call__( 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`. """ http_options = ( _BaseModelServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_operation( request, metadata ) @@ -5906,6 +7251,33 @@ async 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.aiplatform_v1beta1.ModelServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncModelServiceRestTransport._DeleteOperation._get_response( @@ -5970,7 +7342,7 @@ async 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. @@ -5981,8 +7353,10 @@ async def __call__( 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: Response from GetOperation method. @@ -5991,6 +7365,7 @@ async def __call__( http_options = ( _BaseModelServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_operation( request, metadata ) @@ -6005,6 +7380,33 @@ async 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.aiplatform_v1beta1.ModelServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncModelServiceRestTransport._GetOperation._get_response( self._host, @@ -6030,6 +7432,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1beta1.ModelServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -6071,7 +7494,7 @@ async 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. @@ -6082,8 +7505,10 @@ async def __call__( 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 from ListOperations method. @@ -6092,6 +7517,7 @@ async def __call__( http_options = ( _BaseModelServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_operations( request, metadata ) @@ -6104,6 +7530,33 @@ async 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.aiplatform_v1beta1.ModelServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncModelServiceRestTransport._ListOperations._get_response( @@ -6131,6 +7584,27 @@ async def __call__( resp = operations_pb2.ListOperationsResponse() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1beta1.ModelServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -6172,7 +7646,7 @@ async 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 wait operation method over HTTP. @@ -6183,8 +7657,10 @@ async def __call__( 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: Response from WaitOperation method. @@ -6193,6 +7669,7 @@ async def __call__( http_options = ( _BaseModelServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_wait_operation( request, metadata ) @@ -6205,6 +7682,33 @@ async 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.aiplatform_v1beta1.ModelServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncModelServiceRestTransport._WaitOperation._get_response( @@ -6232,6 +7736,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_wait_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.aiplatform_v1beta1.ModelServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ModelService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1beta1/services/model_service/transports/rest_base.py b/google/cloud/aiplatform_v1beta1/services/model_service/transports/rest_base.py index 40e552482d..e3e9042207 100644 --- a/google/cloud/aiplatform_v1beta1/services/model_service/transports/rest_base.py +++ b/google/cloud/aiplatform_v1beta1/services/model_service/transports/rest_base.py @@ -1958,6 +1958,10 @@ def _get_http_options(): "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -2174,6 +2178,10 @@ def _get_http_options(): "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -2399,6 +2407,10 @@ def _get_http_options(): "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}", @@ -2615,6 +2627,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, ] return http_options @@ -2832,6 +2848,10 @@ def _get_http_options(): "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*}/operations", @@ -3048,6 +3068,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*}/operations", + }, ] return http_options @@ -3265,6 +3289,10 @@ def _get_http_options(): "method": "post", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}:wait", @@ -3477,6 +3505,10 @@ def _get_http_options(): "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, ] return http_options diff --git a/google/cloud/aiplatform_v1beta1/services/notebook_service/async_client.py b/google/cloud/aiplatform_v1beta1/services/notebook_service/async_client.py index 4b1745520f..486f62d471 100644 --- a/google/cloud/aiplatform_v1beta1/services/notebook_service/async_client.py +++ b/google/cloud/aiplatform_v1beta1/services/notebook_service/async_client.py @@ -13,6 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging as std_logging from collections import OrderedDict import re from typing import ( @@ -76,6 +77,15 @@ from .transports.grpc_asyncio import NotebookServiceGrpcAsyncIOTransport from .client import NotebookServiceClient +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 NotebookServiceAsyncClient: """The interface for Vertex Notebook service (a.k.a. Colab on @@ -307,6 +317,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.aiplatform_v1beta1.NotebookServiceAsyncClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.NotebookService", + "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.aiplatform.v1beta1.NotebookService", + "credentialsType": None, + }, + ) + async def create_notebook_runtime_template( self, request: Optional[ @@ -320,7 +352,7 @@ async def create_notebook_runtime_template( notebook_runtime_template_id: 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"""Creates a NotebookRuntimeTemplate. @@ -387,8 +419,10 @@ async def sample_create_notebook_runtime_template(): 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: @@ -471,7 +505,7 @@ async def get_notebook_runtime_template( 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]]] = (), ) -> notebook_runtime.NotebookRuntimeTemplate: r"""Gets a NotebookRuntimeTemplate. @@ -516,8 +550,10 @@ async def sample_get_notebook_runtime_template(): 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.aiplatform_v1beta1.types.NotebookRuntimeTemplate: @@ -583,7 +619,7 @@ async def list_notebook_runtime_templates( 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.ListNotebookRuntimeTemplatesAsyncPager: r"""Lists NotebookRuntimeTemplates in a Location. @@ -629,8 +665,10 @@ async def sample_list_notebook_runtime_templates(): 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.aiplatform_v1beta1.services.notebook_service.pagers.ListNotebookRuntimeTemplatesAsyncPager: @@ -709,7 +747,7 @@ async def delete_notebook_runtime_template( 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"""Deletes a NotebookRuntimeTemplate. @@ -758,8 +796,10 @@ async def sample_delete_notebook_runtime_template(): 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: @@ -845,7 +885,7 @@ async def update_notebook_runtime_template( 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]]] = (), ) -> notebook_runtime.NotebookRuntimeTemplate: r"""Updates a NotebookRuntimeTemplate. @@ -904,8 +944,10 @@ async def sample_update_notebook_runtime_template(): 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.aiplatform_v1beta1.types.NotebookRuntimeTemplate: @@ -985,7 +1027,7 @@ async def assign_notebook_runtime( notebook_runtime_id: 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"""Assigns a NotebookRuntime to a user for a particular Notebook file. This method will either returns an @@ -1067,8 +1109,10 @@ async def sample_assign_notebook_runtime(): 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: @@ -1150,7 +1194,7 @@ async def get_notebook_runtime( 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]]] = (), ) -> notebook_runtime.NotebookRuntime: r"""Gets a NotebookRuntime. @@ -1199,8 +1243,10 @@ async def sample_get_notebook_runtime(): 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.aiplatform_v1beta1.types.NotebookRuntime: @@ -1265,7 +1311,7 @@ async def list_notebook_runtimes( 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.ListNotebookRuntimesAsyncPager: r"""Lists NotebookRuntimes in a Location. @@ -1311,8 +1357,10 @@ async def sample_list_notebook_runtimes(): 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.aiplatform_v1beta1.services.notebook_service.pagers.ListNotebookRuntimesAsyncPager: @@ -1389,7 +1437,7 @@ async def delete_notebook_runtime( 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"""Deletes a NotebookRuntime. @@ -1442,8 +1490,10 @@ async def sample_delete_notebook_runtime(): 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: @@ -1524,7 +1574,7 @@ async def upgrade_notebook_runtime( 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"""Upgrades a NotebookRuntime. @@ -1577,8 +1627,10 @@ async def sample_upgrade_notebook_runtime(): 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: @@ -1651,7 +1703,7 @@ async def start_notebook_runtime( 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"""Starts a NotebookRuntime. @@ -1704,8 +1756,10 @@ async def sample_start_notebook_runtime(): 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: @@ -1778,7 +1832,7 @@ async def stop_notebook_runtime( 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"""Stops a NotebookRuntime. @@ -1831,8 +1885,10 @@ async def sample_stop_notebook_runtime(): 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: @@ -1909,7 +1965,7 @@ async def create_notebook_execution_job( notebook_execution_job_id: 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"""Creates a NotebookExecutionJob. @@ -1978,8 +2034,10 @@ async def sample_create_notebook_execution_job(): 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: @@ -2060,7 +2118,7 @@ async def get_notebook_execution_job( 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]]] = (), ) -> notebook_execution_job.NotebookExecutionJob: r"""Gets a NotebookExecutionJob. @@ -2104,8 +2162,10 @@ async def sample_get_notebook_execution_job(): 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.aiplatform_v1beta1.types.NotebookExecutionJob: @@ -2168,7 +2228,7 @@ async def list_notebook_execution_jobs( 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.ListNotebookExecutionJobsAsyncPager: r"""Lists NotebookExecutionJobs in a Location. @@ -2214,8 +2274,10 @@ async def sample_list_notebook_execution_jobs(): 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.aiplatform_v1beta1.services.notebook_service.pagers.ListNotebookExecutionJobsAsyncPager: @@ -2292,7 +2354,7 @@ async def delete_notebook_execution_job( 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"""Deletes a NotebookExecutionJob. @@ -2341,8 +2403,10 @@ async def sample_delete_notebook_execution_job(): 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: @@ -2420,7 +2484,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. @@ -2431,8 +2495,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. @@ -2473,7 +2539,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. @@ -2484,8 +2550,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. @@ -2526,7 +2594,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. @@ -2542,8 +2610,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 """ @@ -2580,7 +2650,7 @@ async def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -2595,8 +2665,10 @@ async def cancel_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 """ @@ -2633,7 +2705,7 @@ async def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -2650,8 +2722,10 @@ async def wait_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. @@ -2692,7 +2766,7 @@ async def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -2705,8 +2779,10 @@ async def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -2811,7 +2887,7 @@ async def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -2825,8 +2901,10 @@ async def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -2931,7 +3009,7 @@ async def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -2946,8 +3024,10 @@ async def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -2991,7 +3071,7 @@ async def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -3002,8 +3082,10 @@ async def get_location( 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: ~.location_pb2.Location: Location object. @@ -3044,7 +3126,7 @@ async def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -3055,8 +3137,10 @@ async def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1beta1/services/notebook_service/client.py b/google/cloud/aiplatform_v1beta1/services/notebook_service/client.py index 0dfcc7d861..8b42939a21 100644 --- a/google/cloud/aiplatform_v1beta1/services/notebook_service/client.py +++ b/google/cloud/aiplatform_v1beta1/services/notebook_service/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 ( @@ -48,6 +49,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 as gac_operation # type: ignore from google.api_core import operation_async # type: ignore from google.cloud.aiplatform_v1beta1.services.notebook_service import pagers @@ -751,6 +761,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( @@ -841,6 +855,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.aiplatform_v1beta1.NotebookServiceClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.NotebookService", + "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.aiplatform.v1beta1.NotebookService", + "credentialsType": None, + }, + ) + def create_notebook_runtime_template( self, request: Optional[ @@ -854,7 +891,7 @@ def create_notebook_runtime_template( notebook_runtime_template_id: 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]]] = (), ) -> gac_operation.Operation: r"""Creates a NotebookRuntimeTemplate. @@ -921,8 +958,10 @@ def sample_create_notebook_runtime_template(): 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: @@ -1004,7 +1043,7 @@ def get_notebook_runtime_template( 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]]] = (), ) -> notebook_runtime.NotebookRuntimeTemplate: r"""Gets a NotebookRuntimeTemplate. @@ -1049,8 +1088,10 @@ def sample_get_notebook_runtime_template(): 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.aiplatform_v1beta1.types.NotebookRuntimeTemplate: @@ -1115,7 +1156,7 @@ def list_notebook_runtime_templates( 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.ListNotebookRuntimeTemplatesPager: r"""Lists NotebookRuntimeTemplates in a Location. @@ -1161,8 +1202,10 @@ def sample_list_notebook_runtime_templates(): 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.aiplatform_v1beta1.services.notebook_service.pagers.ListNotebookRuntimeTemplatesPager: @@ -1240,7 +1283,7 @@ def delete_notebook_runtime_template( 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]]] = (), ) -> gac_operation.Operation: r"""Deletes a NotebookRuntimeTemplate. @@ -1289,8 +1332,10 @@ def sample_delete_notebook_runtime_template(): 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: @@ -1375,7 +1420,7 @@ def update_notebook_runtime_template( 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]]] = (), ) -> notebook_runtime.NotebookRuntimeTemplate: r"""Updates a NotebookRuntimeTemplate. @@ -1434,8 +1479,10 @@ def sample_update_notebook_runtime_template(): 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.aiplatform_v1beta1.types.NotebookRuntimeTemplate: @@ -1514,7 +1561,7 @@ def assign_notebook_runtime( notebook_runtime_id: 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]]] = (), ) -> gac_operation.Operation: r"""Assigns a NotebookRuntime to a user for a particular Notebook file. This method will either returns an @@ -1596,8 +1643,10 @@ def sample_assign_notebook_runtime(): 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: @@ -1676,7 +1725,7 @@ def get_notebook_runtime( 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]]] = (), ) -> notebook_runtime.NotebookRuntime: r"""Gets a NotebookRuntime. @@ -1725,8 +1774,10 @@ def sample_get_notebook_runtime(): 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.aiplatform_v1beta1.types.NotebookRuntime: @@ -1788,7 +1839,7 @@ def list_notebook_runtimes( 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.ListNotebookRuntimesPager: r"""Lists NotebookRuntimes in a Location. @@ -1834,8 +1885,10 @@ def sample_list_notebook_runtimes(): 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.aiplatform_v1beta1.services.notebook_service.pagers.ListNotebookRuntimesPager: @@ -1909,7 +1962,7 @@ def delete_notebook_runtime( 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]]] = (), ) -> gac_operation.Operation: r"""Deletes a NotebookRuntime. @@ -1962,8 +2015,10 @@ def sample_delete_notebook_runtime(): 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: @@ -2041,7 +2096,7 @@ def upgrade_notebook_runtime( 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]]] = (), ) -> gac_operation.Operation: r"""Upgrades a NotebookRuntime. @@ -2094,8 +2149,10 @@ def sample_upgrade_notebook_runtime(): 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: @@ -2165,7 +2222,7 @@ def start_notebook_runtime( 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]]] = (), ) -> gac_operation.Operation: r"""Starts a NotebookRuntime. @@ -2218,8 +2275,10 @@ def sample_start_notebook_runtime(): 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: @@ -2289,7 +2348,7 @@ def stop_notebook_runtime( 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]]] = (), ) -> gac_operation.Operation: r"""Stops a NotebookRuntime. @@ -2342,8 +2401,10 @@ def sample_stop_notebook_runtime(): 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: @@ -2417,7 +2478,7 @@ def create_notebook_execution_job( notebook_execution_job_id: 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]]] = (), ) -> gac_operation.Operation: r"""Creates a NotebookExecutionJob. @@ -2486,8 +2547,10 @@ def sample_create_notebook_execution_job(): 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: @@ -2567,7 +2630,7 @@ def get_notebook_execution_job( 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]]] = (), ) -> notebook_execution_job.NotebookExecutionJob: r"""Gets a NotebookExecutionJob. @@ -2611,8 +2674,10 @@ def sample_get_notebook_execution_job(): 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.aiplatform_v1beta1.types.NotebookExecutionJob: @@ -2674,7 +2739,7 @@ def list_notebook_execution_jobs( 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.ListNotebookExecutionJobsPager: r"""Lists NotebookExecutionJobs in a Location. @@ -2720,8 +2785,10 @@ def sample_list_notebook_execution_jobs(): 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.aiplatform_v1beta1.services.notebook_service.pagers.ListNotebookExecutionJobsPager: @@ -2797,7 +2864,7 @@ def delete_notebook_execution_job( 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]]] = (), ) -> gac_operation.Operation: r"""Deletes a NotebookExecutionJob. @@ -2846,8 +2913,10 @@ def sample_delete_notebook_execution_job(): 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: @@ -2937,7 +3006,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. @@ -2948,8 +3017,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. @@ -2990,7 +3061,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. @@ -3001,8 +3072,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. @@ -3043,7 +3116,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. @@ -3059,8 +3132,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 """ @@ -3097,7 +3172,7 @@ def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -3112,8 +3187,10 @@ def cancel_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 """ @@ -3150,7 +3227,7 @@ def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -3167,8 +3244,10 @@ def wait_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. @@ -3209,7 +3288,7 @@ def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -3222,8 +3301,10 @@ def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -3328,7 +3409,7 @@ def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -3342,8 +3423,10 @@ def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -3448,7 +3531,7 @@ def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -3463,8 +3546,10 @@ def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -3506,7 +3591,7 @@ def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -3517,8 +3602,10 @@ def get_location( 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: ~.location_pb2.Location: Location object. @@ -3559,7 +3646,7 @@ def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -3570,8 +3657,10 @@ def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1beta1/services/notebook_service/pagers.py b/google/cloud/aiplatform_v1beta1/services/notebook_service/pagers.py index 9ce5b53212..93c794d0a9 100644 --- a/google/cloud/aiplatform_v1beta1/services/notebook_service/pagers.py +++ b/google/cloud/aiplatform_v1beta1/services/notebook_service/pagers.py @@ -68,7 +68,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. @@ -82,8 +82,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 = notebook_service.ListNotebookRuntimeTemplatesRequest(request) @@ -144,7 +146,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. @@ -158,8 +160,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 = notebook_service.ListNotebookRuntimeTemplatesRequest(request) @@ -224,7 +228,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. @@ -238,8 +242,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 = notebook_service.ListNotebookRuntimesRequest(request) @@ -298,7 +304,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. @@ -312,8 +318,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 = notebook_service.ListNotebookRuntimesRequest(request) @@ -378,7 +386,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. @@ -392,8 +400,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 = notebook_service.ListNotebookExecutionJobsRequest(request) @@ -454,7 +464,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. @@ -468,8 +478,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 = notebook_service.ListNotebookExecutionJobsRequest(request) diff --git a/google/cloud/aiplatform_v1beta1/services/notebook_service/transports/grpc.py b/google/cloud/aiplatform_v1beta1/services/notebook_service/transports/grpc.py index 8953f27b74..2fcc23a66d 100644 --- a/google/cloud/aiplatform_v1beta1/services/notebook_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1beta1/services/notebook_service/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 import warnings from typing import Callable, Dict, Optional, Sequence, Tuple, Union @@ -22,8 +25,11 @@ import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from google.cloud.aiplatform_v1beta1.types import notebook_execution_job from google.cloud.aiplatform_v1beta1.types import notebook_runtime @@ -34,6 +40,81 @@ from google.longrunning import operations_pb2 # type: ignore from .base import NotebookServiceTransport, DEFAULT_CLIENT_INFO +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.aiplatform.v1beta1.NotebookService", + "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.aiplatform.v1beta1.NotebookService", + "rpcName": client_call_details.method, + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class NotebookServiceGrpcTransport(NotebookServiceTransport): """gRPC backend transport for NotebookService. @@ -189,7 +270,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 @@ -253,7 +339,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 @@ -283,7 +371,7 @@ def create_notebook_runtime_template( if "create_notebook_runtime_template" not in self._stubs: self._stubs[ "create_notebook_runtime_template" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.NotebookService/CreateNotebookRuntimeTemplate", request_serializer=notebook_service.CreateNotebookRuntimeTemplateRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -314,7 +402,7 @@ def get_notebook_runtime_template( if "get_notebook_runtime_template" not in self._stubs: self._stubs[ "get_notebook_runtime_template" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.NotebookService/GetNotebookRuntimeTemplate", request_serializer=notebook_service.GetNotebookRuntimeTemplateRequest.serialize, response_deserializer=notebook_runtime.NotebookRuntimeTemplate.deserialize, @@ -346,7 +434,7 @@ def list_notebook_runtime_templates( if "list_notebook_runtime_templates" not in self._stubs: self._stubs[ "list_notebook_runtime_templates" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.NotebookService/ListNotebookRuntimeTemplates", request_serializer=notebook_service.ListNotebookRuntimeTemplatesRequest.serialize, response_deserializer=notebook_service.ListNotebookRuntimeTemplatesResponse.deserialize, @@ -378,7 +466,7 @@ def delete_notebook_runtime_template( if "delete_notebook_runtime_template" not in self._stubs: self._stubs[ "delete_notebook_runtime_template" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.NotebookService/DeleteNotebookRuntimeTemplate", request_serializer=notebook_service.DeleteNotebookRuntimeTemplateRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -410,7 +498,7 @@ def update_notebook_runtime_template( if "update_notebook_runtime_template" not in self._stubs: self._stubs[ "update_notebook_runtime_template" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.NotebookService/UpdateNotebookRuntimeTemplate", request_serializer=notebook_service.UpdateNotebookRuntimeTemplateRequest.serialize, response_deserializer=notebook_runtime.NotebookRuntimeTemplate.deserialize, @@ -440,7 +528,7 @@ def assign_notebook_runtime( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "assign_notebook_runtime" not in self._stubs: - self._stubs["assign_notebook_runtime"] = self.grpc_channel.unary_unary( + self._stubs["assign_notebook_runtime"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.NotebookService/AssignNotebookRuntime", request_serializer=notebook_service.AssignNotebookRuntimeRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -468,7 +556,7 @@ def get_notebook_runtime( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_notebook_runtime" not in self._stubs: - self._stubs["get_notebook_runtime"] = self.grpc_channel.unary_unary( + self._stubs["get_notebook_runtime"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.NotebookService/GetNotebookRuntime", request_serializer=notebook_service.GetNotebookRuntimeRequest.serialize, response_deserializer=notebook_runtime.NotebookRuntime.deserialize, @@ -497,7 +585,7 @@ def list_notebook_runtimes( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_notebook_runtimes" not in self._stubs: - self._stubs["list_notebook_runtimes"] = self.grpc_channel.unary_unary( + self._stubs["list_notebook_runtimes"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.NotebookService/ListNotebookRuntimes", request_serializer=notebook_service.ListNotebookRuntimesRequest.serialize, response_deserializer=notebook_service.ListNotebookRuntimesResponse.deserialize, @@ -525,7 +613,7 @@ def delete_notebook_runtime( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_notebook_runtime" not in self._stubs: - self._stubs["delete_notebook_runtime"] = self.grpc_channel.unary_unary( + self._stubs["delete_notebook_runtime"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.NotebookService/DeleteNotebookRuntime", request_serializer=notebook_service.DeleteNotebookRuntimeRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -553,7 +641,7 @@ def upgrade_notebook_runtime( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "upgrade_notebook_runtime" not in self._stubs: - self._stubs["upgrade_notebook_runtime"] = self.grpc_channel.unary_unary( + self._stubs["upgrade_notebook_runtime"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.NotebookService/UpgradeNotebookRuntime", request_serializer=notebook_service.UpgradeNotebookRuntimeRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -581,7 +669,7 @@ def start_notebook_runtime( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "start_notebook_runtime" not in self._stubs: - self._stubs["start_notebook_runtime"] = self.grpc_channel.unary_unary( + self._stubs["start_notebook_runtime"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.NotebookService/StartNotebookRuntime", request_serializer=notebook_service.StartNotebookRuntimeRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -609,7 +697,7 @@ def stop_notebook_runtime( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "stop_notebook_runtime" not in self._stubs: - self._stubs["stop_notebook_runtime"] = self.grpc_channel.unary_unary( + self._stubs["stop_notebook_runtime"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.NotebookService/StopNotebookRuntime", request_serializer=notebook_service.StopNotebookRuntimeRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -639,7 +727,7 @@ def create_notebook_execution_job( if "create_notebook_execution_job" not in self._stubs: self._stubs[ "create_notebook_execution_job" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.NotebookService/CreateNotebookExecutionJob", request_serializer=notebook_service.CreateNotebookExecutionJobRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -668,7 +756,9 @@ def get_notebook_execution_job( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_notebook_execution_job" not in self._stubs: - self._stubs["get_notebook_execution_job"] = self.grpc_channel.unary_unary( + self._stubs[ + "get_notebook_execution_job" + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.NotebookService/GetNotebookExecutionJob", request_serializer=notebook_service.GetNotebookExecutionJobRequest.serialize, response_deserializer=notebook_execution_job.NotebookExecutionJob.deserialize, @@ -697,7 +787,9 @@ def list_notebook_execution_jobs( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_notebook_execution_jobs" not in self._stubs: - self._stubs["list_notebook_execution_jobs"] = self.grpc_channel.unary_unary( + self._stubs[ + "list_notebook_execution_jobs" + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.NotebookService/ListNotebookExecutionJobs", request_serializer=notebook_service.ListNotebookExecutionJobsRequest.serialize, response_deserializer=notebook_service.ListNotebookExecutionJobsResponse.deserialize, @@ -727,7 +819,7 @@ def delete_notebook_execution_job( if "delete_notebook_execution_job" not in self._stubs: self._stubs[ "delete_notebook_execution_job" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.NotebookService/DeleteNotebookExecutionJob", request_serializer=notebook_service.DeleteNotebookExecutionJobRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -735,7 +827,7 @@ def delete_notebook_execution_job( return self._stubs["delete_notebook_execution_job"] def close(self): - self.grpc_channel.close() + self._logged_channel.close() @property def delete_operation( @@ -747,7 +839,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, @@ -764,7 +856,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -781,7 +873,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -798,7 +890,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, @@ -817,7 +909,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, @@ -836,7 +928,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -853,7 +945,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -878,7 +970,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -904,7 +996,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -933,7 +1025,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1beta1/services/notebook_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1beta1/services/notebook_service/transports/grpc_asyncio.py index b1418da4d5..0f75bb72b2 100644 --- a/google/cloud/aiplatform_v1beta1/services/notebook_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/notebook_service/transports/grpc_asyncio.py @@ -14,6 +14,9 @@ # limitations under the License. # import inspect +import json +import pickle +import logging as std_logging import warnings from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union @@ -24,8 +27,11 @@ from google.api_core import operations_v1 from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from grpc.experimental import aio # type: ignore from google.cloud.aiplatform_v1beta1.types import notebook_execution_job @@ -38,6 +44,82 @@ from .base import NotebookServiceTransport, DEFAULT_CLIENT_INFO from .grpc import NotebookServiceGrpcTransport +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.aiplatform.v1beta1.NotebookService", + "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.aiplatform.v1beta1.NotebookService", + "rpcName": str(client_call_details.method), + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class NotebookServiceGrpcAsyncIOTransport(NotebookServiceTransport): """gRPC AsyncIO backend transport for NotebookService. @@ -236,10 +318,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 @@ -262,7 +347,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. @@ -293,7 +378,7 @@ def create_notebook_runtime_template( if "create_notebook_runtime_template" not in self._stubs: self._stubs[ "create_notebook_runtime_template" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.NotebookService/CreateNotebookRuntimeTemplate", request_serializer=notebook_service.CreateNotebookRuntimeTemplateRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -324,7 +409,7 @@ def get_notebook_runtime_template( if "get_notebook_runtime_template" not in self._stubs: self._stubs[ "get_notebook_runtime_template" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.NotebookService/GetNotebookRuntimeTemplate", request_serializer=notebook_service.GetNotebookRuntimeTemplateRequest.serialize, response_deserializer=notebook_runtime.NotebookRuntimeTemplate.deserialize, @@ -356,7 +441,7 @@ def list_notebook_runtime_templates( if "list_notebook_runtime_templates" not in self._stubs: self._stubs[ "list_notebook_runtime_templates" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.NotebookService/ListNotebookRuntimeTemplates", request_serializer=notebook_service.ListNotebookRuntimeTemplatesRequest.serialize, response_deserializer=notebook_service.ListNotebookRuntimeTemplatesResponse.deserialize, @@ -388,7 +473,7 @@ def delete_notebook_runtime_template( if "delete_notebook_runtime_template" not in self._stubs: self._stubs[ "delete_notebook_runtime_template" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.NotebookService/DeleteNotebookRuntimeTemplate", request_serializer=notebook_service.DeleteNotebookRuntimeTemplateRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -420,7 +505,7 @@ def update_notebook_runtime_template( if "update_notebook_runtime_template" not in self._stubs: self._stubs[ "update_notebook_runtime_template" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.NotebookService/UpdateNotebookRuntimeTemplate", request_serializer=notebook_service.UpdateNotebookRuntimeTemplateRequest.serialize, response_deserializer=notebook_runtime.NotebookRuntimeTemplate.deserialize, @@ -451,7 +536,7 @@ def assign_notebook_runtime( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "assign_notebook_runtime" not in self._stubs: - self._stubs["assign_notebook_runtime"] = self.grpc_channel.unary_unary( + self._stubs["assign_notebook_runtime"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.NotebookService/AssignNotebookRuntime", request_serializer=notebook_service.AssignNotebookRuntimeRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -480,7 +565,7 @@ def get_notebook_runtime( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_notebook_runtime" not in self._stubs: - self._stubs["get_notebook_runtime"] = self.grpc_channel.unary_unary( + self._stubs["get_notebook_runtime"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.NotebookService/GetNotebookRuntime", request_serializer=notebook_service.GetNotebookRuntimeRequest.serialize, response_deserializer=notebook_runtime.NotebookRuntime.deserialize, @@ -509,7 +594,7 @@ def list_notebook_runtimes( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_notebook_runtimes" not in self._stubs: - self._stubs["list_notebook_runtimes"] = self.grpc_channel.unary_unary( + self._stubs["list_notebook_runtimes"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.NotebookService/ListNotebookRuntimes", request_serializer=notebook_service.ListNotebookRuntimesRequest.serialize, response_deserializer=notebook_service.ListNotebookRuntimesResponse.deserialize, @@ -538,7 +623,7 @@ def delete_notebook_runtime( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_notebook_runtime" not in self._stubs: - self._stubs["delete_notebook_runtime"] = self.grpc_channel.unary_unary( + self._stubs["delete_notebook_runtime"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.NotebookService/DeleteNotebookRuntime", request_serializer=notebook_service.DeleteNotebookRuntimeRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -567,7 +652,7 @@ def upgrade_notebook_runtime( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "upgrade_notebook_runtime" not in self._stubs: - self._stubs["upgrade_notebook_runtime"] = self.grpc_channel.unary_unary( + self._stubs["upgrade_notebook_runtime"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.NotebookService/UpgradeNotebookRuntime", request_serializer=notebook_service.UpgradeNotebookRuntimeRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -596,7 +681,7 @@ def start_notebook_runtime( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "start_notebook_runtime" not in self._stubs: - self._stubs["start_notebook_runtime"] = self.grpc_channel.unary_unary( + self._stubs["start_notebook_runtime"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.NotebookService/StartNotebookRuntime", request_serializer=notebook_service.StartNotebookRuntimeRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -625,7 +710,7 @@ def stop_notebook_runtime( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "stop_notebook_runtime" not in self._stubs: - self._stubs["stop_notebook_runtime"] = self.grpc_channel.unary_unary( + self._stubs["stop_notebook_runtime"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.NotebookService/StopNotebookRuntime", request_serializer=notebook_service.StopNotebookRuntimeRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -656,7 +741,7 @@ def create_notebook_execution_job( if "create_notebook_execution_job" not in self._stubs: self._stubs[ "create_notebook_execution_job" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.NotebookService/CreateNotebookExecutionJob", request_serializer=notebook_service.CreateNotebookExecutionJobRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -685,7 +770,9 @@ def get_notebook_execution_job( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_notebook_execution_job" not in self._stubs: - self._stubs["get_notebook_execution_job"] = self.grpc_channel.unary_unary( + self._stubs[ + "get_notebook_execution_job" + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.NotebookService/GetNotebookExecutionJob", request_serializer=notebook_service.GetNotebookExecutionJobRequest.serialize, response_deserializer=notebook_execution_job.NotebookExecutionJob.deserialize, @@ -714,7 +801,9 @@ def list_notebook_execution_jobs( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_notebook_execution_jobs" not in self._stubs: - self._stubs["list_notebook_execution_jobs"] = self.grpc_channel.unary_unary( + self._stubs[ + "list_notebook_execution_jobs" + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.NotebookService/ListNotebookExecutionJobs", request_serializer=notebook_service.ListNotebookExecutionJobsRequest.serialize, response_deserializer=notebook_service.ListNotebookExecutionJobsResponse.deserialize, @@ -745,7 +834,7 @@ def delete_notebook_execution_job( if "delete_notebook_execution_job" not in self._stubs: self._stubs[ "delete_notebook_execution_job" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.NotebookService/DeleteNotebookExecutionJob", request_serializer=notebook_service.DeleteNotebookExecutionJobRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -893,7 +982,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: @@ -909,7 +998,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, @@ -926,7 +1015,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -943,7 +1032,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -960,7 +1049,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, @@ -979,7 +1068,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, @@ -998,7 +1087,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -1015,7 +1104,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -1040,7 +1129,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -1066,7 +1155,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -1095,7 +1184,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1beta1/services/notebook_service/transports/rest.py b/google/cloud/aiplatform_v1beta1/services/notebook_service/transports/rest.py index f3b426529c..94c752d0f3 100644 --- a/google/cloud/aiplatform_v1beta1/services/notebook_service/transports/rest.py +++ b/google/cloud/aiplatform_v1beta1/services/notebook_service/transports/rest.py @@ -13,9 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging +import json # type: ignore from google.auth.transport.requests import AuthorizedSession # type: ignore -import json # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.api_core import exceptions as core_exceptions from google.api_core import retry as retries @@ -49,6 +50,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, @@ -209,9 +218,10 @@ def post_upgrade_notebook_runtime(self, response): def pre_assign_notebook_runtime( self, request: notebook_service.AssignNotebookRuntimeRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - notebook_service.AssignNotebookRuntimeRequest, Sequence[Tuple[str, str]] + notebook_service.AssignNotebookRuntimeRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for assign_notebook_runtime @@ -234,9 +244,10 @@ def post_assign_notebook_runtime( def pre_create_notebook_execution_job( self, request: notebook_service.CreateNotebookExecutionJobRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - notebook_service.CreateNotebookExecutionJobRequest, Sequence[Tuple[str, str]] + notebook_service.CreateNotebookExecutionJobRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for create_notebook_execution_job @@ -259,9 +270,10 @@ def post_create_notebook_execution_job( def pre_create_notebook_runtime_template( self, request: notebook_service.CreateNotebookRuntimeTemplateRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - notebook_service.CreateNotebookRuntimeTemplateRequest, Sequence[Tuple[str, str]] + notebook_service.CreateNotebookRuntimeTemplateRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for create_notebook_runtime_template @@ -284,9 +296,10 @@ def post_create_notebook_runtime_template( def pre_delete_notebook_execution_job( self, request: notebook_service.DeleteNotebookExecutionJobRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - notebook_service.DeleteNotebookExecutionJobRequest, Sequence[Tuple[str, str]] + notebook_service.DeleteNotebookExecutionJobRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for delete_notebook_execution_job @@ -309,9 +322,10 @@ def post_delete_notebook_execution_job( def pre_delete_notebook_runtime( self, request: notebook_service.DeleteNotebookRuntimeRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - notebook_service.DeleteNotebookRuntimeRequest, Sequence[Tuple[str, str]] + notebook_service.DeleteNotebookRuntimeRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for delete_notebook_runtime @@ -334,9 +348,10 @@ def post_delete_notebook_runtime( def pre_delete_notebook_runtime_template( self, request: notebook_service.DeleteNotebookRuntimeTemplateRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - notebook_service.DeleteNotebookRuntimeTemplateRequest, Sequence[Tuple[str, str]] + notebook_service.DeleteNotebookRuntimeTemplateRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for delete_notebook_runtime_template @@ -359,9 +374,10 @@ def post_delete_notebook_runtime_template( def pre_get_notebook_execution_job( self, request: notebook_service.GetNotebookExecutionJobRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - notebook_service.GetNotebookExecutionJobRequest, Sequence[Tuple[str, str]] + notebook_service.GetNotebookExecutionJobRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for get_notebook_execution_job @@ -384,8 +400,11 @@ def post_get_notebook_execution_job( def pre_get_notebook_runtime( self, request: notebook_service.GetNotebookRuntimeRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[notebook_service.GetNotebookRuntimeRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + notebook_service.GetNotebookRuntimeRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for get_notebook_runtime Override in a subclass to manipulate the request or metadata @@ -407,9 +426,10 @@ def post_get_notebook_runtime( def pre_get_notebook_runtime_template( self, request: notebook_service.GetNotebookRuntimeTemplateRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - notebook_service.GetNotebookRuntimeTemplateRequest, Sequence[Tuple[str, str]] + notebook_service.GetNotebookRuntimeTemplateRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for get_notebook_runtime_template @@ -432,9 +452,10 @@ def post_get_notebook_runtime_template( def pre_list_notebook_execution_jobs( self, request: notebook_service.ListNotebookExecutionJobsRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - notebook_service.ListNotebookExecutionJobsRequest, Sequence[Tuple[str, str]] + notebook_service.ListNotebookExecutionJobsRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for list_notebook_execution_jobs @@ -457,8 +478,11 @@ def post_list_notebook_execution_jobs( def pre_list_notebook_runtimes( self, request: notebook_service.ListNotebookRuntimesRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[notebook_service.ListNotebookRuntimesRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + notebook_service.ListNotebookRuntimesRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for list_notebook_runtimes Override in a subclass to manipulate the request or metadata @@ -480,9 +504,10 @@ def post_list_notebook_runtimes( def pre_list_notebook_runtime_templates( self, request: notebook_service.ListNotebookRuntimeTemplatesRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - notebook_service.ListNotebookRuntimeTemplatesRequest, Sequence[Tuple[str, str]] + notebook_service.ListNotebookRuntimeTemplatesRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for list_notebook_runtime_templates @@ -505,8 +530,11 @@ def post_list_notebook_runtime_templates( def pre_start_notebook_runtime( self, request: notebook_service.StartNotebookRuntimeRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[notebook_service.StartNotebookRuntimeRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + notebook_service.StartNotebookRuntimeRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for start_notebook_runtime Override in a subclass to manipulate the request or metadata @@ -528,8 +556,11 @@ def post_start_notebook_runtime( def pre_stop_notebook_runtime( self, request: notebook_service.StopNotebookRuntimeRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[notebook_service.StopNotebookRuntimeRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + notebook_service.StopNotebookRuntimeRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for stop_notebook_runtime Override in a subclass to manipulate the request or metadata @@ -551,9 +582,10 @@ def post_stop_notebook_runtime( def pre_update_notebook_runtime_template( self, request: notebook_service.UpdateNotebookRuntimeTemplateRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - notebook_service.UpdateNotebookRuntimeTemplateRequest, Sequence[Tuple[str, str]] + notebook_service.UpdateNotebookRuntimeTemplateRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for update_notebook_runtime_template @@ -576,9 +608,10 @@ def post_update_notebook_runtime_template( def pre_upgrade_notebook_runtime( self, request: notebook_service.UpgradeNotebookRuntimeRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - notebook_service.UpgradeNotebookRuntimeRequest, Sequence[Tuple[str, str]] + notebook_service.UpgradeNotebookRuntimeRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for upgrade_notebook_runtime @@ -601,8 +634,10 @@ def post_upgrade_notebook_runtime( def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -624,8 +659,10 @@ def post_get_location( def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -647,8 +684,10 @@ def post_list_locations( def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -668,8 +707,10 @@ def post_get_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -689,8 +730,11 @@ def post_set_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -712,8 +756,10 @@ def post_test_iam_permissions( def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -733,8 +779,10 @@ def post_cancel_operation(self, response: None) -> None: 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 @@ -754,8 +802,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 @@ -777,8 +827,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 @@ -800,8 +852,10 @@ def post_list_operations( def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -1482,6 +1536,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -1698,6 +1756,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -1904,6 +1966,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}", @@ -2120,6 +2186,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, ], "google.longrunning.Operations.ListOperations": [ { @@ -2318,6 +2388,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*}/operations", @@ -2534,6 +2608,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*}/operations", + }, ], "google.longrunning.Operations.WaitOperation": [ { @@ -2732,6 +2810,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "post", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}:wait", @@ -2944,6 +3026,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, ], } @@ -3000,7 +3086,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 assign notebook runtime method over HTTP. @@ -3011,8 +3097,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: @@ -3025,6 +3113,7 @@ def __call__( http_options = ( _BaseNotebookServiceRestTransport._BaseAssignNotebookRuntime._get_http_options() ) + request, metadata = self._interceptor.pre_assign_notebook_runtime( request, metadata ) @@ -3041,6 +3130,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.aiplatform_v1beta1.NotebookServiceClient.AssignNotebookRuntime", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.NotebookService", + "rpcName": "AssignNotebookRuntime", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( NotebookServiceRestTransport._AssignNotebookRuntime._get_response( @@ -3062,7 +3178,29 @@ def __call__( # Return the response resp = operations_pb2.Operation() json_format.Parse(response.content, resp, ignore_unknown_fields=True) + resp = self._interceptor.post_assign_notebook_runtime(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.aiplatform_v1beta1.NotebookServiceClient.assign_notebook_runtime", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.NotebookService", + "rpcName": "AssignNotebookRuntime", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _CreateNotebookExecutionJob( @@ -3102,7 +3240,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 notebook execution job method over HTTP. @@ -3114,8 +3252,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: @@ -3128,6 +3268,7 @@ def __call__( http_options = ( _BaseNotebookServiceRestTransport._BaseCreateNotebookExecutionJob._get_http_options() ) + request, metadata = self._interceptor.pre_create_notebook_execution_job( request, metadata ) @@ -3144,6 +3285,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.aiplatform_v1beta1.NotebookServiceClient.CreateNotebookExecutionJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.NotebookService", + "rpcName": "CreateNotebookExecutionJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( NotebookServiceRestTransport._CreateNotebookExecutionJob._get_response( @@ -3165,7 +3333,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_notebook_execution_job(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.aiplatform_v1beta1.NotebookServiceClient.create_notebook_execution_job", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.NotebookService", + "rpcName": "CreateNotebookExecutionJob", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _CreateNotebookRuntimeTemplate( @@ -3205,7 +3395,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 notebook runtime template method over HTTP. @@ -3217,8 +3407,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: @@ -3231,6 +3423,7 @@ def __call__( http_options = ( _BaseNotebookServiceRestTransport._BaseCreateNotebookRuntimeTemplate._get_http_options() ) + request, metadata = self._interceptor.pre_create_notebook_runtime_template( request, metadata ) @@ -3247,6 +3440,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.aiplatform_v1beta1.NotebookServiceClient.CreateNotebookRuntimeTemplate", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.NotebookService", + "rpcName": "CreateNotebookRuntimeTemplate", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = NotebookServiceRestTransport._CreateNotebookRuntimeTemplate._get_response( self._host, @@ -3266,7 +3486,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_notebook_runtime_template(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.aiplatform_v1beta1.NotebookServiceClient.create_notebook_runtime_template", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.NotebookService", + "rpcName": "CreateNotebookRuntimeTemplate", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _DeleteNotebookExecutionJob( @@ -3305,7 +3547,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 notebook execution job method over HTTP. @@ -3317,8 +3559,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: @@ -3331,6 +3575,7 @@ def __call__( http_options = ( _BaseNotebookServiceRestTransport._BaseDeleteNotebookExecutionJob._get_http_options() ) + request, metadata = self._interceptor.pre_delete_notebook_execution_job( request, metadata ) @@ -3343,6 +3588,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.aiplatform_v1beta1.NotebookServiceClient.DeleteNotebookExecutionJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.NotebookService", + "rpcName": "DeleteNotebookExecutionJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( NotebookServiceRestTransport._DeleteNotebookExecutionJob._get_response( @@ -3363,7 +3635,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_notebook_execution_job(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.aiplatform_v1beta1.NotebookServiceClient.delete_notebook_execution_job", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.NotebookService", + "rpcName": "DeleteNotebookExecutionJob", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _DeleteNotebookRuntime( @@ -3402,7 +3696,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 notebook runtime method over HTTP. @@ -3413,8 +3707,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: @@ -3427,6 +3723,7 @@ def __call__( http_options = ( _BaseNotebookServiceRestTransport._BaseDeleteNotebookRuntime._get_http_options() ) + request, metadata = self._interceptor.pre_delete_notebook_runtime( request, metadata ) @@ -3439,6 +3736,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.aiplatform_v1beta1.NotebookServiceClient.DeleteNotebookRuntime", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.NotebookService", + "rpcName": "DeleteNotebookRuntime", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( NotebookServiceRestTransport._DeleteNotebookRuntime._get_response( @@ -3459,7 +3783,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_notebook_runtime(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.aiplatform_v1beta1.NotebookServiceClient.delete_notebook_runtime", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.NotebookService", + "rpcName": "DeleteNotebookRuntime", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _DeleteNotebookRuntimeTemplate( @@ -3498,7 +3844,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 notebook runtime template method over HTTP. @@ -3510,8 +3856,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: @@ -3524,6 +3872,7 @@ def __call__( http_options = ( _BaseNotebookServiceRestTransport._BaseDeleteNotebookRuntimeTemplate._get_http_options() ) + request, metadata = self._interceptor.pre_delete_notebook_runtime_template( request, metadata ) @@ -3536,6 +3885,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.aiplatform_v1beta1.NotebookServiceClient.DeleteNotebookRuntimeTemplate", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.NotebookService", + "rpcName": "DeleteNotebookRuntimeTemplate", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = NotebookServiceRestTransport._DeleteNotebookRuntimeTemplate._get_response( self._host, @@ -3554,7 +3930,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_notebook_runtime_template(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.aiplatform_v1beta1.NotebookServiceClient.delete_notebook_runtime_template", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.NotebookService", + "rpcName": "DeleteNotebookRuntimeTemplate", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _GetNotebookExecutionJob( @@ -3593,7 +3991,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]]] = (), ) -> notebook_execution_job.NotebookExecutionJob: r"""Call the get notebook execution job method over HTTP. @@ -3605,8 +4003,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: ~.notebook_execution_job.NotebookExecutionJob: @@ -3618,6 +4018,7 @@ def __call__( http_options = ( _BaseNotebookServiceRestTransport._BaseGetNotebookExecutionJob._get_http_options() ) + request, metadata = self._interceptor.pre_get_notebook_execution_job( request, metadata ) @@ -3630,6 +4031,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.aiplatform_v1beta1.NotebookServiceClient.GetNotebookExecutionJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.NotebookService", + "rpcName": "GetNotebookExecutionJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( NotebookServiceRestTransport._GetNotebookExecutionJob._get_response( @@ -3652,7 +4080,31 @@ def __call__( pb_resp = notebook_execution_job.NotebookExecutionJob.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_notebook_execution_job(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + notebook_execution_job.NotebookExecutionJob.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.aiplatform_v1beta1.NotebookServiceClient.get_notebook_execution_job", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.NotebookService", + "rpcName": "GetNotebookExecutionJob", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _GetNotebookRuntime( @@ -3691,7 +4143,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]]] = (), ) -> notebook_runtime.NotebookRuntime: r"""Call the get notebook runtime method over HTTP. @@ -3702,8 +4154,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: ~.notebook_runtime.NotebookRuntime: @@ -3717,6 +4171,7 @@ def __call__( http_options = ( _BaseNotebookServiceRestTransport._BaseGetNotebookRuntime._get_http_options() ) + request, metadata = self._interceptor.pre_get_notebook_runtime( request, metadata ) @@ -3729,6 +4184,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.aiplatform_v1beta1.NotebookServiceClient.GetNotebookRuntime", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.NotebookService", + "rpcName": "GetNotebookRuntime", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = NotebookServiceRestTransport._GetNotebookRuntime._get_response( self._host, @@ -3749,7 +4231,31 @@ def __call__( pb_resp = notebook_runtime.NotebookRuntime.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_notebook_runtime(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = notebook_runtime.NotebookRuntime.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.aiplatform_v1beta1.NotebookServiceClient.get_notebook_runtime", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.NotebookService", + "rpcName": "GetNotebookRuntime", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _GetNotebookRuntimeTemplate( @@ -3788,7 +4294,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]]] = (), ) -> notebook_runtime.NotebookRuntimeTemplate: r"""Call the get notebook runtime template method over HTTP. @@ -3800,8 +4306,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: ~.notebook_runtime.NotebookRuntimeTemplate: @@ -3816,6 +4324,7 @@ def __call__( http_options = ( _BaseNotebookServiceRestTransport._BaseGetNotebookRuntimeTemplate._get_http_options() ) + request, metadata = self._interceptor.pre_get_notebook_runtime_template( request, metadata ) @@ -3828,6 +4337,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.aiplatform_v1beta1.NotebookServiceClient.GetNotebookRuntimeTemplate", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.NotebookService", + "rpcName": "GetNotebookRuntimeTemplate", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( NotebookServiceRestTransport._GetNotebookRuntimeTemplate._get_response( @@ -3850,7 +4386,31 @@ def __call__( pb_resp = notebook_runtime.NotebookRuntimeTemplate.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_notebook_runtime_template(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = notebook_runtime.NotebookRuntimeTemplate.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.aiplatform_v1beta1.NotebookServiceClient.get_notebook_runtime_template", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.NotebookService", + "rpcName": "GetNotebookRuntimeTemplate", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListNotebookExecutionJobs( @@ -3889,7 +4449,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]]] = (), ) -> notebook_service.ListNotebookExecutionJobsResponse: r"""Call the list notebook execution jobs method over HTTP. @@ -3901,8 +4461,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: ~.notebook_service.ListNotebookExecutionJobsResponse: @@ -3914,6 +4476,7 @@ def __call__( http_options = ( _BaseNotebookServiceRestTransport._BaseListNotebookExecutionJobs._get_http_options() ) + request, metadata = self._interceptor.pre_list_notebook_execution_jobs( request, metadata ) @@ -3926,6 +4489,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.aiplatform_v1beta1.NotebookServiceClient.ListNotebookExecutionJobs", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.NotebookService", + "rpcName": "ListNotebookExecutionJobs", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( NotebookServiceRestTransport._ListNotebookExecutionJobs._get_response( @@ -3948,7 +4538,33 @@ def __call__( pb_resp = notebook_service.ListNotebookExecutionJobsResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_notebook_execution_jobs(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + notebook_service.ListNotebookExecutionJobsResponse.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.aiplatform_v1beta1.NotebookServiceClient.list_notebook_execution_jobs", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.NotebookService", + "rpcName": "ListNotebookExecutionJobs", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListNotebookRuntimes( @@ -3987,7 +4603,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]]] = (), ) -> notebook_service.ListNotebookRuntimesResponse: r"""Call the list notebook runtimes method over HTTP. @@ -3998,8 +4614,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: ~.notebook_service.ListNotebookRuntimesResponse: @@ -4011,6 +4629,7 @@ def __call__( http_options = ( _BaseNotebookServiceRestTransport._BaseListNotebookRuntimes._get_http_options() ) + request, metadata = self._interceptor.pre_list_notebook_runtimes( request, metadata ) @@ -4023,6 +4642,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.aiplatform_v1beta1.NotebookServiceClient.ListNotebookRuntimes", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.NotebookService", + "rpcName": "ListNotebookRuntimes", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = NotebookServiceRestTransport._ListNotebookRuntimes._get_response( self._host, @@ -4043,7 +4689,31 @@ def __call__( pb_resp = notebook_service.ListNotebookRuntimesResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_notebook_runtimes(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + notebook_service.ListNotebookRuntimesResponse.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.aiplatform_v1beta1.NotebookServiceClient.list_notebook_runtimes", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.NotebookService", + "rpcName": "ListNotebookRuntimes", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListNotebookRuntimeTemplates( @@ -4082,7 +4752,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]]] = (), ) -> notebook_service.ListNotebookRuntimeTemplatesResponse: r"""Call the list notebook runtime templates method over HTTP. @@ -4094,8 +4764,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: ~.notebook_service.ListNotebookRuntimeTemplatesResponse: @@ -4107,6 +4779,7 @@ def __call__( http_options = ( _BaseNotebookServiceRestTransport._BaseListNotebookRuntimeTemplates._get_http_options() ) + request, metadata = self._interceptor.pre_list_notebook_runtime_templates( request, metadata ) @@ -4119,6 +4792,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.aiplatform_v1beta1.NotebookServiceClient.ListNotebookRuntimeTemplates", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.NotebookService", + "rpcName": "ListNotebookRuntimeTemplates", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = NotebookServiceRestTransport._ListNotebookRuntimeTemplates._get_response( self._host, @@ -4139,7 +4839,33 @@ def __call__( pb_resp = notebook_service.ListNotebookRuntimeTemplatesResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_notebook_runtime_templates(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + notebook_service.ListNotebookRuntimeTemplatesResponse.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.aiplatform_v1beta1.NotebookServiceClient.list_notebook_runtime_templates", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.NotebookService", + "rpcName": "ListNotebookRuntimeTemplates", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _StartNotebookRuntime( @@ -4179,7 +4905,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 start notebook runtime method over HTTP. @@ -4190,8 +4916,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: @@ -4204,6 +4932,7 @@ def __call__( http_options = ( _BaseNotebookServiceRestTransport._BaseStartNotebookRuntime._get_http_options() ) + request, metadata = self._interceptor.pre_start_notebook_runtime( request, metadata ) @@ -4220,6 +4949,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.aiplatform_v1beta1.NotebookServiceClient.StartNotebookRuntime", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.NotebookService", + "rpcName": "StartNotebookRuntime", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = NotebookServiceRestTransport._StartNotebookRuntime._get_response( self._host, @@ -4239,7 +4995,29 @@ def __call__( # Return the response resp = operations_pb2.Operation() json_format.Parse(response.content, resp, ignore_unknown_fields=True) + resp = self._interceptor.post_start_notebook_runtime(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.aiplatform_v1beta1.NotebookServiceClient.start_notebook_runtime", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.NotebookService", + "rpcName": "StartNotebookRuntime", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _StopNotebookRuntime( @@ -4279,7 +5057,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 stop notebook runtime method over HTTP. @@ -4290,8 +5068,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: @@ -4304,6 +5084,7 @@ def __call__( http_options = ( _BaseNotebookServiceRestTransport._BaseStopNotebookRuntime._get_http_options() ) + request, metadata = self._interceptor.pre_stop_notebook_runtime( request, metadata ) @@ -4320,6 +5101,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.aiplatform_v1beta1.NotebookServiceClient.StopNotebookRuntime", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.NotebookService", + "rpcName": "StopNotebookRuntime", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = NotebookServiceRestTransport._StopNotebookRuntime._get_response( self._host, @@ -4339,7 +5147,29 @@ def __call__( # Return the response resp = operations_pb2.Operation() json_format.Parse(response.content, resp, ignore_unknown_fields=True) + resp = self._interceptor.post_stop_notebook_runtime(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.aiplatform_v1beta1.NotebookServiceClient.stop_notebook_runtime", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.NotebookService", + "rpcName": "StopNotebookRuntime", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _UpdateNotebookRuntimeTemplate( @@ -4379,7 +5209,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]]] = (), ) -> notebook_runtime.NotebookRuntimeTemplate: r"""Call the update notebook runtime template method over HTTP. @@ -4391,8 +5221,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: ~.notebook_runtime.NotebookRuntimeTemplate: @@ -4407,6 +5239,7 @@ def __call__( http_options = ( _BaseNotebookServiceRestTransport._BaseUpdateNotebookRuntimeTemplate._get_http_options() ) + request, metadata = self._interceptor.pre_update_notebook_runtime_template( request, metadata ) @@ -4423,6 +5256,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.aiplatform_v1beta1.NotebookServiceClient.UpdateNotebookRuntimeTemplate", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.NotebookService", + "rpcName": "UpdateNotebookRuntimeTemplate", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = NotebookServiceRestTransport._UpdateNotebookRuntimeTemplate._get_response( self._host, @@ -4444,7 +5304,31 @@ def __call__( pb_resp = notebook_runtime.NotebookRuntimeTemplate.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_update_notebook_runtime_template(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = notebook_runtime.NotebookRuntimeTemplate.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.aiplatform_v1beta1.NotebookServiceClient.update_notebook_runtime_template", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.NotebookService", + "rpcName": "UpdateNotebookRuntimeTemplate", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _UpgradeNotebookRuntime( @@ -4484,7 +5368,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 upgrade notebook runtime method over HTTP. @@ -4495,8 +5379,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: @@ -4509,6 +5395,7 @@ def __call__( http_options = ( _BaseNotebookServiceRestTransport._BaseUpgradeNotebookRuntime._get_http_options() ) + request, metadata = self._interceptor.pre_upgrade_notebook_runtime( request, metadata ) @@ -4525,6 +5412,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.aiplatform_v1beta1.NotebookServiceClient.UpgradeNotebookRuntime", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.NotebookService", + "rpcName": "UpgradeNotebookRuntime", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( NotebookServiceRestTransport._UpgradeNotebookRuntime._get_response( @@ -4546,7 +5460,29 @@ def __call__( # Return the response resp = operations_pb2.Operation() json_format.Parse(response.content, resp, ignore_unknown_fields=True) + resp = self._interceptor.post_upgrade_notebook_runtime(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.aiplatform_v1beta1.NotebookServiceClient.upgrade_notebook_runtime", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.NotebookService", + "rpcName": "UpgradeNotebookRuntime", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp @property @@ -4756,7 +5692,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]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -4767,8 +5703,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: locations_pb2.Location: Response from GetLocation method. @@ -4777,6 +5715,7 @@ def __call__( http_options = ( _BaseNotebookServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = self._interceptor.pre_get_location(request, metadata) transcoded_request = _BaseNotebookServiceRestTransport._BaseGetLocation._get_transcoded_request( http_options, request @@ -4787,6 +5726,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.aiplatform_v1beta1.NotebookServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.NotebookService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = NotebookServiceRestTransport._GetLocation._get_response( self._host, @@ -4806,6 +5772,27 @@ def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_location(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.aiplatform_v1beta1.NotebookServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.NotebookService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4847,7 +5834,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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -4858,8 +5845,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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -4868,6 +5857,7 @@ def __call__( http_options = ( _BaseNotebookServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = self._interceptor.pre_list_locations(request, metadata) transcoded_request = _BaseNotebookServiceRestTransport._BaseListLocations._get_transcoded_request( http_options, request @@ -4878,6 +5868,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.aiplatform_v1beta1.NotebookServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.NotebookService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = NotebookServiceRestTransport._ListLocations._get_response( self._host, @@ -4897,6 +5914,27 @@ def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_list_locations(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.aiplatform_v1beta1.NotebookServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.NotebookService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4939,7 +5977,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]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -4950,8 +5988,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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -4960,6 +6000,7 @@ def __call__( http_options = ( _BaseNotebookServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_get_iam_policy(request, metadata) transcoded_request = _BaseNotebookServiceRestTransport._BaseGetIamPolicy._get_transcoded_request( http_options, request @@ -4974,6 +6015,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.aiplatform_v1beta1.NotebookServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.NotebookService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = NotebookServiceRestTransport._GetIamPolicy._get_response( self._host, @@ -4994,6 +6062,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_iam_policy(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.aiplatform_v1beta1.NotebookServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.NotebookService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5036,7 +6125,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]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -5047,8 +6136,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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -5057,6 +6148,7 @@ def __call__( http_options = ( _BaseNotebookServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_set_iam_policy(request, metadata) transcoded_request = _BaseNotebookServiceRestTransport._BaseSetIamPolicy._get_transcoded_request( http_options, request @@ -5071,6 +6163,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.aiplatform_v1beta1.NotebookServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.NotebookService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = NotebookServiceRestTransport._SetIamPolicy._get_response( self._host, @@ -5091,6 +6210,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_set_iam_policy(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.aiplatform_v1beta1.NotebookServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.NotebookService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5134,7 +6274,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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -5145,8 +6285,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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -5155,6 +6297,7 @@ def __call__( http_options = ( _BaseNotebookServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -5171,6 +6314,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.aiplatform_v1beta1.NotebookServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.NotebookService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = NotebookServiceRestTransport._TestIamPermissions._get_response( self._host, @@ -5191,6 +6361,27 @@ def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_test_iam_permissions(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.aiplatform_v1beta1.NotebookServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.NotebookService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5232,7 +6423,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 cancel operation method over HTTP. @@ -5243,13 +6434,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 = ( _BaseNotebookServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = self._interceptor.pre_cancel_operation( request, metadata ) @@ -5262,6 +6456,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.aiplatform_v1beta1.NotebookServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.NotebookService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = NotebookServiceRestTransport._CancelOperation._get_response( self._host, @@ -5318,7 +6539,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. @@ -5329,13 +6550,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 = ( _BaseNotebookServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = self._interceptor.pre_delete_operation( request, metadata ) @@ -5348,6 +6572,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.aiplatform_v1beta1.NotebookServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.NotebookService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = NotebookServiceRestTransport._DeleteOperation._get_response( self._host, @@ -5404,7 +6655,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. @@ -5415,8 +6666,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. @@ -5425,6 +6678,7 @@ def __call__( http_options = ( _BaseNotebookServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = self._interceptor.pre_get_operation(request, metadata) transcoded_request = _BaseNotebookServiceRestTransport._BaseGetOperation._get_transcoded_request( http_options, request @@ -5435,6 +6689,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.aiplatform_v1beta1.NotebookServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.NotebookService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = NotebookServiceRestTransport._GetOperation._get_response( self._host, @@ -5454,6 +6735,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.aiplatform_v1beta1.NotebookServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.NotebookService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5495,7 +6797,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. @@ -5506,8 +6808,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. @@ -5516,6 +6820,7 @@ def __call__( http_options = ( _BaseNotebookServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = self._interceptor.pre_list_operations(request, metadata) transcoded_request = _BaseNotebookServiceRestTransport._BaseListOperations._get_transcoded_request( http_options, request @@ -5526,6 +6831,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.aiplatform_v1beta1.NotebookServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.NotebookService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = NotebookServiceRestTransport._ListOperations._get_response( self._host, @@ -5545,6 +6877,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.aiplatform_v1beta1.NotebookServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.NotebookService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5586,7 +6939,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 wait operation method over HTTP. @@ -5597,8 +6950,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 WaitOperation method. @@ -5607,6 +6962,7 @@ def __call__( http_options = ( _BaseNotebookServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = self._interceptor.pre_wait_operation(request, metadata) transcoded_request = _BaseNotebookServiceRestTransport._BaseWaitOperation._get_transcoded_request( http_options, request @@ -5617,6 +6973,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.aiplatform_v1beta1.NotebookServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.NotebookService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = NotebookServiceRestTransport._WaitOperation._get_response( self._host, @@ -5636,6 +7019,27 @@ def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = self._interceptor.post_wait_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.aiplatform_v1beta1.NotebookServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.NotebookService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1beta1/services/notebook_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1beta1/services/notebook_service/transports/rest_asyncio.py index 0c35dc3484..b04a5d760b 100644 --- a/google/cloud/aiplatform_v1beta1/services/notebook_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/notebook_service/transports/rest_asyncio.py @@ -60,6 +60,18 @@ from .base import DEFAULT_CLIENT_INFO as BASE_DEFAULT_CLIENT_INFO + +import logging + +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__) + try: OptionalRetry = Union[retries.AsyncRetry, gapic_v1.method._MethodDefault, None] except AttributeError: # pragma: NO COVER @@ -224,9 +236,10 @@ async def post_upgrade_notebook_runtime(self, response): async def pre_assign_notebook_runtime( self, request: notebook_service.AssignNotebookRuntimeRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - notebook_service.AssignNotebookRuntimeRequest, Sequence[Tuple[str, str]] + notebook_service.AssignNotebookRuntimeRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for assign_notebook_runtime @@ -249,9 +262,10 @@ async def post_assign_notebook_runtime( async def pre_create_notebook_execution_job( self, request: notebook_service.CreateNotebookExecutionJobRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - notebook_service.CreateNotebookExecutionJobRequest, Sequence[Tuple[str, str]] + notebook_service.CreateNotebookExecutionJobRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for create_notebook_execution_job @@ -274,9 +288,10 @@ async def post_create_notebook_execution_job( async def pre_create_notebook_runtime_template( self, request: notebook_service.CreateNotebookRuntimeTemplateRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - notebook_service.CreateNotebookRuntimeTemplateRequest, Sequence[Tuple[str, str]] + notebook_service.CreateNotebookRuntimeTemplateRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for create_notebook_runtime_template @@ -299,9 +314,10 @@ async def post_create_notebook_runtime_template( async def pre_delete_notebook_execution_job( self, request: notebook_service.DeleteNotebookExecutionJobRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - notebook_service.DeleteNotebookExecutionJobRequest, Sequence[Tuple[str, str]] + notebook_service.DeleteNotebookExecutionJobRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for delete_notebook_execution_job @@ -324,9 +340,10 @@ async def post_delete_notebook_execution_job( async def pre_delete_notebook_runtime( self, request: notebook_service.DeleteNotebookRuntimeRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - notebook_service.DeleteNotebookRuntimeRequest, Sequence[Tuple[str, str]] + notebook_service.DeleteNotebookRuntimeRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for delete_notebook_runtime @@ -349,9 +366,10 @@ async def post_delete_notebook_runtime( async def pre_delete_notebook_runtime_template( self, request: notebook_service.DeleteNotebookRuntimeTemplateRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - notebook_service.DeleteNotebookRuntimeTemplateRequest, Sequence[Tuple[str, str]] + notebook_service.DeleteNotebookRuntimeTemplateRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for delete_notebook_runtime_template @@ -374,9 +392,10 @@ async def post_delete_notebook_runtime_template( async def pre_get_notebook_execution_job( self, request: notebook_service.GetNotebookExecutionJobRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - notebook_service.GetNotebookExecutionJobRequest, Sequence[Tuple[str, str]] + notebook_service.GetNotebookExecutionJobRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for get_notebook_execution_job @@ -399,8 +418,11 @@ async def post_get_notebook_execution_job( async def pre_get_notebook_runtime( self, request: notebook_service.GetNotebookRuntimeRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[notebook_service.GetNotebookRuntimeRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + notebook_service.GetNotebookRuntimeRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for get_notebook_runtime Override in a subclass to manipulate the request or metadata @@ -422,9 +444,10 @@ async def post_get_notebook_runtime( async def pre_get_notebook_runtime_template( self, request: notebook_service.GetNotebookRuntimeTemplateRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - notebook_service.GetNotebookRuntimeTemplateRequest, Sequence[Tuple[str, str]] + notebook_service.GetNotebookRuntimeTemplateRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for get_notebook_runtime_template @@ -447,9 +470,10 @@ async def post_get_notebook_runtime_template( async def pre_list_notebook_execution_jobs( self, request: notebook_service.ListNotebookExecutionJobsRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - notebook_service.ListNotebookExecutionJobsRequest, Sequence[Tuple[str, str]] + notebook_service.ListNotebookExecutionJobsRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for list_notebook_execution_jobs @@ -472,8 +496,11 @@ async def post_list_notebook_execution_jobs( async def pre_list_notebook_runtimes( self, request: notebook_service.ListNotebookRuntimesRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[notebook_service.ListNotebookRuntimesRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + notebook_service.ListNotebookRuntimesRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for list_notebook_runtimes Override in a subclass to manipulate the request or metadata @@ -495,9 +522,10 @@ async def post_list_notebook_runtimes( async def pre_list_notebook_runtime_templates( self, request: notebook_service.ListNotebookRuntimeTemplatesRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - notebook_service.ListNotebookRuntimeTemplatesRequest, Sequence[Tuple[str, str]] + notebook_service.ListNotebookRuntimeTemplatesRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for list_notebook_runtime_templates @@ -520,8 +548,11 @@ async def post_list_notebook_runtime_templates( async def pre_start_notebook_runtime( self, request: notebook_service.StartNotebookRuntimeRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[notebook_service.StartNotebookRuntimeRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + notebook_service.StartNotebookRuntimeRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for start_notebook_runtime Override in a subclass to manipulate the request or metadata @@ -543,8 +574,11 @@ async def post_start_notebook_runtime( async def pre_stop_notebook_runtime( self, request: notebook_service.StopNotebookRuntimeRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[notebook_service.StopNotebookRuntimeRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + notebook_service.StopNotebookRuntimeRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for stop_notebook_runtime Override in a subclass to manipulate the request or metadata @@ -566,9 +600,10 @@ async def post_stop_notebook_runtime( async def pre_update_notebook_runtime_template( self, request: notebook_service.UpdateNotebookRuntimeTemplateRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - notebook_service.UpdateNotebookRuntimeTemplateRequest, Sequence[Tuple[str, str]] + notebook_service.UpdateNotebookRuntimeTemplateRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for update_notebook_runtime_template @@ -591,9 +626,10 @@ async def post_update_notebook_runtime_template( async def pre_upgrade_notebook_runtime( self, request: notebook_service.UpgradeNotebookRuntimeRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - notebook_service.UpgradeNotebookRuntimeRequest, Sequence[Tuple[str, str]] + notebook_service.UpgradeNotebookRuntimeRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for upgrade_notebook_runtime @@ -616,8 +652,10 @@ async def post_upgrade_notebook_runtime( async def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -639,8 +677,10 @@ async def post_get_location( async def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -662,8 +702,10 @@ async def post_list_locations( async def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -685,8 +727,10 @@ async def post_get_iam_policy( async def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -708,8 +752,11 @@ async def post_set_iam_policy( async def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -731,8 +778,10 @@ async def post_test_iam_permissions( async def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -752,8 +801,10 @@ async def post_cancel_operation(self, response: None) -> None: async 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 @@ -773,8 +824,10 @@ async def post_delete_operation(self, response: None) -> None: async 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 @@ -796,8 +849,10 @@ async def post_get_operation( async 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 @@ -819,8 +874,10 @@ async def post_list_operations( async def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -1082,7 +1139,7 @@ async 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 assign notebook runtime method over HTTP. @@ -1093,8 +1150,10 @@ async def __call__( 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: @@ -1107,6 +1166,7 @@ async def __call__( http_options = ( _BaseNotebookServiceRestTransport._BaseAssignNotebookRuntime._get_http_options() ) + request, metadata = await self._interceptor.pre_assign_notebook_runtime( request, metadata ) @@ -1123,6 +1183,33 @@ async 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.aiplatform_v1beta1.NotebookServiceClient.AssignNotebookRuntime", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.NotebookService", + "rpcName": "AssignNotebookRuntime", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncNotebookServiceRestTransport._AssignNotebookRuntime._get_response( self._host, @@ -1151,6 +1238,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_assign_notebook_runtime(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.NotebookServiceAsyncClient.assign_notebook_runtime", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.NotebookService", + "rpcName": "AssignNotebookRuntime", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _CreateNotebookExecutionJob( @@ -1190,7 +1299,7 @@ async 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 notebook execution job method over HTTP. @@ -1202,8 +1311,10 @@ async def __call__( 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: @@ -1216,6 +1327,7 @@ async def __call__( http_options = ( _BaseNotebookServiceRestTransport._BaseCreateNotebookExecutionJob._get_http_options() ) + ( request, metadata, @@ -1235,6 +1347,33 @@ async 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.aiplatform_v1beta1.NotebookServiceClient.CreateNotebookExecutionJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.NotebookService", + "rpcName": "CreateNotebookExecutionJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncNotebookServiceRestTransport._CreateNotebookExecutionJob._get_response( self._host, @@ -1263,6 +1402,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_create_notebook_execution_job(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.NotebookServiceAsyncClient.create_notebook_execution_job", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.NotebookService", + "rpcName": "CreateNotebookExecutionJob", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _CreateNotebookRuntimeTemplate( @@ -1304,7 +1465,7 @@ async 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 notebook runtime template method over HTTP. @@ -1316,8 +1477,10 @@ async def __call__( 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: @@ -1330,6 +1493,7 @@ async def __call__( http_options = ( _BaseNotebookServiceRestTransport._BaseCreateNotebookRuntimeTemplate._get_http_options() ) + ( request, metadata, @@ -1349,6 +1513,33 @@ async 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.aiplatform_v1beta1.NotebookServiceClient.CreateNotebookRuntimeTemplate", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.NotebookService", + "rpcName": "CreateNotebookRuntimeTemplate", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncNotebookServiceRestTransport._CreateNotebookRuntimeTemplate._get_response( self._host, @@ -1377,6 +1568,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_create_notebook_runtime_template(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.NotebookServiceAsyncClient.create_notebook_runtime_template", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.NotebookService", + "rpcName": "CreateNotebookRuntimeTemplate", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _DeleteNotebookExecutionJob( @@ -1415,7 +1628,7 @@ async 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 notebook execution job method over HTTP. @@ -1427,8 +1640,10 @@ async def __call__( 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: @@ -1441,6 +1656,7 @@ async def __call__( http_options = ( _BaseNotebookServiceRestTransport._BaseDeleteNotebookExecutionJob._get_http_options() ) + ( request, metadata, @@ -1456,6 +1672,33 @@ async 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.aiplatform_v1beta1.NotebookServiceClient.DeleteNotebookExecutionJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.NotebookService", + "rpcName": "DeleteNotebookExecutionJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncNotebookServiceRestTransport._DeleteNotebookExecutionJob._get_response( self._host, @@ -1483,6 +1726,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_delete_notebook_execution_job(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.NotebookServiceAsyncClient.delete_notebook_execution_job", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.NotebookService", + "rpcName": "DeleteNotebookExecutionJob", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _DeleteNotebookRuntime( @@ -1521,7 +1786,7 @@ async 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 notebook runtime method over HTTP. @@ -1532,8 +1797,10 @@ async def __call__( 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: @@ -1546,6 +1813,7 @@ async def __call__( http_options = ( _BaseNotebookServiceRestTransport._BaseDeleteNotebookRuntime._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_notebook_runtime( request, metadata ) @@ -1558,6 +1826,33 @@ async 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.aiplatform_v1beta1.NotebookServiceClient.DeleteNotebookRuntime", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.NotebookService", + "rpcName": "DeleteNotebookRuntime", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncNotebookServiceRestTransport._DeleteNotebookRuntime._get_response( self._host, @@ -1585,6 +1880,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_delete_notebook_runtime(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.NotebookServiceAsyncClient.delete_notebook_runtime", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.NotebookService", + "rpcName": "DeleteNotebookRuntime", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _DeleteNotebookRuntimeTemplate( @@ -1625,7 +1942,7 @@ async 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 notebook runtime template method over HTTP. @@ -1637,8 +1954,10 @@ async def __call__( 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: @@ -1651,6 +1970,7 @@ async def __call__( http_options = ( _BaseNotebookServiceRestTransport._BaseDeleteNotebookRuntimeTemplate._get_http_options() ) + ( request, metadata, @@ -1666,6 +1986,33 @@ async 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.aiplatform_v1beta1.NotebookServiceClient.DeleteNotebookRuntimeTemplate", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.NotebookService", + "rpcName": "DeleteNotebookRuntimeTemplate", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncNotebookServiceRestTransport._DeleteNotebookRuntimeTemplate._get_response( self._host, @@ -1693,6 +2040,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_delete_notebook_runtime_template(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.NotebookServiceAsyncClient.delete_notebook_runtime_template", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.NotebookService", + "rpcName": "DeleteNotebookRuntimeTemplate", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _GetNotebookExecutionJob( @@ -1731,7 +2100,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> notebook_execution_job.NotebookExecutionJob: r"""Call the get notebook execution job method over HTTP. @@ -1743,8 +2112,10 @@ async def __call__( 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: ~.notebook_execution_job.NotebookExecutionJob: @@ -1756,6 +2127,7 @@ async def __call__( http_options = ( _BaseNotebookServiceRestTransport._BaseGetNotebookExecutionJob._get_http_options() ) + request, metadata = await self._interceptor.pre_get_notebook_execution_job( request, metadata ) @@ -1768,6 +2140,33 @@ async 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.aiplatform_v1beta1.NotebookServiceClient.GetNotebookExecutionJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.NotebookService", + "rpcName": "GetNotebookExecutionJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncNotebookServiceRestTransport._GetNotebookExecutionJob._get_response( self._host, @@ -1795,6 +2194,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_get_notebook_execution_job(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + notebook_execution_job.NotebookExecutionJob.to_json(response) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.NotebookServiceAsyncClient.get_notebook_execution_job", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.NotebookService", + "rpcName": "GetNotebookExecutionJob", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _GetNotebookRuntime( @@ -1833,7 +2256,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> notebook_runtime.NotebookRuntime: r"""Call the get notebook runtime method over HTTP. @@ -1844,8 +2267,10 @@ async def __call__( 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: ~.notebook_runtime.NotebookRuntime: @@ -1859,6 +2284,7 @@ async def __call__( http_options = ( _BaseNotebookServiceRestTransport._BaseGetNotebookRuntime._get_http_options() ) + request, metadata = await self._interceptor.pre_get_notebook_runtime( request, metadata ) @@ -1871,6 +2297,33 @@ async 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.aiplatform_v1beta1.NotebookServiceClient.GetNotebookRuntime", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.NotebookService", + "rpcName": "GetNotebookRuntime", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncNotebookServiceRestTransport._GetNotebookRuntime._get_response( self._host, @@ -1898,6 +2351,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_get_notebook_runtime(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = notebook_runtime.NotebookRuntime.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.NotebookServiceAsyncClient.get_notebook_runtime", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.NotebookService", + "rpcName": "GetNotebookRuntime", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _GetNotebookRuntimeTemplate( @@ -1936,7 +2413,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> notebook_runtime.NotebookRuntimeTemplate: r"""Call the get notebook runtime template method over HTTP. @@ -1948,8 +2425,10 @@ async def __call__( 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: ~.notebook_runtime.NotebookRuntimeTemplate: @@ -1964,6 +2443,7 @@ async def __call__( http_options = ( _BaseNotebookServiceRestTransport._BaseGetNotebookRuntimeTemplate._get_http_options() ) + ( request, metadata, @@ -1979,6 +2459,33 @@ async 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.aiplatform_v1beta1.NotebookServiceClient.GetNotebookRuntimeTemplate", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.NotebookService", + "rpcName": "GetNotebookRuntimeTemplate", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncNotebookServiceRestTransport._GetNotebookRuntimeTemplate._get_response( self._host, @@ -2006,6 +2513,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_get_notebook_runtime_template(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = notebook_runtime.NotebookRuntimeTemplate.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.NotebookServiceAsyncClient.get_notebook_runtime_template", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.NotebookService", + "rpcName": "GetNotebookRuntimeTemplate", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ListNotebookExecutionJobs( @@ -2044,7 +2575,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> notebook_service.ListNotebookExecutionJobsResponse: r"""Call the list notebook execution jobs method over HTTP. @@ -2056,8 +2587,10 @@ async def __call__( 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: ~.notebook_service.ListNotebookExecutionJobsResponse: @@ -2069,6 +2602,7 @@ async def __call__( http_options = ( _BaseNotebookServiceRestTransport._BaseListNotebookExecutionJobs._get_http_options() ) + ( request, metadata, @@ -2084,6 +2618,33 @@ async 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.aiplatform_v1beta1.NotebookServiceClient.ListNotebookExecutionJobs", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.NotebookService", + "rpcName": "ListNotebookExecutionJobs", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncNotebookServiceRestTransport._ListNotebookExecutionJobs._get_response( self._host, @@ -2111,6 +2672,32 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_list_notebook_execution_jobs(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + notebook_service.ListNotebookExecutionJobsResponse.to_json( + response + ) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.NotebookServiceAsyncClient.list_notebook_execution_jobs", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.NotebookService", + "rpcName": "ListNotebookExecutionJobs", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ListNotebookRuntimes( @@ -2149,7 +2736,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> notebook_service.ListNotebookRuntimesResponse: r"""Call the list notebook runtimes method over HTTP. @@ -2160,8 +2747,10 @@ async def __call__( 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: ~.notebook_service.ListNotebookRuntimesResponse: @@ -2173,6 +2762,7 @@ async def __call__( http_options = ( _BaseNotebookServiceRestTransport._BaseListNotebookRuntimes._get_http_options() ) + request, metadata = await self._interceptor.pre_list_notebook_runtimes( request, metadata ) @@ -2185,6 +2775,33 @@ async 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.aiplatform_v1beta1.NotebookServiceClient.ListNotebookRuntimes", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.NotebookService", + "rpcName": "ListNotebookRuntimes", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncNotebookServiceRestTransport._ListNotebookRuntimes._get_response( self._host, @@ -2212,6 +2829,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_list_notebook_runtimes(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + notebook_service.ListNotebookRuntimesResponse.to_json(response) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.NotebookServiceAsyncClient.list_notebook_runtimes", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.NotebookService", + "rpcName": "ListNotebookRuntimes", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ListNotebookRuntimeTemplates( @@ -2252,7 +2893,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> notebook_service.ListNotebookRuntimeTemplatesResponse: r"""Call the list notebook runtime templates method over HTTP. @@ -2264,8 +2905,10 @@ async def __call__( 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: ~.notebook_service.ListNotebookRuntimeTemplatesResponse: @@ -2277,6 +2920,7 @@ async def __call__( http_options = ( _BaseNotebookServiceRestTransport._BaseListNotebookRuntimeTemplates._get_http_options() ) + ( request, metadata, @@ -2292,6 +2936,33 @@ async 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.aiplatform_v1beta1.NotebookServiceClient.ListNotebookRuntimeTemplates", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.NotebookService", + "rpcName": "ListNotebookRuntimeTemplates", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncNotebookServiceRestTransport._ListNotebookRuntimeTemplates._get_response( self._host, @@ -2319,6 +2990,32 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_list_notebook_runtime_templates(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + notebook_service.ListNotebookRuntimeTemplatesResponse.to_json( + response + ) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.NotebookServiceAsyncClient.list_notebook_runtime_templates", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.NotebookService", + "rpcName": "ListNotebookRuntimeTemplates", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _StartNotebookRuntime( @@ -2358,7 +3055,7 @@ async 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 start notebook runtime method over HTTP. @@ -2369,8 +3066,10 @@ async def __call__( 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: @@ -2383,6 +3082,7 @@ async def __call__( http_options = ( _BaseNotebookServiceRestTransport._BaseStartNotebookRuntime._get_http_options() ) + request, metadata = await self._interceptor.pre_start_notebook_runtime( request, metadata ) @@ -2399,6 +3099,33 @@ async 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.aiplatform_v1beta1.NotebookServiceClient.StartNotebookRuntime", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.NotebookService", + "rpcName": "StartNotebookRuntime", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncNotebookServiceRestTransport._StartNotebookRuntime._get_response( self._host, @@ -2427,6 +3154,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_start_notebook_runtime(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.NotebookServiceAsyncClient.start_notebook_runtime", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.NotebookService", + "rpcName": "StartNotebookRuntime", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _StopNotebookRuntime( @@ -2466,7 +3215,7 @@ async 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 stop notebook runtime method over HTTP. @@ -2477,8 +3226,10 @@ async def __call__( 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: @@ -2491,6 +3242,7 @@ async def __call__( http_options = ( _BaseNotebookServiceRestTransport._BaseStopNotebookRuntime._get_http_options() ) + request, metadata = await self._interceptor.pre_stop_notebook_runtime( request, metadata ) @@ -2507,6 +3259,33 @@ async 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.aiplatform_v1beta1.NotebookServiceClient.StopNotebookRuntime", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.NotebookService", + "rpcName": "StopNotebookRuntime", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncNotebookServiceRestTransport._StopNotebookRuntime._get_response( self._host, @@ -2535,6 +3314,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_stop_notebook_runtime(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.NotebookServiceAsyncClient.stop_notebook_runtime", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.NotebookService", + "rpcName": "StopNotebookRuntime", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _UpdateNotebookRuntimeTemplate( @@ -2576,7 +3377,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> notebook_runtime.NotebookRuntimeTemplate: r"""Call the update notebook runtime template method over HTTP. @@ -2588,8 +3389,10 @@ async def __call__( 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: ~.notebook_runtime.NotebookRuntimeTemplate: @@ -2604,6 +3407,7 @@ async def __call__( http_options = ( _BaseNotebookServiceRestTransport._BaseUpdateNotebookRuntimeTemplate._get_http_options() ) + ( request, metadata, @@ -2623,6 +3427,33 @@ async 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.aiplatform_v1beta1.NotebookServiceClient.UpdateNotebookRuntimeTemplate", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.NotebookService", + "rpcName": "UpdateNotebookRuntimeTemplate", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncNotebookServiceRestTransport._UpdateNotebookRuntimeTemplate._get_response( self._host, @@ -2651,6 +3482,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_update_notebook_runtime_template(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = notebook_runtime.NotebookRuntimeTemplate.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.NotebookServiceAsyncClient.update_notebook_runtime_template", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.NotebookService", + "rpcName": "UpdateNotebookRuntimeTemplate", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _UpgradeNotebookRuntime( @@ -2690,7 +3545,7 @@ async 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 upgrade notebook runtime method over HTTP. @@ -2701,8 +3556,10 @@ async def __call__( 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: @@ -2715,6 +3572,7 @@ async def __call__( http_options = ( _BaseNotebookServiceRestTransport._BaseUpgradeNotebookRuntime._get_http_options() ) + request, metadata = await self._interceptor.pre_upgrade_notebook_runtime( request, metadata ) @@ -2731,6 +3589,33 @@ async 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.aiplatform_v1beta1.NotebookServiceClient.UpgradeNotebookRuntime", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.NotebookService", + "rpcName": "UpgradeNotebookRuntime", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncNotebookServiceRestTransport._UpgradeNotebookRuntime._get_response( self._host, @@ -2759,6 +3644,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_upgrade_notebook_runtime(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.NotebookServiceAsyncClient.upgrade_notebook_runtime", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.NotebookService", + "rpcName": "UpgradeNotebookRuntime", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp @property @@ -3334,6 +4241,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -3550,6 +4461,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -3756,6 +4671,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}", @@ -3972,6 +4891,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, ], "google.longrunning.Operations.ListOperations": [ { @@ -4170,6 +5093,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*}/operations", @@ -4386,6 +5313,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*}/operations", + }, ], "google.longrunning.Operations.WaitOperation": [ { @@ -4584,6 +5515,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "post", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}:wait", @@ -4796,6 +5731,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, ], } @@ -4989,7 +5928,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -5000,8 +5939,10 @@ async def __call__( 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: locations_pb2.Location: Response from GetLocation method. @@ -5010,6 +5951,7 @@ async def __call__( http_options = ( _BaseNotebookServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_location( request, metadata ) @@ -5022,6 +5964,33 @@ async 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.aiplatform_v1beta1.NotebookServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.NotebookService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncNotebookServiceRestTransport._GetLocation._get_response( @@ -5049,6 +6018,27 @@ async def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_location(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.aiplatform_v1beta1.NotebookServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.NotebookService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5091,7 +6081,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -5102,8 +6092,10 @@ async def __call__( 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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -5112,6 +6104,7 @@ async def __call__( http_options = ( _BaseNotebookServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_locations( request, metadata ) @@ -5124,6 +6117,33 @@ async 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.aiplatform_v1beta1.NotebookServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.NotebookService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncNotebookServiceRestTransport._ListLocations._get_response( @@ -5151,6 +6171,27 @@ async def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_list_locations(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.aiplatform_v1beta1.NotebookServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.NotebookService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5194,7 +6235,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -5205,8 +6246,10 @@ async def __call__( 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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -5215,6 +6258,7 @@ async def __call__( http_options = ( _BaseNotebookServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_get_iam_policy( request, metadata ) @@ -5231,6 +6275,33 @@ async 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.aiplatform_v1beta1.NotebookServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.NotebookService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncNotebookServiceRestTransport._GetIamPolicy._get_response( @@ -5259,6 +6330,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_iam_policy(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.aiplatform_v1beta1.NotebookServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.NotebookService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5302,7 +6394,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -5313,8 +6405,10 @@ async def __call__( 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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -5323,6 +6417,7 @@ async def __call__( http_options = ( _BaseNotebookServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_set_iam_policy( request, metadata ) @@ -5339,6 +6434,33 @@ async 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.aiplatform_v1beta1.NotebookServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.NotebookService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncNotebookServiceRestTransport._SetIamPolicy._get_response( @@ -5367,6 +6489,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_set_iam_policy(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.aiplatform_v1beta1.NotebookServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.NotebookService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5410,7 +6553,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -5421,8 +6564,10 @@ async def __call__( 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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -5431,6 +6576,7 @@ async def __call__( http_options = ( _BaseNotebookServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = await self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -5447,6 +6593,33 @@ async 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.aiplatform_v1beta1.NotebookServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.NotebookService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncNotebookServiceRestTransport._TestIamPermissions._get_response( self._host, @@ -5473,6 +6646,27 @@ async def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_test_iam_permissions(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.aiplatform_v1beta1.NotebookServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.NotebookService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5515,7 +6709,7 @@ async 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 cancel operation method over HTTP. @@ -5526,13 +6720,16 @@ async def __call__( 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`. """ http_options = ( _BaseNotebookServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_cancel_operation( request, metadata ) @@ -5545,6 +6742,33 @@ async 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.aiplatform_v1beta1.NotebookServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.NotebookService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncNotebookServiceRestTransport._CancelOperation._get_response( @@ -5610,7 +6834,7 @@ async 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. @@ -5621,13 +6845,16 @@ async def __call__( 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`. """ http_options = ( _BaseNotebookServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_operation( request, metadata ) @@ -5640,6 +6867,33 @@ async 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.aiplatform_v1beta1.NotebookServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.NotebookService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncNotebookServiceRestTransport._DeleteOperation._get_response( @@ -5705,7 +6959,7 @@ async 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. @@ -5716,8 +6970,10 @@ async def __call__( 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: Response from GetOperation method. @@ -5726,6 +6982,7 @@ async def __call__( http_options = ( _BaseNotebookServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_operation( request, metadata ) @@ -5738,6 +6995,33 @@ async 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.aiplatform_v1beta1.NotebookServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.NotebookService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncNotebookServiceRestTransport._GetOperation._get_response( @@ -5765,6 +7049,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1beta1.NotebookServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.NotebookService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5807,7 +7112,7 @@ async 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. @@ -5818,8 +7123,10 @@ async def __call__( 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 from ListOperations method. @@ -5828,6 +7135,7 @@ async def __call__( http_options = ( _BaseNotebookServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_operations( request, metadata ) @@ -5840,6 +7148,33 @@ async 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.aiplatform_v1beta1.NotebookServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.NotebookService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncNotebookServiceRestTransport._ListOperations._get_response( @@ -5867,6 +7202,27 @@ async def __call__( resp = operations_pb2.ListOperationsResponse() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1beta1.NotebookServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.NotebookService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5909,7 +7265,7 @@ async 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 wait operation method over HTTP. @@ -5920,8 +7276,10 @@ async def __call__( 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: Response from WaitOperation method. @@ -5930,6 +7288,7 @@ async def __call__( http_options = ( _BaseNotebookServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_wait_operation( request, metadata ) @@ -5942,6 +7301,33 @@ async 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.aiplatform_v1beta1.NotebookServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.NotebookService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncNotebookServiceRestTransport._WaitOperation._get_response( @@ -5969,6 +7355,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_wait_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.aiplatform_v1beta1.NotebookServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.NotebookService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1beta1/services/notebook_service/transports/rest_base.py b/google/cloud/aiplatform_v1beta1/services/notebook_service/transports/rest_base.py index 2dcb370362..d4f2f6a0a5 100644 --- a/google/cloud/aiplatform_v1beta1/services/notebook_service/transports/rest_base.py +++ b/google/cloud/aiplatform_v1beta1/services/notebook_service/transports/rest_base.py @@ -1843,6 +1843,10 @@ def _get_http_options(): "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -2059,6 +2063,10 @@ def _get_http_options(): "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -2284,6 +2292,10 @@ def _get_http_options(): "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}", @@ -2500,6 +2512,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, ] return http_options @@ -2717,6 +2733,10 @@ def _get_http_options(): "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*}/operations", @@ -2933,6 +2953,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*}/operations", + }, ] return http_options @@ -3150,6 +3174,10 @@ def _get_http_options(): "method": "post", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}:wait", @@ -3362,6 +3390,10 @@ def _get_http_options(): "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, ] return http_options diff --git a/google/cloud/aiplatform_v1beta1/services/persistent_resource_service/async_client.py b/google/cloud/aiplatform_v1beta1/services/persistent_resource_service/async_client.py index 962e797226..29f97627c5 100644 --- a/google/cloud/aiplatform_v1beta1/services/persistent_resource_service/async_client.py +++ b/google/cloud/aiplatform_v1beta1/services/persistent_resource_service/async_client.py @@ -13,6 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging as std_logging from collections import OrderedDict import re from typing import ( @@ -66,6 +67,15 @@ from .transports.grpc_asyncio import PersistentResourceServiceGrpcAsyncIOTransport from .client import PersistentResourceServiceClient +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 PersistentResourceServiceAsyncClient: """A service for managing Vertex AI's machine learning @@ -309,6 +319,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.aiplatform_v1beta1.PersistentResourceServiceAsyncClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PersistentResourceService", + "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.aiplatform.v1beta1.PersistentResourceService", + "credentialsType": None, + }, + ) + async def create_persistent_resource( self, request: Optional[ @@ -322,7 +354,7 @@ async def create_persistent_resource( persistent_resource_id: 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"""Creates a PersistentResource. @@ -390,8 +422,10 @@ async def sample_create_persistent_resource(): 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: @@ -476,7 +510,7 @@ async def get_persistent_resource( 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]]] = (), ) -> persistent_resource.PersistentResource: r"""Gets a PersistentResource. @@ -521,8 +555,10 @@ async def sample_get_persistent_resource(): 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.aiplatform_v1beta1.types.PersistentResource: @@ -590,7 +626,7 @@ async def list_persistent_resources( 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.ListPersistentResourcesAsyncPager: r"""Lists PersistentResources in a Location. @@ -636,8 +672,10 @@ async def sample_list_persistent_resources(): 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.aiplatform_v1beta1.services.persistent_resource_service.pagers.ListPersistentResourcesAsyncPager: @@ -718,7 +756,7 @@ async def delete_persistent_resource( 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"""Deletes a PersistentResource. @@ -767,8 +805,10 @@ async def sample_delete_persistent_resource(): 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: @@ -856,7 +896,7 @@ async def update_persistent_resource( 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"""Updates a PersistentResource. @@ -914,8 +954,10 @@ async def sample_update_persistent_resource(): 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: @@ -998,7 +1040,7 @@ async def reboot_persistent_resource( 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"""Reboots a PersistentResource. @@ -1047,8 +1089,10 @@ async def sample_reboot_persistent_resource(): 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: @@ -1124,7 +1168,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. @@ -1135,8 +1179,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. @@ -1177,7 +1223,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. @@ -1188,8 +1234,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. @@ -1230,7 +1278,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. @@ -1246,8 +1294,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 """ @@ -1284,7 +1334,7 @@ async def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -1299,8 +1349,10 @@ async def cancel_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 """ @@ -1337,7 +1389,7 @@ async def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -1354,8 +1406,10 @@ async def wait_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. @@ -1396,7 +1450,7 @@ async def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -1409,8 +1463,10 @@ async def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -1515,7 +1571,7 @@ async def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -1529,8 +1585,10 @@ async def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -1635,7 +1693,7 @@ async def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -1650,8 +1708,10 @@ async def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -1695,7 +1755,7 @@ async def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -1706,8 +1766,10 @@ async def get_location( 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: ~.location_pb2.Location: Location object. @@ -1748,7 +1810,7 @@ async def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -1759,8 +1821,10 @@ async def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1beta1/services/persistent_resource_service/client.py b/google/cloud/aiplatform_v1beta1/services/persistent_resource_service/client.py index df7de9de7c..4d487729e1 100644 --- a/google/cloud/aiplatform_v1beta1/services/persistent_resource_service/client.py +++ b/google/cloud/aiplatform_v1beta1/services/persistent_resource_service/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 ( @@ -48,6 +49,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 as gac_operation # type: ignore from google.api_core import operation_async # type: ignore from google.cloud.aiplatform_v1beta1.services.persistent_resource_service import pagers @@ -705,6 +715,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( @@ -796,6 +810,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.aiplatform_v1beta1.PersistentResourceServiceClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PersistentResourceService", + "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.aiplatform.v1beta1.PersistentResourceService", + "credentialsType": None, + }, + ) + def create_persistent_resource( self, request: Optional[ @@ -809,7 +846,7 @@ def create_persistent_resource( persistent_resource_id: 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]]] = (), ) -> gac_operation.Operation: r"""Creates a PersistentResource. @@ -877,8 +914,10 @@ def sample_create_persistent_resource(): 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: @@ -962,7 +1001,7 @@ def get_persistent_resource( 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]]] = (), ) -> persistent_resource.PersistentResource: r"""Gets a PersistentResource. @@ -1007,8 +1046,10 @@ def sample_get_persistent_resource(): 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.aiplatform_v1beta1.types.PersistentResource: @@ -1073,7 +1114,7 @@ def list_persistent_resources( 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.ListPersistentResourcesPager: r"""Lists PersistentResources in a Location. @@ -1119,8 +1160,10 @@ def sample_list_persistent_resources(): 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.aiplatform_v1beta1.services.persistent_resource_service.pagers.ListPersistentResourcesPager: @@ -1200,7 +1243,7 @@ def delete_persistent_resource( 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]]] = (), ) -> gac_operation.Operation: r"""Deletes a PersistentResource. @@ -1249,8 +1292,10 @@ def sample_delete_persistent_resource(): 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: @@ -1337,7 +1382,7 @@ def update_persistent_resource( 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]]] = (), ) -> gac_operation.Operation: r"""Updates a PersistentResource. @@ -1395,8 +1440,10 @@ def sample_update_persistent_resource(): 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: @@ -1478,7 +1525,7 @@ def reboot_persistent_resource( 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]]] = (), ) -> gac_operation.Operation: r"""Reboots a PersistentResource. @@ -1527,8 +1574,10 @@ def sample_reboot_persistent_resource(): 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: @@ -1616,7 +1665,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. @@ -1627,8 +1676,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. @@ -1669,7 +1720,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. @@ -1680,8 +1731,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. @@ -1722,7 +1775,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. @@ -1738,8 +1791,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 """ @@ -1776,7 +1831,7 @@ def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -1791,8 +1846,10 @@ def cancel_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 """ @@ -1829,7 +1886,7 @@ def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -1846,8 +1903,10 @@ def wait_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. @@ -1888,7 +1947,7 @@ def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -1901,8 +1960,10 @@ def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -2007,7 +2068,7 @@ def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -2021,8 +2082,10 @@ def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -2127,7 +2190,7 @@ def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -2142,8 +2205,10 @@ def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -2185,7 +2250,7 @@ def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -2196,8 +2261,10 @@ def get_location( 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: ~.location_pb2.Location: Location object. @@ -2238,7 +2305,7 @@ def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -2249,8 +2316,10 @@ def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1beta1/services/persistent_resource_service/pagers.py b/google/cloud/aiplatform_v1beta1/services/persistent_resource_service/pagers.py index ec0d30ef5a..b42fd5bb00 100644 --- a/google/cloud/aiplatform_v1beta1/services/persistent_resource_service/pagers.py +++ b/google/cloud/aiplatform_v1beta1/services/persistent_resource_service/pagers.py @@ -69,7 +69,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. @@ -83,8 +83,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 = persistent_resource_service.ListPersistentResourcesRequest( @@ -149,7 +151,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. @@ -163,8 +165,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 = persistent_resource_service.ListPersistentResourcesRequest( diff --git a/google/cloud/aiplatform_v1beta1/services/persistent_resource_service/transports/grpc.py b/google/cloud/aiplatform_v1beta1/services/persistent_resource_service/transports/grpc.py index d09bed32cf..0dc853e681 100644 --- a/google/cloud/aiplatform_v1beta1/services/persistent_resource_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1beta1/services/persistent_resource_service/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 import warnings from typing import Callable, Dict, Optional, Sequence, Tuple, Union @@ -22,8 +25,11 @@ import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from google.cloud.aiplatform_v1beta1.types import persistent_resource from google.cloud.aiplatform_v1beta1.types import persistent_resource_service @@ -33,6 +39,81 @@ from google.longrunning import operations_pb2 # type: ignore from .base import PersistentResourceServiceTransport, DEFAULT_CLIENT_INFO +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.aiplatform.v1beta1.PersistentResourceService", + "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.aiplatform.v1beta1.PersistentResourceService", + "rpcName": client_call_details.method, + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class PersistentResourceServiceGrpcTransport(PersistentResourceServiceTransport): """gRPC backend transport for PersistentResourceService. @@ -188,7 +269,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 @@ -252,7 +338,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 @@ -279,7 +367,9 @@ def create_persistent_resource( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_persistent_resource" not in self._stubs: - self._stubs["create_persistent_resource"] = self.grpc_channel.unary_unary( + self._stubs[ + "create_persistent_resource" + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.PersistentResourceService/CreatePersistentResource", request_serializer=persistent_resource_service.CreatePersistentResourceRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -308,7 +398,7 @@ def get_persistent_resource( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_persistent_resource" not in self._stubs: - self._stubs["get_persistent_resource"] = self.grpc_channel.unary_unary( + self._stubs["get_persistent_resource"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.PersistentResourceService/GetPersistentResource", request_serializer=persistent_resource_service.GetPersistentResourceRequest.serialize, response_deserializer=persistent_resource.PersistentResource.deserialize, @@ -337,7 +427,7 @@ def list_persistent_resources( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_persistent_resources" not in self._stubs: - self._stubs["list_persistent_resources"] = self.grpc_channel.unary_unary( + self._stubs["list_persistent_resources"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.PersistentResourceService/ListPersistentResources", request_serializer=persistent_resource_service.ListPersistentResourcesRequest.serialize, response_deserializer=persistent_resource_service.ListPersistentResourcesResponse.deserialize, @@ -366,7 +456,9 @@ def delete_persistent_resource( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_persistent_resource" not in self._stubs: - self._stubs["delete_persistent_resource"] = self.grpc_channel.unary_unary( + self._stubs[ + "delete_persistent_resource" + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.PersistentResourceService/DeletePersistentResource", request_serializer=persistent_resource_service.DeletePersistentResourceRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -395,7 +487,9 @@ def update_persistent_resource( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_persistent_resource" not in self._stubs: - self._stubs["update_persistent_resource"] = self.grpc_channel.unary_unary( + self._stubs[ + "update_persistent_resource" + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.PersistentResourceService/UpdatePersistentResource", request_serializer=persistent_resource_service.UpdatePersistentResourceRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -424,7 +518,9 @@ def reboot_persistent_resource( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "reboot_persistent_resource" not in self._stubs: - self._stubs["reboot_persistent_resource"] = self.grpc_channel.unary_unary( + self._stubs[ + "reboot_persistent_resource" + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.PersistentResourceService/RebootPersistentResource", request_serializer=persistent_resource_service.RebootPersistentResourceRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -432,7 +528,7 @@ def reboot_persistent_resource( return self._stubs["reboot_persistent_resource"] def close(self): - self.grpc_channel.close() + self._logged_channel.close() @property def delete_operation( @@ -444,7 +540,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, @@ -461,7 +557,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -478,7 +574,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -495,7 +591,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, @@ -514,7 +610,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, @@ -533,7 +629,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -550,7 +646,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -575,7 +671,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -601,7 +697,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -630,7 +726,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1beta1/services/persistent_resource_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1beta1/services/persistent_resource_service/transports/grpc_asyncio.py index 09f75a9fec..002bbee549 100644 --- a/google/cloud/aiplatform_v1beta1/services/persistent_resource_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/persistent_resource_service/transports/grpc_asyncio.py @@ -14,6 +14,9 @@ # limitations under the License. # import inspect +import json +import pickle +import logging as std_logging import warnings from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union @@ -24,8 +27,11 @@ from google.api_core import operations_v1 from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from grpc.experimental import aio # type: ignore from google.cloud.aiplatform_v1beta1.types import persistent_resource @@ -37,6 +43,82 @@ from .base import PersistentResourceServiceTransport, DEFAULT_CLIENT_INFO from .grpc import PersistentResourceServiceGrpcTransport +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.aiplatform.v1beta1.PersistentResourceService", + "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.aiplatform.v1beta1.PersistentResourceService", + "rpcName": str(client_call_details.method), + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class PersistentResourceServiceGrpcAsyncIOTransport(PersistentResourceServiceTransport): """gRPC AsyncIO backend transport for PersistentResourceService. @@ -235,10 +317,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 @@ -261,7 +346,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. @@ -289,7 +374,9 @@ def create_persistent_resource( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_persistent_resource" not in self._stubs: - self._stubs["create_persistent_resource"] = self.grpc_channel.unary_unary( + self._stubs[ + "create_persistent_resource" + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.PersistentResourceService/CreatePersistentResource", request_serializer=persistent_resource_service.CreatePersistentResourceRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -318,7 +405,7 @@ def get_persistent_resource( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_persistent_resource" not in self._stubs: - self._stubs["get_persistent_resource"] = self.grpc_channel.unary_unary( + self._stubs["get_persistent_resource"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.PersistentResourceService/GetPersistentResource", request_serializer=persistent_resource_service.GetPersistentResourceRequest.serialize, response_deserializer=persistent_resource.PersistentResource.deserialize, @@ -347,7 +434,7 @@ def list_persistent_resources( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_persistent_resources" not in self._stubs: - self._stubs["list_persistent_resources"] = self.grpc_channel.unary_unary( + self._stubs["list_persistent_resources"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.PersistentResourceService/ListPersistentResources", request_serializer=persistent_resource_service.ListPersistentResourcesRequest.serialize, response_deserializer=persistent_resource_service.ListPersistentResourcesResponse.deserialize, @@ -376,7 +463,9 @@ def delete_persistent_resource( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_persistent_resource" not in self._stubs: - self._stubs["delete_persistent_resource"] = self.grpc_channel.unary_unary( + self._stubs[ + "delete_persistent_resource" + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.PersistentResourceService/DeletePersistentResource", request_serializer=persistent_resource_service.DeletePersistentResourceRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -405,7 +494,9 @@ def update_persistent_resource( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_persistent_resource" not in self._stubs: - self._stubs["update_persistent_resource"] = self.grpc_channel.unary_unary( + self._stubs[ + "update_persistent_resource" + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.PersistentResourceService/UpdatePersistentResource", request_serializer=persistent_resource_service.UpdatePersistentResourceRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -434,7 +525,9 @@ def reboot_persistent_resource( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "reboot_persistent_resource" not in self._stubs: - self._stubs["reboot_persistent_resource"] = self.grpc_channel.unary_unary( + self._stubs[ + "reboot_persistent_resource" + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.PersistentResourceService/RebootPersistentResource", request_serializer=persistent_resource_service.RebootPersistentResourceRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -532,7 +625,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: @@ -548,7 +641,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, @@ -565,7 +658,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -582,7 +675,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -599,7 +692,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, @@ -618,7 +711,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, @@ -637,7 +730,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -654,7 +747,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -679,7 +772,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -705,7 +798,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -734,7 +827,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1beta1/services/persistent_resource_service/transports/rest.py b/google/cloud/aiplatform_v1beta1/services/persistent_resource_service/transports/rest.py index 539596f1a5..aa53e1a4d0 100644 --- a/google/cloud/aiplatform_v1beta1/services/persistent_resource_service/transports/rest.py +++ b/google/cloud/aiplatform_v1beta1/services/persistent_resource_service/transports/rest.py @@ -13,9 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging +import json # type: ignore from google.auth.transport.requests import AuthorizedSession # type: ignore -import json # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.api_core import exceptions as core_exceptions from google.api_core import retry as retries @@ -48,6 +49,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, @@ -128,10 +137,10 @@ def post_update_persistent_resource(self, response): def pre_create_persistent_resource( self, request: persistent_resource_service.CreatePersistentResourceRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ persistent_resource_service.CreatePersistentResourceRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for create_persistent_resource @@ -154,10 +163,10 @@ def post_create_persistent_resource( def pre_delete_persistent_resource( self, request: persistent_resource_service.DeletePersistentResourceRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ persistent_resource_service.DeletePersistentResourceRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for delete_persistent_resource @@ -180,10 +189,10 @@ def post_delete_persistent_resource( def pre_get_persistent_resource( self, request: persistent_resource_service.GetPersistentResourceRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ persistent_resource_service.GetPersistentResourceRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for get_persistent_resource @@ -206,10 +215,10 @@ def post_get_persistent_resource( def pre_list_persistent_resources( self, request: persistent_resource_service.ListPersistentResourcesRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ persistent_resource_service.ListPersistentResourcesRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for list_persistent_resources @@ -232,10 +241,10 @@ def post_list_persistent_resources( def pre_reboot_persistent_resource( self, request: persistent_resource_service.RebootPersistentResourceRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ persistent_resource_service.RebootPersistentResourceRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for reboot_persistent_resource @@ -258,10 +267,10 @@ def post_reboot_persistent_resource( def pre_update_persistent_resource( self, request: persistent_resource_service.UpdatePersistentResourceRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ persistent_resource_service.UpdatePersistentResourceRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for update_persistent_resource @@ -284,8 +293,10 @@ def post_update_persistent_resource( def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -307,8 +318,10 @@ def post_get_location( def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -330,8 +343,10 @@ def post_list_locations( def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -351,8 +366,10 @@ def post_get_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -372,8 +389,11 @@ def post_set_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -395,8 +415,10 @@ def post_test_iam_permissions( def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -416,8 +438,10 @@ def post_cancel_operation(self, response: None) -> None: 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 @@ -437,8 +461,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 @@ -460,8 +486,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 @@ -483,8 +511,10 @@ def post_list_operations( def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -1167,6 +1197,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -1383,6 +1417,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -1589,6 +1627,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}", @@ -1805,6 +1847,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, ], "google.longrunning.Operations.ListOperations": [ { @@ -2003,6 +2049,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*}/operations", @@ -2219,6 +2269,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*}/operations", + }, ], "google.longrunning.Operations.WaitOperation": [ { @@ -2417,6 +2471,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "post", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}:wait", @@ -2629,6 +2687,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, ], } @@ -2687,7 +2749,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 persistent resource method over HTTP. @@ -2699,8 +2761,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: @@ -2713,6 +2777,7 @@ def __call__( http_options = ( _BasePersistentResourceServiceRestTransport._BaseCreatePersistentResource._get_http_options() ) + request, metadata = self._interceptor.pre_create_persistent_resource( request, metadata ) @@ -2729,6 +2794,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.aiplatform_v1beta1.PersistentResourceServiceClient.CreatePersistentResource", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PersistentResourceService", + "rpcName": "CreatePersistentResource", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = PersistentResourceServiceRestTransport._CreatePersistentResource._get_response( self._host, @@ -2748,7 +2840,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_persistent_resource(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.aiplatform_v1beta1.PersistentResourceServiceClient.create_persistent_resource", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PersistentResourceService", + "rpcName": "CreatePersistentResource", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _DeletePersistentResource( @@ -2789,7 +2903,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 persistent resource method over HTTP. @@ -2801,8 +2915,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: @@ -2815,6 +2931,7 @@ def __call__( http_options = ( _BasePersistentResourceServiceRestTransport._BaseDeletePersistentResource._get_http_options() ) + request, metadata = self._interceptor.pre_delete_persistent_resource( request, metadata ) @@ -2827,6 +2944,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.aiplatform_v1beta1.PersistentResourceServiceClient.DeletePersistentResource", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PersistentResourceService", + "rpcName": "DeletePersistentResource", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = PersistentResourceServiceRestTransport._DeletePersistentResource._get_response( self._host, @@ -2845,7 +2989,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_persistent_resource(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.aiplatform_v1beta1.PersistentResourceServiceClient.delete_persistent_resource", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PersistentResourceService", + "rpcName": "DeletePersistentResource", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _GetPersistentResource( @@ -2884,7 +3050,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]]] = (), ) -> persistent_resource.PersistentResource: r"""Call the get persistent resource method over HTTP. @@ -2895,8 +3061,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: ~.persistent_resource.PersistentResource: @@ -2911,6 +3079,7 @@ def __call__( http_options = ( _BasePersistentResourceServiceRestTransport._BaseGetPersistentResource._get_http_options() ) + request, metadata = self._interceptor.pre_get_persistent_resource( request, metadata ) @@ -2923,6 +3092,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.aiplatform_v1beta1.PersistentResourceServiceClient.GetPersistentResource", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PersistentResourceService", + "rpcName": "GetPersistentResource", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = PersistentResourceServiceRestTransport._GetPersistentResource._get_response( self._host, @@ -2943,7 +3139,31 @@ def __call__( pb_resp = persistent_resource.PersistentResource.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_persistent_resource(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = persistent_resource.PersistentResource.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.aiplatform_v1beta1.PersistentResourceServiceClient.get_persistent_resource", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PersistentResourceService", + "rpcName": "GetPersistentResource", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListPersistentResources( @@ -2984,7 +3204,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]]] = (), ) -> persistent_resource_service.ListPersistentResourcesResponse: r"""Call the list persistent resources method over HTTP. @@ -2995,8 +3215,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: ~.persistent_resource_service.ListPersistentResourcesResponse: @@ -3008,6 +3230,7 @@ def __call__( http_options = ( _BasePersistentResourceServiceRestTransport._BaseListPersistentResources._get_http_options() ) + request, metadata = self._interceptor.pre_list_persistent_resources( request, metadata ) @@ -3020,6 +3243,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.aiplatform_v1beta1.PersistentResourceServiceClient.ListPersistentResources", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PersistentResourceService", + "rpcName": "ListPersistentResources", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = PersistentResourceServiceRestTransport._ListPersistentResources._get_response( self._host, @@ -3042,7 +3292,31 @@ def __call__( ) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_persistent_resources(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = persistent_resource_service.ListPersistentResourcesResponse.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.aiplatform_v1beta1.PersistentResourceServiceClient.list_persistent_resources", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PersistentResourceService", + "rpcName": "ListPersistentResources", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _RebootPersistentResource( @@ -3084,7 +3358,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 reboot persistent resource method over HTTP. @@ -3096,8 +3370,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: @@ -3110,6 +3386,7 @@ def __call__( http_options = ( _BasePersistentResourceServiceRestTransport._BaseRebootPersistentResource._get_http_options() ) + request, metadata = self._interceptor.pre_reboot_persistent_resource( request, metadata ) @@ -3126,6 +3403,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.aiplatform_v1beta1.PersistentResourceServiceClient.RebootPersistentResource", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PersistentResourceService", + "rpcName": "RebootPersistentResource", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = PersistentResourceServiceRestTransport._RebootPersistentResource._get_response( self._host, @@ -3145,7 +3449,29 @@ def __call__( # Return the response resp = operations_pb2.Operation() json_format.Parse(response.content, resp, ignore_unknown_fields=True) + resp = self._interceptor.post_reboot_persistent_resource(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.aiplatform_v1beta1.PersistentResourceServiceClient.reboot_persistent_resource", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PersistentResourceService", + "rpcName": "RebootPersistentResource", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _UpdatePersistentResource( @@ -3187,7 +3513,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 persistent resource method over HTTP. @@ -3199,8 +3525,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: @@ -3213,6 +3541,7 @@ def __call__( http_options = ( _BasePersistentResourceServiceRestTransport._BaseUpdatePersistentResource._get_http_options() ) + request, metadata = self._interceptor.pre_update_persistent_resource( request, metadata ) @@ -3229,6 +3558,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.aiplatform_v1beta1.PersistentResourceServiceClient.UpdatePersistentResource", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PersistentResourceService", + "rpcName": "UpdatePersistentResource", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = PersistentResourceServiceRestTransport._UpdatePersistentResource._get_response( self._host, @@ -3248,7 +3604,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_persistent_resource(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.aiplatform_v1beta1.PersistentResourceServiceClient.update_persistent_resource", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PersistentResourceService", + "rpcName": "UpdatePersistentResource", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp @property @@ -3357,7 +3735,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]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -3368,8 +3746,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: locations_pb2.Location: Response from GetLocation method. @@ -3378,6 +3758,7 @@ def __call__( http_options = ( _BasePersistentResourceServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = self._interceptor.pre_get_location(request, metadata) transcoded_request = _BasePersistentResourceServiceRestTransport._BaseGetLocation._get_transcoded_request( http_options, request @@ -3388,6 +3769,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.aiplatform_v1beta1.PersistentResourceServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PersistentResourceService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( PersistentResourceServiceRestTransport._GetLocation._get_response( @@ -3409,6 +3817,27 @@ def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_location(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.aiplatform_v1beta1.PersistentResourceServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PersistentResourceService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3451,7 +3880,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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -3462,8 +3891,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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -3472,6 +3903,7 @@ def __call__( http_options = ( _BasePersistentResourceServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = self._interceptor.pre_list_locations(request, metadata) transcoded_request = _BasePersistentResourceServiceRestTransport._BaseListLocations._get_transcoded_request( http_options, request @@ -3482,6 +3914,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.aiplatform_v1beta1.PersistentResourceServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PersistentResourceService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( PersistentResourceServiceRestTransport._ListLocations._get_response( @@ -3503,6 +3962,27 @@ def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_list_locations(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.aiplatform_v1beta1.PersistentResourceServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PersistentResourceService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3546,7 +4026,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]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -3557,8 +4037,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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -3567,6 +4049,7 @@ def __call__( http_options = ( _BasePersistentResourceServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_get_iam_policy(request, metadata) transcoded_request = _BasePersistentResourceServiceRestTransport._BaseGetIamPolicy._get_transcoded_request( http_options, request @@ -3581,6 +4064,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.aiplatform_v1beta1.PersistentResourceServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PersistentResourceService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( PersistentResourceServiceRestTransport._GetIamPolicy._get_response( @@ -3603,6 +4113,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_iam_policy(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.aiplatform_v1beta1.PersistentResourceServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PersistentResourceService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3646,7 +4177,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]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -3657,8 +4188,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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -3667,6 +4200,7 @@ def __call__( http_options = ( _BasePersistentResourceServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_set_iam_policy(request, metadata) transcoded_request = _BasePersistentResourceServiceRestTransport._BaseSetIamPolicy._get_transcoded_request( http_options, request @@ -3681,6 +4215,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.aiplatform_v1beta1.PersistentResourceServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PersistentResourceService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( PersistentResourceServiceRestTransport._SetIamPolicy._get_response( @@ -3703,6 +4264,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_set_iam_policy(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.aiplatform_v1beta1.PersistentResourceServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PersistentResourceService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3746,7 +4328,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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -3757,8 +4339,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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -3767,6 +4351,7 @@ def __call__( http_options = ( _BasePersistentResourceServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -3783,6 +4368,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.aiplatform_v1beta1.PersistentResourceServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PersistentResourceService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = PersistentResourceServiceRestTransport._TestIamPermissions._get_response( self._host, @@ -3803,6 +4415,27 @@ def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_test_iam_permissions(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.aiplatform_v1beta1.PersistentResourceServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PersistentResourceService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3845,7 +4478,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 cancel operation method over HTTP. @@ -3856,13 +4489,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 = ( _BasePersistentResourceServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = self._interceptor.pre_cancel_operation( request, metadata ) @@ -3875,6 +4511,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.aiplatform_v1beta1.PersistentResourceServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PersistentResourceService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( PersistentResourceServiceRestTransport._CancelOperation._get_response( @@ -3934,7 +4597,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. @@ -3945,13 +4608,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 = ( _BasePersistentResourceServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = self._interceptor.pre_delete_operation( request, metadata ) @@ -3964,6 +4630,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.aiplatform_v1beta1.PersistentResourceServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PersistentResourceService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( PersistentResourceServiceRestTransport._DeleteOperation._get_response( @@ -4023,7 +4716,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. @@ -4034,8 +4727,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. @@ -4044,6 +4739,7 @@ def __call__( http_options = ( _BasePersistentResourceServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = self._interceptor.pre_get_operation(request, metadata) transcoded_request = _BasePersistentResourceServiceRestTransport._BaseGetOperation._get_transcoded_request( http_options, request @@ -4054,6 +4750,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.aiplatform_v1beta1.PersistentResourceServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PersistentResourceService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( PersistentResourceServiceRestTransport._GetOperation._get_response( @@ -4075,6 +4798,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.aiplatform_v1beta1.PersistentResourceServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PersistentResourceService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4117,7 +4861,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. @@ -4128,8 +4872,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. @@ -4138,6 +4884,7 @@ def __call__( http_options = ( _BasePersistentResourceServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = self._interceptor.pre_list_operations(request, metadata) transcoded_request = _BasePersistentResourceServiceRestTransport._BaseListOperations._get_transcoded_request( http_options, request @@ -4148,6 +4895,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.aiplatform_v1beta1.PersistentResourceServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PersistentResourceService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( PersistentResourceServiceRestTransport._ListOperations._get_response( @@ -4169,6 +4943,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.aiplatform_v1beta1.PersistentResourceServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PersistentResourceService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4211,7 +5006,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 wait operation method over HTTP. @@ -4222,8 +5017,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 WaitOperation method. @@ -4232,6 +5029,7 @@ def __call__( http_options = ( _BasePersistentResourceServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = self._interceptor.pre_wait_operation(request, metadata) transcoded_request = _BasePersistentResourceServiceRestTransport._BaseWaitOperation._get_transcoded_request( http_options, request @@ -4242,6 +5040,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.aiplatform_v1beta1.PersistentResourceServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PersistentResourceService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( PersistentResourceServiceRestTransport._WaitOperation._get_response( @@ -4263,6 +5088,27 @@ def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = self._interceptor.post_wait_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.aiplatform_v1beta1.PersistentResourceServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PersistentResourceService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1beta1/services/persistent_resource_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1beta1/services/persistent_resource_service/transports/rest_asyncio.py index 4c0ae6ef61..a6f0f6162b 100644 --- a/google/cloud/aiplatform_v1beta1/services/persistent_resource_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/persistent_resource_service/transports/rest_asyncio.py @@ -59,6 +59,18 @@ from .base import DEFAULT_CLIENT_INFO as BASE_DEFAULT_CLIENT_INFO + +import logging + +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__) + try: OptionalRetry = Union[retries.AsyncRetry, gapic_v1.method._MethodDefault, None] except AttributeError: # pragma: NO COVER @@ -143,10 +155,10 @@ async def post_update_persistent_resource(self, response): async def pre_create_persistent_resource( self, request: persistent_resource_service.CreatePersistentResourceRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ persistent_resource_service.CreatePersistentResourceRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for create_persistent_resource @@ -169,10 +181,10 @@ async def post_create_persistent_resource( async def pre_delete_persistent_resource( self, request: persistent_resource_service.DeletePersistentResourceRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ persistent_resource_service.DeletePersistentResourceRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for delete_persistent_resource @@ -195,10 +207,10 @@ async def post_delete_persistent_resource( async def pre_get_persistent_resource( self, request: persistent_resource_service.GetPersistentResourceRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ persistent_resource_service.GetPersistentResourceRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for get_persistent_resource @@ -221,10 +233,10 @@ async def post_get_persistent_resource( async def pre_list_persistent_resources( self, request: persistent_resource_service.ListPersistentResourcesRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ persistent_resource_service.ListPersistentResourcesRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for list_persistent_resources @@ -247,10 +259,10 @@ async def post_list_persistent_resources( async def pre_reboot_persistent_resource( self, request: persistent_resource_service.RebootPersistentResourceRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ persistent_resource_service.RebootPersistentResourceRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for reboot_persistent_resource @@ -273,10 +285,10 @@ async def post_reboot_persistent_resource( async def pre_update_persistent_resource( self, request: persistent_resource_service.UpdatePersistentResourceRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ persistent_resource_service.UpdatePersistentResourceRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for update_persistent_resource @@ -299,8 +311,10 @@ async def post_update_persistent_resource( async def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -322,8 +336,10 @@ async def post_get_location( async def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -345,8 +361,10 @@ async def post_list_locations( async def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -368,8 +386,10 @@ async def post_get_iam_policy( async def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -391,8 +411,11 @@ async def post_set_iam_policy( async def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -414,8 +437,10 @@ async def post_test_iam_permissions( async def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -435,8 +460,10 @@ async def post_cancel_operation(self, response: None) -> None: async 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 @@ -456,8 +483,10 @@ async def post_delete_operation(self, response: None) -> None: async 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 @@ -479,8 +508,10 @@ async def post_get_operation( async 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 @@ -502,8 +533,10 @@ async def post_list_operations( async def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -721,7 +754,7 @@ async 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 persistent resource method over HTTP. @@ -733,8 +766,10 @@ async def __call__( 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: @@ -747,6 +782,7 @@ async def __call__( http_options = ( _BasePersistentResourceServiceRestTransport._BaseCreatePersistentResource._get_http_options() ) + request, metadata = await self._interceptor.pre_create_persistent_resource( request, metadata ) @@ -763,6 +799,33 @@ async 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.aiplatform_v1beta1.PersistentResourceServiceClient.CreatePersistentResource", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PersistentResourceService", + "rpcName": "CreatePersistentResource", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncPersistentResourceServiceRestTransport._CreatePersistentResource._get_response( self._host, @@ -791,6 +854,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_create_persistent_resource(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.PersistentResourceServiceAsyncClient.create_persistent_resource", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PersistentResourceService", + "rpcName": "CreatePersistentResource", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _DeletePersistentResource( @@ -831,7 +916,7 @@ async 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 persistent resource method over HTTP. @@ -843,8 +928,10 @@ async def __call__( 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: @@ -857,6 +944,7 @@ async def __call__( http_options = ( _BasePersistentResourceServiceRestTransport._BaseDeletePersistentResource._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_persistent_resource( request, metadata ) @@ -869,6 +957,33 @@ async 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.aiplatform_v1beta1.PersistentResourceServiceClient.DeletePersistentResource", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PersistentResourceService", + "rpcName": "DeletePersistentResource", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncPersistentResourceServiceRestTransport._DeletePersistentResource._get_response( self._host, @@ -896,6 +1011,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_delete_persistent_resource(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.PersistentResourceServiceAsyncClient.delete_persistent_resource", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PersistentResourceService", + "rpcName": "DeletePersistentResource", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _GetPersistentResource( @@ -936,7 +1073,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> persistent_resource.PersistentResource: r"""Call the get persistent resource method over HTTP. @@ -947,8 +1084,10 @@ async def __call__( 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: ~.persistent_resource.PersistentResource: @@ -963,6 +1102,7 @@ async def __call__( http_options = ( _BasePersistentResourceServiceRestTransport._BaseGetPersistentResource._get_http_options() ) + request, metadata = await self._interceptor.pre_get_persistent_resource( request, metadata ) @@ -975,6 +1115,33 @@ async 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.aiplatform_v1beta1.PersistentResourceServiceClient.GetPersistentResource", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PersistentResourceService", + "rpcName": "GetPersistentResource", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncPersistentResourceServiceRestTransport._GetPersistentResource._get_response( self._host, @@ -1002,6 +1169,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_get_persistent_resource(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = persistent_resource.PersistentResource.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.PersistentResourceServiceAsyncClient.get_persistent_resource", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PersistentResourceService", + "rpcName": "GetPersistentResource", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ListPersistentResources( @@ -1042,7 +1233,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> persistent_resource_service.ListPersistentResourcesResponse: r"""Call the list persistent resources method over HTTP. @@ -1053,8 +1244,10 @@ async def __call__( 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: ~.persistent_resource_service.ListPersistentResourcesResponse: @@ -1066,6 +1259,7 @@ async def __call__( http_options = ( _BasePersistentResourceServiceRestTransport._BaseListPersistentResources._get_http_options() ) + request, metadata = await self._interceptor.pre_list_persistent_resources( request, metadata ) @@ -1078,6 +1272,33 @@ async 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.aiplatform_v1beta1.PersistentResourceServiceClient.ListPersistentResources", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PersistentResourceService", + "rpcName": "ListPersistentResources", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncPersistentResourceServiceRestTransport._ListPersistentResources._get_response( self._host, @@ -1107,6 +1328,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_list_persistent_resources(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = persistent_resource_service.ListPersistentResourcesResponse.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.PersistentResourceServiceAsyncClient.list_persistent_resources", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PersistentResourceService", + "rpcName": "ListPersistentResources", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _RebootPersistentResource( @@ -1148,7 +1393,7 @@ async 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 reboot persistent resource method over HTTP. @@ -1160,8 +1405,10 @@ async def __call__( 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: @@ -1174,6 +1421,7 @@ async def __call__( http_options = ( _BasePersistentResourceServiceRestTransport._BaseRebootPersistentResource._get_http_options() ) + request, metadata = await self._interceptor.pre_reboot_persistent_resource( request, metadata ) @@ -1190,6 +1438,33 @@ async 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.aiplatform_v1beta1.PersistentResourceServiceClient.RebootPersistentResource", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PersistentResourceService", + "rpcName": "RebootPersistentResource", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncPersistentResourceServiceRestTransport._RebootPersistentResource._get_response( self._host, @@ -1218,6 +1493,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_reboot_persistent_resource(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.PersistentResourceServiceAsyncClient.reboot_persistent_resource", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PersistentResourceService", + "rpcName": "RebootPersistentResource", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _UpdatePersistentResource( @@ -1259,7 +1556,7 @@ async 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 persistent resource method over HTTP. @@ -1271,8 +1568,10 @@ async def __call__( 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: @@ -1285,6 +1584,7 @@ async def __call__( http_options = ( _BasePersistentResourceServiceRestTransport._BaseUpdatePersistentResource._get_http_options() ) + request, metadata = await self._interceptor.pre_update_persistent_resource( request, metadata ) @@ -1301,6 +1601,33 @@ async 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.aiplatform_v1beta1.PersistentResourceServiceClient.UpdatePersistentResource", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PersistentResourceService", + "rpcName": "UpdatePersistentResource", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncPersistentResourceServiceRestTransport._UpdatePersistentResource._get_response( self._host, @@ -1329,6 +1656,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_update_persistent_resource(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.PersistentResourceServiceAsyncClient.update_persistent_resource", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PersistentResourceService", + "rpcName": "UpdatePersistentResource", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp @property @@ -1904,6 +2253,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -2120,6 +2473,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -2326,6 +2683,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}", @@ -2542,6 +2903,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, ], "google.longrunning.Operations.ListOperations": [ { @@ -2740,6 +3105,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*}/operations", @@ -2956,6 +3325,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*}/operations", + }, ], "google.longrunning.Operations.WaitOperation": [ { @@ -3154,6 +3527,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "post", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}:wait", @@ -3366,6 +3743,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, ], } @@ -3478,7 +3859,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -3489,8 +3870,10 @@ async def __call__( 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: locations_pb2.Location: Response from GetLocation method. @@ -3499,6 +3882,7 @@ async def __call__( http_options = ( _BasePersistentResourceServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_location( request, metadata ) @@ -3511,6 +3895,33 @@ async 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.aiplatform_v1beta1.PersistentResourceServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PersistentResourceService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncPersistentResourceServiceRestTransport._GetLocation._get_response( self._host, @@ -3536,6 +3947,27 @@ async def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_location(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.aiplatform_v1beta1.PersistentResourceServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PersistentResourceService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3578,7 +4010,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -3589,8 +4021,10 @@ async def __call__( 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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -3599,6 +4033,7 @@ async def __call__( http_options = ( _BasePersistentResourceServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_locations( request, metadata ) @@ -3611,6 +4046,33 @@ async 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.aiplatform_v1beta1.PersistentResourceServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PersistentResourceService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncPersistentResourceServiceRestTransport._ListLocations._get_response( self._host, @@ -3636,6 +4098,27 @@ async def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_list_locations(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.aiplatform_v1beta1.PersistentResourceServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PersistentResourceService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3679,7 +4162,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -3690,8 +4173,10 @@ async def __call__( 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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -3700,6 +4185,7 @@ async def __call__( http_options = ( _BasePersistentResourceServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_get_iam_policy( request, metadata ) @@ -3716,6 +4202,33 @@ async 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.aiplatform_v1beta1.PersistentResourceServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PersistentResourceService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncPersistentResourceServiceRestTransport._GetIamPolicy._get_response( self._host, @@ -3742,6 +4255,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_iam_policy(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.aiplatform_v1beta1.PersistentResourceServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PersistentResourceService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3785,7 +4319,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -3796,8 +4330,10 @@ async def __call__( 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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -3806,6 +4342,7 @@ async def __call__( http_options = ( _BasePersistentResourceServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_set_iam_policy( request, metadata ) @@ -3822,6 +4359,33 @@ async 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.aiplatform_v1beta1.PersistentResourceServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PersistentResourceService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncPersistentResourceServiceRestTransport._SetIamPolicy._get_response( self._host, @@ -3848,6 +4412,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_set_iam_policy(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.aiplatform_v1beta1.PersistentResourceServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PersistentResourceService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3893,7 +4478,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -3904,8 +4489,10 @@ async def __call__( 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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -3914,6 +4501,7 @@ async def __call__( http_options = ( _BasePersistentResourceServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = await self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -3930,6 +4518,33 @@ async 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.aiplatform_v1beta1.PersistentResourceServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PersistentResourceService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncPersistentResourceServiceRestTransport._TestIamPermissions._get_response( self._host, @@ -3956,6 +4571,27 @@ async def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_test_iam_permissions(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.aiplatform_v1beta1.PersistentResourceServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PersistentResourceService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3998,7 +4634,7 @@ async 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 cancel operation method over HTTP. @@ -4009,13 +4645,16 @@ async def __call__( 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`. """ http_options = ( _BasePersistentResourceServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_cancel_operation( request, metadata ) @@ -4028,6 +4667,33 @@ async 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.aiplatform_v1beta1.PersistentResourceServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PersistentResourceService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncPersistentResourceServiceRestTransport._CancelOperation._get_response( self._host, @@ -4091,7 +4757,7 @@ async 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. @@ -4102,13 +4768,16 @@ async def __call__( 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`. """ http_options = ( _BasePersistentResourceServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_operation( request, metadata ) @@ -4121,6 +4790,33 @@ async 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.aiplatform_v1beta1.PersistentResourceServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PersistentResourceService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncPersistentResourceServiceRestTransport._DeleteOperation._get_response( self._host, @@ -4184,7 +4880,7 @@ async 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. @@ -4195,8 +4891,10 @@ async def __call__( 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: Response from GetOperation method. @@ -4205,6 +4903,7 @@ async def __call__( http_options = ( _BasePersistentResourceServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_operation( request, metadata ) @@ -4217,6 +4916,33 @@ async 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.aiplatform_v1beta1.PersistentResourceServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PersistentResourceService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncPersistentResourceServiceRestTransport._GetOperation._get_response( self._host, @@ -4242,6 +4968,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1beta1.PersistentResourceServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PersistentResourceService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4284,7 +5031,7 @@ async 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. @@ -4295,8 +5042,10 @@ async def __call__( 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 from ListOperations method. @@ -4305,6 +5054,7 @@ async def __call__( http_options = ( _BasePersistentResourceServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_operations( request, metadata ) @@ -4317,6 +5067,33 @@ async 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.aiplatform_v1beta1.PersistentResourceServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PersistentResourceService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncPersistentResourceServiceRestTransport._ListOperations._get_response( self._host, @@ -4342,6 +5119,27 @@ async def __call__( resp = operations_pb2.ListOperationsResponse() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1beta1.PersistentResourceServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PersistentResourceService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4384,7 +5182,7 @@ async 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 wait operation method over HTTP. @@ -4395,8 +5193,10 @@ async def __call__( 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: Response from WaitOperation method. @@ -4405,6 +5205,7 @@ async def __call__( http_options = ( _BasePersistentResourceServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_wait_operation( request, metadata ) @@ -4417,6 +5218,33 @@ async 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.aiplatform_v1beta1.PersistentResourceServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PersistentResourceService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncPersistentResourceServiceRestTransport._WaitOperation._get_response( self._host, @@ -4442,6 +5270,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_wait_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.aiplatform_v1beta1.PersistentResourceServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PersistentResourceService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1beta1/services/persistent_resource_service/transports/rest_base.py b/google/cloud/aiplatform_v1beta1/services/persistent_resource_service/transports/rest_base.py index cf1852ef10..2349b66ff7 100644 --- a/google/cloud/aiplatform_v1beta1/services/persistent_resource_service/transports/rest_base.py +++ b/google/cloud/aiplatform_v1beta1/services/persistent_resource_service/transports/rest_base.py @@ -1338,6 +1338,10 @@ def _get_http_options(): "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -1554,6 +1558,10 @@ def _get_http_options(): "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -1779,6 +1787,10 @@ def _get_http_options(): "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}", @@ -1995,6 +2007,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, ] return http_options @@ -2212,6 +2228,10 @@ def _get_http_options(): "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*}/operations", @@ -2428,6 +2448,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*}/operations", + }, ] return http_options @@ -2645,6 +2669,10 @@ def _get_http_options(): "method": "post", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}:wait", @@ -2857,6 +2885,10 @@ def _get_http_options(): "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, ] return http_options diff --git a/google/cloud/aiplatform_v1beta1/services/pipeline_service/async_client.py b/google/cloud/aiplatform_v1beta1/services/pipeline_service/async_client.py index ffb9692401..2baf1b08b8 100644 --- a/google/cloud/aiplatform_v1beta1/services/pipeline_service/async_client.py +++ b/google/cloud/aiplatform_v1beta1/services/pipeline_service/async_client.py @@ -13,6 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging as std_logging from collections import OrderedDict import re from typing import ( @@ -70,6 +71,15 @@ from .transports.grpc_asyncio import PipelineServiceGrpcAsyncIOTransport from .client import PipelineServiceClient +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 PipelineServiceAsyncClient: """A service for creating and managing Vertex AI's pipelines. This @@ -307,6 +317,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.aiplatform_v1beta1.PipelineServiceAsyncClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PipelineService", + "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.aiplatform.v1beta1.PipelineService", + "credentialsType": None, + }, + ) + async def create_training_pipeline( self, request: Optional[ @@ -317,7 +349,7 @@ async def create_training_pipeline( training_pipeline: Optional[gca_training_pipeline.TrainingPipeline] = 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]]] = (), ) -> gca_training_pipeline.TrainingPipeline: r"""Creates a TrainingPipeline. A created TrainingPipeline right away will be attempted to be run. @@ -376,8 +408,10 @@ async def sample_create_training_pipeline(): 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.aiplatform_v1beta1.types.TrainingPipeline: @@ -446,7 +480,7 @@ async def get_training_pipeline( 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]]] = (), ) -> training_pipeline.TrainingPipeline: r"""Gets a TrainingPipeline. @@ -491,8 +525,10 @@ async def sample_get_training_pipeline(): 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.aiplatform_v1beta1.types.TrainingPipeline: @@ -559,7 +595,7 @@ async def list_training_pipelines( 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.ListTrainingPipelinesAsyncPager: r"""Lists TrainingPipelines in a Location. @@ -605,8 +641,10 @@ async def sample_list_training_pipelines(): 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.aiplatform_v1beta1.services.pipeline_service.pagers.ListTrainingPipelinesAsyncPager: @@ -683,7 +721,7 @@ async def delete_training_pipeline( 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"""Deletes a TrainingPipeline. @@ -732,8 +770,10 @@ async def sample_delete_training_pipeline(): 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: @@ -814,7 +854,7 @@ async def cancel_training_pipeline( 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"""Cancels a TrainingPipeline. Starts asynchronous cancellation on the TrainingPipeline. The server makes a best effort to cancel @@ -868,8 +908,10 @@ async def sample_cancel_training_pipeline(): 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 @@ -925,7 +967,7 @@ async def create_pipeline_job( pipeline_job_id: 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]]] = (), ) -> gca_pipeline_job.PipelineJob: r"""Creates a PipelineJob. A PipelineJob will run immediately when created. @@ -987,8 +1029,10 @@ async def sample_create_pipeline_job(): 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.aiplatform_v1beta1.types.PipelineJob: @@ -1053,7 +1097,7 @@ async def get_pipeline_job( 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]]] = (), ) -> pipeline_job.PipelineJob: r"""Gets a PipelineJob. @@ -1097,8 +1141,10 @@ async def sample_get_pipeline_job(): 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.aiplatform_v1beta1.types.PipelineJob: @@ -1159,7 +1205,7 @@ async def list_pipeline_jobs( 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.ListPipelineJobsAsyncPager: r"""Lists PipelineJobs in a Location. @@ -1205,8 +1251,10 @@ async def sample_list_pipeline_jobs(): 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.aiplatform_v1beta1.services.pipeline_service.pagers.ListPipelineJobsAsyncPager: @@ -1283,7 +1331,7 @@ async def delete_pipeline_job( 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"""Deletes a PipelineJob. @@ -1332,8 +1380,10 @@ async def sample_delete_pipeline_job(): 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: @@ -1415,7 +1465,7 @@ async def batch_delete_pipeline_jobs( names: Optional[MutableSequence[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"""Batch deletes PipelineJobs The Operation is atomic. If it fails, none of the @@ -1476,8 +1526,10 @@ async def sample_batch_delete_pipeline_jobs(): 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: @@ -1552,7 +1604,7 @@ async def cancel_pipeline_job( 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"""Cancels a PipelineJob. Starts asynchronous cancellation on the PipelineJob. The server makes a best effort to cancel the @@ -1605,8 +1657,10 @@ async def sample_cancel_pipeline_job(): 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 @@ -1661,7 +1715,7 @@ async def batch_cancel_pipeline_jobs( names: Optional[MutableSequence[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"""Batch cancel PipelineJobs. Firstly the server will check if all the jobs are in @@ -1727,8 +1781,10 @@ async def sample_batch_cancel_pipeline_jobs(): 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: @@ -1800,7 +1856,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. @@ -1811,8 +1867,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. @@ -1853,7 +1911,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. @@ -1864,8 +1922,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. @@ -1906,7 +1966,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. @@ -1922,8 +1982,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 """ @@ -1960,7 +2022,7 @@ async def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -1975,8 +2037,10 @@ async def cancel_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 """ @@ -2013,7 +2077,7 @@ async def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -2030,8 +2094,10 @@ async def wait_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. @@ -2072,7 +2138,7 @@ async def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -2085,8 +2151,10 @@ async def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -2191,7 +2259,7 @@ async def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -2205,8 +2273,10 @@ async def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -2311,7 +2381,7 @@ async def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -2326,8 +2396,10 @@ async def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -2371,7 +2443,7 @@ async def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -2382,8 +2454,10 @@ async def get_location( 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: ~.location_pb2.Location: Location object. @@ -2424,7 +2498,7 @@ async def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -2435,8 +2509,10 @@ async def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1beta1/services/pipeline_service/client.py b/google/cloud/aiplatform_v1beta1/services/pipeline_service/client.py index f43a81c075..7c9d5c8e13 100644 --- a/google/cloud/aiplatform_v1beta1/services/pipeline_service/client.py +++ b/google/cloud/aiplatform_v1beta1/services/pipeline_service/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 ( @@ -48,6 +49,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 as gac_operation # type: ignore from google.api_core import operation_async # type: ignore from google.cloud.aiplatform_v1beta1.services.pipeline_service import pagers @@ -819,6 +829,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( @@ -909,6 +923,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.aiplatform_v1beta1.PipelineServiceClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PipelineService", + "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.aiplatform.v1beta1.PipelineService", + "credentialsType": None, + }, + ) + def create_training_pipeline( self, request: Optional[ @@ -919,7 +956,7 @@ def create_training_pipeline( training_pipeline: Optional[gca_training_pipeline.TrainingPipeline] = 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]]] = (), ) -> gca_training_pipeline.TrainingPipeline: r"""Creates a TrainingPipeline. A created TrainingPipeline right away will be attempted to be run. @@ -978,8 +1015,10 @@ def sample_create_training_pipeline(): 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.aiplatform_v1beta1.types.TrainingPipeline: @@ -1045,7 +1084,7 @@ def get_training_pipeline( 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]]] = (), ) -> training_pipeline.TrainingPipeline: r"""Gets a TrainingPipeline. @@ -1090,8 +1129,10 @@ def sample_get_training_pipeline(): 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.aiplatform_v1beta1.types.TrainingPipeline: @@ -1155,7 +1196,7 @@ def list_training_pipelines( 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.ListTrainingPipelinesPager: r"""Lists TrainingPipelines in a Location. @@ -1201,8 +1242,10 @@ def sample_list_training_pipelines(): 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.aiplatform_v1beta1.services.pipeline_service.pagers.ListTrainingPipelinesPager: @@ -1276,7 +1319,7 @@ def delete_training_pipeline( 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]]] = (), ) -> gac_operation.Operation: r"""Deletes a TrainingPipeline. @@ -1325,8 +1368,10 @@ def sample_delete_training_pipeline(): 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 cancel_training_pipeline( 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"""Cancels a TrainingPipeline. Starts asynchronous cancellation on the TrainingPipeline. The server makes a best effort to cancel @@ -1458,8 +1503,10 @@ def sample_cancel_training_pipeline(): 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 @@ -1512,7 +1559,7 @@ def create_pipeline_job( pipeline_job_id: 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]]] = (), ) -> gca_pipeline_job.PipelineJob: r"""Creates a PipelineJob. A PipelineJob will run immediately when created. @@ -1574,8 +1621,10 @@ def sample_create_pipeline_job(): 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.aiplatform_v1beta1.types.PipelineJob: @@ -1637,7 +1686,7 @@ def get_pipeline_job( 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]]] = (), ) -> pipeline_job.PipelineJob: r"""Gets a PipelineJob. @@ -1681,8 +1730,10 @@ def sample_get_pipeline_job(): 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.aiplatform_v1beta1.types.PipelineJob: @@ -1740,7 +1791,7 @@ def list_pipeline_jobs( 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.ListPipelineJobsPager: r"""Lists PipelineJobs in a Location. @@ -1786,8 +1837,10 @@ def sample_list_pipeline_jobs(): 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.aiplatform_v1beta1.services.pipeline_service.pagers.ListPipelineJobsPager: @@ -1861,7 +1914,7 @@ def delete_pipeline_job( 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]]] = (), ) -> gac_operation.Operation: r"""Deletes a PipelineJob. @@ -1910,8 +1963,10 @@ def sample_delete_pipeline_job(): 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: @@ -1990,7 +2045,7 @@ def batch_delete_pipeline_jobs( names: Optional[MutableSequence[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]]] = (), ) -> gac_operation.Operation: r"""Batch deletes PipelineJobs The Operation is atomic. If it fails, none of the @@ -2051,8 +2106,10 @@ def sample_batch_delete_pipeline_jobs(): 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: @@ -2126,7 +2183,7 @@ def cancel_pipeline_job( 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"""Cancels a PipelineJob. Starts asynchronous cancellation on the PipelineJob. The server makes a best effort to cancel the @@ -2179,8 +2236,10 @@ def sample_cancel_pipeline_job(): 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 @@ -2232,7 +2291,7 @@ def batch_cancel_pipeline_jobs( names: Optional[MutableSequence[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]]] = (), ) -> gac_operation.Operation: r"""Batch cancel PipelineJobs. Firstly the server will check if all the jobs are in @@ -2298,8 +2357,10 @@ def sample_batch_cancel_pipeline_jobs(): 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: @@ -2383,7 +2444,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. @@ -2394,8 +2455,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. @@ -2436,7 +2499,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. @@ -2447,8 +2510,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. @@ -2489,7 +2554,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. @@ -2505,8 +2570,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 """ @@ -2543,7 +2610,7 @@ def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -2558,8 +2625,10 @@ def cancel_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 """ @@ -2596,7 +2665,7 @@ def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -2613,8 +2682,10 @@ def wait_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. @@ -2655,7 +2726,7 @@ def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -2668,8 +2739,10 @@ def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -2774,7 +2847,7 @@ def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -2788,8 +2861,10 @@ def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -2894,7 +2969,7 @@ def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -2909,8 +2984,10 @@ def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -2952,7 +3029,7 @@ def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -2963,8 +3040,10 @@ def get_location( 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: ~.location_pb2.Location: Location object. @@ -3005,7 +3084,7 @@ def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -3016,8 +3095,10 @@ def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1beta1/services/pipeline_service/pagers.py b/google/cloud/aiplatform_v1beta1/services/pipeline_service/pagers.py index 6d60b4ed93..ff0248d09f 100644 --- a/google/cloud/aiplatform_v1beta1/services/pipeline_service/pagers.py +++ b/google/cloud/aiplatform_v1beta1/services/pipeline_service/pagers.py @@ -68,7 +68,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. @@ -82,8 +82,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 = pipeline_service.ListTrainingPipelinesRequest(request) @@ -144,7 +146,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. @@ -158,8 +160,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 = pipeline_service.ListTrainingPipelinesRequest(request) @@ -224,7 +228,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. @@ -238,8 +242,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 = pipeline_service.ListPipelineJobsRequest(request) @@ -298,7 +304,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. @@ -312,8 +318,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 = pipeline_service.ListPipelineJobsRequest(request) diff --git a/google/cloud/aiplatform_v1beta1/services/pipeline_service/transports/grpc.py b/google/cloud/aiplatform_v1beta1/services/pipeline_service/transports/grpc.py index a17074e07c..682146b66a 100644 --- a/google/cloud/aiplatform_v1beta1/services/pipeline_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1beta1/services/pipeline_service/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 import warnings from typing import Callable, Dict, Optional, Sequence, Tuple, Union @@ -22,8 +25,11 @@ import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from google.cloud.aiplatform_v1beta1.types import pipeline_job from google.cloud.aiplatform_v1beta1.types import pipeline_job as gca_pipeline_job @@ -39,6 +45,81 @@ from google.protobuf import empty_pb2 # type: ignore from .base import PipelineServiceTransport, DEFAULT_CLIENT_INFO +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.aiplatform.v1beta1.PipelineService", + "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.aiplatform.v1beta1.PipelineService", + "rpcName": client_call_details.method, + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class PipelineServiceGrpcTransport(PipelineServiceTransport): """gRPC backend transport for PipelineService. @@ -196,7 +277,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 @@ -260,7 +346,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 @@ -288,7 +376,7 @@ def create_training_pipeline( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_training_pipeline" not in self._stubs: - self._stubs["create_training_pipeline"] = self.grpc_channel.unary_unary( + self._stubs["create_training_pipeline"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.PipelineService/CreateTrainingPipeline", request_serializer=pipeline_service.CreateTrainingPipelineRequest.serialize, response_deserializer=gca_training_pipeline.TrainingPipeline.deserialize, @@ -317,7 +405,7 @@ def get_training_pipeline( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_training_pipeline" not in self._stubs: - self._stubs["get_training_pipeline"] = self.grpc_channel.unary_unary( + self._stubs["get_training_pipeline"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.PipelineService/GetTrainingPipeline", request_serializer=pipeline_service.GetTrainingPipelineRequest.serialize, response_deserializer=training_pipeline.TrainingPipeline.deserialize, @@ -346,7 +434,7 @@ def list_training_pipelines( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_training_pipelines" not in self._stubs: - self._stubs["list_training_pipelines"] = self.grpc_channel.unary_unary( + self._stubs["list_training_pipelines"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.PipelineService/ListTrainingPipelines", request_serializer=pipeline_service.ListTrainingPipelinesRequest.serialize, response_deserializer=pipeline_service.ListTrainingPipelinesResponse.deserialize, @@ -374,7 +462,7 @@ def delete_training_pipeline( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_training_pipeline" not in self._stubs: - self._stubs["delete_training_pipeline"] = self.grpc_channel.unary_unary( + self._stubs["delete_training_pipeline"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.PipelineService/DeleteTrainingPipeline", request_serializer=pipeline_service.DeleteTrainingPipelineRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -412,7 +500,7 @@ def cancel_training_pipeline( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_training_pipeline" not in self._stubs: - self._stubs["cancel_training_pipeline"] = self.grpc_channel.unary_unary( + self._stubs["cancel_training_pipeline"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.PipelineService/CancelTrainingPipeline", request_serializer=pipeline_service.CancelTrainingPipelineRequest.serialize, response_deserializer=empty_pb2.Empty.FromString, @@ -441,7 +529,7 @@ def create_pipeline_job( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_pipeline_job" not in self._stubs: - self._stubs["create_pipeline_job"] = self.grpc_channel.unary_unary( + self._stubs["create_pipeline_job"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.PipelineService/CreatePipelineJob", request_serializer=pipeline_service.CreatePipelineJobRequest.serialize, response_deserializer=gca_pipeline_job.PipelineJob.deserialize, @@ -467,7 +555,7 @@ def get_pipeline_job( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_pipeline_job" not in self._stubs: - self._stubs["get_pipeline_job"] = self.grpc_channel.unary_unary( + self._stubs["get_pipeline_job"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.PipelineService/GetPipelineJob", request_serializer=pipeline_service.GetPipelineJobRequest.serialize, response_deserializer=pipeline_job.PipelineJob.deserialize, @@ -496,7 +584,7 @@ def list_pipeline_jobs( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_pipeline_jobs" not in self._stubs: - self._stubs["list_pipeline_jobs"] = self.grpc_channel.unary_unary( + self._stubs["list_pipeline_jobs"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.PipelineService/ListPipelineJobs", request_serializer=pipeline_service.ListPipelineJobsRequest.serialize, response_deserializer=pipeline_service.ListPipelineJobsResponse.deserialize, @@ -524,7 +612,7 @@ def delete_pipeline_job( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_pipeline_job" not in self._stubs: - self._stubs["delete_pipeline_job"] = self.grpc_channel.unary_unary( + self._stubs["delete_pipeline_job"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.PipelineService/DeletePipelineJob", request_serializer=pipeline_service.DeletePipelineJobRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -555,7 +643,9 @@ def batch_delete_pipeline_jobs( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "batch_delete_pipeline_jobs" not in self._stubs: - self._stubs["batch_delete_pipeline_jobs"] = self.grpc_channel.unary_unary( + self._stubs[ + "batch_delete_pipeline_jobs" + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.PipelineService/BatchDeletePipelineJobs", request_serializer=pipeline_service.BatchDeletePipelineJobsRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -593,7 +683,7 @@ def cancel_pipeline_job( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_pipeline_job" not in self._stubs: - self._stubs["cancel_pipeline_job"] = self.grpc_channel.unary_unary( + self._stubs["cancel_pipeline_job"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.PipelineService/CancelPipelineJob", request_serializer=pipeline_service.CancelPipelineJobRequest.serialize, response_deserializer=empty_pb2.Empty.FromString, @@ -629,7 +719,9 @@ def batch_cancel_pipeline_jobs( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "batch_cancel_pipeline_jobs" not in self._stubs: - self._stubs["batch_cancel_pipeline_jobs"] = self.grpc_channel.unary_unary( + self._stubs[ + "batch_cancel_pipeline_jobs" + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.PipelineService/BatchCancelPipelineJobs", request_serializer=pipeline_service.BatchCancelPipelineJobsRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -637,7 +729,7 @@ def batch_cancel_pipeline_jobs( return self._stubs["batch_cancel_pipeline_jobs"] def close(self): - self.grpc_channel.close() + self._logged_channel.close() @property def delete_operation( @@ -649,7 +741,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, @@ -666,7 +758,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -683,7 +775,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -700,7 +792,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, @@ -719,7 +811,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, @@ -738,7 +830,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -755,7 +847,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -780,7 +872,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -806,7 +898,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -835,7 +927,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1beta1/services/pipeline_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1beta1/services/pipeline_service/transports/grpc_asyncio.py index d8cfd188ae..819cf8f917 100644 --- a/google/cloud/aiplatform_v1beta1/services/pipeline_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/pipeline_service/transports/grpc_asyncio.py @@ -14,6 +14,9 @@ # limitations under the License. # import inspect +import json +import pickle +import logging as std_logging import warnings from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union @@ -24,8 +27,11 @@ from google.api_core import operations_v1 from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from grpc.experimental import aio # type: ignore from google.cloud.aiplatform_v1beta1.types import pipeline_job @@ -43,6 +49,82 @@ from .base import PipelineServiceTransport, DEFAULT_CLIENT_INFO from .grpc import PipelineServiceGrpcTransport +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.aiplatform.v1beta1.PipelineService", + "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.aiplatform.v1beta1.PipelineService", + "rpcName": str(client_call_details.method), + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class PipelineServiceGrpcAsyncIOTransport(PipelineServiceTransport): """gRPC AsyncIO backend transport for PipelineService. @@ -243,10 +325,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 @@ -269,7 +354,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. @@ -298,7 +383,7 @@ def create_training_pipeline( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_training_pipeline" not in self._stubs: - self._stubs["create_training_pipeline"] = self.grpc_channel.unary_unary( + self._stubs["create_training_pipeline"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.PipelineService/CreateTrainingPipeline", request_serializer=pipeline_service.CreateTrainingPipelineRequest.serialize, response_deserializer=gca_training_pipeline.TrainingPipeline.deserialize, @@ -327,7 +412,7 @@ def get_training_pipeline( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_training_pipeline" not in self._stubs: - self._stubs["get_training_pipeline"] = self.grpc_channel.unary_unary( + self._stubs["get_training_pipeline"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.PipelineService/GetTrainingPipeline", request_serializer=pipeline_service.GetTrainingPipelineRequest.serialize, response_deserializer=training_pipeline.TrainingPipeline.deserialize, @@ -356,7 +441,7 @@ def list_training_pipelines( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_training_pipelines" not in self._stubs: - self._stubs["list_training_pipelines"] = self.grpc_channel.unary_unary( + self._stubs["list_training_pipelines"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.PipelineService/ListTrainingPipelines", request_serializer=pipeline_service.ListTrainingPipelinesRequest.serialize, response_deserializer=pipeline_service.ListTrainingPipelinesResponse.deserialize, @@ -385,7 +470,7 @@ def delete_training_pipeline( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_training_pipeline" not in self._stubs: - self._stubs["delete_training_pipeline"] = self.grpc_channel.unary_unary( + self._stubs["delete_training_pipeline"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.PipelineService/DeleteTrainingPipeline", request_serializer=pipeline_service.DeleteTrainingPipelineRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -425,7 +510,7 @@ def cancel_training_pipeline( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_training_pipeline" not in self._stubs: - self._stubs["cancel_training_pipeline"] = self.grpc_channel.unary_unary( + self._stubs["cancel_training_pipeline"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.PipelineService/CancelTrainingPipeline", request_serializer=pipeline_service.CancelTrainingPipelineRequest.serialize, response_deserializer=empty_pb2.Empty.FromString, @@ -455,7 +540,7 @@ def create_pipeline_job( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_pipeline_job" not in self._stubs: - self._stubs["create_pipeline_job"] = self.grpc_channel.unary_unary( + self._stubs["create_pipeline_job"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.PipelineService/CreatePipelineJob", request_serializer=pipeline_service.CreatePipelineJobRequest.serialize, response_deserializer=gca_pipeline_job.PipelineJob.deserialize, @@ -483,7 +568,7 @@ def get_pipeline_job( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_pipeline_job" not in self._stubs: - self._stubs["get_pipeline_job"] = self.grpc_channel.unary_unary( + self._stubs["get_pipeline_job"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.PipelineService/GetPipelineJob", request_serializer=pipeline_service.GetPipelineJobRequest.serialize, response_deserializer=pipeline_job.PipelineJob.deserialize, @@ -512,7 +597,7 @@ def list_pipeline_jobs( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_pipeline_jobs" not in self._stubs: - self._stubs["list_pipeline_jobs"] = self.grpc_channel.unary_unary( + self._stubs["list_pipeline_jobs"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.PipelineService/ListPipelineJobs", request_serializer=pipeline_service.ListPipelineJobsRequest.serialize, response_deserializer=pipeline_service.ListPipelineJobsResponse.deserialize, @@ -540,7 +625,7 @@ def delete_pipeline_job( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_pipeline_job" not in self._stubs: - self._stubs["delete_pipeline_job"] = self.grpc_channel.unary_unary( + self._stubs["delete_pipeline_job"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.PipelineService/DeletePipelineJob", request_serializer=pipeline_service.DeletePipelineJobRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -572,7 +657,9 @@ def batch_delete_pipeline_jobs( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "batch_delete_pipeline_jobs" not in self._stubs: - self._stubs["batch_delete_pipeline_jobs"] = self.grpc_channel.unary_unary( + self._stubs[ + "batch_delete_pipeline_jobs" + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.PipelineService/BatchDeletePipelineJobs", request_serializer=pipeline_service.BatchDeletePipelineJobsRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -612,7 +699,7 @@ def cancel_pipeline_job( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_pipeline_job" not in self._stubs: - self._stubs["cancel_pipeline_job"] = self.grpc_channel.unary_unary( + self._stubs["cancel_pipeline_job"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.PipelineService/CancelPipelineJob", request_serializer=pipeline_service.CancelPipelineJobRequest.serialize, response_deserializer=empty_pb2.Empty.FromString, @@ -649,7 +736,9 @@ def batch_cancel_pipeline_jobs( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "batch_cancel_pipeline_jobs" not in self._stubs: - self._stubs["batch_cancel_pipeline_jobs"] = self.grpc_channel.unary_unary( + self._stubs[ + "batch_cancel_pipeline_jobs" + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.PipelineService/BatchCancelPipelineJobs", request_serializer=pipeline_service.BatchCancelPipelineJobsRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -777,7 +866,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: @@ -793,7 +882,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, @@ -810,7 +899,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -827,7 +916,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -844,7 +933,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, @@ -863,7 +952,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, @@ -882,7 +971,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -899,7 +988,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -924,7 +1013,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -950,7 +1039,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -979,7 +1068,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1beta1/services/pipeline_service/transports/rest.py b/google/cloud/aiplatform_v1beta1/services/pipeline_service/transports/rest.py index 64c53817e2..a50dfe8d5b 100644 --- a/google/cloud/aiplatform_v1beta1/services/pipeline_service/transports/rest.py +++ b/google/cloud/aiplatform_v1beta1/services/pipeline_service/transports/rest.py @@ -13,9 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging +import json # type: ignore from google.auth.transport.requests import AuthorizedSession # type: ignore -import json # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.api_core import exceptions as core_exceptions from google.api_core import retry as retries @@ -54,6 +55,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, @@ -174,9 +183,10 @@ def post_list_training_pipelines(self, response): def pre_batch_cancel_pipeline_jobs( self, request: pipeline_service.BatchCancelPipelineJobsRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - pipeline_service.BatchCancelPipelineJobsRequest, Sequence[Tuple[str, str]] + pipeline_service.BatchCancelPipelineJobsRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for batch_cancel_pipeline_jobs @@ -199,9 +209,10 @@ def post_batch_cancel_pipeline_jobs( def pre_batch_delete_pipeline_jobs( self, request: pipeline_service.BatchDeletePipelineJobsRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - pipeline_service.BatchDeletePipelineJobsRequest, Sequence[Tuple[str, str]] + pipeline_service.BatchDeletePipelineJobsRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for batch_delete_pipeline_jobs @@ -224,8 +235,11 @@ def post_batch_delete_pipeline_jobs( def pre_cancel_pipeline_job( self, request: pipeline_service.CancelPipelineJobRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[pipeline_service.CancelPipelineJobRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + pipeline_service.CancelPipelineJobRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for cancel_pipeline_job Override in a subclass to manipulate the request or metadata @@ -236,9 +250,10 @@ def pre_cancel_pipeline_job( def pre_cancel_training_pipeline( self, request: pipeline_service.CancelTrainingPipelineRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - pipeline_service.CancelTrainingPipelineRequest, Sequence[Tuple[str, str]] + pipeline_service.CancelTrainingPipelineRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for cancel_training_pipeline @@ -250,8 +265,11 @@ def pre_cancel_training_pipeline( def pre_create_pipeline_job( self, request: pipeline_service.CreatePipelineJobRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[pipeline_service.CreatePipelineJobRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + pipeline_service.CreatePipelineJobRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for create_pipeline_job Override in a subclass to manipulate the request or metadata @@ -273,9 +291,10 @@ def post_create_pipeline_job( def pre_create_training_pipeline( self, request: pipeline_service.CreateTrainingPipelineRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - pipeline_service.CreateTrainingPipelineRequest, Sequence[Tuple[str, str]] + pipeline_service.CreateTrainingPipelineRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for create_training_pipeline @@ -298,8 +317,11 @@ def post_create_training_pipeline( def pre_delete_pipeline_job( self, request: pipeline_service.DeletePipelineJobRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[pipeline_service.DeletePipelineJobRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + pipeline_service.DeletePipelineJobRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for delete_pipeline_job Override in a subclass to manipulate the request or metadata @@ -321,9 +343,10 @@ def post_delete_pipeline_job( def pre_delete_training_pipeline( self, request: pipeline_service.DeleteTrainingPipelineRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - pipeline_service.DeleteTrainingPipelineRequest, Sequence[Tuple[str, str]] + pipeline_service.DeleteTrainingPipelineRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for delete_training_pipeline @@ -346,8 +369,10 @@ def post_delete_training_pipeline( def pre_get_pipeline_job( self, request: pipeline_service.GetPipelineJobRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[pipeline_service.GetPipelineJobRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + pipeline_service.GetPipelineJobRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_pipeline_job Override in a subclass to manipulate the request or metadata @@ -369,8 +394,11 @@ def post_get_pipeline_job( def pre_get_training_pipeline( self, request: pipeline_service.GetTrainingPipelineRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[pipeline_service.GetTrainingPipelineRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + pipeline_service.GetTrainingPipelineRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for get_training_pipeline Override in a subclass to manipulate the request or metadata @@ -392,8 +420,11 @@ def post_get_training_pipeline( def pre_list_pipeline_jobs( self, request: pipeline_service.ListPipelineJobsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[pipeline_service.ListPipelineJobsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + pipeline_service.ListPipelineJobsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for list_pipeline_jobs Override in a subclass to manipulate the request or metadata @@ -415,9 +446,10 @@ def post_list_pipeline_jobs( def pre_list_training_pipelines( self, request: pipeline_service.ListTrainingPipelinesRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - pipeline_service.ListTrainingPipelinesRequest, Sequence[Tuple[str, str]] + pipeline_service.ListTrainingPipelinesRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for list_training_pipelines @@ -440,8 +472,10 @@ def post_list_training_pipelines( def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -463,8 +497,10 @@ def post_get_location( def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -486,8 +522,10 @@ def post_list_locations( def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -507,8 +545,10 @@ def post_get_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -528,8 +568,11 @@ def post_set_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -551,8 +594,10 @@ def post_test_iam_permissions( def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -572,8 +617,10 @@ def post_cancel_operation(self, response: None) -> None: 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 @@ -593,8 +640,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 @@ -616,8 +665,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 @@ -639,8 +690,10 @@ def post_list_operations( def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -1323,6 +1376,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -1539,6 +1596,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -1745,6 +1806,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}", @@ -1961,6 +2026,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, ], "google.longrunning.Operations.ListOperations": [ { @@ -2159,6 +2228,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*}/operations", @@ -2375,6 +2448,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*}/operations", + }, ], "google.longrunning.Operations.WaitOperation": [ { @@ -2573,6 +2650,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "post", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}:wait", @@ -2785,6 +2866,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, ], } @@ -2841,7 +2926,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 batch cancel pipeline jobs method over HTTP. @@ -2853,8 +2938,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: @@ -2867,6 +2954,7 @@ def __call__( http_options = ( _BasePipelineServiceRestTransport._BaseBatchCancelPipelineJobs._get_http_options() ) + request, metadata = self._interceptor.pre_batch_cancel_pipeline_jobs( request, metadata ) @@ -2883,6 +2971,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.aiplatform_v1beta1.PipelineServiceClient.BatchCancelPipelineJobs", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PipelineService", + "rpcName": "BatchCancelPipelineJobs", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( PipelineServiceRestTransport._BatchCancelPipelineJobs._get_response( @@ -2904,7 +3019,29 @@ def __call__( # Return the response resp = operations_pb2.Operation() json_format.Parse(response.content, resp, ignore_unknown_fields=True) + resp = self._interceptor.post_batch_cancel_pipeline_jobs(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.aiplatform_v1beta1.PipelineServiceClient.batch_cancel_pipeline_jobs", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PipelineService", + "rpcName": "BatchCancelPipelineJobs", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _BatchDeletePipelineJobs( @@ -2944,7 +3081,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 batch delete pipeline jobs method over HTTP. @@ -2956,8 +3093,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: @@ -2970,6 +3109,7 @@ def __call__( http_options = ( _BasePipelineServiceRestTransport._BaseBatchDeletePipelineJobs._get_http_options() ) + request, metadata = self._interceptor.pre_batch_delete_pipeline_jobs( request, metadata ) @@ -2986,6 +3126,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.aiplatform_v1beta1.PipelineServiceClient.BatchDeletePipelineJobs", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PipelineService", + "rpcName": "BatchDeletePipelineJobs", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( PipelineServiceRestTransport._BatchDeletePipelineJobs._get_response( @@ -3007,7 +3174,29 @@ def __call__( # Return the response resp = operations_pb2.Operation() json_format.Parse(response.content, resp, ignore_unknown_fields=True) + resp = self._interceptor.post_batch_delete_pipeline_jobs(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.aiplatform_v1beta1.PipelineServiceClient.batch_delete_pipeline_jobs", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PipelineService", + "rpcName": "BatchDeletePipelineJobs", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _CancelPipelineJob( @@ -3047,7 +3236,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 cancel pipeline job method over HTTP. @@ -3058,13 +3247,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 = ( _BasePipelineServiceRestTransport._BaseCancelPipelineJob._get_http_options() ) + request, metadata = self._interceptor.pre_cancel_pipeline_job( request, metadata ) @@ -3081,6 +3273,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.aiplatform_v1beta1.PipelineServiceClient.CancelPipelineJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PipelineService", + "rpcName": "CancelPipelineJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = PipelineServiceRestTransport._CancelPipelineJob._get_response( self._host, @@ -3134,7 +3353,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 cancel training pipeline method over HTTP. @@ -3145,13 +3364,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 = ( _BasePipelineServiceRestTransport._BaseCancelTrainingPipeline._get_http_options() ) + request, metadata = self._interceptor.pre_cancel_training_pipeline( request, metadata ) @@ -3168,6 +3390,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.aiplatform_v1beta1.PipelineServiceClient.CancelTrainingPipeline", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PipelineService", + "rpcName": "CancelTrainingPipeline", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( PipelineServiceRestTransport._CancelTrainingPipeline._get_response( @@ -3223,7 +3472,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]]] = (), ) -> gca_pipeline_job.PipelineJob: r"""Call the create pipeline job method over HTTP. @@ -3234,8 +3483,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: ~.gca_pipeline_job.PipelineJob: @@ -3247,6 +3498,7 @@ def __call__( http_options = ( _BasePipelineServiceRestTransport._BaseCreatePipelineJob._get_http_options() ) + request, metadata = self._interceptor.pre_create_pipeline_job( request, metadata ) @@ -3263,6 +3515,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.aiplatform_v1beta1.PipelineServiceClient.CreatePipelineJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PipelineService", + "rpcName": "CreatePipelineJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = PipelineServiceRestTransport._CreatePipelineJob._get_response( self._host, @@ -3284,7 +3563,29 @@ def __call__( pb_resp = gca_pipeline_job.PipelineJob.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_create_pipeline_job(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gca_pipeline_job.PipelineJob.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.aiplatform_v1beta1.PipelineServiceClient.create_pipeline_job", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PipelineService", + "rpcName": "CreatePipelineJob", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _CreateTrainingPipeline( @@ -3324,7 +3625,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]]] = (), ) -> gca_training_pipeline.TrainingPipeline: r"""Call the create training pipeline method over HTTP. @@ -3335,8 +3636,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: ~.gca_training_pipeline.TrainingPipeline: @@ -3352,6 +3655,7 @@ def __call__( http_options = ( _BasePipelineServiceRestTransport._BaseCreateTrainingPipeline._get_http_options() ) + request, metadata = self._interceptor.pre_create_training_pipeline( request, metadata ) @@ -3368,6 +3672,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.aiplatform_v1beta1.PipelineServiceClient.CreateTrainingPipeline", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PipelineService", + "rpcName": "CreateTrainingPipeline", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( PipelineServiceRestTransport._CreateTrainingPipeline._get_response( @@ -3391,7 +3722,31 @@ def __call__( pb_resp = gca_training_pipeline.TrainingPipeline.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_create_training_pipeline(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gca_training_pipeline.TrainingPipeline.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.aiplatform_v1beta1.PipelineServiceClient.create_training_pipeline", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PipelineService", + "rpcName": "CreateTrainingPipeline", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _DeletePipelineJob( @@ -3430,7 +3785,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 pipeline job method over HTTP. @@ -3441,8 +3796,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: @@ -3455,6 +3812,7 @@ def __call__( http_options = ( _BasePipelineServiceRestTransport._BaseDeletePipelineJob._get_http_options() ) + request, metadata = self._interceptor.pre_delete_pipeline_job( request, metadata ) @@ -3467,6 +3825,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.aiplatform_v1beta1.PipelineServiceClient.DeletePipelineJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PipelineService", + "rpcName": "DeletePipelineJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = PipelineServiceRestTransport._DeletePipelineJob._get_response( self._host, @@ -3485,7 +3870,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_pipeline_job(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.aiplatform_v1beta1.PipelineServiceClient.delete_pipeline_job", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PipelineService", + "rpcName": "DeletePipelineJob", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _DeleteTrainingPipeline( @@ -3524,7 +3931,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 training pipeline method over HTTP. @@ -3535,8 +3942,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: @@ -3549,6 +3958,7 @@ def __call__( http_options = ( _BasePipelineServiceRestTransport._BaseDeleteTrainingPipeline._get_http_options() ) + request, metadata = self._interceptor.pre_delete_training_pipeline( request, metadata ) @@ -3561,6 +3971,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.aiplatform_v1beta1.PipelineServiceClient.DeleteTrainingPipeline", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PipelineService", + "rpcName": "DeleteTrainingPipeline", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( PipelineServiceRestTransport._DeleteTrainingPipeline._get_response( @@ -3581,7 +4018,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_training_pipeline(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.aiplatform_v1beta1.PipelineServiceClient.delete_training_pipeline", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PipelineService", + "rpcName": "DeleteTrainingPipeline", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _GetPipelineJob( @@ -3619,7 +4078,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]]] = (), ) -> pipeline_job.PipelineJob: r"""Call the get pipeline job method over HTTP. @@ -3630,8 +4089,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: ~.pipeline_job.PipelineJob: @@ -3643,6 +4104,7 @@ def __call__( http_options = ( _BasePipelineServiceRestTransport._BaseGetPipelineJob._get_http_options() ) + request, metadata = self._interceptor.pre_get_pipeline_job( request, metadata ) @@ -3655,6 +4117,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.aiplatform_v1beta1.PipelineServiceClient.GetPipelineJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PipelineService", + "rpcName": "GetPipelineJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = PipelineServiceRestTransport._GetPipelineJob._get_response( self._host, @@ -3675,7 +4164,29 @@ def __call__( pb_resp = pipeline_job.PipelineJob.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_pipeline_job(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = pipeline_job.PipelineJob.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.aiplatform_v1beta1.PipelineServiceClient.get_pipeline_job", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PipelineService", + "rpcName": "GetPipelineJob", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _GetTrainingPipeline( @@ -3714,7 +4225,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]]] = (), ) -> training_pipeline.TrainingPipeline: r"""Call the get training pipeline method over HTTP. @@ -3725,8 +4236,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: ~.training_pipeline.TrainingPipeline: @@ -3742,6 +4255,7 @@ def __call__( http_options = ( _BasePipelineServiceRestTransport._BaseGetTrainingPipeline._get_http_options() ) + request, metadata = self._interceptor.pre_get_training_pipeline( request, metadata ) @@ -3754,6 +4268,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.aiplatform_v1beta1.PipelineServiceClient.GetTrainingPipeline", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PipelineService", + "rpcName": "GetTrainingPipeline", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = PipelineServiceRestTransport._GetTrainingPipeline._get_response( self._host, @@ -3774,7 +4315,31 @@ def __call__( pb_resp = training_pipeline.TrainingPipeline.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_training_pipeline(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = training_pipeline.TrainingPipeline.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.aiplatform_v1beta1.PipelineServiceClient.get_training_pipeline", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PipelineService", + "rpcName": "GetTrainingPipeline", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListPipelineJobs( @@ -3812,7 +4377,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]]] = (), ) -> pipeline_service.ListPipelineJobsResponse: r"""Call the list pipeline jobs method over HTTP. @@ -3823,8 +4388,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: ~.pipeline_service.ListPipelineJobsResponse: @@ -3836,6 +4403,7 @@ def __call__( http_options = ( _BasePipelineServiceRestTransport._BaseListPipelineJobs._get_http_options() ) + request, metadata = self._interceptor.pre_list_pipeline_jobs( request, metadata ) @@ -3848,6 +4416,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.aiplatform_v1beta1.PipelineServiceClient.ListPipelineJobs", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PipelineService", + "rpcName": "ListPipelineJobs", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = PipelineServiceRestTransport._ListPipelineJobs._get_response( self._host, @@ -3868,7 +4463,31 @@ def __call__( pb_resp = pipeline_service.ListPipelineJobsResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_pipeline_jobs(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + pipeline_service.ListPipelineJobsResponse.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.aiplatform_v1beta1.PipelineServiceClient.list_pipeline_jobs", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PipelineService", + "rpcName": "ListPipelineJobs", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListTrainingPipelines( @@ -3907,7 +4526,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]]] = (), ) -> pipeline_service.ListTrainingPipelinesResponse: r"""Call the list training pipelines method over HTTP. @@ -3918,8 +4537,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: ~.pipeline_service.ListTrainingPipelinesResponse: @@ -3931,6 +4552,7 @@ def __call__( http_options = ( _BasePipelineServiceRestTransport._BaseListTrainingPipelines._get_http_options() ) + request, metadata = self._interceptor.pre_list_training_pipelines( request, metadata ) @@ -3943,6 +4565,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.aiplatform_v1beta1.PipelineServiceClient.ListTrainingPipelines", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PipelineService", + "rpcName": "ListTrainingPipelines", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( PipelineServiceRestTransport._ListTrainingPipelines._get_response( @@ -3965,7 +4614,31 @@ def __call__( pb_resp = pipeline_service.ListTrainingPipelinesResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_training_pipelines(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + pipeline_service.ListTrainingPipelinesResponse.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.aiplatform_v1beta1.PipelineServiceClient.list_training_pipelines", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PipelineService", + "rpcName": "ListTrainingPipelines", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp @property @@ -4125,7 +4798,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]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -4136,8 +4809,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: locations_pb2.Location: Response from GetLocation method. @@ -4146,6 +4821,7 @@ def __call__( http_options = ( _BasePipelineServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = self._interceptor.pre_get_location(request, metadata) transcoded_request = _BasePipelineServiceRestTransport._BaseGetLocation._get_transcoded_request( http_options, request @@ -4156,6 +4832,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.aiplatform_v1beta1.PipelineServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PipelineService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = PipelineServiceRestTransport._GetLocation._get_response( self._host, @@ -4175,6 +4878,27 @@ def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_location(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.aiplatform_v1beta1.PipelineServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PipelineService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4216,7 +4940,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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -4227,8 +4951,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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -4237,6 +4963,7 @@ def __call__( http_options = ( _BasePipelineServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = self._interceptor.pre_list_locations(request, metadata) transcoded_request = _BasePipelineServiceRestTransport._BaseListLocations._get_transcoded_request( http_options, request @@ -4247,6 +4974,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.aiplatform_v1beta1.PipelineServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PipelineService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = PipelineServiceRestTransport._ListLocations._get_response( self._host, @@ -4266,6 +5020,27 @@ def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_list_locations(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.aiplatform_v1beta1.PipelineServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PipelineService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4308,7 +5083,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]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -4319,8 +5094,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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -4329,6 +5106,7 @@ def __call__( http_options = ( _BasePipelineServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_get_iam_policy(request, metadata) transcoded_request = _BasePipelineServiceRestTransport._BaseGetIamPolicy._get_transcoded_request( http_options, request @@ -4343,6 +5121,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.aiplatform_v1beta1.PipelineServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PipelineService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = PipelineServiceRestTransport._GetIamPolicy._get_response( self._host, @@ -4363,6 +5168,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_iam_policy(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.aiplatform_v1beta1.PipelineServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PipelineService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4405,7 +5231,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]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -4416,8 +5242,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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -4426,6 +5254,7 @@ def __call__( http_options = ( _BasePipelineServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_set_iam_policy(request, metadata) transcoded_request = _BasePipelineServiceRestTransport._BaseSetIamPolicy._get_transcoded_request( http_options, request @@ -4440,6 +5269,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.aiplatform_v1beta1.PipelineServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PipelineService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = PipelineServiceRestTransport._SetIamPolicy._get_response( self._host, @@ -4460,6 +5316,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_set_iam_policy(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.aiplatform_v1beta1.PipelineServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PipelineService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4503,7 +5380,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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -4514,8 +5391,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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -4524,6 +5403,7 @@ def __call__( http_options = ( _BasePipelineServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -4540,6 +5420,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.aiplatform_v1beta1.PipelineServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PipelineService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = PipelineServiceRestTransport._TestIamPermissions._get_response( self._host, @@ -4560,6 +5467,27 @@ def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_test_iam_permissions(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.aiplatform_v1beta1.PipelineServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PipelineService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4601,7 +5529,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 cancel operation method over HTTP. @@ -4612,13 +5540,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 = ( _BasePipelineServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = self._interceptor.pre_cancel_operation( request, metadata ) @@ -4631,6 +5562,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.aiplatform_v1beta1.PipelineServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PipelineService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = PipelineServiceRestTransport._CancelOperation._get_response( self._host, @@ -4687,7 +5645,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. @@ -4698,13 +5656,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 = ( _BasePipelineServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = self._interceptor.pre_delete_operation( request, metadata ) @@ -4717,6 +5678,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.aiplatform_v1beta1.PipelineServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PipelineService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = PipelineServiceRestTransport._DeleteOperation._get_response( self._host, @@ -4773,7 +5761,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. @@ -4784,8 +5772,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. @@ -4794,6 +5784,7 @@ def __call__( http_options = ( _BasePipelineServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = self._interceptor.pre_get_operation(request, metadata) transcoded_request = _BasePipelineServiceRestTransport._BaseGetOperation._get_transcoded_request( http_options, request @@ -4804,6 +5795,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.aiplatform_v1beta1.PipelineServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PipelineService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = PipelineServiceRestTransport._GetOperation._get_response( self._host, @@ -4823,6 +5841,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.aiplatform_v1beta1.PipelineServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PipelineService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4864,7 +5903,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. @@ -4875,8 +5914,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. @@ -4885,6 +5926,7 @@ def __call__( http_options = ( _BasePipelineServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = self._interceptor.pre_list_operations(request, metadata) transcoded_request = _BasePipelineServiceRestTransport._BaseListOperations._get_transcoded_request( http_options, request @@ -4895,6 +5937,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.aiplatform_v1beta1.PipelineServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PipelineService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = PipelineServiceRestTransport._ListOperations._get_response( self._host, @@ -4914,6 +5983,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.aiplatform_v1beta1.PipelineServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PipelineService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4955,7 +6045,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 wait operation method over HTTP. @@ -4966,8 +6056,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 WaitOperation method. @@ -4976,6 +6068,7 @@ def __call__( http_options = ( _BasePipelineServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = self._interceptor.pre_wait_operation(request, metadata) transcoded_request = _BasePipelineServiceRestTransport._BaseWaitOperation._get_transcoded_request( http_options, request @@ -4986,6 +6079,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.aiplatform_v1beta1.PipelineServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PipelineService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = PipelineServiceRestTransport._WaitOperation._get_response( self._host, @@ -5005,6 +6125,27 @@ def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = self._interceptor.post_wait_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.aiplatform_v1beta1.PipelineServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PipelineService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1beta1/services/pipeline_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1beta1/services/pipeline_service/transports/rest_asyncio.py index 37676698da..ff2b16cdf6 100644 --- a/google/cloud/aiplatform_v1beta1/services/pipeline_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/pipeline_service/transports/rest_asyncio.py @@ -65,6 +65,18 @@ from .base import DEFAULT_CLIENT_INFO as BASE_DEFAULT_CLIENT_INFO + +import logging + +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__) + try: OptionalRetry = Union[retries.AsyncRetry, gapic_v1.method._MethodDefault, None] except AttributeError: # pragma: NO COVER @@ -189,9 +201,10 @@ async def post_list_training_pipelines(self, response): async def pre_batch_cancel_pipeline_jobs( self, request: pipeline_service.BatchCancelPipelineJobsRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - pipeline_service.BatchCancelPipelineJobsRequest, Sequence[Tuple[str, str]] + pipeline_service.BatchCancelPipelineJobsRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for batch_cancel_pipeline_jobs @@ -214,9 +227,10 @@ async def post_batch_cancel_pipeline_jobs( async def pre_batch_delete_pipeline_jobs( self, request: pipeline_service.BatchDeletePipelineJobsRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - pipeline_service.BatchDeletePipelineJobsRequest, Sequence[Tuple[str, str]] + pipeline_service.BatchDeletePipelineJobsRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for batch_delete_pipeline_jobs @@ -239,8 +253,11 @@ async def post_batch_delete_pipeline_jobs( async def pre_cancel_pipeline_job( self, request: pipeline_service.CancelPipelineJobRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[pipeline_service.CancelPipelineJobRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + pipeline_service.CancelPipelineJobRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for cancel_pipeline_job Override in a subclass to manipulate the request or metadata @@ -251,9 +268,10 @@ async def pre_cancel_pipeline_job( async def pre_cancel_training_pipeline( self, request: pipeline_service.CancelTrainingPipelineRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - pipeline_service.CancelTrainingPipelineRequest, Sequence[Tuple[str, str]] + pipeline_service.CancelTrainingPipelineRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for cancel_training_pipeline @@ -265,8 +283,11 @@ async def pre_cancel_training_pipeline( async def pre_create_pipeline_job( self, request: pipeline_service.CreatePipelineJobRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[pipeline_service.CreatePipelineJobRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + pipeline_service.CreatePipelineJobRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for create_pipeline_job Override in a subclass to manipulate the request or metadata @@ -288,9 +309,10 @@ async def post_create_pipeline_job( async def pre_create_training_pipeline( self, request: pipeline_service.CreateTrainingPipelineRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - pipeline_service.CreateTrainingPipelineRequest, Sequence[Tuple[str, str]] + pipeline_service.CreateTrainingPipelineRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for create_training_pipeline @@ -313,8 +335,11 @@ async def post_create_training_pipeline( async def pre_delete_pipeline_job( self, request: pipeline_service.DeletePipelineJobRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[pipeline_service.DeletePipelineJobRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + pipeline_service.DeletePipelineJobRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for delete_pipeline_job Override in a subclass to manipulate the request or metadata @@ -336,9 +361,10 @@ async def post_delete_pipeline_job( async def pre_delete_training_pipeline( self, request: pipeline_service.DeleteTrainingPipelineRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - pipeline_service.DeleteTrainingPipelineRequest, Sequence[Tuple[str, str]] + pipeline_service.DeleteTrainingPipelineRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for delete_training_pipeline @@ -361,8 +387,10 @@ async def post_delete_training_pipeline( async def pre_get_pipeline_job( self, request: pipeline_service.GetPipelineJobRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[pipeline_service.GetPipelineJobRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + pipeline_service.GetPipelineJobRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_pipeline_job Override in a subclass to manipulate the request or metadata @@ -384,8 +412,11 @@ async def post_get_pipeline_job( async def pre_get_training_pipeline( self, request: pipeline_service.GetTrainingPipelineRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[pipeline_service.GetTrainingPipelineRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + pipeline_service.GetTrainingPipelineRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for get_training_pipeline Override in a subclass to manipulate the request or metadata @@ -407,8 +438,11 @@ async def post_get_training_pipeline( async def pre_list_pipeline_jobs( self, request: pipeline_service.ListPipelineJobsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[pipeline_service.ListPipelineJobsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + pipeline_service.ListPipelineJobsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for list_pipeline_jobs Override in a subclass to manipulate the request or metadata @@ -430,9 +464,10 @@ async def post_list_pipeline_jobs( async def pre_list_training_pipelines( self, request: pipeline_service.ListTrainingPipelinesRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - pipeline_service.ListTrainingPipelinesRequest, Sequence[Tuple[str, str]] + pipeline_service.ListTrainingPipelinesRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for list_training_pipelines @@ -455,8 +490,10 @@ async def post_list_training_pipelines( async def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -478,8 +515,10 @@ async def post_get_location( async def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -501,8 +540,10 @@ async def post_list_locations( async def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -524,8 +565,10 @@ async def post_get_iam_policy( async def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -547,8 +590,11 @@ async def post_set_iam_policy( async def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -570,8 +616,10 @@ async def post_test_iam_permissions( async def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -591,8 +639,10 @@ async def post_cancel_operation(self, response: None) -> None: async 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 @@ -612,8 +662,10 @@ async def post_delete_operation(self, response: None) -> None: async 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 @@ -635,8 +687,10 @@ async def post_get_operation( async 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 @@ -658,8 +712,10 @@ async def post_list_operations( async def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -903,7 +959,7 @@ async 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 batch cancel pipeline jobs method over HTTP. @@ -915,8 +971,10 @@ async def __call__( 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: @@ -929,6 +987,7 @@ async def __call__( http_options = ( _BasePipelineServiceRestTransport._BaseBatchCancelPipelineJobs._get_http_options() ) + request, metadata = await self._interceptor.pre_batch_cancel_pipeline_jobs( request, metadata ) @@ -945,6 +1004,33 @@ async 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.aiplatform_v1beta1.PipelineServiceClient.BatchCancelPipelineJobs", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PipelineService", + "rpcName": "BatchCancelPipelineJobs", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncPipelineServiceRestTransport._BatchCancelPipelineJobs._get_response( self._host, @@ -973,6 +1059,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_batch_cancel_pipeline_jobs(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.PipelineServiceAsyncClient.batch_cancel_pipeline_jobs", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PipelineService", + "rpcName": "BatchCancelPipelineJobs", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _BatchDeletePipelineJobs( @@ -1012,7 +1120,7 @@ async 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 batch delete pipeline jobs method over HTTP. @@ -1024,8 +1132,10 @@ async def __call__( 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: @@ -1038,6 +1148,7 @@ async def __call__( http_options = ( _BasePipelineServiceRestTransport._BaseBatchDeletePipelineJobs._get_http_options() ) + request, metadata = await self._interceptor.pre_batch_delete_pipeline_jobs( request, metadata ) @@ -1054,6 +1165,33 @@ async 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.aiplatform_v1beta1.PipelineServiceClient.BatchDeletePipelineJobs", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PipelineService", + "rpcName": "BatchDeletePipelineJobs", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncPipelineServiceRestTransport._BatchDeletePipelineJobs._get_response( self._host, @@ -1082,6 +1220,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_batch_delete_pipeline_jobs(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.PipelineServiceAsyncClient.batch_delete_pipeline_jobs", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PipelineService", + "rpcName": "BatchDeletePipelineJobs", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _CancelPipelineJob( @@ -1121,7 +1281,7 @@ async 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 cancel pipeline job method over HTTP. @@ -1132,13 +1292,16 @@ async def __call__( 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`. """ http_options = ( _BasePipelineServiceRestTransport._BaseCancelPipelineJob._get_http_options() ) + request, metadata = await self._interceptor.pre_cancel_pipeline_job( request, metadata ) @@ -1155,6 +1318,33 @@ async 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.aiplatform_v1beta1.PipelineServiceClient.CancelPipelineJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PipelineService", + "rpcName": "CancelPipelineJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncPipelineServiceRestTransport._CancelPipelineJob._get_response( self._host, @@ -1214,7 +1404,7 @@ async 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 cancel training pipeline method over HTTP. @@ -1225,13 +1415,16 @@ async def __call__( 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`. """ http_options = ( _BasePipelineServiceRestTransport._BaseCancelTrainingPipeline._get_http_options() ) + request, metadata = await self._interceptor.pre_cancel_training_pipeline( request, metadata ) @@ -1248,6 +1441,33 @@ async 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.aiplatform_v1beta1.PipelineServiceClient.CancelTrainingPipeline", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PipelineService", + "rpcName": "CancelTrainingPipeline", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncPipelineServiceRestTransport._CancelTrainingPipeline._get_response( self._host, @@ -1307,7 +1527,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> gca_pipeline_job.PipelineJob: r"""Call the create pipeline job method over HTTP. @@ -1318,8 +1538,10 @@ async def __call__( 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: ~.gca_pipeline_job.PipelineJob: @@ -1331,6 +1553,7 @@ async def __call__( http_options = ( _BasePipelineServiceRestTransport._BaseCreatePipelineJob._get_http_options() ) + request, metadata = await self._interceptor.pre_create_pipeline_job( request, metadata ) @@ -1347,6 +1570,33 @@ async 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.aiplatform_v1beta1.PipelineServiceClient.CreatePipelineJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PipelineService", + "rpcName": "CreatePipelineJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncPipelineServiceRestTransport._CreatePipelineJob._get_response( self._host, @@ -1375,6 +1625,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_create_pipeline_job(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gca_pipeline_job.PipelineJob.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.PipelineServiceAsyncClient.create_pipeline_job", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PipelineService", + "rpcName": "CreatePipelineJob", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _CreateTrainingPipeline( @@ -1414,7 +1686,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> gca_training_pipeline.TrainingPipeline: r"""Call the create training pipeline method over HTTP. @@ -1425,8 +1697,10 @@ async def __call__( 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: ~.gca_training_pipeline.TrainingPipeline: @@ -1442,6 +1716,7 @@ async def __call__( http_options = ( _BasePipelineServiceRestTransport._BaseCreateTrainingPipeline._get_http_options() ) + request, metadata = await self._interceptor.pre_create_training_pipeline( request, metadata ) @@ -1458,6 +1733,33 @@ async 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.aiplatform_v1beta1.PipelineServiceClient.CreateTrainingPipeline", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PipelineService", + "rpcName": "CreateTrainingPipeline", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncPipelineServiceRestTransport._CreateTrainingPipeline._get_response( self._host, @@ -1486,6 +1788,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_create_training_pipeline(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gca_training_pipeline.TrainingPipeline.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.PipelineServiceAsyncClient.create_training_pipeline", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PipelineService", + "rpcName": "CreateTrainingPipeline", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _DeletePipelineJob( @@ -1524,7 +1850,7 @@ async 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 pipeline job method over HTTP. @@ -1535,8 +1861,10 @@ async def __call__( 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: @@ -1549,6 +1877,7 @@ async def __call__( http_options = ( _BasePipelineServiceRestTransport._BaseDeletePipelineJob._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_pipeline_job( request, metadata ) @@ -1561,6 +1890,33 @@ async 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.aiplatform_v1beta1.PipelineServiceClient.DeletePipelineJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PipelineService", + "rpcName": "DeletePipelineJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncPipelineServiceRestTransport._DeletePipelineJob._get_response( self._host, @@ -1588,6 +1944,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_delete_pipeline_job(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.PipelineServiceAsyncClient.delete_pipeline_job", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PipelineService", + "rpcName": "DeletePipelineJob", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _DeleteTrainingPipeline( @@ -1626,7 +2004,7 @@ async 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 training pipeline method over HTTP. @@ -1637,8 +2015,10 @@ async def __call__( 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: @@ -1651,6 +2031,7 @@ async def __call__( http_options = ( _BasePipelineServiceRestTransport._BaseDeleteTrainingPipeline._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_training_pipeline( request, metadata ) @@ -1663,6 +2044,33 @@ async 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.aiplatform_v1beta1.PipelineServiceClient.DeleteTrainingPipeline", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PipelineService", + "rpcName": "DeleteTrainingPipeline", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncPipelineServiceRestTransport._DeleteTrainingPipeline._get_response( self._host, @@ -1690,6 +2098,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_delete_training_pipeline(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.PipelineServiceAsyncClient.delete_training_pipeline", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PipelineService", + "rpcName": "DeleteTrainingPipeline", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _GetPipelineJob( @@ -1728,7 +2158,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> pipeline_job.PipelineJob: r"""Call the get pipeline job method over HTTP. @@ -1739,8 +2169,10 @@ async def __call__( 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: ~.pipeline_job.PipelineJob: @@ -1752,6 +2184,7 @@ async def __call__( http_options = ( _BasePipelineServiceRestTransport._BaseGetPipelineJob._get_http_options() ) + request, metadata = await self._interceptor.pre_get_pipeline_job( request, metadata ) @@ -1764,6 +2197,33 @@ async 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.aiplatform_v1beta1.PipelineServiceClient.GetPipelineJob", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PipelineService", + "rpcName": "GetPipelineJob", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncPipelineServiceRestTransport._GetPipelineJob._get_response( @@ -1793,6 +2253,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_get_pipeline_job(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = pipeline_job.PipelineJob.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.PipelineServiceAsyncClient.get_pipeline_job", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PipelineService", + "rpcName": "GetPipelineJob", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _GetTrainingPipeline( @@ -1831,7 +2313,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> training_pipeline.TrainingPipeline: r"""Call the get training pipeline method over HTTP. @@ -1842,8 +2324,10 @@ async def __call__( 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: ~.training_pipeline.TrainingPipeline: @@ -1859,6 +2343,7 @@ async def __call__( http_options = ( _BasePipelineServiceRestTransport._BaseGetTrainingPipeline._get_http_options() ) + request, metadata = await self._interceptor.pre_get_training_pipeline( request, metadata ) @@ -1871,6 +2356,33 @@ async 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.aiplatform_v1beta1.PipelineServiceClient.GetTrainingPipeline", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PipelineService", + "rpcName": "GetTrainingPipeline", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncPipelineServiceRestTransport._GetTrainingPipeline._get_response( self._host, @@ -1898,6 +2410,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_get_training_pipeline(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = training_pipeline.TrainingPipeline.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.PipelineServiceAsyncClient.get_training_pipeline", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PipelineService", + "rpcName": "GetTrainingPipeline", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ListPipelineJobs( @@ -1936,7 +2472,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> pipeline_service.ListPipelineJobsResponse: r"""Call the list pipeline jobs method over HTTP. @@ -1947,8 +2483,10 @@ async def __call__( 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: ~.pipeline_service.ListPipelineJobsResponse: @@ -1960,6 +2498,7 @@ async def __call__( http_options = ( _BasePipelineServiceRestTransport._BaseListPipelineJobs._get_http_options() ) + request, metadata = await self._interceptor.pre_list_pipeline_jobs( request, metadata ) @@ -1972,6 +2511,33 @@ async 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.aiplatform_v1beta1.PipelineServiceClient.ListPipelineJobs", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PipelineService", + "rpcName": "ListPipelineJobs", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncPipelineServiceRestTransport._ListPipelineJobs._get_response( @@ -2001,6 +2567,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_list_pipeline_jobs(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + pipeline_service.ListPipelineJobsResponse.to_json(response) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.PipelineServiceAsyncClient.list_pipeline_jobs", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PipelineService", + "rpcName": "ListPipelineJobs", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ListTrainingPipelines( @@ -2039,7 +2629,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> pipeline_service.ListTrainingPipelinesResponse: r"""Call the list training pipelines method over HTTP. @@ -2050,8 +2640,10 @@ async def __call__( 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: ~.pipeline_service.ListTrainingPipelinesResponse: @@ -2063,6 +2655,7 @@ async def __call__( http_options = ( _BasePipelineServiceRestTransport._BaseListTrainingPipelines._get_http_options() ) + request, metadata = await self._interceptor.pre_list_training_pipelines( request, metadata ) @@ -2075,6 +2668,33 @@ async 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.aiplatform_v1beta1.PipelineServiceClient.ListTrainingPipelines", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PipelineService", + "rpcName": "ListTrainingPipelines", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncPipelineServiceRestTransport._ListTrainingPipelines._get_response( self._host, @@ -2102,6 +2722,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_list_training_pipelines(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + pipeline_service.ListTrainingPipelinesResponse.to_json(response) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.PipelineServiceAsyncClient.list_training_pipelines", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PipelineService", + "rpcName": "ListTrainingPipelines", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp @property @@ -2677,6 +3321,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -2893,6 +3541,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -3099,6 +3751,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}", @@ -3315,6 +3971,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, ], "google.longrunning.Operations.ListOperations": [ { @@ -3513,6 +4173,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*}/operations", @@ -3729,6 +4393,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*}/operations", + }, ], "google.longrunning.Operations.WaitOperation": [ { @@ -3927,6 +4595,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "post", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}:wait", @@ -4139,6 +4811,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, ], } @@ -4290,7 +4966,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -4301,8 +4977,10 @@ async def __call__( 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: locations_pb2.Location: Response from GetLocation method. @@ -4311,6 +4989,7 @@ async def __call__( http_options = ( _BasePipelineServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_location( request, metadata ) @@ -4323,6 +5002,33 @@ async 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.aiplatform_v1beta1.PipelineServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PipelineService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncPipelineServiceRestTransport._GetLocation._get_response( @@ -4350,6 +5056,27 @@ async def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_location(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.aiplatform_v1beta1.PipelineServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PipelineService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4392,7 +5119,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -4403,8 +5130,10 @@ async def __call__( 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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -4413,6 +5142,7 @@ async def __call__( http_options = ( _BasePipelineServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_locations( request, metadata ) @@ -4425,6 +5155,33 @@ async 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.aiplatform_v1beta1.PipelineServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PipelineService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncPipelineServiceRestTransport._ListLocations._get_response( @@ -4452,6 +5209,27 @@ async def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_list_locations(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.aiplatform_v1beta1.PipelineServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PipelineService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4495,7 +5273,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -4506,8 +5284,10 @@ async def __call__( 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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -4516,6 +5296,7 @@ async def __call__( http_options = ( _BasePipelineServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_get_iam_policy( request, metadata ) @@ -4532,6 +5313,33 @@ async 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.aiplatform_v1beta1.PipelineServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PipelineService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncPipelineServiceRestTransport._GetIamPolicy._get_response( @@ -4560,6 +5368,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_iam_policy(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.aiplatform_v1beta1.PipelineServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PipelineService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4603,7 +5432,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -4614,8 +5443,10 @@ async def __call__( 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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -4624,6 +5455,7 @@ async def __call__( http_options = ( _BasePipelineServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_set_iam_policy( request, metadata ) @@ -4640,6 +5472,33 @@ async 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.aiplatform_v1beta1.PipelineServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PipelineService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncPipelineServiceRestTransport._SetIamPolicy._get_response( @@ -4668,6 +5527,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_set_iam_policy(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.aiplatform_v1beta1.PipelineServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PipelineService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4711,7 +5591,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -4722,8 +5602,10 @@ async def __call__( 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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -4732,6 +5614,7 @@ async def __call__( http_options = ( _BasePipelineServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = await self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -4748,6 +5631,33 @@ async 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.aiplatform_v1beta1.PipelineServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PipelineService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncPipelineServiceRestTransport._TestIamPermissions._get_response( self._host, @@ -4774,6 +5684,27 @@ async def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_test_iam_permissions(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.aiplatform_v1beta1.PipelineServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PipelineService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4816,7 +5747,7 @@ async 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 cancel operation method over HTTP. @@ -4827,13 +5758,16 @@ async def __call__( 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`. """ http_options = ( _BasePipelineServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_cancel_operation( request, metadata ) @@ -4846,6 +5780,33 @@ async 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.aiplatform_v1beta1.PipelineServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PipelineService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncPipelineServiceRestTransport._CancelOperation._get_response( @@ -4911,7 +5872,7 @@ async 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. @@ -4922,13 +5883,16 @@ async def __call__( 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`. """ http_options = ( _BasePipelineServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_operation( request, metadata ) @@ -4941,6 +5905,33 @@ async 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.aiplatform_v1beta1.PipelineServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PipelineService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncPipelineServiceRestTransport._DeleteOperation._get_response( @@ -5006,7 +5997,7 @@ async 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. @@ -5017,8 +6008,10 @@ async def __call__( 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: Response from GetOperation method. @@ -5027,6 +6020,7 @@ async def __call__( http_options = ( _BasePipelineServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_operation( request, metadata ) @@ -5039,6 +6033,33 @@ async 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.aiplatform_v1beta1.PipelineServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PipelineService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncPipelineServiceRestTransport._GetOperation._get_response( @@ -5066,6 +6087,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1beta1.PipelineServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PipelineService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5108,7 +6150,7 @@ async 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. @@ -5119,8 +6161,10 @@ async def __call__( 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 from ListOperations method. @@ -5129,6 +6173,7 @@ async def __call__( http_options = ( _BasePipelineServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_operations( request, metadata ) @@ -5141,6 +6186,33 @@ async 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.aiplatform_v1beta1.PipelineServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PipelineService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncPipelineServiceRestTransport._ListOperations._get_response( @@ -5168,6 +6240,27 @@ async def __call__( resp = operations_pb2.ListOperationsResponse() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1beta1.PipelineServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PipelineService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5210,7 +6303,7 @@ async 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 wait operation method over HTTP. @@ -5221,8 +6314,10 @@ async def __call__( 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: Response from WaitOperation method. @@ -5231,6 +6326,7 @@ async def __call__( http_options = ( _BasePipelineServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_wait_operation( request, metadata ) @@ -5243,6 +6339,33 @@ async 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.aiplatform_v1beta1.PipelineServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PipelineService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncPipelineServiceRestTransport._WaitOperation._get_response( @@ -5270,6 +6393,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_wait_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.aiplatform_v1beta1.PipelineServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PipelineService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1beta1/services/pipeline_service/transports/rest_base.py b/google/cloud/aiplatform_v1beta1/services/pipeline_service/transports/rest_base.py index 2db1c12f38..f059560ada 100644 --- a/google/cloud/aiplatform_v1beta1/services/pipeline_service/transports/rest_base.py +++ b/google/cloud/aiplatform_v1beta1/services/pipeline_service/transports/rest_base.py @@ -1640,6 +1640,10 @@ def _get_http_options(): "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -1856,6 +1860,10 @@ def _get_http_options(): "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -2081,6 +2089,10 @@ def _get_http_options(): "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}", @@ -2297,6 +2309,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, ] return http_options @@ -2514,6 +2530,10 @@ def _get_http_options(): "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*}/operations", @@ -2730,6 +2750,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*}/operations", + }, ] return http_options @@ -2947,6 +2971,10 @@ def _get_http_options(): "method": "post", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}:wait", @@ -3159,6 +3187,10 @@ def _get_http_options(): "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, ] return http_options diff --git a/google/cloud/aiplatform_v1beta1/services/prediction_service/async_client.py b/google/cloud/aiplatform_v1beta1/services/prediction_service/async_client.py index ca81a2f564..f76710287b 100644 --- a/google/cloud/aiplatform_v1beta1/services/prediction_service/async_client.py +++ b/google/cloud/aiplatform_v1beta1/services/prediction_service/async_client.py @@ -13,6 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging as std_logging from collections import OrderedDict import re from typing import ( @@ -61,6 +62,15 @@ from .transports.grpc_asyncio import PredictionServiceGrpcAsyncIOTransport from .client import PredictionServiceClient +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 PredictionServiceAsyncClient: """A service for online predictions and explanations.""" @@ -278,6 +288,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.aiplatform_v1beta1.PredictionServiceAsyncClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PredictionService", + "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.aiplatform.v1beta1.PredictionService", + "credentialsType": None, + }, + ) + async def predict( self, request: Optional[Union[prediction_service.PredictRequest, dict]] = None, @@ -287,7 +319,7 @@ async def predict( parameters: Optional[struct_pb2.Value] = 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]]] = (), ) -> prediction_service.PredictResponse: r"""Perform an online prediction. @@ -363,8 +395,10 @@ async def sample_predict(): 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.aiplatform_v1beta1.types.PredictResponse: @@ -428,7 +462,7 @@ async def raw_predict( http_body: Optional[httpbody_pb2.HttpBody] = 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]]] = (), ) -> httpbody_pb2.HttpBody: r"""Perform an online prediction with an arbitrary HTTP payload. @@ -509,8 +543,10 @@ async def sample_raw_predict(): 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.httpbody_pb2.HttpBody: @@ -620,7 +656,7 @@ def stream_raw_predict( http_body: Optional[httpbody_pb2.HttpBody] = 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]]] = (), ) -> Awaitable[AsyncIterable[httpbody_pb2.HttpBody]]: r"""Perform a streaming online prediction with an arbitrary HTTP payload. @@ -674,8 +710,10 @@ async def sample_stream_raw_predict(): 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: AsyncIterable[google.api.httpbody_pb2.HttpBody]: @@ -781,7 +819,7 @@ async def direct_predict( *, 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]]] = (), ) -> prediction_service.DirectPredictResponse: r"""Perform an unary online prediction request to a gRPC model server for Vertex first-party products and @@ -820,8 +858,10 @@ async def sample_direct_predict(): 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.aiplatform_v1beta1.types.DirectPredictResponse: @@ -869,7 +909,7 @@ async def direct_raw_predict( *, 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]]] = (), ) -> prediction_service.DirectRawPredictResponse: r"""Perform an unary online prediction request to a gRPC model server for custom containers. @@ -907,8 +947,10 @@ async def sample_direct_raw_predict(): 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.aiplatform_v1beta1.types.DirectRawPredictResponse: @@ -956,7 +998,7 @@ def stream_direct_predict( *, 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]]] = (), ) -> Awaitable[AsyncIterable[prediction_service.StreamDirectPredictResponse]]: r"""Perform a streaming online prediction request to a gRPC model server for Vertex first-party products and @@ -1011,8 +1053,10 @@ def request_generator(): 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: AsyncIterable[google.cloud.aiplatform_v1beta1.types.StreamDirectPredictResponse]: @@ -1049,7 +1093,7 @@ def stream_direct_raw_predict( *, 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]]] = (), ) -> Awaitable[AsyncIterable[prediction_service.StreamDirectRawPredictResponse]]: r"""Perform a streaming online prediction request to a gRPC model server for custom containers. @@ -1109,8 +1153,10 @@ def request_generator(): 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: AsyncIterable[google.cloud.aiplatform_v1beta1.types.StreamDirectRawPredictResponse]: @@ -1147,7 +1193,7 @@ def streaming_predict( *, 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]]] = (), ) -> Awaitable[AsyncIterable[prediction_service.StreamingPredictResponse]]: r"""Perform a streaming online prediction request for Vertex first-party products and frameworks. @@ -1201,8 +1247,10 @@ def request_generator(): 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: AsyncIterable[google.cloud.aiplatform_v1beta1.types.StreamingPredictResponse]: @@ -1239,7 +1287,7 @@ def server_streaming_predict( *, 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]]] = (), ) -> Awaitable[AsyncIterable[prediction_service.StreamingPredictResponse]]: r"""Perform a server-side streaming online prediction request for Vertex LLM streaming. @@ -1283,8 +1331,10 @@ async def sample_server_streaming_predict(): 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: AsyncIterable[google.cloud.aiplatform_v1beta1.types.StreamingPredictResponse]: @@ -1332,7 +1382,7 @@ def streaming_raw_predict( *, 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]]] = (), ) -> Awaitable[AsyncIterable[prediction_service.StreamingRawPredictResponse]]: r"""Perform a streaming online prediction request through gRPC. @@ -1392,8 +1442,10 @@ def request_generator(): 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: AsyncIterable[google.cloud.aiplatform_v1beta1.types.StreamingRawPredictResponse]: @@ -1432,7 +1484,7 @@ async def explain( deployed_model_id: 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]]] = (), ) -> prediction_service.ExplainResponse: r"""Perform an online explanation. @@ -1526,8 +1578,10 @@ async def sample_explain(): 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.aiplatform_v1beta1.types.ExplainResponse: @@ -1593,7 +1647,7 @@ async def count_tokens( instances: Optional[MutableSequence[struct_pb2.Value]] = 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]]] = (), ) -> prediction_service.CountTokensResponse: r"""Perform a token counting. @@ -1647,8 +1701,10 @@ async def sample_count_tokens(): 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.aiplatform_v1beta1.types.CountTokensResponse: @@ -1714,7 +1770,7 @@ async def generate_content( contents: Optional[MutableSequence[content.Content]] = 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]]] = (), ) -> prediction_service.GenerateContentResponse: r"""Generate content with multimodal inputs. @@ -1778,8 +1834,10 @@ async def sample_generate_content(): 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.aiplatform_v1beta1.types.GenerateContentResponse: @@ -1845,7 +1903,7 @@ def stream_generate_content( contents: Optional[MutableSequence[content.Content]] = 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]]] = (), ) -> Awaitable[AsyncIterable[prediction_service.GenerateContentResponse]]: r"""Generate content with multimodal inputs with streaming support. @@ -1911,8 +1969,10 @@ async def sample_stream_generate_content(): 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: AsyncIterable[google.cloud.aiplatform_v1beta1.types.GenerateContentResponse]: @@ -1978,7 +2038,7 @@ def chat_completions( http_body: Optional[httpbody_pb2.HttpBody] = 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]]] = (), ) -> Awaitable[AsyncIterable[httpbody_pb2.HttpBody]]: r"""Exposes an OpenAI-compatible endpoint for chat completions. @@ -2032,8 +2092,10 @@ async def sample_chat_completions(): 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: AsyncIterable[google.api.httpbody_pb2.HttpBody]: @@ -2139,7 +2201,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. @@ -2150,8 +2212,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. @@ -2192,7 +2256,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. @@ -2203,8 +2267,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. @@ -2245,7 +2311,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. @@ -2261,8 +2327,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 """ @@ -2299,7 +2367,7 @@ async def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -2314,8 +2382,10 @@ async def cancel_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 """ @@ -2352,7 +2422,7 @@ async def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -2369,8 +2439,10 @@ async def wait_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. @@ -2411,7 +2483,7 @@ async def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -2424,8 +2496,10 @@ async def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -2530,7 +2604,7 @@ async def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -2544,8 +2618,10 @@ async def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -2650,7 +2726,7 @@ async def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -2665,8 +2741,10 @@ async def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -2710,7 +2788,7 @@ async def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -2721,8 +2799,10 @@ async def get_location( 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: ~.location_pb2.Location: Location object. @@ -2763,7 +2843,7 @@ async def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -2774,8 +2854,10 @@ async def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1beta1/services/prediction_service/client.py b/google/cloud/aiplatform_v1beta1/services/prediction_service/client.py index db9bafc912..91fd76407c 100644 --- a/google/cloud/aiplatform_v1beta1/services/prediction_service/client.py +++ b/google/cloud/aiplatform_v1beta1/services/prediction_service/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 import httpbody_pb2 # type: ignore from google.cloud.aiplatform_v1beta1.types import content from google.cloud.aiplatform_v1beta1.types import explanation @@ -672,6 +682,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( @@ -763,6 +777,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.aiplatform_v1beta1.PredictionServiceClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PredictionService", + "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.aiplatform.v1beta1.PredictionService", + "credentialsType": None, + }, + ) + def predict( self, request: Optional[Union[prediction_service.PredictRequest, dict]] = None, @@ -772,7 +809,7 @@ def predict( parameters: Optional[struct_pb2.Value] = 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]]] = (), ) -> prediction_service.PredictResponse: r"""Perform an online prediction. @@ -848,8 +885,10 @@ def sample_predict(): 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.aiplatform_v1beta1.types.PredictResponse: @@ -912,7 +951,7 @@ def raw_predict( http_body: Optional[httpbody_pb2.HttpBody] = 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]]] = (), ) -> httpbody_pb2.HttpBody: r"""Perform an online prediction with an arbitrary HTTP payload. @@ -993,8 +1032,10 @@ def sample_raw_predict(): 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.httpbody_pb2.HttpBody: @@ -1101,7 +1142,7 @@ def stream_raw_predict( http_body: Optional[httpbody_pb2.HttpBody] = 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]]] = (), ) -> Iterable[httpbody_pb2.HttpBody]: r"""Perform a streaming online prediction with an arbitrary HTTP payload. @@ -1155,8 +1196,10 @@ def sample_stream_raw_predict(): 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: Iterable[google.api.httpbody_pb2.HttpBody]: @@ -1259,7 +1302,7 @@ def direct_predict( *, 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]]] = (), ) -> prediction_service.DirectPredictResponse: r"""Perform an unary online prediction request to a gRPC model server for Vertex first-party products and @@ -1298,8 +1341,10 @@ def sample_direct_predict(): 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.aiplatform_v1beta1.types.DirectPredictResponse: @@ -1345,7 +1390,7 @@ def direct_raw_predict( *, 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]]] = (), ) -> prediction_service.DirectRawPredictResponse: r"""Perform an unary online prediction request to a gRPC model server for custom containers. @@ -1383,8 +1428,10 @@ def sample_direct_raw_predict(): 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.aiplatform_v1beta1.types.DirectRawPredictResponse: @@ -1430,7 +1477,7 @@ def stream_direct_predict( *, 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]]] = (), ) -> Iterable[prediction_service.StreamDirectPredictResponse]: r"""Perform a streaming online prediction request to a gRPC model server for Vertex first-party products and @@ -1485,8 +1532,10 @@ def request_generator(): 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: Iterable[google.cloud.aiplatform_v1beta1.types.StreamDirectPredictResponse]: @@ -1521,7 +1570,7 @@ def stream_direct_raw_predict( *, 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]]] = (), ) -> Iterable[prediction_service.StreamDirectRawPredictResponse]: r"""Perform a streaming online prediction request to a gRPC model server for custom containers. @@ -1581,8 +1630,10 @@ def request_generator(): 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: Iterable[google.cloud.aiplatform_v1beta1.types.StreamDirectRawPredictResponse]: @@ -1617,7 +1668,7 @@ def streaming_predict( *, 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]]] = (), ) -> Iterable[prediction_service.StreamingPredictResponse]: r"""Perform a streaming online prediction request for Vertex first-party products and frameworks. @@ -1671,8 +1722,10 @@ def request_generator(): 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: Iterable[google.cloud.aiplatform_v1beta1.types.StreamingPredictResponse]: @@ -1707,7 +1760,7 @@ def server_streaming_predict( *, 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]]] = (), ) -> Iterable[prediction_service.StreamingPredictResponse]: r"""Perform a server-side streaming online prediction request for Vertex LLM streaming. @@ -1751,8 +1804,10 @@ def sample_server_streaming_predict(): 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: Iterable[google.cloud.aiplatform_v1beta1.types.StreamingPredictResponse]: @@ -1798,7 +1853,7 @@ def streaming_raw_predict( *, 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]]] = (), ) -> Iterable[prediction_service.StreamingRawPredictResponse]: r"""Perform a streaming online prediction request through gRPC. @@ -1858,8 +1913,10 @@ def request_generator(): 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: Iterable[google.cloud.aiplatform_v1beta1.types.StreamingRawPredictResponse]: @@ -1896,7 +1953,7 @@ def explain( deployed_model_id: 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]]] = (), ) -> prediction_service.ExplainResponse: r"""Perform an online explanation. @@ -1990,8 +2047,10 @@ def sample_explain(): 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.aiplatform_v1beta1.types.ExplainResponse: @@ -2056,7 +2115,7 @@ def count_tokens( instances: Optional[MutableSequence[struct_pb2.Value]] = 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]]] = (), ) -> prediction_service.CountTokensResponse: r"""Perform a token counting. @@ -2110,8 +2169,10 @@ def sample_count_tokens(): 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.aiplatform_v1beta1.types.CountTokensResponse: @@ -2174,7 +2235,7 @@ def generate_content( contents: Optional[MutableSequence[content.Content]] = 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]]] = (), ) -> prediction_service.GenerateContentResponse: r"""Generate content with multimodal inputs. @@ -2238,8 +2299,10 @@ def sample_generate_content(): 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.aiplatform_v1beta1.types.GenerateContentResponse: @@ -2302,7 +2365,7 @@ def stream_generate_content( contents: Optional[MutableSequence[content.Content]] = 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]]] = (), ) -> Iterable[prediction_service.GenerateContentResponse]: r"""Generate content with multimodal inputs with streaming support. @@ -2368,8 +2431,10 @@ def sample_stream_generate_content(): 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: Iterable[google.cloud.aiplatform_v1beta1.types.GenerateContentResponse]: @@ -2432,7 +2497,7 @@ def chat_completions( http_body: Optional[httpbody_pb2.HttpBody] = 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]]] = (), ) -> Iterable[httpbody_pb2.HttpBody]: r"""Exposes an OpenAI-compatible endpoint for chat completions. @@ -2486,8 +2551,10 @@ def sample_chat_completions(): 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: Iterable[google.api.httpbody_pb2.HttpBody]: @@ -2603,7 +2670,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. @@ -2614,8 +2681,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. @@ -2656,7 +2725,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. @@ -2667,8 +2736,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. @@ -2709,7 +2780,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. @@ -2725,8 +2796,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 """ @@ -2763,7 +2836,7 @@ def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -2778,8 +2851,10 @@ def cancel_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 """ @@ -2816,7 +2891,7 @@ def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -2833,8 +2908,10 @@ def wait_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. @@ -2875,7 +2952,7 @@ def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -2888,8 +2965,10 @@ def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -2994,7 +3073,7 @@ def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -3008,8 +3087,10 @@ def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -3114,7 +3195,7 @@ def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -3129,8 +3210,10 @@ def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -3172,7 +3255,7 @@ def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -3183,8 +3266,10 @@ def get_location( 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: ~.location_pb2.Location: Location object. @@ -3225,7 +3310,7 @@ def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -3236,8 +3321,10 @@ def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1beta1/services/prediction_service/transports/grpc.py b/google/cloud/aiplatform_v1beta1/services/prediction_service/transports/grpc.py index 2cf6d6801a..14775cfe9e 100644 --- a/google/cloud/aiplatform_v1beta1/services/prediction_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1beta1/services/prediction_service/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 import warnings from typing import Callable, Dict, Optional, Sequence, Tuple, Union @@ -21,8 +24,11 @@ import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from google.api import httpbody_pb2 # type: ignore from google.cloud.aiplatform_v1beta1.types import prediction_service @@ -32,6 +38,81 @@ from google.longrunning import operations_pb2 # type: ignore from .base import PredictionServiceTransport, DEFAULT_CLIENT_INFO +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.aiplatform.v1beta1.PredictionService", + "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.aiplatform.v1beta1.PredictionService", + "rpcName": client_call_details.method, + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class PredictionServiceGrpcTransport(PredictionServiceTransport): """gRPC backend transport for PredictionService. @@ -185,7 +266,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 @@ -261,7 +347,7 @@ def predict( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "predict" not in self._stubs: - self._stubs["predict"] = self.grpc_channel.unary_unary( + self._stubs["predict"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.PredictionService/Predict", request_serializer=prediction_service.PredictRequest.serialize, response_deserializer=prediction_service.PredictResponse.deserialize, @@ -297,7 +383,7 @@ def raw_predict( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "raw_predict" not in self._stubs: - self._stubs["raw_predict"] = self.grpc_channel.unary_unary( + self._stubs["raw_predict"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.PredictionService/RawPredict", request_serializer=prediction_service.RawPredictRequest.serialize, response_deserializer=httpbody_pb2.HttpBody.FromString, @@ -324,7 +410,7 @@ def stream_raw_predict( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "stream_raw_predict" not in self._stubs: - self._stubs["stream_raw_predict"] = self.grpc_channel.unary_stream( + self._stubs["stream_raw_predict"] = self._logged_channel.unary_stream( "/google.cloud.aiplatform.v1beta1.PredictionService/StreamRawPredict", request_serializer=prediction_service.StreamRawPredictRequest.serialize, response_deserializer=httpbody_pb2.HttpBody.FromString, @@ -355,7 +441,7 @@ def direct_predict( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "direct_predict" not in self._stubs: - self._stubs["direct_predict"] = self.grpc_channel.unary_unary( + self._stubs["direct_predict"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.PredictionService/DirectPredict", request_serializer=prediction_service.DirectPredictRequest.serialize, response_deserializer=prediction_service.DirectPredictResponse.deserialize, @@ -385,7 +471,7 @@ def direct_raw_predict( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "direct_raw_predict" not in self._stubs: - self._stubs["direct_raw_predict"] = self.grpc_channel.unary_unary( + self._stubs["direct_raw_predict"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.PredictionService/DirectRawPredict", request_serializer=prediction_service.DirectRawPredictRequest.serialize, response_deserializer=prediction_service.DirectRawPredictResponse.deserialize, @@ -416,7 +502,7 @@ def stream_direct_predict( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "stream_direct_predict" not in self._stubs: - self._stubs["stream_direct_predict"] = self.grpc_channel.stream_stream( + self._stubs["stream_direct_predict"] = self._logged_channel.stream_stream( "/google.cloud.aiplatform.v1beta1.PredictionService/StreamDirectPredict", request_serializer=prediction_service.StreamDirectPredictRequest.serialize, response_deserializer=prediction_service.StreamDirectPredictResponse.deserialize, @@ -446,7 +532,9 @@ def stream_direct_raw_predict( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "stream_direct_raw_predict" not in self._stubs: - self._stubs["stream_direct_raw_predict"] = self.grpc_channel.stream_stream( + self._stubs[ + "stream_direct_raw_predict" + ] = self._logged_channel.stream_stream( "/google.cloud.aiplatform.v1beta1.PredictionService/StreamDirectRawPredict", request_serializer=prediction_service.StreamDirectRawPredictRequest.serialize, response_deserializer=prediction_service.StreamDirectRawPredictResponse.deserialize, @@ -476,7 +564,7 @@ def streaming_predict( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "streaming_predict" not in self._stubs: - self._stubs["streaming_predict"] = self.grpc_channel.stream_stream( + self._stubs["streaming_predict"] = self._logged_channel.stream_stream( "/google.cloud.aiplatform.v1beta1.PredictionService/StreamingPredict", request_serializer=prediction_service.StreamingPredictRequest.serialize, response_deserializer=prediction_service.StreamingPredictResponse.deserialize, @@ -506,7 +594,7 @@ def server_streaming_predict( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "server_streaming_predict" not in self._stubs: - self._stubs["server_streaming_predict"] = self.grpc_channel.unary_stream( + self._stubs["server_streaming_predict"] = self._logged_channel.unary_stream( "/google.cloud.aiplatform.v1beta1.PredictionService/ServerStreamingPredict", request_serializer=prediction_service.StreamingPredictRequest.serialize, response_deserializer=prediction_service.StreamingPredictResponse.deserialize, @@ -536,7 +624,7 @@ def streaming_raw_predict( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "streaming_raw_predict" not in self._stubs: - self._stubs["streaming_raw_predict"] = self.grpc_channel.stream_stream( + self._stubs["streaming_raw_predict"] = self._logged_channel.stream_stream( "/google.cloud.aiplatform.v1beta1.PredictionService/StreamingRawPredict", request_serializer=prediction_service.StreamingRawPredictRequest.serialize, response_deserializer=prediction_service.StreamingRawPredictResponse.deserialize, @@ -574,7 +662,7 @@ def explain( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "explain" not in self._stubs: - self._stubs["explain"] = self.grpc_channel.unary_unary( + self._stubs["explain"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.PredictionService/Explain", request_serializer=prediction_service.ExplainRequest.serialize, response_deserializer=prediction_service.ExplainResponse.deserialize, @@ -602,7 +690,7 @@ def count_tokens( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "count_tokens" not in self._stubs: - self._stubs["count_tokens"] = self.grpc_channel.unary_unary( + self._stubs["count_tokens"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.PredictionService/CountTokens", request_serializer=prediction_service.CountTokensRequest.serialize, response_deserializer=prediction_service.CountTokensResponse.deserialize, @@ -631,7 +719,7 @@ def generate_content( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "generate_content" not in self._stubs: - self._stubs["generate_content"] = self.grpc_channel.unary_unary( + self._stubs["generate_content"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.PredictionService/GenerateContent", request_serializer=prediction_service.GenerateContentRequest.serialize, response_deserializer=prediction_service.GenerateContentResponse.deserialize, @@ -661,7 +749,7 @@ def stream_generate_content( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "stream_generate_content" not in self._stubs: - self._stubs["stream_generate_content"] = self.grpc_channel.unary_stream( + self._stubs["stream_generate_content"] = self._logged_channel.unary_stream( "/google.cloud.aiplatform.v1beta1.PredictionService/StreamGenerateContent", request_serializer=prediction_service.GenerateContentRequest.serialize, response_deserializer=prediction_service.GenerateContentResponse.deserialize, @@ -688,7 +776,7 @@ def chat_completions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "chat_completions" not in self._stubs: - self._stubs["chat_completions"] = self.grpc_channel.unary_stream( + self._stubs["chat_completions"] = self._logged_channel.unary_stream( "/google.cloud.aiplatform.v1beta1.PredictionService/ChatCompletions", request_serializer=prediction_service.ChatCompletionsRequest.serialize, response_deserializer=httpbody_pb2.HttpBody.FromString, @@ -696,7 +784,7 @@ def chat_completions( return self._stubs["chat_completions"] def close(self): - self.grpc_channel.close() + self._logged_channel.close() @property def delete_operation( @@ -708,7 +796,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, @@ -725,7 +813,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -742,7 +830,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -759,7 +847,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, @@ -778,7 +866,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, @@ -797,7 +885,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -814,7 +902,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -839,7 +927,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -865,7 +953,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -894,7 +982,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1beta1/services/prediction_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1beta1/services/prediction_service/transports/grpc_asyncio.py index 54931ed17a..3c78fdead4 100644 --- a/google/cloud/aiplatform_v1beta1/services/prediction_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/prediction_service/transports/grpc_asyncio.py @@ -14,6 +14,9 @@ # limitations under the License. # import inspect +import json +import pickle +import logging as std_logging import warnings from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union @@ -23,8 +26,11 @@ from google.api_core import retry_async as retries from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from grpc.experimental import aio # type: ignore from google.api import httpbody_pb2 # type: ignore @@ -36,6 +42,82 @@ from .base import PredictionServiceTransport, DEFAULT_CLIENT_INFO from .grpc import PredictionServiceGrpcTransport +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.aiplatform.v1beta1.PredictionService", + "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.aiplatform.v1beta1.PredictionService", + "rpcName": str(client_call_details.method), + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class PredictionServiceGrpcAsyncIOTransport(PredictionServiceTransport): """gRPC AsyncIO backend transport for PredictionService. @@ -232,10 +314,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 @@ -270,7 +355,7 @@ def predict( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "predict" not in self._stubs: - self._stubs["predict"] = self.grpc_channel.unary_unary( + self._stubs["predict"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.PredictionService/Predict", request_serializer=prediction_service.PredictRequest.serialize, response_deserializer=prediction_service.PredictResponse.deserialize, @@ -308,7 +393,7 @@ def raw_predict( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "raw_predict" not in self._stubs: - self._stubs["raw_predict"] = self.grpc_channel.unary_unary( + self._stubs["raw_predict"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.PredictionService/RawPredict", request_serializer=prediction_service.RawPredictRequest.serialize, response_deserializer=httpbody_pb2.HttpBody.FromString, @@ -337,7 +422,7 @@ def stream_raw_predict( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "stream_raw_predict" not in self._stubs: - self._stubs["stream_raw_predict"] = self.grpc_channel.unary_stream( + self._stubs["stream_raw_predict"] = self._logged_channel.unary_stream( "/google.cloud.aiplatform.v1beta1.PredictionService/StreamRawPredict", request_serializer=prediction_service.StreamRawPredictRequest.serialize, response_deserializer=httpbody_pb2.HttpBody.FromString, @@ -368,7 +453,7 @@ def direct_predict( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "direct_predict" not in self._stubs: - self._stubs["direct_predict"] = self.grpc_channel.unary_unary( + self._stubs["direct_predict"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.PredictionService/DirectPredict", request_serializer=prediction_service.DirectPredictRequest.serialize, response_deserializer=prediction_service.DirectPredictResponse.deserialize, @@ -398,7 +483,7 @@ def direct_raw_predict( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "direct_raw_predict" not in self._stubs: - self._stubs["direct_raw_predict"] = self.grpc_channel.unary_unary( + self._stubs["direct_raw_predict"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.PredictionService/DirectRawPredict", request_serializer=prediction_service.DirectRawPredictRequest.serialize, response_deserializer=prediction_service.DirectRawPredictResponse.deserialize, @@ -429,7 +514,7 @@ def stream_direct_predict( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "stream_direct_predict" not in self._stubs: - self._stubs["stream_direct_predict"] = self.grpc_channel.stream_stream( + self._stubs["stream_direct_predict"] = self._logged_channel.stream_stream( "/google.cloud.aiplatform.v1beta1.PredictionService/StreamDirectPredict", request_serializer=prediction_service.StreamDirectPredictRequest.serialize, response_deserializer=prediction_service.StreamDirectPredictResponse.deserialize, @@ -459,7 +544,9 @@ def stream_direct_raw_predict( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "stream_direct_raw_predict" not in self._stubs: - self._stubs["stream_direct_raw_predict"] = self.grpc_channel.stream_stream( + self._stubs[ + "stream_direct_raw_predict" + ] = self._logged_channel.stream_stream( "/google.cloud.aiplatform.v1beta1.PredictionService/StreamDirectRawPredict", request_serializer=prediction_service.StreamDirectRawPredictRequest.serialize, response_deserializer=prediction_service.StreamDirectRawPredictResponse.deserialize, @@ -489,7 +576,7 @@ def streaming_predict( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "streaming_predict" not in self._stubs: - self._stubs["streaming_predict"] = self.grpc_channel.stream_stream( + self._stubs["streaming_predict"] = self._logged_channel.stream_stream( "/google.cloud.aiplatform.v1beta1.PredictionService/StreamingPredict", request_serializer=prediction_service.StreamingPredictRequest.serialize, response_deserializer=prediction_service.StreamingPredictResponse.deserialize, @@ -519,7 +606,7 @@ def server_streaming_predict( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "server_streaming_predict" not in self._stubs: - self._stubs["server_streaming_predict"] = self.grpc_channel.unary_stream( + self._stubs["server_streaming_predict"] = self._logged_channel.unary_stream( "/google.cloud.aiplatform.v1beta1.PredictionService/ServerStreamingPredict", request_serializer=prediction_service.StreamingPredictRequest.serialize, response_deserializer=prediction_service.StreamingPredictResponse.deserialize, @@ -549,7 +636,7 @@ def streaming_raw_predict( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "streaming_raw_predict" not in self._stubs: - self._stubs["streaming_raw_predict"] = self.grpc_channel.stream_stream( + self._stubs["streaming_raw_predict"] = self._logged_channel.stream_stream( "/google.cloud.aiplatform.v1beta1.PredictionService/StreamingRawPredict", request_serializer=prediction_service.StreamingRawPredictRequest.serialize, response_deserializer=prediction_service.StreamingRawPredictResponse.deserialize, @@ -588,7 +675,7 @@ def explain( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "explain" not in self._stubs: - self._stubs["explain"] = self.grpc_channel.unary_unary( + self._stubs["explain"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.PredictionService/Explain", request_serializer=prediction_service.ExplainRequest.serialize, response_deserializer=prediction_service.ExplainResponse.deserialize, @@ -617,7 +704,7 @@ def count_tokens( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "count_tokens" not in self._stubs: - self._stubs["count_tokens"] = self.grpc_channel.unary_unary( + self._stubs["count_tokens"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.PredictionService/CountTokens", request_serializer=prediction_service.CountTokensRequest.serialize, response_deserializer=prediction_service.CountTokensResponse.deserialize, @@ -646,7 +733,7 @@ def generate_content( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "generate_content" not in self._stubs: - self._stubs["generate_content"] = self.grpc_channel.unary_unary( + self._stubs["generate_content"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.PredictionService/GenerateContent", request_serializer=prediction_service.GenerateContentRequest.serialize, response_deserializer=prediction_service.GenerateContentResponse.deserialize, @@ -676,7 +763,7 @@ def stream_generate_content( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "stream_generate_content" not in self._stubs: - self._stubs["stream_generate_content"] = self.grpc_channel.unary_stream( + self._stubs["stream_generate_content"] = self._logged_channel.unary_stream( "/google.cloud.aiplatform.v1beta1.PredictionService/StreamGenerateContent", request_serializer=prediction_service.GenerateContentRequest.serialize, response_deserializer=prediction_service.GenerateContentResponse.deserialize, @@ -705,7 +792,7 @@ def chat_completions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "chat_completions" not in self._stubs: - self._stubs["chat_completions"] = self.grpc_channel.unary_stream( + self._stubs["chat_completions"] = self._logged_channel.unary_stream( "/google.cloud.aiplatform.v1beta1.PredictionService/ChatCompletions", request_serializer=prediction_service.ChatCompletionsRequest.serialize, response_deserializer=httpbody_pb2.HttpBody.FromString, @@ -848,7 +935,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: @@ -864,7 +951,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, @@ -881,7 +968,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -898,7 +985,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -915,7 +1002,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, @@ -934,7 +1021,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, @@ -953,7 +1040,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -970,7 +1057,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -995,7 +1082,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -1021,7 +1108,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -1050,7 +1137,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1beta1/services/prediction_service/transports/rest.py b/google/cloud/aiplatform_v1beta1/services/prediction_service/transports/rest.py index cdba14775d..7e28e266de 100644 --- a/google/cloud/aiplatform_v1beta1/services/prediction_service/transports/rest.py +++ b/google/cloud/aiplatform_v1beta1/services/prediction_service/transports/rest.py @@ -13,9 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging +import json # type: ignore from google.auth.transport.requests import AuthorizedSession # type: ignore -import json # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.api_core import exceptions as core_exceptions from google.api_core import retry as retries @@ -47,6 +48,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, @@ -167,8 +176,11 @@ def post_stream_raw_predict(self, response): def pre_chat_completions( self, request: prediction_service.ChatCompletionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[prediction_service.ChatCompletionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + prediction_service.ChatCompletionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for chat_completions Override in a subclass to manipulate the request or metadata @@ -190,8 +202,10 @@ def post_chat_completions( def pre_count_tokens( self, request: prediction_service.CountTokensRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[prediction_service.CountTokensRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + prediction_service.CountTokensRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for count_tokens Override in a subclass to manipulate the request or metadata @@ -213,8 +227,10 @@ def post_count_tokens( def pre_direct_predict( self, request: prediction_service.DirectPredictRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[prediction_service.DirectPredictRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + prediction_service.DirectPredictRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for direct_predict Override in a subclass to manipulate the request or metadata @@ -236,8 +252,11 @@ def post_direct_predict( def pre_direct_raw_predict( self, request: prediction_service.DirectRawPredictRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[prediction_service.DirectRawPredictRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + prediction_service.DirectRawPredictRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for direct_raw_predict Override in a subclass to manipulate the request or metadata @@ -259,8 +278,10 @@ def post_direct_raw_predict( def pre_explain( self, request: prediction_service.ExplainRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[prediction_service.ExplainRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + prediction_service.ExplainRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for explain Override in a subclass to manipulate the request or metadata @@ -282,8 +303,11 @@ def post_explain( def pre_generate_content( self, request: prediction_service.GenerateContentRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[prediction_service.GenerateContentRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + prediction_service.GenerateContentRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for generate_content Override in a subclass to manipulate the request or metadata @@ -305,8 +329,10 @@ def post_generate_content( def pre_predict( self, request: prediction_service.PredictRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[prediction_service.PredictRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + prediction_service.PredictRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for predict Override in a subclass to manipulate the request or metadata @@ -328,8 +354,10 @@ def post_predict( def pre_raw_predict( self, request: prediction_service.RawPredictRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[prediction_service.RawPredictRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + prediction_service.RawPredictRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for raw_predict Override in a subclass to manipulate the request or metadata @@ -351,8 +379,11 @@ def post_raw_predict( def pre_server_streaming_predict( self, request: prediction_service.StreamingPredictRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[prediction_service.StreamingPredictRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + prediction_service.StreamingPredictRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for server_streaming_predict Override in a subclass to manipulate the request or metadata @@ -374,8 +405,11 @@ def post_server_streaming_predict( def pre_stream_generate_content( self, request: prediction_service.GenerateContentRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[prediction_service.GenerateContentRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + prediction_service.GenerateContentRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for stream_generate_content Override in a subclass to manipulate the request or metadata @@ -397,8 +431,11 @@ def post_stream_generate_content( def pre_stream_raw_predict( self, request: prediction_service.StreamRawPredictRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[prediction_service.StreamRawPredictRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + prediction_service.StreamRawPredictRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for stream_raw_predict Override in a subclass to manipulate the request or metadata @@ -420,8 +457,10 @@ def post_stream_raw_predict( def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -443,8 +482,10 @@ def post_get_location( def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -466,8 +507,10 @@ def post_list_locations( def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -487,8 +530,10 @@ def post_get_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -508,8 +553,11 @@ def post_set_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -531,8 +579,10 @@ def post_test_iam_permissions( def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -552,8 +602,10 @@ def post_cancel_operation(self, response: None) -> None: 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 @@ -573,8 +625,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 @@ -596,8 +650,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 @@ -619,8 +675,10 @@ def post_list_operations( def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -764,7 +822,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]]] = (), ) -> rest_streaming.ResponseIterator: r"""Call the chat completions method over HTTP. @@ -774,8 +832,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: ~.httpbody_pb2.HttpBody: @@ -834,6 +894,7 @@ def __call__( http_options = ( _BasePredictionServiceRestTransport._BaseChatCompletions._get_http_options() ) + request, metadata = self._interceptor.pre_chat_completions( request, metadata ) @@ -850,6 +911,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.aiplatform_v1beta1.PredictionServiceClient.ChatCompletions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PredictionService", + "rpcName": "ChatCompletions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = PredictionServiceRestTransport._ChatCompletions._get_response( self._host, @@ -868,6 +956,7 @@ def __call__( # Return the response resp = rest_streaming.ResponseIterator(response, httpbody_pb2.HttpBody) + resp = self._interceptor.post_chat_completions(resp) return resp @@ -907,7 +996,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]]] = (), ) -> prediction_service.CountTokensResponse: r"""Call the count tokens method over HTTP. @@ -918,8 +1007,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: ~.prediction_service.CountTokensResponse: @@ -931,6 +1022,7 @@ def __call__( http_options = ( _BasePredictionServiceRestTransport._BaseCountTokens._get_http_options() ) + request, metadata = self._interceptor.pre_count_tokens(request, metadata) transcoded_request = _BasePredictionServiceRestTransport._BaseCountTokens._get_transcoded_request( http_options, request @@ -945,6 +1037,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.aiplatform_v1beta1.PredictionServiceClient.CountTokens", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PredictionService", + "rpcName": "CountTokens", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = PredictionServiceRestTransport._CountTokens._get_response( self._host, @@ -966,7 +1085,31 @@ def __call__( pb_resp = prediction_service.CountTokensResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_count_tokens(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = prediction_service.CountTokensResponse.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.aiplatform_v1beta1.PredictionServiceClient.count_tokens", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PredictionService", + "rpcName": "CountTokens", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _DirectPredict( @@ -1006,7 +1149,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]]] = (), ) -> prediction_service.DirectPredictResponse: r"""Call the direct predict method over HTTP. @@ -1017,8 +1160,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: ~.prediction_service.DirectPredictResponse: @@ -1030,6 +1175,7 @@ def __call__( http_options = ( _BasePredictionServiceRestTransport._BaseDirectPredict._get_http_options() ) + request, metadata = self._interceptor.pre_direct_predict(request, metadata) transcoded_request = _BasePredictionServiceRestTransport._BaseDirectPredict._get_transcoded_request( http_options, request @@ -1044,6 +1190,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.aiplatform_v1beta1.PredictionServiceClient.DirectPredict", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PredictionService", + "rpcName": "DirectPredict", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = PredictionServiceRestTransport._DirectPredict._get_response( self._host, @@ -1065,7 +1238,31 @@ def __call__( pb_resp = prediction_service.DirectPredictResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_direct_predict(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = prediction_service.DirectPredictResponse.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.aiplatform_v1beta1.PredictionServiceClient.direct_predict", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PredictionService", + "rpcName": "DirectPredict", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _DirectRawPredict( @@ -1105,7 +1302,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]]] = (), ) -> prediction_service.DirectRawPredictResponse: r"""Call the direct raw predict method over HTTP. @@ -1116,8 +1313,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: ~.prediction_service.DirectRawPredictResponse: @@ -1129,6 +1328,7 @@ def __call__( http_options = ( _BasePredictionServiceRestTransport._BaseDirectRawPredict._get_http_options() ) + request, metadata = self._interceptor.pre_direct_raw_predict( request, metadata ) @@ -1145,6 +1345,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.aiplatform_v1beta1.PredictionServiceClient.DirectRawPredict", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PredictionService", + "rpcName": "DirectRawPredict", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = PredictionServiceRestTransport._DirectRawPredict._get_response( self._host, @@ -1166,7 +1393,31 @@ def __call__( pb_resp = prediction_service.DirectRawPredictResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_direct_raw_predict(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + prediction_service.DirectRawPredictResponse.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.aiplatform_v1beta1.PredictionServiceClient.direct_raw_predict", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PredictionService", + "rpcName": "DirectRawPredict", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _Explain( @@ -1205,7 +1456,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]]] = (), ) -> prediction_service.ExplainResponse: r"""Call the explain method over HTTP. @@ -1216,8 +1467,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: ~.prediction_service.ExplainResponse: @@ -1229,6 +1482,7 @@ def __call__( http_options = ( _BasePredictionServiceRestTransport._BaseExplain._get_http_options() ) + request, metadata = self._interceptor.pre_explain(request, metadata) transcoded_request = _BasePredictionServiceRestTransport._BaseExplain._get_transcoded_request( http_options, request @@ -1247,6 +1501,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 = 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.aiplatform_v1beta1.PredictionServiceClient.Explain", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PredictionService", + "rpcName": "Explain", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = PredictionServiceRestTransport._Explain._get_response( self._host, @@ -1268,7 +1549,31 @@ def __call__( pb_resp = prediction_service.ExplainResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_explain(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = prediction_service.ExplainResponse.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.aiplatform_v1beta1.PredictionServiceClient.explain", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PredictionService", + "rpcName": "Explain", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _GenerateContent( @@ -1308,7 +1613,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]]] = (), ) -> prediction_service.GenerateContentResponse: r"""Call the generate content method over HTTP. @@ -1318,8 +1623,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: ~.prediction_service.GenerateContentResponse: @@ -1331,6 +1638,7 @@ def __call__( http_options = ( _BasePredictionServiceRestTransport._BaseGenerateContent._get_http_options() ) + request, metadata = self._interceptor.pre_generate_content( request, metadata ) @@ -1347,6 +1655,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.aiplatform_v1beta1.PredictionServiceClient.GenerateContent", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PredictionService", + "rpcName": "GenerateContent", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = PredictionServiceRestTransport._GenerateContent._get_response( self._host, @@ -1368,7 +1703,31 @@ def __call__( pb_resp = prediction_service.GenerateContentResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_generate_content(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + prediction_service.GenerateContentResponse.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.aiplatform_v1beta1.PredictionServiceClient.generate_content", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PredictionService", + "rpcName": "GenerateContent", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _Predict( @@ -1407,7 +1766,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]]] = (), ) -> prediction_service.PredictResponse: r"""Call the predict method over HTTP. @@ -1418,8 +1777,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: ~.prediction_service.PredictResponse: @@ -1431,6 +1792,7 @@ def __call__( http_options = ( _BasePredictionServiceRestTransport._BasePredict._get_http_options() ) + request, metadata = self._interceptor.pre_predict(request, metadata) transcoded_request = _BasePredictionServiceRestTransport._BasePredict._get_transcoded_request( http_options, request @@ -1449,6 +1811,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 = 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.aiplatform_v1beta1.PredictionServiceClient.Predict", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PredictionService", + "rpcName": "Predict", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = PredictionServiceRestTransport._Predict._get_response( self._host, @@ -1470,7 +1859,31 @@ def __call__( pb_resp = prediction_service.PredictResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_predict(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = prediction_service.PredictResponse.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.aiplatform_v1beta1.PredictionServiceClient.predict", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PredictionService", + "rpcName": "Predict", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _RawPredict( @@ -1509,7 +1922,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]]] = (), ) -> httpbody_pb2.HttpBody: r"""Call the raw predict method over HTTP. @@ -1520,8 +1933,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: ~.httpbody_pb2.HttpBody: @@ -1580,6 +1995,7 @@ def __call__( http_options = ( _BasePredictionServiceRestTransport._BaseRawPredict._get_http_options() ) + request, metadata = self._interceptor.pre_raw_predict(request, metadata) transcoded_request = _BasePredictionServiceRestTransport._BaseRawPredict._get_transcoded_request( http_options, request @@ -1594,6 +2010,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.aiplatform_v1beta1.PredictionServiceClient.RawPredict", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PredictionService", + "rpcName": "RawPredict", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = PredictionServiceRestTransport._RawPredict._get_response( self._host, @@ -1615,7 +2058,29 @@ def __call__( pb_resp = resp json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_raw_predict(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.aiplatform_v1beta1.PredictionServiceClient.raw_predict", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PredictionService", + "rpcName": "RawPredict", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ServerStreamingPredict( @@ -1656,7 +2121,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]]] = (), ) -> rest_streaming.ResponseIterator: r"""Call the server streaming predict method over HTTP. @@ -1672,8 +2137,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: ~.prediction_service.StreamingPredictResponse: @@ -1685,6 +2152,7 @@ def __call__( http_options = ( _BasePredictionServiceRestTransport._BaseServerStreamingPredict._get_http_options() ) + request, metadata = self._interceptor.pre_server_streaming_predict( request, metadata ) @@ -1701,6 +2169,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.aiplatform_v1beta1.PredictionServiceClient.ServerStreamingPredict", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PredictionService", + "rpcName": "ServerStreamingPredict", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( PredictionServiceRestTransport._ServerStreamingPredict._get_response( @@ -1723,6 +2218,7 @@ def __call__( resp = rest_streaming.ResponseIterator( response, prediction_service.StreamingPredictResponse ) + resp = self._interceptor.post_server_streaming_predict(resp) return resp @@ -1739,7 +2235,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]]] = (), ) -> rest_streaming.ResponseIterator: raise NotImplementedError( "Method StreamDirectPredict is not available over REST transport" @@ -1758,7 +2254,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]]] = (), ) -> rest_streaming.ResponseIterator: raise NotImplementedError( "Method StreamDirectRawPredict is not available over REST transport" @@ -1802,7 +2298,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]]] = (), ) -> rest_streaming.ResponseIterator: r"""Call the stream generate content method over HTTP. @@ -1812,8 +2308,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: ~.prediction_service.GenerateContentResponse: @@ -1825,6 +2323,7 @@ def __call__( http_options = ( _BasePredictionServiceRestTransport._BaseStreamGenerateContent._get_http_options() ) + request, metadata = self._interceptor.pre_stream_generate_content( request, metadata ) @@ -1841,6 +2340,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.aiplatform_v1beta1.PredictionServiceClient.StreamGenerateContent", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PredictionService", + "rpcName": "StreamGenerateContent", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( PredictionServiceRestTransport._StreamGenerateContent._get_response( @@ -1863,6 +2389,7 @@ def __call__( resp = rest_streaming.ResponseIterator( response, prediction_service.GenerateContentResponse ) + resp = self._interceptor.post_stream_generate_content(resp) return resp @@ -1879,7 +2406,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]]] = (), ) -> rest_streaming.ResponseIterator: raise NotImplementedError( "Method StreamingPredict is not available over REST transport" @@ -1898,7 +2425,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]]] = (), ) -> rest_streaming.ResponseIterator: raise NotImplementedError( "Method StreamingRawPredict is not available over REST transport" @@ -1942,7 +2469,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]]] = (), ) -> rest_streaming.ResponseIterator: r"""Call the stream raw predict method over HTTP. @@ -1953,8 +2480,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: ~.httpbody_pb2.HttpBody: @@ -2013,6 +2542,7 @@ def __call__( http_options = ( _BasePredictionServiceRestTransport._BaseStreamRawPredict._get_http_options() ) + request, metadata = self._interceptor.pre_stream_raw_predict( request, metadata ) @@ -2029,6 +2559,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.aiplatform_v1beta1.PredictionServiceClient.StreamRawPredict", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PredictionService", + "rpcName": "StreamRawPredict", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = PredictionServiceRestTransport._StreamRawPredict._get_response( self._host, @@ -2047,6 +2604,7 @@ def __call__( # Return the response resp = rest_streaming.ResponseIterator(response, httpbody_pb2.HttpBody) + resp = self._interceptor.post_stream_raw_predict(resp) return resp @@ -2242,7 +2800,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]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -2253,8 +2811,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: locations_pb2.Location: Response from GetLocation method. @@ -2263,6 +2823,7 @@ def __call__( http_options = ( _BasePredictionServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = self._interceptor.pre_get_location(request, metadata) transcoded_request = _BasePredictionServiceRestTransport._BaseGetLocation._get_transcoded_request( http_options, request @@ -2273,6 +2834,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.aiplatform_v1beta1.PredictionServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PredictionService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = PredictionServiceRestTransport._GetLocation._get_response( self._host, @@ -2292,6 +2880,27 @@ def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_location(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.aiplatform_v1beta1.PredictionServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PredictionService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -2334,7 +2943,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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -2345,8 +2954,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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -2355,6 +2966,7 @@ def __call__( http_options = ( _BasePredictionServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = self._interceptor.pre_list_locations(request, metadata) transcoded_request = _BasePredictionServiceRestTransport._BaseListLocations._get_transcoded_request( http_options, request @@ -2365,6 +2977,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.aiplatform_v1beta1.PredictionServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PredictionService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = PredictionServiceRestTransport._ListLocations._get_response( self._host, @@ -2384,6 +3023,27 @@ def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_list_locations(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.aiplatform_v1beta1.PredictionServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PredictionService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -2426,7 +3086,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]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -2437,8 +3097,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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -2447,6 +3109,7 @@ def __call__( http_options = ( _BasePredictionServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_get_iam_policy(request, metadata) transcoded_request = _BasePredictionServiceRestTransport._BaseGetIamPolicy._get_transcoded_request( http_options, request @@ -2461,6 +3124,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.aiplatform_v1beta1.PredictionServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PredictionService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = PredictionServiceRestTransport._GetIamPolicy._get_response( self._host, @@ -2481,6 +3171,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_iam_policy(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.aiplatform_v1beta1.PredictionServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PredictionService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -2523,7 +3234,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]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -2534,8 +3245,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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -2544,6 +3257,7 @@ def __call__( http_options = ( _BasePredictionServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_set_iam_policy(request, metadata) transcoded_request = _BasePredictionServiceRestTransport._BaseSetIamPolicy._get_transcoded_request( http_options, request @@ -2558,6 +3272,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.aiplatform_v1beta1.PredictionServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PredictionService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = PredictionServiceRestTransport._SetIamPolicy._get_response( self._host, @@ -2578,6 +3319,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_set_iam_policy(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.aiplatform_v1beta1.PredictionServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PredictionService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -2621,7 +3383,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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -2632,8 +3394,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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -2642,6 +3406,7 @@ def __call__( http_options = ( _BasePredictionServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -2658,6 +3423,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.aiplatform_v1beta1.PredictionServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PredictionService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = PredictionServiceRestTransport._TestIamPermissions._get_response( self._host, @@ -2678,6 +3470,27 @@ def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_test_iam_permissions(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.aiplatform_v1beta1.PredictionServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PredictionService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -2720,7 +3533,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 cancel operation method over HTTP. @@ -2731,13 +3544,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 = ( _BasePredictionServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = self._interceptor.pre_cancel_operation( request, metadata ) @@ -2750,6 +3566,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.aiplatform_v1beta1.PredictionServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PredictionService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = PredictionServiceRestTransport._CancelOperation._get_response( self._host, @@ -2807,7 +3650,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. @@ -2818,13 +3661,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 = ( _BasePredictionServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = self._interceptor.pre_delete_operation( request, metadata ) @@ -2837,6 +3683,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.aiplatform_v1beta1.PredictionServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PredictionService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = PredictionServiceRestTransport._DeleteOperation._get_response( self._host, @@ -2893,7 +3766,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. @@ -2904,8 +3777,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. @@ -2914,6 +3789,7 @@ def __call__( http_options = ( _BasePredictionServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = self._interceptor.pre_get_operation(request, metadata) transcoded_request = _BasePredictionServiceRestTransport._BaseGetOperation._get_transcoded_request( http_options, request @@ -2924,6 +3800,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.aiplatform_v1beta1.PredictionServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PredictionService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = PredictionServiceRestTransport._GetOperation._get_response( self._host, @@ -2943,6 +3846,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.aiplatform_v1beta1.PredictionServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PredictionService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -2985,7 +3909,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. @@ -2996,8 +3920,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. @@ -3006,6 +3932,7 @@ def __call__( http_options = ( _BasePredictionServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = self._interceptor.pre_list_operations(request, metadata) transcoded_request = _BasePredictionServiceRestTransport._BaseListOperations._get_transcoded_request( http_options, request @@ -3016,6 +3943,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.aiplatform_v1beta1.PredictionServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PredictionService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = PredictionServiceRestTransport._ListOperations._get_response( self._host, @@ -3035,6 +3989,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.aiplatform_v1beta1.PredictionServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PredictionService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3077,7 +4052,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 wait operation method over HTTP. @@ -3088,8 +4063,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 WaitOperation method. @@ -3098,6 +4075,7 @@ def __call__( http_options = ( _BasePredictionServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = self._interceptor.pre_wait_operation(request, metadata) transcoded_request = _BasePredictionServiceRestTransport._BaseWaitOperation._get_transcoded_request( http_options, request @@ -3108,6 +4086,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.aiplatform_v1beta1.PredictionServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PredictionService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = PredictionServiceRestTransport._WaitOperation._get_response( self._host, @@ -3127,6 +4132,27 @@ def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = self._interceptor.post_wait_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.aiplatform_v1beta1.PredictionServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PredictionService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1beta1/services/prediction_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1beta1/services/prediction_service/transports/rest_asyncio.py index 7264b166ab..de906c89e0 100644 --- a/google/cloud/aiplatform_v1beta1/services/prediction_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/prediction_service/transports/rest_asyncio.py @@ -57,6 +57,18 @@ from .base import DEFAULT_CLIENT_INFO as BASE_DEFAULT_CLIENT_INFO + +import logging + +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__) + try: OptionalRetry = Union[retries.AsyncRetry, gapic_v1.method._MethodDefault, None] except AttributeError: # pragma: NO COVER @@ -181,8 +193,11 @@ async def post_stream_raw_predict(self, response): async def pre_chat_completions( self, request: prediction_service.ChatCompletionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[prediction_service.ChatCompletionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + prediction_service.ChatCompletionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for chat_completions Override in a subclass to manipulate the request or metadata @@ -204,8 +219,10 @@ async def post_chat_completions( async def pre_count_tokens( self, request: prediction_service.CountTokensRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[prediction_service.CountTokensRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + prediction_service.CountTokensRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for count_tokens Override in a subclass to manipulate the request or metadata @@ -227,8 +244,10 @@ async def post_count_tokens( async def pre_direct_predict( self, request: prediction_service.DirectPredictRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[prediction_service.DirectPredictRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + prediction_service.DirectPredictRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for direct_predict Override in a subclass to manipulate the request or metadata @@ -250,8 +269,11 @@ async def post_direct_predict( async def pre_direct_raw_predict( self, request: prediction_service.DirectRawPredictRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[prediction_service.DirectRawPredictRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + prediction_service.DirectRawPredictRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for direct_raw_predict Override in a subclass to manipulate the request or metadata @@ -273,8 +295,10 @@ async def post_direct_raw_predict( async def pre_explain( self, request: prediction_service.ExplainRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[prediction_service.ExplainRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + prediction_service.ExplainRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for explain Override in a subclass to manipulate the request or metadata @@ -296,8 +320,11 @@ async def post_explain( async def pre_generate_content( self, request: prediction_service.GenerateContentRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[prediction_service.GenerateContentRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + prediction_service.GenerateContentRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for generate_content Override in a subclass to manipulate the request or metadata @@ -319,8 +346,10 @@ async def post_generate_content( async def pre_predict( self, request: prediction_service.PredictRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[prediction_service.PredictRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + prediction_service.PredictRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for predict Override in a subclass to manipulate the request or metadata @@ -342,8 +371,10 @@ async def post_predict( async def pre_raw_predict( self, request: prediction_service.RawPredictRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[prediction_service.RawPredictRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + prediction_service.RawPredictRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for raw_predict Override in a subclass to manipulate the request or metadata @@ -365,8 +396,11 @@ async def post_raw_predict( async def pre_server_streaming_predict( self, request: prediction_service.StreamingPredictRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[prediction_service.StreamingPredictRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + prediction_service.StreamingPredictRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for server_streaming_predict Override in a subclass to manipulate the request or metadata @@ -388,8 +422,11 @@ async def post_server_streaming_predict( async def pre_stream_generate_content( self, request: prediction_service.GenerateContentRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[prediction_service.GenerateContentRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + prediction_service.GenerateContentRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for stream_generate_content Override in a subclass to manipulate the request or metadata @@ -411,8 +448,11 @@ async def post_stream_generate_content( async def pre_stream_raw_predict( self, request: prediction_service.StreamRawPredictRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[prediction_service.StreamRawPredictRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + prediction_service.StreamRawPredictRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for stream_raw_predict Override in a subclass to manipulate the request or metadata @@ -434,8 +474,10 @@ async def post_stream_raw_predict( async def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -457,8 +499,10 @@ async def post_get_location( async def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -480,8 +524,10 @@ async def post_list_locations( async def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -503,8 +549,10 @@ async def post_get_iam_policy( async def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -526,8 +574,11 @@ async def post_set_iam_policy( async def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -549,8 +600,10 @@ async def post_test_iam_permissions( async def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -570,8 +623,10 @@ async def post_cancel_operation(self, response: None) -> None: async 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 @@ -591,8 +646,10 @@ async def post_delete_operation(self, response: None) -> None: async 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 @@ -614,8 +671,10 @@ async def post_get_operation( async 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 @@ -637,8 +696,10 @@ async def post_list_operations( async def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -891,7 +952,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> rest_streaming_async.AsyncResponseIterator: r"""Call the chat completions method over HTTP. @@ -901,8 +962,10 @@ async def __call__( 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: ~.httpbody_pb2.HttpBody: @@ -961,6 +1024,7 @@ async def __call__( http_options = ( _BasePredictionServiceRestTransport._BaseChatCompletions._get_http_options() ) + request, metadata = await self._interceptor.pre_chat_completions( request, metadata ) @@ -977,6 +1041,33 @@ async 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.aiplatform_v1beta1.PredictionServiceClient.ChatCompletions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PredictionService", + "rpcName": "ChatCompletions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncPredictionServiceRestTransport._ChatCompletions._get_response( self._host, @@ -1043,7 +1134,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> prediction_service.CountTokensResponse: r"""Call the count tokens method over HTTP. @@ -1054,8 +1145,10 @@ async def __call__( 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: ~.prediction_service.CountTokensResponse: @@ -1067,6 +1160,7 @@ async def __call__( http_options = ( _BasePredictionServiceRestTransport._BaseCountTokens._get_http_options() ) + request, metadata = await self._interceptor.pre_count_tokens( request, metadata ) @@ -1083,6 +1177,33 @@ async 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.aiplatform_v1beta1.PredictionServiceClient.CountTokens", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PredictionService", + "rpcName": "CountTokens", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncPredictionServiceRestTransport._CountTokens._get_response( @@ -1113,6 +1234,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_count_tokens(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = prediction_service.CountTokensResponse.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.PredictionServiceAsyncClient.count_tokens", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PredictionService", + "rpcName": "CountTokens", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _DirectPredict( @@ -1152,7 +1297,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> prediction_service.DirectPredictResponse: r"""Call the direct predict method over HTTP. @@ -1163,8 +1308,10 @@ async def __call__( 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: ~.prediction_service.DirectPredictResponse: @@ -1176,6 +1323,7 @@ async def __call__( http_options = ( _BasePredictionServiceRestTransport._BaseDirectPredict._get_http_options() ) + request, metadata = await self._interceptor.pre_direct_predict( request, metadata ) @@ -1192,6 +1340,33 @@ async 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.aiplatform_v1beta1.PredictionServiceClient.DirectPredict", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PredictionService", + "rpcName": "DirectPredict", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncPredictionServiceRestTransport._DirectPredict._get_response( @@ -1222,6 +1397,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_direct_predict(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = prediction_service.DirectPredictResponse.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.PredictionServiceAsyncClient.direct_predict", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PredictionService", + "rpcName": "DirectPredict", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _DirectRawPredict( @@ -1261,7 +1460,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> prediction_service.DirectRawPredictResponse: r"""Call the direct raw predict method over HTTP. @@ -1272,8 +1471,10 @@ async def __call__( 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: ~.prediction_service.DirectRawPredictResponse: @@ -1285,6 +1486,7 @@ async def __call__( http_options = ( _BasePredictionServiceRestTransport._BaseDirectRawPredict._get_http_options() ) + request, metadata = await self._interceptor.pre_direct_raw_predict( request, metadata ) @@ -1301,6 +1503,33 @@ async 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.aiplatform_v1beta1.PredictionServiceClient.DirectRawPredict", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PredictionService", + "rpcName": "DirectRawPredict", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncPredictionServiceRestTransport._DirectRawPredict._get_response( self._host, @@ -1329,6 +1558,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_direct_raw_predict(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + prediction_service.DirectRawPredictResponse.to_json(response) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.PredictionServiceAsyncClient.direct_raw_predict", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PredictionService", + "rpcName": "DirectRawPredict", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _Explain( @@ -1367,7 +1620,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> prediction_service.ExplainResponse: r"""Call the explain method over HTTP. @@ -1378,8 +1631,10 @@ async def __call__( 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: ~.prediction_service.ExplainResponse: @@ -1391,6 +1646,7 @@ async def __call__( http_options = ( _BasePredictionServiceRestTransport._BaseExplain._get_http_options() ) + request, metadata = await self._interceptor.pre_explain(request, metadata) transcoded_request = _BasePredictionServiceRestTransport._BaseExplain._get_transcoded_request( http_options, request @@ -1409,6 +1665,33 @@ async 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 = 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.aiplatform_v1beta1.PredictionServiceClient.Explain", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PredictionService", + "rpcName": "Explain", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncPredictionServiceRestTransport._Explain._get_response( self._host, @@ -1437,6 +1720,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_explain(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = prediction_service.ExplainResponse.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.PredictionServiceAsyncClient.explain", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PredictionService", + "rpcName": "Explain", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _GenerateContent( @@ -1476,7 +1783,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> prediction_service.GenerateContentResponse: r"""Call the generate content method over HTTP. @@ -1486,8 +1793,10 @@ async def __call__( 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: ~.prediction_service.GenerateContentResponse: @@ -1499,6 +1808,7 @@ async def __call__( http_options = ( _BasePredictionServiceRestTransport._BaseGenerateContent._get_http_options() ) + request, metadata = await self._interceptor.pre_generate_content( request, metadata ) @@ -1515,6 +1825,33 @@ async 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.aiplatform_v1beta1.PredictionServiceClient.GenerateContent", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PredictionService", + "rpcName": "GenerateContent", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncPredictionServiceRestTransport._GenerateContent._get_response( self._host, @@ -1543,6 +1880,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_generate_content(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + prediction_service.GenerateContentResponse.to_json(response) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.PredictionServiceAsyncClient.generate_content", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PredictionService", + "rpcName": "GenerateContent", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _Predict( @@ -1581,7 +1942,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> prediction_service.PredictResponse: r"""Call the predict method over HTTP. @@ -1592,8 +1953,10 @@ async def __call__( 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: ~.prediction_service.PredictResponse: @@ -1605,6 +1968,7 @@ async def __call__( http_options = ( _BasePredictionServiceRestTransport._BasePredict._get_http_options() ) + request, metadata = await self._interceptor.pre_predict(request, metadata) transcoded_request = _BasePredictionServiceRestTransport._BasePredict._get_transcoded_request( http_options, request @@ -1623,6 +1987,33 @@ async 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 = 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.aiplatform_v1beta1.PredictionServiceClient.Predict", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PredictionService", + "rpcName": "Predict", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncPredictionServiceRestTransport._Predict._get_response( self._host, @@ -1651,6 +2042,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_predict(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = prediction_service.PredictResponse.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.PredictionServiceAsyncClient.predict", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PredictionService", + "rpcName": "Predict", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _RawPredict( @@ -1690,7 +2105,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> httpbody_pb2.HttpBody: r"""Call the raw predict method over HTTP. @@ -1701,8 +2116,10 @@ async def __call__( 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: ~.httpbody_pb2.HttpBody: @@ -1761,6 +2178,7 @@ async def __call__( http_options = ( _BasePredictionServiceRestTransport._BaseRawPredict._get_http_options() ) + request, metadata = await self._interceptor.pre_raw_predict( request, metadata ) @@ -1777,6 +2195,33 @@ async 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.aiplatform_v1beta1.PredictionServiceClient.RawPredict", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PredictionService", + "rpcName": "RawPredict", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncPredictionServiceRestTransport._RawPredict._get_response( @@ -1807,6 +2252,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_raw_predict(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.PredictionServiceAsyncClient.raw_predict", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PredictionService", + "rpcName": "RawPredict", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ServerStreamingPredict( @@ -1846,7 +2313,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> rest_streaming_async.AsyncResponseIterator: r"""Call the server streaming predict method over HTTP. @@ -1862,8 +2329,10 @@ async def __call__( 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: ~.prediction_service.StreamingPredictResponse: @@ -1875,6 +2344,7 @@ async def __call__( http_options = ( _BasePredictionServiceRestTransport._BaseServerStreamingPredict._get_http_options() ) + request, metadata = await self._interceptor.pre_server_streaming_predict( request, metadata ) @@ -1891,6 +2361,33 @@ async 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.aiplatform_v1beta1.PredictionServiceClient.ServerStreamingPredict", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PredictionService", + "rpcName": "ServerStreamingPredict", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncPredictionServiceRestTransport._ServerStreamingPredict._get_response( self._host, @@ -1933,7 +2430,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> rest_streaming_async.AsyncResponseIterator: raise NotImplementedError( "Method StreamDirectPredict is not available over REST transport" @@ -1952,7 +2449,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> rest_streaming_async.AsyncResponseIterator: raise NotImplementedError( "Method StreamDirectRawPredict is not available over REST transport" @@ -1995,7 +2492,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> rest_streaming_async.AsyncResponseIterator: r"""Call the stream generate content method over HTTP. @@ -2005,8 +2502,10 @@ async def __call__( 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: ~.prediction_service.GenerateContentResponse: @@ -2018,6 +2517,7 @@ async def __call__( http_options = ( _BasePredictionServiceRestTransport._BaseStreamGenerateContent._get_http_options() ) + request, metadata = await self._interceptor.pre_stream_generate_content( request, metadata ) @@ -2034,6 +2534,33 @@ async 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.aiplatform_v1beta1.PredictionServiceClient.StreamGenerateContent", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PredictionService", + "rpcName": "StreamGenerateContent", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncPredictionServiceRestTransport._StreamGenerateContent._get_response( self._host, @@ -2076,7 +2603,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> rest_streaming_async.AsyncResponseIterator: raise NotImplementedError( "Method StreamingPredict is not available over REST transport" @@ -2095,7 +2622,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> rest_streaming_async.AsyncResponseIterator: raise NotImplementedError( "Method StreamingRawPredict is not available over REST transport" @@ -2138,7 +2665,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> rest_streaming_async.AsyncResponseIterator: r"""Call the stream raw predict method over HTTP. @@ -2149,8 +2676,10 @@ async def __call__( 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: ~.httpbody_pb2.HttpBody: @@ -2209,6 +2738,7 @@ async def __call__( http_options = ( _BasePredictionServiceRestTransport._BaseStreamRawPredict._get_http_options() ) + request, metadata = await self._interceptor.pre_stream_raw_predict( request, metadata ) @@ -2225,6 +2755,33 @@ async 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.aiplatform_v1beta1.PredictionServiceClient.StreamRawPredict", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PredictionService", + "rpcName": "StreamRawPredict", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncPredictionServiceRestTransport._StreamRawPredict._get_response( self._host, @@ -2417,7 +2974,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -2428,8 +2985,10 @@ async def __call__( 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: locations_pb2.Location: Response from GetLocation method. @@ -2438,6 +2997,7 @@ async def __call__( http_options = ( _BasePredictionServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_location( request, metadata ) @@ -2450,6 +3010,33 @@ async 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.aiplatform_v1beta1.PredictionServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PredictionService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncPredictionServiceRestTransport._GetLocation._get_response( @@ -2477,6 +3064,27 @@ async def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_location(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.aiplatform_v1beta1.PredictionServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PredictionService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -2519,7 +3127,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -2530,8 +3138,10 @@ async def __call__( 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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -2540,6 +3150,7 @@ async def __call__( http_options = ( _BasePredictionServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_locations( request, metadata ) @@ -2552,6 +3163,33 @@ async 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.aiplatform_v1beta1.PredictionServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PredictionService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncPredictionServiceRestTransport._ListLocations._get_response( @@ -2579,6 +3217,27 @@ async def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_list_locations(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.aiplatform_v1beta1.PredictionServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PredictionService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -2622,7 +3281,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -2633,8 +3292,10 @@ async def __call__( 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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -2643,6 +3304,7 @@ async def __call__( http_options = ( _BasePredictionServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_get_iam_policy( request, metadata ) @@ -2659,6 +3321,33 @@ async 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.aiplatform_v1beta1.PredictionServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PredictionService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncPredictionServiceRestTransport._GetIamPolicy._get_response( @@ -2687,6 +3376,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_iam_policy(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.aiplatform_v1beta1.PredictionServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PredictionService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -2730,7 +3440,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -2741,8 +3451,10 @@ async def __call__( 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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -2751,6 +3463,7 @@ async def __call__( http_options = ( _BasePredictionServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_set_iam_policy( request, metadata ) @@ -2767,6 +3480,33 @@ async 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.aiplatform_v1beta1.PredictionServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PredictionService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncPredictionServiceRestTransport._SetIamPolicy._get_response( @@ -2795,6 +3535,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_set_iam_policy(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.aiplatform_v1beta1.PredictionServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PredictionService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -2838,7 +3599,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -2849,8 +3610,10 @@ async def __call__( 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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -2859,6 +3622,7 @@ async def __call__( http_options = ( _BasePredictionServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = await self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -2875,6 +3639,33 @@ async 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.aiplatform_v1beta1.PredictionServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PredictionService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncPredictionServiceRestTransport._TestIamPermissions._get_response( self._host, @@ -2901,6 +3692,27 @@ async def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_test_iam_permissions(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.aiplatform_v1beta1.PredictionServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PredictionService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -2943,7 +3755,7 @@ async 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 cancel operation method over HTTP. @@ -2954,13 +3766,16 @@ async def __call__( 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`. """ http_options = ( _BasePredictionServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_cancel_operation( request, metadata ) @@ -2973,6 +3788,33 @@ async 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.aiplatform_v1beta1.PredictionServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PredictionService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncPredictionServiceRestTransport._CancelOperation._get_response( self._host, @@ -3036,7 +3878,7 @@ async 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. @@ -3047,13 +3889,16 @@ async def __call__( 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`. """ http_options = ( _BasePredictionServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_operation( request, metadata ) @@ -3066,6 +3911,33 @@ async 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.aiplatform_v1beta1.PredictionServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PredictionService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncPredictionServiceRestTransport._DeleteOperation._get_response( self._host, @@ -3129,7 +4001,7 @@ async 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. @@ -3140,8 +4012,10 @@ async def __call__( 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: Response from GetOperation method. @@ -3150,6 +4024,7 @@ async def __call__( http_options = ( _BasePredictionServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_operation( request, metadata ) @@ -3162,6 +4037,33 @@ async 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.aiplatform_v1beta1.PredictionServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PredictionService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncPredictionServiceRestTransport._GetOperation._get_response( @@ -3189,6 +4091,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1beta1.PredictionServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PredictionService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3231,7 +4154,7 @@ async 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. @@ -3242,8 +4165,10 @@ async def __call__( 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 from ListOperations method. @@ -3252,6 +4177,7 @@ async def __call__( http_options = ( _BasePredictionServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_operations( request, metadata ) @@ -3264,6 +4190,33 @@ async 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.aiplatform_v1beta1.PredictionServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PredictionService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncPredictionServiceRestTransport._ListOperations._get_response( @@ -3291,6 +4244,27 @@ async def __call__( resp = operations_pb2.ListOperationsResponse() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1beta1.PredictionServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PredictionService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3333,7 +4307,7 @@ async 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 wait operation method over HTTP. @@ -3344,8 +4318,10 @@ async def __call__( 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: Response from WaitOperation method. @@ -3354,6 +4330,7 @@ async def __call__( http_options = ( _BasePredictionServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_wait_operation( request, metadata ) @@ -3366,6 +4343,33 @@ async 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.aiplatform_v1beta1.PredictionServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PredictionService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncPredictionServiceRestTransport._WaitOperation._get_response( @@ -3393,6 +4397,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_wait_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.aiplatform_v1beta1.PredictionServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.PredictionService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1beta1/services/prediction_service/transports/rest_base.py b/google/cloud/aiplatform_v1beta1/services/prediction_service/transports/rest_base.py index 12d5e4db6a..291c773753 100644 --- a/google/cloud/aiplatform_v1beta1/services/prediction_service/transports/rest_base.py +++ b/google/cloud/aiplatform_v1beta1/services/prediction_service/transports/rest_base.py @@ -1718,6 +1718,10 @@ def _get_http_options(): "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -1934,6 +1938,10 @@ def _get_http_options(): "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -2159,6 +2167,10 @@ def _get_http_options(): "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}", @@ -2375,6 +2387,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, ] return http_options @@ -2592,6 +2608,10 @@ def _get_http_options(): "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*}/operations", @@ -2808,6 +2828,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*}/operations", + }, ] return http_options @@ -3025,6 +3049,10 @@ def _get_http_options(): "method": "post", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}:wait", @@ -3237,6 +3265,10 @@ def _get_http_options(): "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, ] return http_options diff --git a/google/cloud/aiplatform_v1beta1/services/reasoning_engine_execution_service/async_client.py b/google/cloud/aiplatform_v1beta1/services/reasoning_engine_execution_service/async_client.py index 7035d57750..860b57187f 100644 --- a/google/cloud/aiplatform_v1beta1/services/reasoning_engine_execution_service/async_client.py +++ b/google/cloud/aiplatform_v1beta1/services/reasoning_engine_execution_service/async_client.py @@ -13,6 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging as std_logging from collections import OrderedDict import re from typing import ( @@ -60,6 +61,15 @@ from .transports.grpc_asyncio import ReasoningEngineExecutionServiceGrpcAsyncIOTransport from .client import ReasoningEngineExecutionServiceClient +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 ReasoningEngineExecutionServiceAsyncClient: """A service for executing queries on Reasoning Engine.""" @@ -281,6 +291,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.aiplatform_v1beta1.ReasoningEngineExecutionServiceAsyncClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineExecutionService", + "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.aiplatform.v1beta1.ReasoningEngineExecutionService", + "credentialsType": None, + }, + ) + async def query_reasoning_engine( self, request: Optional[ @@ -289,7 +321,7 @@ async def query_reasoning_engine( *, 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]]] = (), ) -> reasoning_engine_execution_service.QueryReasoningEngineResponse: r"""Queries using a reasoning engine. @@ -326,8 +358,10 @@ async def sample_query_reasoning_engine(): 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.aiplatform_v1beta1.types.QueryReasoningEngineResponse: @@ -382,7 +416,7 @@ def stream_query_reasoning_engine( *, 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]]] = (), ) -> Awaitable[AsyncIterable[httpbody_pb2.HttpBody]]: r"""Streams queries using a reasoning engine. @@ -420,8 +454,10 @@ async def sample_stream_query_reasoning_engine(): 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: AsyncIterable[google.api.httpbody_pb2.HttpBody]: @@ -518,7 +554,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. @@ -529,8 +565,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. @@ -571,7 +609,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. @@ -582,8 +620,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. @@ -624,7 +664,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. @@ -640,8 +680,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 """ @@ -678,7 +720,7 @@ async def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -693,8 +735,10 @@ async def cancel_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 """ @@ -731,7 +775,7 @@ async def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -748,8 +792,10 @@ async def wait_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. @@ -790,7 +836,7 @@ async def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -803,8 +849,10 @@ async def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -909,7 +957,7 @@ async def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -923,8 +971,10 @@ async def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -1029,7 +1079,7 @@ async def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -1044,8 +1094,10 @@ async def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -1089,7 +1141,7 @@ async def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -1100,8 +1152,10 @@ async def get_location( 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: ~.location_pb2.Location: Location object. @@ -1142,7 +1196,7 @@ async def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -1153,8 +1207,10 @@ async def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1beta1/services/reasoning_engine_execution_service/client.py b/google/cloud/aiplatform_v1beta1/services/reasoning_engine_execution_service/client.py index 82f56313f7..04080fac7c 100644 --- a/google/cloud/aiplatform_v1beta1/services/reasoning_engine_execution_service/client.py +++ b/google/cloud/aiplatform_v1beta1/services/reasoning_engine_execution_service/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 ( @@ -49,6 +50,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 import httpbody_pb2 # type: ignore from google.cloud.aiplatform_v1beta1.types import reasoning_engine_execution_service from google.cloud.location import locations_pb2 # type: ignore @@ -619,6 +629,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( @@ -714,6 +728,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.aiplatform_v1beta1.ReasoningEngineExecutionServiceClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineExecutionService", + "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.aiplatform.v1beta1.ReasoningEngineExecutionService", + "credentialsType": None, + }, + ) + def query_reasoning_engine( self, request: Optional[ @@ -722,7 +759,7 @@ def query_reasoning_engine( *, 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]]] = (), ) -> reasoning_engine_execution_service.QueryReasoningEngineResponse: r"""Queries using a reasoning engine. @@ -759,8 +796,10 @@ def sample_query_reasoning_engine(): 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.aiplatform_v1beta1.types.QueryReasoningEngineResponse: @@ -813,7 +852,7 @@ def stream_query_reasoning_engine( *, 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]]] = (), ) -> Iterable[httpbody_pb2.HttpBody]: r"""Streams queries using a reasoning engine. @@ -851,8 +890,10 @@ def sample_stream_query_reasoning_engine(): 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: Iterable[google.api.httpbody_pb2.HttpBody]: @@ -962,7 +1003,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. @@ -973,8 +1014,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. @@ -1015,7 +1058,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. @@ -1026,8 +1069,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. @@ -1068,7 +1113,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. @@ -1084,8 +1129,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 """ @@ -1122,7 +1169,7 @@ def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -1137,8 +1184,10 @@ def cancel_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 """ @@ -1175,7 +1224,7 @@ def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -1192,8 +1241,10 @@ def wait_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. @@ -1234,7 +1285,7 @@ def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -1247,8 +1298,10 @@ def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -1353,7 +1406,7 @@ def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -1367,8 +1420,10 @@ def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -1473,7 +1528,7 @@ def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -1488,8 +1543,10 @@ def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -1531,7 +1588,7 @@ def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -1542,8 +1599,10 @@ def get_location( 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: ~.location_pb2.Location: Location object. @@ -1584,7 +1643,7 @@ def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -1595,8 +1654,10 @@ def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1beta1/services/reasoning_engine_execution_service/transports/grpc.py b/google/cloud/aiplatform_v1beta1/services/reasoning_engine_execution_service/transports/grpc.py index a090ad51fd..a31aeaf3b4 100644 --- a/google/cloud/aiplatform_v1beta1/services/reasoning_engine_execution_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1beta1/services/reasoning_engine_execution_service/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 import warnings from typing import Callable, Dict, Optional, Sequence, Tuple, Union @@ -21,8 +24,11 @@ import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from google.api import httpbody_pb2 # type: ignore from google.cloud.aiplatform_v1beta1.types import reasoning_engine_execution_service @@ -32,6 +38,81 @@ from google.longrunning import operations_pb2 # type: ignore from .base import ReasoningEngineExecutionServiceTransport, DEFAULT_CLIENT_INFO +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.aiplatform.v1beta1.ReasoningEngineExecutionService", + "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.aiplatform.v1beta1.ReasoningEngineExecutionService", + "rpcName": client_call_details.method, + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class ReasoningEngineExecutionServiceGrpcTransport( ReasoningEngineExecutionServiceTransport @@ -187,7 +268,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 @@ -264,7 +350,7 @@ def query_reasoning_engine( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "query_reasoning_engine" not in self._stubs: - self._stubs["query_reasoning_engine"] = self.grpc_channel.unary_unary( + self._stubs["query_reasoning_engine"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.ReasoningEngineExecutionService/QueryReasoningEngine", request_serializer=reasoning_engine_execution_service.QueryReasoningEngineRequest.serialize, response_deserializer=reasoning_engine_execution_service.QueryReasoningEngineResponse.deserialize, @@ -295,7 +381,7 @@ def stream_query_reasoning_engine( if "stream_query_reasoning_engine" not in self._stubs: self._stubs[ "stream_query_reasoning_engine" - ] = self.grpc_channel.unary_stream( + ] = self._logged_channel.unary_stream( "/google.cloud.aiplatform.v1beta1.ReasoningEngineExecutionService/StreamQueryReasoningEngine", request_serializer=reasoning_engine_execution_service.StreamQueryReasoningEngineRequest.serialize, response_deserializer=httpbody_pb2.HttpBody.FromString, @@ -303,7 +389,7 @@ def stream_query_reasoning_engine( return self._stubs["stream_query_reasoning_engine"] def close(self): - self.grpc_channel.close() + self._logged_channel.close() @property def delete_operation( @@ -315,7 +401,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, @@ -332,7 +418,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -349,7 +435,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -366,7 +452,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, @@ -385,7 +471,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, @@ -404,7 +490,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -421,7 +507,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -446,7 +532,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -472,7 +558,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -501,7 +587,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1beta1/services/reasoning_engine_execution_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1beta1/services/reasoning_engine_execution_service/transports/grpc_asyncio.py index 4f42008640..e950bd9c77 100644 --- a/google/cloud/aiplatform_v1beta1/services/reasoning_engine_execution_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/reasoning_engine_execution_service/transports/grpc_asyncio.py @@ -14,6 +14,9 @@ # limitations under the License. # import inspect +import json +import pickle +import logging as std_logging import warnings from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union @@ -23,8 +26,11 @@ from google.api_core import retry_async as retries from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from grpc.experimental import aio # type: ignore from google.api import httpbody_pb2 # type: ignore @@ -36,6 +42,82 @@ from .base import ReasoningEngineExecutionServiceTransport, DEFAULT_CLIENT_INFO from .grpc import ReasoningEngineExecutionServiceGrpcTransport +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.aiplatform.v1beta1.ReasoningEngineExecutionService", + "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.aiplatform.v1beta1.ReasoningEngineExecutionService", + "rpcName": str(client_call_details.method), + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class ReasoningEngineExecutionServiceGrpcAsyncIOTransport( ReasoningEngineExecutionServiceTransport @@ -234,10 +316,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 @@ -272,7 +357,7 @@ def query_reasoning_engine( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "query_reasoning_engine" not in self._stubs: - self._stubs["query_reasoning_engine"] = self.grpc_channel.unary_unary( + self._stubs["query_reasoning_engine"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.ReasoningEngineExecutionService/QueryReasoningEngine", request_serializer=reasoning_engine_execution_service.QueryReasoningEngineRequest.serialize, response_deserializer=reasoning_engine_execution_service.QueryReasoningEngineResponse.deserialize, @@ -303,7 +388,7 @@ def stream_query_reasoning_engine( if "stream_query_reasoning_engine" not in self._stubs: self._stubs[ "stream_query_reasoning_engine" - ] = self.grpc_channel.unary_stream( + ] = self._logged_channel.unary_stream( "/google.cloud.aiplatform.v1beta1.ReasoningEngineExecutionService/StreamQueryReasoningEngine", request_serializer=reasoning_engine_execution_service.StreamQueryReasoningEngineRequest.serialize, response_deserializer=httpbody_pb2.HttpBody.FromString, @@ -381,7 +466,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: @@ -397,7 +482,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, @@ -414,7 +499,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -431,7 +516,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -448,7 +533,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, @@ -467,7 +552,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, @@ -486,7 +571,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -503,7 +588,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -528,7 +613,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -554,7 +639,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -583,7 +668,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1beta1/services/reasoning_engine_execution_service/transports/rest.py b/google/cloud/aiplatform_v1beta1/services/reasoning_engine_execution_service/transports/rest.py index 15bcce1fe3..a29e58b162 100644 --- a/google/cloud/aiplatform_v1beta1/services/reasoning_engine_execution_service/transports/rest.py +++ b/google/cloud/aiplatform_v1beta1/services/reasoning_engine_execution_service/transports/rest.py @@ -13,9 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging +import json # type: ignore from google.auth.transport.requests import AuthorizedSession # type: ignore -import json # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.api_core import exceptions as core_exceptions from google.api_core import retry as retries @@ -47,6 +48,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, @@ -95,10 +104,10 @@ def post_stream_query_reasoning_engine(self, response): def pre_query_reasoning_engine( self, request: reasoning_engine_execution_service.QueryReasoningEngineRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ reasoning_engine_execution_service.QueryReasoningEngineRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for query_reasoning_engine @@ -121,10 +130,10 @@ def post_query_reasoning_engine( def pre_stream_query_reasoning_engine( self, request: reasoning_engine_execution_service.StreamQueryReasoningEngineRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ reasoning_engine_execution_service.StreamQueryReasoningEngineRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for stream_query_reasoning_engine @@ -147,8 +156,10 @@ def post_stream_query_reasoning_engine( def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -170,8 +181,10 @@ def post_get_location( def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -193,8 +206,10 @@ def post_list_locations( def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -214,8 +229,10 @@ def post_get_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -235,8 +252,11 @@ def post_set_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -258,8 +278,10 @@ def post_test_iam_permissions( def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -279,8 +301,10 @@ def post_cancel_operation(self, response: None) -> None: 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 @@ -300,8 +324,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 @@ -323,8 +349,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 @@ -346,8 +374,10 @@ def post_list_operations( def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -496,7 +526,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]]] = (), ) -> reasoning_engine_execution_service.QueryReasoningEngineResponse: r"""Call the query reasoning engine method over HTTP. @@ -507,8 +537,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: ~.reasoning_engine_execution_service.QueryReasoningEngineResponse: @@ -520,6 +552,7 @@ def __call__( http_options = ( _BaseReasoningEngineExecutionServiceRestTransport._BaseQueryReasoningEngine._get_http_options() ) + request, metadata = self._interceptor.pre_query_reasoning_engine( request, metadata ) @@ -536,6 +569,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.aiplatform_v1beta1.ReasoningEngineExecutionServiceClient.QueryReasoningEngine", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineExecutionService", + "rpcName": "QueryReasoningEngine", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ReasoningEngineExecutionServiceRestTransport._QueryReasoningEngine._get_response( self._host, @@ -559,7 +619,31 @@ def __call__( ) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_query_reasoning_engine(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = reasoning_engine_execution_service.QueryReasoningEngineResponse.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.aiplatform_v1beta1.ReasoningEngineExecutionServiceClient.query_reasoning_engine", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineExecutionService", + "rpcName": "QueryReasoningEngine", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _StreamQueryReasoningEngine( @@ -602,7 +686,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]]] = (), ) -> rest_streaming.ResponseIterator: r"""Call the stream query reasoning engine method over HTTP. @@ -614,8 +698,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: ~.httpbody_pb2.HttpBody: @@ -674,6 +760,7 @@ def __call__( http_options = ( _BaseReasoningEngineExecutionServiceRestTransport._BaseStreamQueryReasoningEngine._get_http_options() ) + request, metadata = self._interceptor.pre_stream_query_reasoning_engine( request, metadata ) @@ -690,6 +777,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.aiplatform_v1beta1.ReasoningEngineExecutionServiceClient.StreamQueryReasoningEngine", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineExecutionService", + "rpcName": "StreamQueryReasoningEngine", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ReasoningEngineExecutionServiceRestTransport._StreamQueryReasoningEngine._get_response( self._host, @@ -708,6 +822,7 @@ def __call__( # Return the response resp = rest_streaming.ResponseIterator(response, httpbody_pb2.HttpBody) + resp = self._interceptor.post_stream_query_reasoning_engine(resp) return resp @@ -773,7 +888,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]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -784,8 +899,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: locations_pb2.Location: Response from GetLocation method. @@ -794,6 +911,7 @@ def __call__( http_options = ( _BaseReasoningEngineExecutionServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = self._interceptor.pre_get_location(request, metadata) transcoded_request = _BaseReasoningEngineExecutionServiceRestTransport._BaseGetLocation._get_transcoded_request( http_options, request @@ -804,6 +922,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.aiplatform_v1beta1.ReasoningEngineExecutionServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineExecutionService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( ReasoningEngineExecutionServiceRestTransport._GetLocation._get_response( @@ -825,6 +970,27 @@ def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_location(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.aiplatform_v1beta1.ReasoningEngineExecutionServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineExecutionService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -867,7 +1033,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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -878,8 +1044,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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -888,6 +1056,7 @@ def __call__( http_options = ( _BaseReasoningEngineExecutionServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = self._interceptor.pre_list_locations(request, metadata) transcoded_request = _BaseReasoningEngineExecutionServiceRestTransport._BaseListLocations._get_transcoded_request( http_options, request @@ -898,6 +1067,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.aiplatform_v1beta1.ReasoningEngineExecutionServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineExecutionService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ReasoningEngineExecutionServiceRestTransport._ListLocations._get_response( self._host, @@ -917,6 +1113,27 @@ def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_list_locations(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.aiplatform_v1beta1.ReasoningEngineExecutionServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineExecutionService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -960,7 +1177,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]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -971,8 +1188,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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -981,6 +1200,7 @@ def __call__( http_options = ( _BaseReasoningEngineExecutionServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_get_iam_policy(request, metadata) transcoded_request = _BaseReasoningEngineExecutionServiceRestTransport._BaseGetIamPolicy._get_transcoded_request( http_options, request @@ -995,6 +1215,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.aiplatform_v1beta1.ReasoningEngineExecutionServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineExecutionService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ReasoningEngineExecutionServiceRestTransport._GetIamPolicy._get_response( self._host, @@ -1015,6 +1262,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_iam_policy(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.aiplatform_v1beta1.ReasoningEngineExecutionServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineExecutionService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1058,7 +1326,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]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -1069,8 +1337,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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -1079,6 +1349,7 @@ def __call__( http_options = ( _BaseReasoningEngineExecutionServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_set_iam_policy(request, metadata) transcoded_request = _BaseReasoningEngineExecutionServiceRestTransport._BaseSetIamPolicy._get_transcoded_request( http_options, request @@ -1093,6 +1364,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.aiplatform_v1beta1.ReasoningEngineExecutionServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineExecutionService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ReasoningEngineExecutionServiceRestTransport._SetIamPolicy._get_response( self._host, @@ -1113,6 +1411,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_set_iam_policy(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.aiplatform_v1beta1.ReasoningEngineExecutionServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineExecutionService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1158,7 +1477,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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -1169,8 +1488,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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -1179,6 +1500,7 @@ def __call__( http_options = ( _BaseReasoningEngineExecutionServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -1195,6 +1517,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.aiplatform_v1beta1.ReasoningEngineExecutionServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineExecutionService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ReasoningEngineExecutionServiceRestTransport._TestIamPermissions._get_response( self._host, @@ -1215,6 +1564,27 @@ def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_test_iam_permissions(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.aiplatform_v1beta1.ReasoningEngineExecutionServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineExecutionService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1257,7 +1627,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 cancel operation method over HTTP. @@ -1268,13 +1638,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 = ( _BaseReasoningEngineExecutionServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = self._interceptor.pre_cancel_operation( request, metadata ) @@ -1287,6 +1660,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.aiplatform_v1beta1.ReasoningEngineExecutionServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineExecutionService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ReasoningEngineExecutionServiceRestTransport._CancelOperation._get_response( self._host, @@ -1344,7 +1744,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. @@ -1355,13 +1755,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 = ( _BaseReasoningEngineExecutionServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = self._interceptor.pre_delete_operation( request, metadata ) @@ -1374,6 +1777,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.aiplatform_v1beta1.ReasoningEngineExecutionServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineExecutionService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ReasoningEngineExecutionServiceRestTransport._DeleteOperation._get_response( self._host, @@ -1431,7 +1861,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. @@ -1442,8 +1872,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. @@ -1452,6 +1884,7 @@ def __call__( http_options = ( _BaseReasoningEngineExecutionServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = self._interceptor.pre_get_operation(request, metadata) transcoded_request = _BaseReasoningEngineExecutionServiceRestTransport._BaseGetOperation._get_transcoded_request( http_options, request @@ -1462,6 +1895,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.aiplatform_v1beta1.ReasoningEngineExecutionServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineExecutionService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ReasoningEngineExecutionServiceRestTransport._GetOperation._get_response( self._host, @@ -1481,6 +1941,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.aiplatform_v1beta1.ReasoningEngineExecutionServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineExecutionService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1523,7 +2004,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. @@ -1534,8 +2015,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. @@ -1544,6 +2027,7 @@ def __call__( http_options = ( _BaseReasoningEngineExecutionServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = self._interceptor.pre_list_operations(request, metadata) transcoded_request = _BaseReasoningEngineExecutionServiceRestTransport._BaseListOperations._get_transcoded_request( http_options, request @@ -1554,6 +2038,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.aiplatform_v1beta1.ReasoningEngineExecutionServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineExecutionService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ReasoningEngineExecutionServiceRestTransport._ListOperations._get_response( self._host, @@ -1573,6 +2084,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.aiplatform_v1beta1.ReasoningEngineExecutionServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineExecutionService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1615,7 +2147,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 wait operation method over HTTP. @@ -1626,8 +2158,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 WaitOperation method. @@ -1636,6 +2170,7 @@ def __call__( http_options = ( _BaseReasoningEngineExecutionServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = self._interceptor.pre_wait_operation(request, metadata) transcoded_request = _BaseReasoningEngineExecutionServiceRestTransport._BaseWaitOperation._get_transcoded_request( http_options, request @@ -1646,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.aiplatform_v1beta1.ReasoningEngineExecutionServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineExecutionService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ReasoningEngineExecutionServiceRestTransport._WaitOperation._get_response( self._host, @@ -1665,6 +2227,27 @@ def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = self._interceptor.post_wait_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.aiplatform_v1beta1.ReasoningEngineExecutionServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineExecutionService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1beta1/services/reasoning_engine_execution_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1beta1/services/reasoning_engine_execution_service/transports/rest_asyncio.py index f12620ec81..cdc52e80a7 100644 --- a/google/cloud/aiplatform_v1beta1/services/reasoning_engine_execution_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/reasoning_engine_execution_service/transports/rest_asyncio.py @@ -57,6 +57,18 @@ from .base import DEFAULT_CLIENT_INFO as BASE_DEFAULT_CLIENT_INFO + +import logging + +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__) + try: OptionalRetry = Union[retries.AsyncRetry, gapic_v1.method._MethodDefault, None] except AttributeError: # pragma: NO COVER @@ -109,10 +121,10 @@ async def post_stream_query_reasoning_engine(self, response): async def pre_query_reasoning_engine( self, request: reasoning_engine_execution_service.QueryReasoningEngineRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ reasoning_engine_execution_service.QueryReasoningEngineRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for query_reasoning_engine @@ -135,10 +147,10 @@ async def post_query_reasoning_engine( async def pre_stream_query_reasoning_engine( self, request: reasoning_engine_execution_service.StreamQueryReasoningEngineRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ reasoning_engine_execution_service.StreamQueryReasoningEngineRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for stream_query_reasoning_engine @@ -161,8 +173,10 @@ async def post_stream_query_reasoning_engine( async def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -184,8 +198,10 @@ async def post_get_location( async def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -207,8 +223,10 @@ async def post_list_locations( async def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -230,8 +248,10 @@ async def post_get_iam_policy( async def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -253,8 +273,11 @@ async def post_set_iam_policy( async def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -276,8 +299,10 @@ async def post_test_iam_permissions( async def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -297,8 +322,10 @@ async def post_cancel_operation(self, response: None) -> None: async 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 @@ -318,8 +345,10 @@ async def post_delete_operation(self, response: None) -> None: async 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 @@ -341,8 +370,10 @@ async def post_get_operation( async 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 @@ -364,8 +395,10 @@ async def post_list_operations( async def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -561,7 +594,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> reasoning_engine_execution_service.QueryReasoningEngineResponse: r"""Call the query reasoning engine method over HTTP. @@ -572,8 +605,10 @@ async def __call__( 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: ~.reasoning_engine_execution_service.QueryReasoningEngineResponse: @@ -585,6 +620,7 @@ async def __call__( http_options = ( _BaseReasoningEngineExecutionServiceRestTransport._BaseQueryReasoningEngine._get_http_options() ) + request, metadata = await self._interceptor.pre_query_reasoning_engine( request, metadata ) @@ -601,6 +637,33 @@ async 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.aiplatform_v1beta1.ReasoningEngineExecutionServiceClient.QueryReasoningEngine", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineExecutionService", + "rpcName": "QueryReasoningEngine", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncReasoningEngineExecutionServiceRestTransport._QueryReasoningEngine._get_response( self._host, @@ -631,6 +694,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_query_reasoning_engine(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = reasoning_engine_execution_service.QueryReasoningEngineResponse.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.ReasoningEngineExecutionServiceAsyncClient.query_reasoning_engine", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineExecutionService", + "rpcName": "QueryReasoningEngine", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _StreamQueryReasoningEngine( @@ -672,7 +759,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> rest_streaming_async.AsyncResponseIterator: r"""Call the stream query reasoning engine method over HTTP. @@ -684,8 +771,10 @@ async def __call__( 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: ~.httpbody_pb2.HttpBody: @@ -744,6 +833,7 @@ async def __call__( http_options = ( _BaseReasoningEngineExecutionServiceRestTransport._BaseStreamQueryReasoningEngine._get_http_options() ) + ( request, metadata, @@ -763,6 +853,33 @@ async 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.aiplatform_v1beta1.ReasoningEngineExecutionServiceClient.StreamQueryReasoningEngine", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineExecutionService", + "rpcName": "StreamQueryReasoningEngine", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncReasoningEngineExecutionServiceRestTransport._StreamQueryReasoningEngine._get_response( self._host, @@ -850,7 +967,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -861,8 +978,10 @@ async def __call__( 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: locations_pb2.Location: Response from GetLocation method. @@ -871,6 +990,7 @@ async def __call__( http_options = ( _BaseReasoningEngineExecutionServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_location( request, metadata ) @@ -883,6 +1003,33 @@ async 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.aiplatform_v1beta1.ReasoningEngineExecutionServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineExecutionService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncReasoningEngineExecutionServiceRestTransport._GetLocation._get_response( self._host, @@ -908,6 +1055,27 @@ async def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_location(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.aiplatform_v1beta1.ReasoningEngineExecutionServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineExecutionService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -952,7 +1120,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -963,8 +1131,10 @@ async def __call__( 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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -973,6 +1143,7 @@ async def __call__( http_options = ( _BaseReasoningEngineExecutionServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_locations( request, metadata ) @@ -985,6 +1156,33 @@ async 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.aiplatform_v1beta1.ReasoningEngineExecutionServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineExecutionService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncReasoningEngineExecutionServiceRestTransport._ListLocations._get_response( self._host, @@ -1010,6 +1208,27 @@ async def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_list_locations(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.aiplatform_v1beta1.ReasoningEngineExecutionServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineExecutionService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1055,7 +1274,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -1066,8 +1285,10 @@ async def __call__( 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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -1076,6 +1297,7 @@ async def __call__( http_options = ( _BaseReasoningEngineExecutionServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_get_iam_policy( request, metadata ) @@ -1092,6 +1314,33 @@ async 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.aiplatform_v1beta1.ReasoningEngineExecutionServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineExecutionService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncReasoningEngineExecutionServiceRestTransport._GetIamPolicy._get_response( self._host, @@ -1118,6 +1367,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_iam_policy(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.aiplatform_v1beta1.ReasoningEngineExecutionServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineExecutionService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1163,7 +1433,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -1174,8 +1444,10 @@ async def __call__( 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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -1184,6 +1456,7 @@ async def __call__( http_options = ( _BaseReasoningEngineExecutionServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_set_iam_policy( request, metadata ) @@ -1200,6 +1473,33 @@ async 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.aiplatform_v1beta1.ReasoningEngineExecutionServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineExecutionService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncReasoningEngineExecutionServiceRestTransport._SetIamPolicy._get_response( self._host, @@ -1226,6 +1526,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_set_iam_policy(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.aiplatform_v1beta1.ReasoningEngineExecutionServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineExecutionService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1271,7 +1592,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -1282,8 +1603,10 @@ async def __call__( 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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -1292,6 +1615,7 @@ async def __call__( http_options = ( _BaseReasoningEngineExecutionServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = await self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -1308,6 +1632,33 @@ async 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.aiplatform_v1beta1.ReasoningEngineExecutionServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineExecutionService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncReasoningEngineExecutionServiceRestTransport._TestIamPermissions._get_response( self._host, @@ -1334,6 +1685,27 @@ async def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_test_iam_permissions(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.aiplatform_v1beta1.ReasoningEngineExecutionServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineExecutionService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1378,7 +1750,7 @@ async 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 cancel operation method over HTTP. @@ -1389,13 +1761,16 @@ async def __call__( 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`. """ http_options = ( _BaseReasoningEngineExecutionServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_cancel_operation( request, metadata ) @@ -1408,6 +1783,33 @@ async 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.aiplatform_v1beta1.ReasoningEngineExecutionServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineExecutionService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncReasoningEngineExecutionServiceRestTransport._CancelOperation._get_response( self._host, @@ -1473,7 +1875,7 @@ async 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. @@ -1484,13 +1886,16 @@ async def __call__( 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`. """ http_options = ( _BaseReasoningEngineExecutionServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_operation( request, metadata ) @@ -1503,6 +1908,33 @@ async 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.aiplatform_v1beta1.ReasoningEngineExecutionServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineExecutionService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncReasoningEngineExecutionServiceRestTransport._DeleteOperation._get_response( self._host, @@ -1568,7 +2000,7 @@ async 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. @@ -1579,8 +2011,10 @@ async def __call__( 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: Response from GetOperation method. @@ -1589,6 +2023,7 @@ async def __call__( http_options = ( _BaseReasoningEngineExecutionServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_operation( request, metadata ) @@ -1601,6 +2036,33 @@ async 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.aiplatform_v1beta1.ReasoningEngineExecutionServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineExecutionService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncReasoningEngineExecutionServiceRestTransport._GetOperation._get_response( self._host, @@ -1626,6 +2088,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1beta1.ReasoningEngineExecutionServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineExecutionService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1670,7 +2153,7 @@ async 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. @@ -1681,8 +2164,10 @@ async def __call__( 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 from ListOperations method. @@ -1691,6 +2176,7 @@ async def __call__( http_options = ( _BaseReasoningEngineExecutionServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_operations( request, metadata ) @@ -1703,6 +2189,33 @@ async 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.aiplatform_v1beta1.ReasoningEngineExecutionServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineExecutionService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncReasoningEngineExecutionServiceRestTransport._ListOperations._get_response( self._host, @@ -1728,6 +2241,27 @@ async def __call__( resp = operations_pb2.ListOperationsResponse() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1beta1.ReasoningEngineExecutionServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineExecutionService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1772,7 +2306,7 @@ async 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 wait operation method over HTTP. @@ -1783,8 +2317,10 @@ async def __call__( 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: Response from WaitOperation method. @@ -1793,6 +2329,7 @@ async def __call__( http_options = ( _BaseReasoningEngineExecutionServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_wait_operation( request, metadata ) @@ -1805,6 +2342,33 @@ async 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.aiplatform_v1beta1.ReasoningEngineExecutionServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineExecutionService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncReasoningEngineExecutionServiceRestTransport._WaitOperation._get_response( self._host, @@ -1830,6 +2394,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_wait_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.aiplatform_v1beta1.ReasoningEngineExecutionServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineExecutionService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1beta1/services/reasoning_engine_execution_service/transports/rest_base.py b/google/cloud/aiplatform_v1beta1/services/reasoning_engine_execution_service/transports/rest_base.py index e5ae062971..be6e4da79b 100644 --- a/google/cloud/aiplatform_v1beta1/services/reasoning_engine_execution_service/transports/rest_base.py +++ b/google/cloud/aiplatform_v1beta1/services/reasoning_engine_execution_service/transports/rest_base.py @@ -1134,6 +1134,10 @@ def _get_http_options(): "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -1350,6 +1354,10 @@ def _get_http_options(): "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -1575,6 +1583,10 @@ def _get_http_options(): "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}", @@ -1791,6 +1803,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, ] return http_options @@ -2008,6 +2024,10 @@ def _get_http_options(): "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*}/operations", @@ -2224,6 +2244,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*}/operations", + }, ] return http_options @@ -2441,6 +2465,10 @@ def _get_http_options(): "method": "post", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}:wait", @@ -2653,6 +2681,10 @@ def _get_http_options(): "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, ] return http_options diff --git a/google/cloud/aiplatform_v1beta1/services/reasoning_engine_service/async_client.py b/google/cloud/aiplatform_v1beta1/services/reasoning_engine_service/async_client.py index 0509631a92..ee36552535 100644 --- a/google/cloud/aiplatform_v1beta1/services/reasoning_engine_service/async_client.py +++ b/google/cloud/aiplatform_v1beta1/services/reasoning_engine_service/async_client.py @@ -13,6 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging as std_logging from collections import OrderedDict import re from typing import ( @@ -63,6 +64,15 @@ from .transports.grpc_asyncio import ReasoningEngineServiceGrpcAsyncIOTransport from .client import ReasoningEngineServiceClient +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 ReasoningEngineServiceAsyncClient: """A service for managing Vertex AI's Reasoning Engines.""" @@ -278,6 +288,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.aiplatform_v1beta1.ReasoningEngineServiceAsyncClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineService", + "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.aiplatform.v1beta1.ReasoningEngineService", + "credentialsType": None, + }, + ) + async def create_reasoning_engine( self, request: Optional[ @@ -288,7 +320,7 @@ async def create_reasoning_engine( reasoning_engine: Optional[gca_reasoning_engine.ReasoningEngine] = 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"""Creates a reasoning engine. @@ -348,8 +380,10 @@ async def sample_create_reasoning_engine(): 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: @@ -426,7 +460,7 @@ async def get_reasoning_engine( 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]]] = (), ) -> reasoning_engine.ReasoningEngine: r"""Gets a reasoning engine. @@ -471,8 +505,10 @@ async def sample_get_reasoning_engine(): 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.aiplatform_v1beta1.types.ReasoningEngine: @@ -537,7 +573,7 @@ async def list_reasoning_engines( 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.ListReasoningEnginesAsyncPager: r"""Lists reasoning engines in a location. @@ -583,8 +619,10 @@ async def sample_list_reasoning_engines(): 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.aiplatform_v1beta1.services.reasoning_engine_service.pagers.ListReasoningEnginesAsyncPager: @@ -664,7 +702,7 @@ async def update_reasoning_engine( 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"""Updates a reasoning engine. @@ -722,8 +760,10 @@ async def sample_update_reasoning_engine(): 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: @@ -802,7 +842,7 @@ async def delete_reasoning_engine( 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"""Deletes a reasoning engine. @@ -851,8 +891,10 @@ async def sample_delete_reasoning_engine(): 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: @@ -932,7 +974,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. @@ -943,8 +985,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. @@ -985,7 +1029,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. @@ -996,8 +1040,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. @@ -1038,7 +1084,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. @@ -1054,8 +1100,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 """ @@ -1092,7 +1140,7 @@ async def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -1107,8 +1155,10 @@ async def cancel_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 """ @@ -1145,7 +1195,7 @@ async def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -1162,8 +1212,10 @@ async def wait_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. @@ -1204,7 +1256,7 @@ async def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -1217,8 +1269,10 @@ async def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -1323,7 +1377,7 @@ async def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -1337,8 +1391,10 @@ async def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -1443,7 +1499,7 @@ async def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -1458,8 +1514,10 @@ async def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -1503,7 +1561,7 @@ async def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -1514,8 +1572,10 @@ async def get_location( 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: ~.location_pb2.Location: Location object. @@ -1556,7 +1616,7 @@ async def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -1567,8 +1627,10 @@ async def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1beta1/services/reasoning_engine_service/client.py b/google/cloud/aiplatform_v1beta1/services/reasoning_engine_service/client.py index ca36ee9cf5..5843e57107 100644 --- a/google/cloud/aiplatform_v1beta1/services/reasoning_engine_service/client.py +++ b/google/cloud/aiplatform_v1beta1/services/reasoning_engine_service/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 ( @@ -48,6 +49,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 as gac_operation # type: ignore from google.api_core import operation_async # type: ignore from google.cloud.aiplatform_v1beta1.services.reasoning_engine_service import pagers @@ -611,6 +621,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.aiplatform_v1beta1.ReasoningEngineServiceClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineService", + "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.aiplatform.v1beta1.ReasoningEngineService", + "credentialsType": None, + }, + ) + def create_reasoning_engine( self, request: Optional[ @@ -712,7 +749,7 @@ def create_reasoning_engine( reasoning_engine: Optional[gca_reasoning_engine.ReasoningEngine] = 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]]] = (), ) -> gac_operation.Operation: r"""Creates a reasoning engine. @@ -772,8 +809,10 @@ def sample_create_reasoning_engine(): 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: @@ -847,7 +886,7 @@ def get_reasoning_engine( 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]]] = (), ) -> reasoning_engine.ReasoningEngine: r"""Gets a reasoning engine. @@ -892,8 +931,10 @@ def sample_get_reasoning_engine(): 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.aiplatform_v1beta1.types.ReasoningEngine: @@ -955,7 +996,7 @@ def list_reasoning_engines( 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.ListReasoningEnginesPager: r"""Lists reasoning engines in a location. @@ -1001,8 +1042,10 @@ def sample_list_reasoning_engines(): 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.aiplatform_v1beta1.services.reasoning_engine_service.pagers.ListReasoningEnginesPager: @@ -1079,7 +1122,7 @@ def update_reasoning_engine( 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]]] = (), ) -> gac_operation.Operation: r"""Updates a reasoning engine. @@ -1137,8 +1180,10 @@ def sample_update_reasoning_engine(): 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: @@ -1214,7 +1259,7 @@ def delete_reasoning_engine( 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]]] = (), ) -> gac_operation.Operation: r"""Deletes a reasoning engine. @@ -1263,8 +1308,10 @@ def sample_delete_reasoning_engine(): 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: @@ -1354,7 +1401,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. @@ -1365,8 +1412,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. @@ -1407,7 +1456,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. @@ -1418,8 +1467,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. @@ -1460,7 +1511,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. @@ -1476,8 +1527,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 """ @@ -1514,7 +1567,7 @@ def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -1529,8 +1582,10 @@ def cancel_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 """ @@ -1567,7 +1622,7 @@ def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -1584,8 +1639,10 @@ def wait_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. @@ -1626,7 +1683,7 @@ def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -1639,8 +1696,10 @@ def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -1745,7 +1804,7 @@ def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -1759,8 +1818,10 @@ def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -1865,7 +1926,7 @@ def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -1880,8 +1941,10 @@ def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -1923,7 +1986,7 @@ def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -1934,8 +1997,10 @@ def get_location( 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: ~.location_pb2.Location: Location object. @@ -1976,7 +2041,7 @@ def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -1987,8 +2052,10 @@ def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1beta1/services/reasoning_engine_service/pagers.py b/google/cloud/aiplatform_v1beta1/services/reasoning_engine_service/pagers.py index 494e469ba0..e7afdd1798 100644 --- a/google/cloud/aiplatform_v1beta1/services/reasoning_engine_service/pagers.py +++ b/google/cloud/aiplatform_v1beta1/services/reasoning_engine_service/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 = reasoning_engine_service.ListReasoningEnginesRequest(request) @@ -143,7 +145,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. @@ -157,8 +159,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 = reasoning_engine_service.ListReasoningEnginesRequest(request) diff --git a/google/cloud/aiplatform_v1beta1/services/reasoning_engine_service/transports/grpc.py b/google/cloud/aiplatform_v1beta1/services/reasoning_engine_service/transports/grpc.py index b80d217658..9c9bb93371 100644 --- a/google/cloud/aiplatform_v1beta1/services/reasoning_engine_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1beta1/services/reasoning_engine_service/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 import warnings from typing import Callable, Dict, Optional, Sequence, Tuple, Union @@ -22,8 +25,11 @@ import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from google.cloud.aiplatform_v1beta1.types import reasoning_engine from google.cloud.aiplatform_v1beta1.types import reasoning_engine_service @@ -33,6 +39,81 @@ from google.longrunning import operations_pb2 # type: ignore from .base import ReasoningEngineServiceTransport, DEFAULT_CLIENT_INFO +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.aiplatform.v1beta1.ReasoningEngineService", + "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.aiplatform.v1beta1.ReasoningEngineService", + "rpcName": client_call_details.method, + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class ReasoningEngineServiceGrpcTransport(ReasoningEngineServiceTransport): """gRPC backend transport for ReasoningEngineService. @@ -187,7 +268,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 @@ -251,7 +337,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 @@ -278,7 +366,7 @@ def create_reasoning_engine( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_reasoning_engine" not in self._stubs: - self._stubs["create_reasoning_engine"] = self.grpc_channel.unary_unary( + self._stubs["create_reasoning_engine"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.ReasoningEngineService/CreateReasoningEngine", request_serializer=reasoning_engine_service.CreateReasoningEngineRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -307,7 +395,7 @@ def get_reasoning_engine( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_reasoning_engine" not in self._stubs: - self._stubs["get_reasoning_engine"] = self.grpc_channel.unary_unary( + self._stubs["get_reasoning_engine"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.ReasoningEngineService/GetReasoningEngine", request_serializer=reasoning_engine_service.GetReasoningEngineRequest.serialize, response_deserializer=reasoning_engine.ReasoningEngine.deserialize, @@ -336,7 +424,7 @@ def list_reasoning_engines( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_reasoning_engines" not in self._stubs: - self._stubs["list_reasoning_engines"] = self.grpc_channel.unary_unary( + self._stubs["list_reasoning_engines"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.ReasoningEngineService/ListReasoningEngines", request_serializer=reasoning_engine_service.ListReasoningEnginesRequest.serialize, response_deserializer=reasoning_engine_service.ListReasoningEnginesResponse.deserialize, @@ -365,7 +453,7 @@ def update_reasoning_engine( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_reasoning_engine" not in self._stubs: - self._stubs["update_reasoning_engine"] = self.grpc_channel.unary_unary( + self._stubs["update_reasoning_engine"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.ReasoningEngineService/UpdateReasoningEngine", request_serializer=reasoning_engine_service.UpdateReasoningEngineRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -394,7 +482,7 @@ def delete_reasoning_engine( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_reasoning_engine" not in self._stubs: - self._stubs["delete_reasoning_engine"] = self.grpc_channel.unary_unary( + self._stubs["delete_reasoning_engine"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.ReasoningEngineService/DeleteReasoningEngine", request_serializer=reasoning_engine_service.DeleteReasoningEngineRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -402,7 +490,7 @@ def delete_reasoning_engine( return self._stubs["delete_reasoning_engine"] def close(self): - self.grpc_channel.close() + self._logged_channel.close() @property def delete_operation( @@ -414,7 +502,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, @@ -431,7 +519,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -448,7 +536,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -465,7 +553,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, @@ -484,7 +572,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, @@ -503,7 +591,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -520,7 +608,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -545,7 +633,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -571,7 +659,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -600,7 +688,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1beta1/services/reasoning_engine_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1beta1/services/reasoning_engine_service/transports/grpc_asyncio.py index 96be9fb528..37856e8b78 100644 --- a/google/cloud/aiplatform_v1beta1/services/reasoning_engine_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/reasoning_engine_service/transports/grpc_asyncio.py @@ -14,6 +14,9 @@ # limitations under the License. # import inspect +import json +import pickle +import logging as std_logging import warnings from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union @@ -24,8 +27,11 @@ from google.api_core import operations_v1 from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from grpc.experimental import aio # type: ignore from google.cloud.aiplatform_v1beta1.types import reasoning_engine @@ -37,6 +43,82 @@ from .base import ReasoningEngineServiceTransport, DEFAULT_CLIENT_INFO from .grpc import ReasoningEngineServiceGrpcTransport +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.aiplatform.v1beta1.ReasoningEngineService", + "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.aiplatform.v1beta1.ReasoningEngineService", + "rpcName": str(client_call_details.method), + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class ReasoningEngineServiceGrpcAsyncIOTransport(ReasoningEngineServiceTransport): """gRPC AsyncIO backend transport for ReasoningEngineService. @@ -234,10 +316,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 @@ -260,7 +345,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. @@ -288,7 +373,7 @@ def create_reasoning_engine( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_reasoning_engine" not in self._stubs: - self._stubs["create_reasoning_engine"] = self.grpc_channel.unary_unary( + self._stubs["create_reasoning_engine"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.ReasoningEngineService/CreateReasoningEngine", request_serializer=reasoning_engine_service.CreateReasoningEngineRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -317,7 +402,7 @@ def get_reasoning_engine( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_reasoning_engine" not in self._stubs: - self._stubs["get_reasoning_engine"] = self.grpc_channel.unary_unary( + self._stubs["get_reasoning_engine"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.ReasoningEngineService/GetReasoningEngine", request_serializer=reasoning_engine_service.GetReasoningEngineRequest.serialize, response_deserializer=reasoning_engine.ReasoningEngine.deserialize, @@ -346,7 +431,7 @@ def list_reasoning_engines( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_reasoning_engines" not in self._stubs: - self._stubs["list_reasoning_engines"] = self.grpc_channel.unary_unary( + self._stubs["list_reasoning_engines"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.ReasoningEngineService/ListReasoningEngines", request_serializer=reasoning_engine_service.ListReasoningEnginesRequest.serialize, response_deserializer=reasoning_engine_service.ListReasoningEnginesResponse.deserialize, @@ -375,7 +460,7 @@ def update_reasoning_engine( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_reasoning_engine" not in self._stubs: - self._stubs["update_reasoning_engine"] = self.grpc_channel.unary_unary( + self._stubs["update_reasoning_engine"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.ReasoningEngineService/UpdateReasoningEngine", request_serializer=reasoning_engine_service.UpdateReasoningEngineRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -404,7 +489,7 @@ def delete_reasoning_engine( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_reasoning_engine" not in self._stubs: - self._stubs["delete_reasoning_engine"] = self.grpc_channel.unary_unary( + self._stubs["delete_reasoning_engine"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.ReasoningEngineService/DeleteReasoningEngine", request_serializer=reasoning_engine_service.DeleteReasoningEngineRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -497,7 +582,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: @@ -513,7 +598,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, @@ -530,7 +615,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -547,7 +632,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -564,7 +649,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, @@ -583,7 +668,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, @@ -602,7 +687,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -619,7 +704,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -644,7 +729,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -670,7 +755,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -699,7 +784,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1beta1/services/reasoning_engine_service/transports/rest.py b/google/cloud/aiplatform_v1beta1/services/reasoning_engine_service/transports/rest.py index 37416c2b14..10aded0c2a 100644 --- a/google/cloud/aiplatform_v1beta1/services/reasoning_engine_service/transports/rest.py +++ b/google/cloud/aiplatform_v1beta1/services/reasoning_engine_service/transports/rest.py @@ -13,9 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging +import json # type: ignore from google.auth.transport.requests import AuthorizedSession # type: ignore -import json # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.api_core import exceptions as core_exceptions from google.api_core import retry as retries @@ -48,6 +49,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, @@ -120,9 +129,10 @@ def post_update_reasoning_engine(self, response): def pre_create_reasoning_engine( self, request: reasoning_engine_service.CreateReasoningEngineRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - reasoning_engine_service.CreateReasoningEngineRequest, Sequence[Tuple[str, str]] + reasoning_engine_service.CreateReasoningEngineRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for create_reasoning_engine @@ -145,9 +155,10 @@ def post_create_reasoning_engine( def pre_delete_reasoning_engine( self, request: reasoning_engine_service.DeleteReasoningEngineRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - reasoning_engine_service.DeleteReasoningEngineRequest, Sequence[Tuple[str, str]] + reasoning_engine_service.DeleteReasoningEngineRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for delete_reasoning_engine @@ -170,9 +181,10 @@ def post_delete_reasoning_engine( def pre_get_reasoning_engine( self, request: reasoning_engine_service.GetReasoningEngineRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - reasoning_engine_service.GetReasoningEngineRequest, Sequence[Tuple[str, str]] + reasoning_engine_service.GetReasoningEngineRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for get_reasoning_engine @@ -195,9 +207,10 @@ def post_get_reasoning_engine( def pre_list_reasoning_engines( self, request: reasoning_engine_service.ListReasoningEnginesRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - reasoning_engine_service.ListReasoningEnginesRequest, Sequence[Tuple[str, str]] + reasoning_engine_service.ListReasoningEnginesRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for list_reasoning_engines @@ -220,9 +233,10 @@ def post_list_reasoning_engines( def pre_update_reasoning_engine( self, request: reasoning_engine_service.UpdateReasoningEngineRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - reasoning_engine_service.UpdateReasoningEngineRequest, Sequence[Tuple[str, str]] + reasoning_engine_service.UpdateReasoningEngineRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for update_reasoning_engine @@ -245,8 +259,10 @@ def post_update_reasoning_engine( def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -268,8 +284,10 @@ def post_get_location( def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -291,8 +309,10 @@ def post_list_locations( def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -312,8 +332,10 @@ def post_get_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -333,8 +355,11 @@ def post_set_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -356,8 +381,10 @@ def post_test_iam_permissions( def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -377,8 +404,10 @@ def post_cancel_operation(self, response: None) -> None: 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 @@ -398,8 +427,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 @@ -421,8 +452,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 @@ -444,8 +477,10 @@ def post_list_operations( def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -1125,6 +1160,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -1341,6 +1380,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -1547,6 +1590,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}", @@ -1763,6 +1810,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, ], "google.longrunning.Operations.ListOperations": [ { @@ -1961,6 +2012,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*}/operations", @@ -2177,6 +2232,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*}/operations", + }, ], "google.longrunning.Operations.WaitOperation": [ { @@ -2375,6 +2434,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "post", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}:wait", @@ -2587,6 +2650,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, ], } @@ -2643,7 +2710,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 reasoning engine method over HTTP. @@ -2654,8 +2721,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: @@ -2668,6 +2737,7 @@ def __call__( http_options = ( _BaseReasoningEngineServiceRestTransport._BaseCreateReasoningEngine._get_http_options() ) + request, metadata = self._interceptor.pre_create_reasoning_engine( request, metadata ) @@ -2684,6 +2754,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.aiplatform_v1beta1.ReasoningEngineServiceClient.CreateReasoningEngine", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineService", + "rpcName": "CreateReasoningEngine", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ReasoningEngineServiceRestTransport._CreateReasoningEngine._get_response( self._host, @@ -2703,7 +2800,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_reasoning_engine(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.aiplatform_v1beta1.ReasoningEngineServiceClient.create_reasoning_engine", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineService", + "rpcName": "CreateReasoningEngine", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _DeleteReasoningEngine( @@ -2742,7 +2861,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 reasoning engine method over HTTP. @@ -2753,8 +2872,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: @@ -2767,6 +2888,7 @@ def __call__( http_options = ( _BaseReasoningEngineServiceRestTransport._BaseDeleteReasoningEngine._get_http_options() ) + request, metadata = self._interceptor.pre_delete_reasoning_engine( request, metadata ) @@ -2779,6 +2901,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.aiplatform_v1beta1.ReasoningEngineServiceClient.DeleteReasoningEngine", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineService", + "rpcName": "DeleteReasoningEngine", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ReasoningEngineServiceRestTransport._DeleteReasoningEngine._get_response( self._host, @@ -2797,7 +2946,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_reasoning_engine(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.aiplatform_v1beta1.ReasoningEngineServiceClient.delete_reasoning_engine", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineService", + "rpcName": "DeleteReasoningEngine", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _GetReasoningEngine( @@ -2836,7 +3007,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]]] = (), ) -> reasoning_engine.ReasoningEngine: r"""Call the get reasoning engine method over HTTP. @@ -2847,8 +3018,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: ~.reasoning_engine.ReasoningEngine: @@ -2862,6 +3035,7 @@ def __call__( http_options = ( _BaseReasoningEngineServiceRestTransport._BaseGetReasoningEngine._get_http_options() ) + request, metadata = self._interceptor.pre_get_reasoning_engine( request, metadata ) @@ -2874,6 +3048,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.aiplatform_v1beta1.ReasoningEngineServiceClient.GetReasoningEngine", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineService", + "rpcName": "GetReasoningEngine", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( ReasoningEngineServiceRestTransport._GetReasoningEngine._get_response( @@ -2896,7 +3097,31 @@ def __call__( pb_resp = reasoning_engine.ReasoningEngine.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_reasoning_engine(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = reasoning_engine.ReasoningEngine.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.aiplatform_v1beta1.ReasoningEngineServiceClient.get_reasoning_engine", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineService", + "rpcName": "GetReasoningEngine", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListReasoningEngines( @@ -2935,7 +3160,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]]] = (), ) -> reasoning_engine_service.ListReasoningEnginesResponse: r"""Call the list reasoning engines method over HTTP. @@ -2946,8 +3171,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: ~.reasoning_engine_service.ListReasoningEnginesResponse: @@ -2959,6 +3186,7 @@ def __call__( http_options = ( _BaseReasoningEngineServiceRestTransport._BaseListReasoningEngines._get_http_options() ) + request, metadata = self._interceptor.pre_list_reasoning_engines( request, metadata ) @@ -2971,6 +3199,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.aiplatform_v1beta1.ReasoningEngineServiceClient.ListReasoningEngines", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineService", + "rpcName": "ListReasoningEngines", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( ReasoningEngineServiceRestTransport._ListReasoningEngines._get_response( @@ -2993,7 +3248,33 @@ def __call__( pb_resp = reasoning_engine_service.ListReasoningEnginesResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_reasoning_engines(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + reasoning_engine_service.ListReasoningEnginesResponse.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.aiplatform_v1beta1.ReasoningEngineServiceClient.list_reasoning_engines", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineService", + "rpcName": "ListReasoningEngines", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _UpdateReasoningEngine( @@ -3033,7 +3314,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 reasoning engine method over HTTP. @@ -3044,8 +3325,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: @@ -3058,6 +3341,7 @@ def __call__( http_options = ( _BaseReasoningEngineServiceRestTransport._BaseUpdateReasoningEngine._get_http_options() ) + request, metadata = self._interceptor.pre_update_reasoning_engine( request, metadata ) @@ -3074,6 +3358,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.aiplatform_v1beta1.ReasoningEngineServiceClient.UpdateReasoningEngine", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineService", + "rpcName": "UpdateReasoningEngine", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ReasoningEngineServiceRestTransport._UpdateReasoningEngine._get_response( self._host, @@ -3093,7 +3404,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_reasoning_engine(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.aiplatform_v1beta1.ReasoningEngineServiceClient.update_reasoning_engine", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineService", + "rpcName": "UpdateReasoningEngine", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp @property @@ -3191,7 +3524,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]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -3202,8 +3535,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: locations_pb2.Location: Response from GetLocation method. @@ -3212,6 +3547,7 @@ def __call__( http_options = ( _BaseReasoningEngineServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = self._interceptor.pre_get_location(request, metadata) transcoded_request = _BaseReasoningEngineServiceRestTransport._BaseGetLocation._get_transcoded_request( http_options, request @@ -3222,6 +3558,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.aiplatform_v1beta1.ReasoningEngineServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ReasoningEngineServiceRestTransport._GetLocation._get_response( self._host, @@ -3241,6 +3604,27 @@ def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_location(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.aiplatform_v1beta1.ReasoningEngineServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3283,7 +3667,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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -3294,8 +3678,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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -3304,6 +3690,7 @@ def __call__( http_options = ( _BaseReasoningEngineServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = self._interceptor.pre_list_locations(request, metadata) transcoded_request = _BaseReasoningEngineServiceRestTransport._BaseListLocations._get_transcoded_request( http_options, request @@ -3314,6 +3701,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.aiplatform_v1beta1.ReasoningEngineServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ReasoningEngineServiceRestTransport._ListLocations._get_response( self._host, @@ -3333,6 +3747,27 @@ def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_list_locations(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.aiplatform_v1beta1.ReasoningEngineServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3376,7 +3811,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]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -3387,8 +3822,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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -3397,6 +3834,7 @@ def __call__( http_options = ( _BaseReasoningEngineServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_get_iam_policy(request, metadata) transcoded_request = _BaseReasoningEngineServiceRestTransport._BaseGetIamPolicy._get_transcoded_request( http_options, request @@ -3411,6 +3849,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.aiplatform_v1beta1.ReasoningEngineServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ReasoningEngineServiceRestTransport._GetIamPolicy._get_response( self._host, @@ -3431,6 +3896,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_iam_policy(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.aiplatform_v1beta1.ReasoningEngineServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3474,7 +3960,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]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -3485,8 +3971,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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -3495,6 +3983,7 @@ def __call__( http_options = ( _BaseReasoningEngineServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_set_iam_policy(request, metadata) transcoded_request = _BaseReasoningEngineServiceRestTransport._BaseSetIamPolicy._get_transcoded_request( http_options, request @@ -3509,6 +3998,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.aiplatform_v1beta1.ReasoningEngineServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ReasoningEngineServiceRestTransport._SetIamPolicy._get_response( self._host, @@ -3529,6 +4045,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_set_iam_policy(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.aiplatform_v1beta1.ReasoningEngineServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3572,7 +4109,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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -3583,8 +4120,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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -3593,6 +4132,7 @@ def __call__( http_options = ( _BaseReasoningEngineServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -3609,6 +4149,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.aiplatform_v1beta1.ReasoningEngineServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( ReasoningEngineServiceRestTransport._TestIamPermissions._get_response( @@ -3631,6 +4198,27 @@ def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_test_iam_permissions(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.aiplatform_v1beta1.ReasoningEngineServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3673,7 +4261,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 cancel operation method over HTTP. @@ -3684,13 +4272,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 = ( _BaseReasoningEngineServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = self._interceptor.pre_cancel_operation( request, metadata ) @@ -3703,6 +4294,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.aiplatform_v1beta1.ReasoningEngineServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( ReasoningEngineServiceRestTransport._CancelOperation._get_response( @@ -3762,7 +4380,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. @@ -3773,13 +4391,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 = ( _BaseReasoningEngineServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = self._interceptor.pre_delete_operation( request, metadata ) @@ -3792,6 +4413,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.aiplatform_v1beta1.ReasoningEngineServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( ReasoningEngineServiceRestTransport._DeleteOperation._get_response( @@ -3851,7 +4499,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. @@ -3862,8 +4510,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. @@ -3872,6 +4522,7 @@ def __call__( http_options = ( _BaseReasoningEngineServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = self._interceptor.pre_get_operation(request, metadata) transcoded_request = _BaseReasoningEngineServiceRestTransport._BaseGetOperation._get_transcoded_request( http_options, request @@ -3882,6 +4533,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.aiplatform_v1beta1.ReasoningEngineServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ReasoningEngineServiceRestTransport._GetOperation._get_response( self._host, @@ -3901,6 +4579,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.aiplatform_v1beta1.ReasoningEngineServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3943,7 +4642,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. @@ -3954,8 +4653,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. @@ -3964,6 +4665,7 @@ def __call__( http_options = ( _BaseReasoningEngineServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = self._interceptor.pre_list_operations(request, metadata) transcoded_request = _BaseReasoningEngineServiceRestTransport._BaseListOperations._get_transcoded_request( http_options, request @@ -3974,6 +4676,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.aiplatform_v1beta1.ReasoningEngineServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( ReasoningEngineServiceRestTransport._ListOperations._get_response( @@ -3995,6 +4724,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.aiplatform_v1beta1.ReasoningEngineServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4037,7 +4787,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 wait operation method over HTTP. @@ -4048,8 +4798,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 WaitOperation method. @@ -4058,6 +4810,7 @@ def __call__( http_options = ( _BaseReasoningEngineServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = self._interceptor.pre_wait_operation(request, metadata) transcoded_request = _BaseReasoningEngineServiceRestTransport._BaseWaitOperation._get_transcoded_request( http_options, request @@ -4068,6 +4821,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.aiplatform_v1beta1.ReasoningEngineServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ReasoningEngineServiceRestTransport._WaitOperation._get_response( self._host, @@ -4087,6 +4867,27 @@ def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = self._interceptor.post_wait_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.aiplatform_v1beta1.ReasoningEngineServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1beta1/services/reasoning_engine_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1beta1/services/reasoning_engine_service/transports/rest_asyncio.py index 88432f4d7d..56611a471e 100644 --- a/google/cloud/aiplatform_v1beta1/services/reasoning_engine_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/reasoning_engine_service/transports/rest_asyncio.py @@ -59,6 +59,18 @@ from .base import DEFAULT_CLIENT_INFO as BASE_DEFAULT_CLIENT_INFO + +import logging + +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__) + try: OptionalRetry = Union[retries.AsyncRetry, gapic_v1.method._MethodDefault, None] except AttributeError: # pragma: NO COVER @@ -135,9 +147,10 @@ async def post_update_reasoning_engine(self, response): async def pre_create_reasoning_engine( self, request: reasoning_engine_service.CreateReasoningEngineRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - reasoning_engine_service.CreateReasoningEngineRequest, Sequence[Tuple[str, str]] + reasoning_engine_service.CreateReasoningEngineRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for create_reasoning_engine @@ -160,9 +173,10 @@ async def post_create_reasoning_engine( async def pre_delete_reasoning_engine( self, request: reasoning_engine_service.DeleteReasoningEngineRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - reasoning_engine_service.DeleteReasoningEngineRequest, Sequence[Tuple[str, str]] + reasoning_engine_service.DeleteReasoningEngineRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for delete_reasoning_engine @@ -185,9 +199,10 @@ async def post_delete_reasoning_engine( async def pre_get_reasoning_engine( self, request: reasoning_engine_service.GetReasoningEngineRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - reasoning_engine_service.GetReasoningEngineRequest, Sequence[Tuple[str, str]] + reasoning_engine_service.GetReasoningEngineRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for get_reasoning_engine @@ -210,9 +225,10 @@ async def post_get_reasoning_engine( async def pre_list_reasoning_engines( self, request: reasoning_engine_service.ListReasoningEnginesRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - reasoning_engine_service.ListReasoningEnginesRequest, Sequence[Tuple[str, str]] + reasoning_engine_service.ListReasoningEnginesRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for list_reasoning_engines @@ -235,9 +251,10 @@ async def post_list_reasoning_engines( async def pre_update_reasoning_engine( self, request: reasoning_engine_service.UpdateReasoningEngineRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - reasoning_engine_service.UpdateReasoningEngineRequest, Sequence[Tuple[str, str]] + reasoning_engine_service.UpdateReasoningEngineRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for update_reasoning_engine @@ -260,8 +277,10 @@ async def post_update_reasoning_engine( async def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -283,8 +302,10 @@ async def post_get_location( async def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -306,8 +327,10 @@ async def post_list_locations( async def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -329,8 +352,10 @@ async def post_get_iam_policy( async def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -352,8 +377,11 @@ async def post_set_iam_policy( async def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -375,8 +403,10 @@ async def post_test_iam_permissions( async def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -396,8 +426,10 @@ async def post_cancel_operation(self, response: None) -> None: async 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 @@ -417,8 +449,10 @@ async def post_delete_operation(self, response: None) -> None: async 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 @@ -440,8 +474,10 @@ async def post_get_operation( async 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 @@ -463,8 +499,10 @@ async def post_list_operations( async def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -674,7 +712,7 @@ async 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 reasoning engine method over HTTP. @@ -685,8 +723,10 @@ async def __call__( 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: @@ -699,6 +739,7 @@ async def __call__( http_options = ( _BaseReasoningEngineServiceRestTransport._BaseCreateReasoningEngine._get_http_options() ) + request, metadata = await self._interceptor.pre_create_reasoning_engine( request, metadata ) @@ -715,6 +756,33 @@ async 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.aiplatform_v1beta1.ReasoningEngineServiceClient.CreateReasoningEngine", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineService", + "rpcName": "CreateReasoningEngine", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncReasoningEngineServiceRestTransport._CreateReasoningEngine._get_response( self._host, @@ -743,6 +811,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_create_reasoning_engine(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.ReasoningEngineServiceAsyncClient.create_reasoning_engine", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineService", + "rpcName": "CreateReasoningEngine", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _DeleteReasoningEngine( @@ -783,7 +873,7 @@ async 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 reasoning engine method over HTTP. @@ -794,8 +884,10 @@ async def __call__( 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: @@ -808,6 +900,7 @@ async def __call__( http_options = ( _BaseReasoningEngineServiceRestTransport._BaseDeleteReasoningEngine._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_reasoning_engine( request, metadata ) @@ -820,6 +913,33 @@ async 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.aiplatform_v1beta1.ReasoningEngineServiceClient.DeleteReasoningEngine", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineService", + "rpcName": "DeleteReasoningEngine", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncReasoningEngineServiceRestTransport._DeleteReasoningEngine._get_response( self._host, @@ -847,6 +967,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_delete_reasoning_engine(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.ReasoningEngineServiceAsyncClient.delete_reasoning_engine", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineService", + "rpcName": "DeleteReasoningEngine", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _GetReasoningEngine( @@ -885,7 +1027,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> reasoning_engine.ReasoningEngine: r"""Call the get reasoning engine method over HTTP. @@ -896,8 +1038,10 @@ async def __call__( 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: ~.reasoning_engine.ReasoningEngine: @@ -911,6 +1055,7 @@ async def __call__( http_options = ( _BaseReasoningEngineServiceRestTransport._BaseGetReasoningEngine._get_http_options() ) + request, metadata = await self._interceptor.pre_get_reasoning_engine( request, metadata ) @@ -923,6 +1068,33 @@ async 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.aiplatform_v1beta1.ReasoningEngineServiceClient.GetReasoningEngine", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineService", + "rpcName": "GetReasoningEngine", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncReasoningEngineServiceRestTransport._GetReasoningEngine._get_response( self._host, @@ -950,6 +1122,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_get_reasoning_engine(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = reasoning_engine.ReasoningEngine.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.ReasoningEngineServiceAsyncClient.get_reasoning_engine", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineService", + "rpcName": "GetReasoningEngine", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ListReasoningEngines( @@ -988,7 +1184,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> reasoning_engine_service.ListReasoningEnginesResponse: r"""Call the list reasoning engines method over HTTP. @@ -999,8 +1195,10 @@ async def __call__( 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: ~.reasoning_engine_service.ListReasoningEnginesResponse: @@ -1012,6 +1210,7 @@ async def __call__( http_options = ( _BaseReasoningEngineServiceRestTransport._BaseListReasoningEngines._get_http_options() ) + request, metadata = await self._interceptor.pre_list_reasoning_engines( request, metadata ) @@ -1024,6 +1223,33 @@ async 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.aiplatform_v1beta1.ReasoningEngineServiceClient.ListReasoningEngines", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineService", + "rpcName": "ListReasoningEngines", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncReasoningEngineServiceRestTransport._ListReasoningEngines._get_response( self._host, @@ -1051,6 +1277,32 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_list_reasoning_engines(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + reasoning_engine_service.ListReasoningEnginesResponse.to_json( + response + ) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.ReasoningEngineServiceAsyncClient.list_reasoning_engines", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineService", + "rpcName": "ListReasoningEngines", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _UpdateReasoningEngine( @@ -1092,7 +1344,7 @@ async 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 reasoning engine method over HTTP. @@ -1103,8 +1355,10 @@ async def __call__( 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: @@ -1117,6 +1371,7 @@ async def __call__( http_options = ( _BaseReasoningEngineServiceRestTransport._BaseUpdateReasoningEngine._get_http_options() ) + request, metadata = await self._interceptor.pre_update_reasoning_engine( request, metadata ) @@ -1133,6 +1388,33 @@ async 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.aiplatform_v1beta1.ReasoningEngineServiceClient.UpdateReasoningEngine", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineService", + "rpcName": "UpdateReasoningEngine", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncReasoningEngineServiceRestTransport._UpdateReasoningEngine._get_response( self._host, @@ -1161,6 +1443,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_update_reasoning_engine(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.ReasoningEngineServiceAsyncClient.update_reasoning_engine", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineService", + "rpcName": "UpdateReasoningEngine", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp @property @@ -1736,6 +2040,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -1952,6 +2260,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -2158,6 +2470,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}", @@ -2374,6 +2690,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, ], "google.longrunning.Operations.ListOperations": [ { @@ -2572,6 +2892,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*}/operations", @@ -2788,6 +3112,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*}/operations", + }, ], "google.longrunning.Operations.WaitOperation": [ { @@ -2986,6 +3314,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "post", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}:wait", @@ -3198,6 +3530,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, ], } @@ -3301,7 +3637,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -3312,8 +3648,10 @@ async def __call__( 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: locations_pb2.Location: Response from GetLocation method. @@ -3322,6 +3660,7 @@ async def __call__( http_options = ( _BaseReasoningEngineServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_location( request, metadata ) @@ -3334,6 +3673,33 @@ async 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.aiplatform_v1beta1.ReasoningEngineServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncReasoningEngineServiceRestTransport._GetLocation._get_response( self._host, @@ -3359,6 +3725,27 @@ async def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_location(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.aiplatform_v1beta1.ReasoningEngineServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3401,7 +3788,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -3412,8 +3799,10 @@ async def __call__( 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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -3422,6 +3811,7 @@ async def __call__( http_options = ( _BaseReasoningEngineServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_locations( request, metadata ) @@ -3434,6 +3824,33 @@ async 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.aiplatform_v1beta1.ReasoningEngineServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncReasoningEngineServiceRestTransport._ListLocations._get_response( self._host, @@ -3459,6 +3876,27 @@ async def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_list_locations(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.aiplatform_v1beta1.ReasoningEngineServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3502,7 +3940,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -3513,8 +3951,10 @@ async def __call__( 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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -3523,6 +3963,7 @@ async def __call__( http_options = ( _BaseReasoningEngineServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_get_iam_policy( request, metadata ) @@ -3539,6 +3980,33 @@ async 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.aiplatform_v1beta1.ReasoningEngineServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncReasoningEngineServiceRestTransport._GetIamPolicy._get_response( self._host, @@ -3565,6 +4033,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_iam_policy(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.aiplatform_v1beta1.ReasoningEngineServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3608,7 +4097,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -3619,8 +4108,10 @@ async def __call__( 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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -3629,6 +4120,7 @@ async def __call__( http_options = ( _BaseReasoningEngineServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_set_iam_policy( request, metadata ) @@ -3645,6 +4137,33 @@ async 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.aiplatform_v1beta1.ReasoningEngineServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncReasoningEngineServiceRestTransport._SetIamPolicy._get_response( self._host, @@ -3671,6 +4190,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_set_iam_policy(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.aiplatform_v1beta1.ReasoningEngineServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3714,7 +4254,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -3725,8 +4265,10 @@ async def __call__( 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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -3735,6 +4277,7 @@ async def __call__( http_options = ( _BaseReasoningEngineServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = await self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -3751,6 +4294,33 @@ async 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.aiplatform_v1beta1.ReasoningEngineServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncReasoningEngineServiceRestTransport._TestIamPermissions._get_response( self._host, @@ -3777,6 +4347,27 @@ async def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_test_iam_permissions(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.aiplatform_v1beta1.ReasoningEngineServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3819,7 +4410,7 @@ async 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 cancel operation method over HTTP. @@ -3830,13 +4421,16 @@ async def __call__( 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`. """ http_options = ( _BaseReasoningEngineServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_cancel_operation( request, metadata ) @@ -3849,6 +4443,33 @@ async 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.aiplatform_v1beta1.ReasoningEngineServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncReasoningEngineServiceRestTransport._CancelOperation._get_response( self._host, @@ -3912,7 +4533,7 @@ async 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. @@ -3923,13 +4544,16 @@ async def __call__( 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`. """ http_options = ( _BaseReasoningEngineServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_operation( request, metadata ) @@ -3942,6 +4566,33 @@ async 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.aiplatform_v1beta1.ReasoningEngineServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncReasoningEngineServiceRestTransport._DeleteOperation._get_response( self._host, @@ -4005,7 +4656,7 @@ async 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. @@ -4016,8 +4667,10 @@ async def __call__( 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: Response from GetOperation method. @@ -4026,6 +4679,7 @@ async def __call__( http_options = ( _BaseReasoningEngineServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_operation( request, metadata ) @@ -4038,6 +4692,33 @@ async 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.aiplatform_v1beta1.ReasoningEngineServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncReasoningEngineServiceRestTransport._GetOperation._get_response( self._host, @@ -4063,6 +4744,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1beta1.ReasoningEngineServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4105,7 +4807,7 @@ async 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. @@ -4116,8 +4818,10 @@ async def __call__( 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 from ListOperations method. @@ -4126,6 +4830,7 @@ async def __call__( http_options = ( _BaseReasoningEngineServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_operations( request, metadata ) @@ -4138,6 +4843,33 @@ async 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.aiplatform_v1beta1.ReasoningEngineServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncReasoningEngineServiceRestTransport._ListOperations._get_response( self._host, @@ -4163,6 +4895,27 @@ async def __call__( resp = operations_pb2.ListOperationsResponse() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1beta1.ReasoningEngineServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4205,7 +4958,7 @@ async 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 wait operation method over HTTP. @@ -4216,8 +4969,10 @@ async def __call__( 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: Response from WaitOperation method. @@ -4226,6 +4981,7 @@ async def __call__( http_options = ( _BaseReasoningEngineServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_wait_operation( request, metadata ) @@ -4238,6 +4994,33 @@ async 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.aiplatform_v1beta1.ReasoningEngineServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncReasoningEngineServiceRestTransport._WaitOperation._get_response( self._host, @@ -4263,6 +5046,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_wait_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.aiplatform_v1beta1.ReasoningEngineServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ReasoningEngineService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1beta1/services/reasoning_engine_service/transports/rest_base.py b/google/cloud/aiplatform_v1beta1/services/reasoning_engine_service/transports/rest_base.py index be67306617..320f3f60ce 100644 --- a/google/cloud/aiplatform_v1beta1/services/reasoning_engine_service/transports/rest_base.py +++ b/google/cloud/aiplatform_v1beta1/services/reasoning_engine_service/transports/rest_base.py @@ -1273,6 +1273,10 @@ def _get_http_options(): "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -1489,6 +1493,10 @@ def _get_http_options(): "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -1714,6 +1722,10 @@ def _get_http_options(): "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}", @@ -1930,6 +1942,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, ] return http_options @@ -2147,6 +2163,10 @@ def _get_http_options(): "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*}/operations", @@ -2363,6 +2383,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*}/operations", + }, ] return http_options @@ -2580,6 +2604,10 @@ def _get_http_options(): "method": "post", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}:wait", @@ -2792,6 +2820,10 @@ def _get_http_options(): "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, ] return http_options diff --git a/google/cloud/aiplatform_v1beta1/services/schedule_service/async_client.py b/google/cloud/aiplatform_v1beta1/services/schedule_service/async_client.py index d3c3e50853..011b0b4655 100644 --- a/google/cloud/aiplatform_v1beta1/services/schedule_service/async_client.py +++ b/google/cloud/aiplatform_v1beta1/services/schedule_service/async_client.py @@ -13,6 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging as std_logging from collections import OrderedDict import re from typing import ( @@ -64,6 +65,15 @@ from .transports.grpc_asyncio import ScheduleServiceGrpcAsyncIOTransport from .client import ScheduleServiceClient +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 ScheduleServiceAsyncClient: """A service for creating and managing Vertex AI's Schedule @@ -330,6 +340,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.aiplatform_v1beta1.ScheduleServiceAsyncClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ScheduleService", + "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.aiplatform.v1beta1.ScheduleService", + "credentialsType": None, + }, + ) + async def create_schedule( self, request: Optional[Union[schedule_service.CreateScheduleRequest, dict]] = None, @@ -338,7 +370,7 @@ async def create_schedule( schedule: Optional[gca_schedule.Schedule] = 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]]] = (), ) -> gca_schedule.Schedule: r"""Creates a Schedule. @@ -395,8 +427,10 @@ async def sample_create_schedule(): 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.aiplatform_v1beta1.types.Schedule: @@ -461,7 +495,7 @@ async def delete_schedule( 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"""Deletes a Schedule. @@ -510,8 +544,10 @@ async def sample_delete_schedule(): 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: @@ -590,7 +626,7 @@ async def get_schedule( 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]]] = (), ) -> schedule.Schedule: r"""Gets a Schedule. @@ -634,8 +670,10 @@ async def sample_get_schedule(): 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.aiplatform_v1beta1.types.Schedule: @@ -698,7 +736,7 @@ async def list_schedules( 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.ListSchedulesAsyncPager: r"""Lists Schedules in a Location. @@ -744,8 +782,10 @@ async def sample_list_schedules(): 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.aiplatform_v1beta1.services.schedule_service.pagers.ListSchedulesAsyncPager: @@ -820,7 +860,7 @@ async def pause_schedule( 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"""Pauses a Schedule. Will mark [Schedule.state][google.cloud.aiplatform.v1beta1.Schedule.state] @@ -865,8 +905,10 @@ async def sample_pause_schedule(): 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 @@ -919,7 +961,7 @@ async def resume_schedule( catch_up: Optional[bool] = 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"""Resumes a paused Schedule to start scheduling new runs. Will mark @@ -982,8 +1024,10 @@ async def sample_resume_schedule(): 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 @@ -1038,7 +1082,7 @@ async def update_schedule( 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]]] = (), ) -> gca_schedule.Schedule: r"""Updates an active or paused Schedule. @@ -1105,8 +1149,10 @@ async def sample_update_schedule(): 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.aiplatform_v1beta1.types.Schedule: @@ -1172,7 +1218,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. @@ -1183,8 +1229,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. @@ -1225,7 +1273,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. @@ -1236,8 +1284,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. @@ -1278,7 +1328,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. @@ -1294,8 +1344,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 """ @@ -1332,7 +1384,7 @@ async def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -1347,8 +1399,10 @@ async def cancel_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 """ @@ -1385,7 +1439,7 @@ async def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -1402,8 +1456,10 @@ async def wait_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. @@ -1444,7 +1500,7 @@ async def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -1457,8 +1513,10 @@ async def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -1563,7 +1621,7 @@ async def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -1577,8 +1635,10 @@ async def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -1683,7 +1743,7 @@ async def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -1698,8 +1758,10 @@ async def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -1743,7 +1805,7 @@ async def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -1754,8 +1816,10 @@ async def get_location( 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: ~.location_pb2.Location: Location object. @@ -1796,7 +1860,7 @@ async def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -1807,8 +1871,10 @@ async def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1beta1/services/schedule_service/client.py b/google/cloud/aiplatform_v1beta1/services/schedule_service/client.py index 086dd5820e..084a9b4c91 100644 --- a/google/cloud/aiplatform_v1beta1/services/schedule_service/client.py +++ b/google/cloud/aiplatform_v1beta1/services/schedule_service/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 ( @@ -48,6 +49,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 as gac_operation # type: ignore from google.api_core import operation_async # type: ignore from google.cloud.aiplatform_v1beta1.services.schedule_service import pagers @@ -968,6 +978,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( @@ -1058,6 +1072,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.aiplatform_v1beta1.ScheduleServiceClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ScheduleService", + "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.aiplatform.v1beta1.ScheduleService", + "credentialsType": None, + }, + ) + def create_schedule( self, request: Optional[Union[schedule_service.CreateScheduleRequest, dict]] = None, @@ -1066,7 +1103,7 @@ def create_schedule( schedule: Optional[gca_schedule.Schedule] = 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]]] = (), ) -> gca_schedule.Schedule: r"""Creates a Schedule. @@ -1123,8 +1160,10 @@ def sample_create_schedule(): 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.aiplatform_v1beta1.types.Schedule: @@ -1186,7 +1225,7 @@ def delete_schedule( 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]]] = (), ) -> gac_operation.Operation: r"""Deletes a Schedule. @@ -1235,8 +1274,10 @@ def sample_delete_schedule(): 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: @@ -1312,7 +1353,7 @@ def get_schedule( 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]]] = (), ) -> schedule.Schedule: r"""Gets a Schedule. @@ -1356,8 +1397,10 @@ def sample_get_schedule(): 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.aiplatform_v1beta1.types.Schedule: @@ -1417,7 +1460,7 @@ def list_schedules( 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.ListSchedulesPager: r"""Lists Schedules in a Location. @@ -1463,8 +1506,10 @@ def sample_list_schedules(): 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.aiplatform_v1beta1.services.schedule_service.pagers.ListSchedulesPager: @@ -1536,7 +1581,7 @@ def pause_schedule( 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"""Pauses a Schedule. Will mark [Schedule.state][google.cloud.aiplatform.v1beta1.Schedule.state] @@ -1581,8 +1626,10 @@ def sample_pause_schedule(): 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 @@ -1632,7 +1679,7 @@ def resume_schedule( catch_up: Optional[bool] = 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"""Resumes a paused Schedule to start scheduling new runs. Will mark @@ -1695,8 +1742,10 @@ def sample_resume_schedule(): 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 @@ -1748,7 +1797,7 @@ def update_schedule( 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]]] = (), ) -> gca_schedule.Schedule: r"""Updates an active or paused Schedule. @@ -1815,8 +1864,10 @@ def sample_update_schedule(): 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.aiplatform_v1beta1.types.Schedule: @@ -1892,7 +1943,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. @@ -1903,8 +1954,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. @@ -1945,7 +1998,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. @@ -1956,8 +2009,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. @@ -1998,7 +2053,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. @@ -2014,8 +2069,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 """ @@ -2052,7 +2109,7 @@ def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -2067,8 +2124,10 @@ def cancel_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 """ @@ -2105,7 +2164,7 @@ def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -2122,8 +2181,10 @@ def wait_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. @@ -2164,7 +2225,7 @@ def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -2177,8 +2238,10 @@ def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -2283,7 +2346,7 @@ def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -2297,8 +2360,10 @@ def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -2403,7 +2468,7 @@ def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -2418,8 +2483,10 @@ def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -2461,7 +2528,7 @@ def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -2472,8 +2539,10 @@ def get_location( 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: ~.location_pb2.Location: Location object. @@ -2514,7 +2583,7 @@ def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -2525,8 +2594,10 @@ def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1beta1/services/schedule_service/pagers.py b/google/cloud/aiplatform_v1beta1/services/schedule_service/pagers.py index f71ce81012..f32fec55c9 100644 --- a/google/cloud/aiplatform_v1beta1/services/schedule_service/pagers.py +++ b/google/cloud/aiplatform_v1beta1/services/schedule_service/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 = schedule_service.ListSchedulesRequest(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 = schedule_service.ListSchedulesRequest(request) diff --git a/google/cloud/aiplatform_v1beta1/services/schedule_service/transports/grpc.py b/google/cloud/aiplatform_v1beta1/services/schedule_service/transports/grpc.py index 6ef41f12ff..d966f7a021 100644 --- a/google/cloud/aiplatform_v1beta1/services/schedule_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1beta1/services/schedule_service/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 import warnings from typing import Callable, Dict, Optional, Sequence, Tuple, Union @@ -22,8 +25,11 @@ import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from google.cloud.aiplatform_v1beta1.types import schedule from google.cloud.aiplatform_v1beta1.types import schedule as gca_schedule @@ -35,6 +41,81 @@ from google.protobuf import empty_pb2 # type: ignore from .base import ScheduleServiceTransport, DEFAULT_CLIENT_INFO +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.aiplatform.v1beta1.ScheduleService", + "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.aiplatform.v1beta1.ScheduleService", + "rpcName": client_call_details.method, + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class ScheduleServiceGrpcTransport(ScheduleServiceTransport): """gRPC backend transport for ScheduleService. @@ -191,7 +272,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 @@ -255,7 +341,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 @@ -279,7 +367,7 @@ def create_schedule( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_schedule" not in self._stubs: - self._stubs["create_schedule"] = self.grpc_channel.unary_unary( + self._stubs["create_schedule"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.ScheduleService/CreateSchedule", request_serializer=schedule_service.CreateScheduleRequest.serialize, response_deserializer=gca_schedule.Schedule.deserialize, @@ -305,7 +393,7 @@ def delete_schedule( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_schedule" not in self._stubs: - self._stubs["delete_schedule"] = self.grpc_channel.unary_unary( + self._stubs["delete_schedule"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.ScheduleService/DeleteSchedule", request_serializer=schedule_service.DeleteScheduleRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -331,7 +419,7 @@ def get_schedule( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_schedule" not in self._stubs: - self._stubs["get_schedule"] = self.grpc_channel.unary_unary( + self._stubs["get_schedule"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.ScheduleService/GetSchedule", request_serializer=schedule_service.GetScheduleRequest.serialize, response_deserializer=schedule.Schedule.deserialize, @@ -359,7 +447,7 @@ def list_schedules( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_schedules" not in self._stubs: - self._stubs["list_schedules"] = self.grpc_channel.unary_unary( + self._stubs["list_schedules"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.ScheduleService/ListSchedules", request_serializer=schedule_service.ListSchedulesRequest.serialize, response_deserializer=schedule_service.ListSchedulesResponse.deserialize, @@ -388,7 +476,7 @@ def pause_schedule( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "pause_schedule" not in self._stubs: - self._stubs["pause_schedule"] = self.grpc_channel.unary_unary( + self._stubs["pause_schedule"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.ScheduleService/PauseSchedule", request_serializer=schedule_service.PauseScheduleRequest.serialize, response_deserializer=empty_pb2.Empty.FromString, @@ -423,7 +511,7 @@ def resume_schedule( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "resume_schedule" not in self._stubs: - self._stubs["resume_schedule"] = self.grpc_channel.unary_unary( + self._stubs["resume_schedule"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.ScheduleService/ResumeSchedule", request_serializer=schedule_service.ResumeScheduleRequest.serialize, response_deserializer=empty_pb2.Empty.FromString, @@ -455,7 +543,7 @@ def update_schedule( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_schedule" not in self._stubs: - self._stubs["update_schedule"] = self.grpc_channel.unary_unary( + self._stubs["update_schedule"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.ScheduleService/UpdateSchedule", request_serializer=schedule_service.UpdateScheduleRequest.serialize, response_deserializer=gca_schedule.Schedule.deserialize, @@ -463,7 +551,7 @@ def update_schedule( return self._stubs["update_schedule"] def close(self): - self.grpc_channel.close() + self._logged_channel.close() @property def delete_operation( @@ -475,7 +563,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, @@ -492,7 +580,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -509,7 +597,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -526,7 +614,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, @@ -545,7 +633,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, @@ -564,7 +652,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -581,7 +669,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -606,7 +694,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -632,7 +720,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -661,7 +749,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1beta1/services/schedule_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1beta1/services/schedule_service/transports/grpc_asyncio.py index 3402355565..91f61bf17d 100644 --- a/google/cloud/aiplatform_v1beta1/services/schedule_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/schedule_service/transports/grpc_asyncio.py @@ -14,6 +14,9 @@ # limitations under the License. # import inspect +import json +import pickle +import logging as std_logging import warnings from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union @@ -24,8 +27,11 @@ from google.api_core import operations_v1 from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from grpc.experimental import aio # type: ignore from google.cloud.aiplatform_v1beta1.types import schedule @@ -39,6 +45,82 @@ from .base import ScheduleServiceTransport, DEFAULT_CLIENT_INFO from .grpc import ScheduleServiceGrpcTransport +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.aiplatform.v1beta1.ScheduleService", + "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.aiplatform.v1beta1.ScheduleService", + "rpcName": str(client_call_details.method), + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class ScheduleServiceGrpcAsyncIOTransport(ScheduleServiceTransport): """gRPC AsyncIO backend transport for ScheduleService. @@ -238,10 +320,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 @@ -264,7 +349,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. @@ -291,7 +376,7 @@ def create_schedule( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_schedule" not in self._stubs: - self._stubs["create_schedule"] = self.grpc_channel.unary_unary( + self._stubs["create_schedule"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.ScheduleService/CreateSchedule", request_serializer=schedule_service.CreateScheduleRequest.serialize, response_deserializer=gca_schedule.Schedule.deserialize, @@ -319,7 +404,7 @@ def delete_schedule( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_schedule" not in self._stubs: - self._stubs["delete_schedule"] = self.grpc_channel.unary_unary( + self._stubs["delete_schedule"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.ScheduleService/DeleteSchedule", request_serializer=schedule_service.DeleteScheduleRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -345,7 +430,7 @@ def get_schedule( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_schedule" not in self._stubs: - self._stubs["get_schedule"] = self.grpc_channel.unary_unary( + self._stubs["get_schedule"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.ScheduleService/GetSchedule", request_serializer=schedule_service.GetScheduleRequest.serialize, response_deserializer=schedule.Schedule.deserialize, @@ -374,7 +459,7 @@ def list_schedules( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_schedules" not in self._stubs: - self._stubs["list_schedules"] = self.grpc_channel.unary_unary( + self._stubs["list_schedules"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.ScheduleService/ListSchedules", request_serializer=schedule_service.ListSchedulesRequest.serialize, response_deserializer=schedule_service.ListSchedulesResponse.deserialize, @@ -403,7 +488,7 @@ def pause_schedule( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "pause_schedule" not in self._stubs: - self._stubs["pause_schedule"] = self.grpc_channel.unary_unary( + self._stubs["pause_schedule"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.ScheduleService/PauseSchedule", request_serializer=schedule_service.PauseScheduleRequest.serialize, response_deserializer=empty_pb2.Empty.FromString, @@ -438,7 +523,7 @@ def resume_schedule( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "resume_schedule" not in self._stubs: - self._stubs["resume_schedule"] = self.grpc_channel.unary_unary( + self._stubs["resume_schedule"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.ScheduleService/ResumeSchedule", request_serializer=schedule_service.ResumeScheduleRequest.serialize, response_deserializer=empty_pb2.Empty.FromString, @@ -472,7 +557,7 @@ def update_schedule( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_schedule" not in self._stubs: - self._stubs["update_schedule"] = self.grpc_channel.unary_unary( + self._stubs["update_schedule"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.ScheduleService/UpdateSchedule", request_serializer=schedule_service.UpdateScheduleRequest.serialize, response_deserializer=gca_schedule.Schedule.deserialize, @@ -575,7 +660,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: @@ -591,7 +676,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, @@ -608,7 +693,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -625,7 +710,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -642,7 +727,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, @@ -661,7 +746,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, @@ -680,7 +765,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -697,7 +782,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -722,7 +807,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -748,7 +833,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -777,7 +862,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1beta1/services/schedule_service/transports/rest.py b/google/cloud/aiplatform_v1beta1/services/schedule_service/transports/rest.py index 896541ef00..43445b1a1c 100644 --- a/google/cloud/aiplatform_v1beta1/services/schedule_service/transports/rest.py +++ b/google/cloud/aiplatform_v1beta1/services/schedule_service/transports/rest.py @@ -13,9 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging +import json # type: ignore from google.auth.transport.requests import AuthorizedSession # type: ignore -import json # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.api_core import exceptions as core_exceptions from google.api_core import retry as retries @@ -50,6 +51,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, @@ -130,8 +139,10 @@ def post_update_schedule(self, response): def pre_create_schedule( self, request: schedule_service.CreateScheduleRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[schedule_service.CreateScheduleRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + schedule_service.CreateScheduleRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for create_schedule Override in a subclass to manipulate the request or metadata @@ -153,8 +164,10 @@ def post_create_schedule( def pre_delete_schedule( self, request: schedule_service.DeleteScheduleRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[schedule_service.DeleteScheduleRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + schedule_service.DeleteScheduleRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for delete_schedule Override in a subclass to manipulate the request or metadata @@ -176,8 +189,10 @@ def post_delete_schedule( def pre_get_schedule( self, request: schedule_service.GetScheduleRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[schedule_service.GetScheduleRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + schedule_service.GetScheduleRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_schedule Override in a subclass to manipulate the request or metadata @@ -197,8 +212,10 @@ def post_get_schedule(self, response: schedule.Schedule) -> schedule.Schedule: def pre_list_schedules( self, request: schedule_service.ListSchedulesRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[schedule_service.ListSchedulesRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + schedule_service.ListSchedulesRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_schedules Override in a subclass to manipulate the request or metadata @@ -220,8 +237,10 @@ def post_list_schedules( def pre_pause_schedule( self, request: schedule_service.PauseScheduleRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[schedule_service.PauseScheduleRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + schedule_service.PauseScheduleRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for pause_schedule Override in a subclass to manipulate the request or metadata @@ -232,8 +251,10 @@ def pre_pause_schedule( def pre_resume_schedule( self, request: schedule_service.ResumeScheduleRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[schedule_service.ResumeScheduleRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + schedule_service.ResumeScheduleRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for resume_schedule Override in a subclass to manipulate the request or metadata @@ -244,8 +265,10 @@ def pre_resume_schedule( def pre_update_schedule( self, request: schedule_service.UpdateScheduleRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[schedule_service.UpdateScheduleRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + schedule_service.UpdateScheduleRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for update_schedule Override in a subclass to manipulate the request or metadata @@ -267,8 +290,10 @@ def post_update_schedule( def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -290,8 +315,10 @@ def post_get_location( def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -313,8 +340,10 @@ def post_list_locations( def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -334,8 +363,10 @@ def post_get_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -355,8 +386,11 @@ def post_set_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -378,8 +412,10 @@ def post_test_iam_permissions( def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -399,8 +435,10 @@ def post_cancel_operation(self, response: None) -> None: 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 @@ -420,8 +458,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 @@ -443,8 +483,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 @@ -466,8 +508,10 @@ def post_list_operations( def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -1149,6 +1193,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -1365,6 +1413,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -1571,6 +1623,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}", @@ -1787,6 +1843,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, ], "google.longrunning.Operations.ListOperations": [ { @@ -1985,6 +2045,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*}/operations", @@ -2201,6 +2265,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*}/operations", + }, ], "google.longrunning.Operations.WaitOperation": [ { @@ -2399,6 +2467,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "post", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}:wait", @@ -2611,6 +2683,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, ], } @@ -2666,7 +2742,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]]] = (), ) -> gca_schedule.Schedule: r"""Call the create schedule method over HTTP. @@ -2677,8 +2753,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: ~.gca_schedule.Schedule: @@ -2692,6 +2770,7 @@ def __call__( http_options = ( _BaseScheduleServiceRestTransport._BaseCreateSchedule._get_http_options() ) + request, metadata = self._interceptor.pre_create_schedule(request, metadata) transcoded_request = _BaseScheduleServiceRestTransport._BaseCreateSchedule._get_transcoded_request( http_options, request @@ -2706,6 +2785,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.aiplatform_v1beta1.ScheduleServiceClient.CreateSchedule", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ScheduleService", + "rpcName": "CreateSchedule", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ScheduleServiceRestTransport._CreateSchedule._get_response( self._host, @@ -2727,7 +2833,29 @@ def __call__( pb_resp = gca_schedule.Schedule.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_create_schedule(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gca_schedule.Schedule.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.aiplatform_v1beta1.ScheduleServiceClient.create_schedule", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ScheduleService", + "rpcName": "CreateSchedule", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _DeleteSchedule( @@ -2765,7 +2893,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 schedule method over HTTP. @@ -2776,8 +2904,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: @@ -2790,6 +2920,7 @@ def __call__( http_options = ( _BaseScheduleServiceRestTransport._BaseDeleteSchedule._get_http_options() ) + request, metadata = self._interceptor.pre_delete_schedule(request, metadata) transcoded_request = _BaseScheduleServiceRestTransport._BaseDeleteSchedule._get_transcoded_request( http_options, request @@ -2800,6 +2931,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.aiplatform_v1beta1.ScheduleServiceClient.DeleteSchedule", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ScheduleService", + "rpcName": "DeleteSchedule", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ScheduleServiceRestTransport._DeleteSchedule._get_response( self._host, @@ -2818,7 +2976,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_schedule(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.aiplatform_v1beta1.ScheduleServiceClient.delete_schedule", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ScheduleService", + "rpcName": "DeleteSchedule", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _GetSchedule( @@ -2856,7 +3036,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]]] = (), ) -> schedule.Schedule: r"""Call the get schedule method over HTTP. @@ -2867,8 +3047,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: ~.schedule.Schedule: @@ -2882,6 +3064,7 @@ def __call__( http_options = ( _BaseScheduleServiceRestTransport._BaseGetSchedule._get_http_options() ) + request, metadata = self._interceptor.pre_get_schedule(request, metadata) transcoded_request = _BaseScheduleServiceRestTransport._BaseGetSchedule._get_transcoded_request( http_options, request @@ -2892,6 +3075,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.aiplatform_v1beta1.ScheduleServiceClient.GetSchedule", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ScheduleService", + "rpcName": "GetSchedule", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ScheduleServiceRestTransport._GetSchedule._get_response( self._host, @@ -2912,7 +3122,29 @@ def __call__( pb_resp = schedule.Schedule.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_schedule(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = schedule.Schedule.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.aiplatform_v1beta1.ScheduleServiceClient.get_schedule", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ScheduleService", + "rpcName": "GetSchedule", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListSchedules( @@ -2950,7 +3182,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]]] = (), ) -> schedule_service.ListSchedulesResponse: r"""Call the list schedules method over HTTP. @@ -2961,8 +3193,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: ~.schedule_service.ListSchedulesResponse: @@ -2974,6 +3208,7 @@ def __call__( http_options = ( _BaseScheduleServiceRestTransport._BaseListSchedules._get_http_options() ) + request, metadata = self._interceptor.pre_list_schedules(request, metadata) transcoded_request = _BaseScheduleServiceRestTransport._BaseListSchedules._get_transcoded_request( http_options, request @@ -2984,6 +3219,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.aiplatform_v1beta1.ScheduleServiceClient.ListSchedules", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ScheduleService", + "rpcName": "ListSchedules", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ScheduleServiceRestTransport._ListSchedules._get_response( self._host, @@ -3004,7 +3266,31 @@ def __call__( pb_resp = schedule_service.ListSchedulesResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_schedules(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = schedule_service.ListSchedulesResponse.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.aiplatform_v1beta1.ScheduleServiceClient.list_schedules", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ScheduleService", + "rpcName": "ListSchedules", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _PauseSchedule( @@ -3043,7 +3329,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 pause schedule method over HTTP. @@ -3054,13 +3340,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 = ( _BaseScheduleServiceRestTransport._BasePauseSchedule._get_http_options() ) + request, metadata = self._interceptor.pre_pause_schedule(request, metadata) transcoded_request = _BaseScheduleServiceRestTransport._BasePauseSchedule._get_transcoded_request( http_options, request @@ -3075,6 +3364,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.aiplatform_v1beta1.ScheduleServiceClient.PauseSchedule", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ScheduleService", + "rpcName": "PauseSchedule", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ScheduleServiceRestTransport._PauseSchedule._get_response( self._host, @@ -3127,7 +3443,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 resume schedule method over HTTP. @@ -3138,13 +3454,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 = ( _BaseScheduleServiceRestTransport._BaseResumeSchedule._get_http_options() ) + request, metadata = self._interceptor.pre_resume_schedule(request, metadata) transcoded_request = _BaseScheduleServiceRestTransport._BaseResumeSchedule._get_transcoded_request( http_options, request @@ -3159,6 +3478,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.aiplatform_v1beta1.ScheduleServiceClient.ResumeSchedule", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ScheduleService", + "rpcName": "ResumeSchedule", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ScheduleServiceRestTransport._ResumeSchedule._get_response( self._host, @@ -3211,7 +3557,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]]] = (), ) -> gca_schedule.Schedule: r"""Call the update schedule method over HTTP. @@ -3222,8 +3568,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: ~.gca_schedule.Schedule: @@ -3237,6 +3585,7 @@ def __call__( http_options = ( _BaseScheduleServiceRestTransport._BaseUpdateSchedule._get_http_options() ) + request, metadata = self._interceptor.pre_update_schedule(request, metadata) transcoded_request = _BaseScheduleServiceRestTransport._BaseUpdateSchedule._get_transcoded_request( http_options, request @@ -3251,6 +3600,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.aiplatform_v1beta1.ScheduleServiceClient.UpdateSchedule", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ScheduleService", + "rpcName": "UpdateSchedule", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ScheduleServiceRestTransport._UpdateSchedule._get_response( self._host, @@ -3272,7 +3648,29 @@ def __call__( pb_resp = gca_schedule.Schedule.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_update_schedule(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gca_schedule.Schedule.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.aiplatform_v1beta1.ScheduleServiceClient.update_schedule", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ScheduleService", + "rpcName": "UpdateSchedule", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp @property @@ -3372,7 +3770,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]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -3383,8 +3781,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: locations_pb2.Location: Response from GetLocation method. @@ -3393,6 +3793,7 @@ def __call__( http_options = ( _BaseScheduleServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = self._interceptor.pre_get_location(request, metadata) transcoded_request = _BaseScheduleServiceRestTransport._BaseGetLocation._get_transcoded_request( http_options, request @@ -3403,6 +3804,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.aiplatform_v1beta1.ScheduleServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ScheduleService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ScheduleServiceRestTransport._GetLocation._get_response( self._host, @@ -3422,6 +3850,27 @@ def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_location(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.aiplatform_v1beta1.ScheduleServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ScheduleService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3463,7 +3912,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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -3474,8 +3923,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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -3484,6 +3935,7 @@ def __call__( http_options = ( _BaseScheduleServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = self._interceptor.pre_list_locations(request, metadata) transcoded_request = _BaseScheduleServiceRestTransport._BaseListLocations._get_transcoded_request( http_options, request @@ -3494,6 +3946,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.aiplatform_v1beta1.ScheduleServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ScheduleService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ScheduleServiceRestTransport._ListLocations._get_response( self._host, @@ -3513,6 +3992,27 @@ def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_list_locations(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.aiplatform_v1beta1.ScheduleServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ScheduleService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3555,7 +4055,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]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -3566,8 +4066,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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -3576,6 +4078,7 @@ def __call__( http_options = ( _BaseScheduleServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_get_iam_policy(request, metadata) transcoded_request = _BaseScheduleServiceRestTransport._BaseGetIamPolicy._get_transcoded_request( http_options, request @@ -3590,6 +4093,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.aiplatform_v1beta1.ScheduleServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ScheduleService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ScheduleServiceRestTransport._GetIamPolicy._get_response( self._host, @@ -3610,6 +4140,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_iam_policy(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.aiplatform_v1beta1.ScheduleServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ScheduleService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3652,7 +4203,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]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -3663,8 +4214,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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -3673,6 +4226,7 @@ def __call__( http_options = ( _BaseScheduleServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_set_iam_policy(request, metadata) transcoded_request = _BaseScheduleServiceRestTransport._BaseSetIamPolicy._get_transcoded_request( http_options, request @@ -3687,6 +4241,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.aiplatform_v1beta1.ScheduleServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ScheduleService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ScheduleServiceRestTransport._SetIamPolicy._get_response( self._host, @@ -3707,6 +4288,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_set_iam_policy(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.aiplatform_v1beta1.ScheduleServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ScheduleService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3750,7 +4352,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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -3761,8 +4363,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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -3771,6 +4375,7 @@ def __call__( http_options = ( _BaseScheduleServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -3787,6 +4392,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.aiplatform_v1beta1.ScheduleServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ScheduleService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ScheduleServiceRestTransport._TestIamPermissions._get_response( self._host, @@ -3807,6 +4439,27 @@ def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_test_iam_permissions(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.aiplatform_v1beta1.ScheduleServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ScheduleService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3848,7 +4501,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 cancel operation method over HTTP. @@ -3859,13 +4512,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 = ( _BaseScheduleServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = self._interceptor.pre_cancel_operation( request, metadata ) @@ -3878,6 +4534,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.aiplatform_v1beta1.ScheduleServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ScheduleService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ScheduleServiceRestTransport._CancelOperation._get_response( self._host, @@ -3934,7 +4617,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. @@ -3945,13 +4628,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 = ( _BaseScheduleServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = self._interceptor.pre_delete_operation( request, metadata ) @@ -3964,6 +4650,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.aiplatform_v1beta1.ScheduleServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ScheduleService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ScheduleServiceRestTransport._DeleteOperation._get_response( self._host, @@ -4020,7 +4733,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. @@ -4031,8 +4744,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. @@ -4041,6 +4756,7 @@ def __call__( http_options = ( _BaseScheduleServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = self._interceptor.pre_get_operation(request, metadata) transcoded_request = _BaseScheduleServiceRestTransport._BaseGetOperation._get_transcoded_request( http_options, request @@ -4051,6 +4767,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.aiplatform_v1beta1.ScheduleServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ScheduleService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ScheduleServiceRestTransport._GetOperation._get_response( self._host, @@ -4070,6 +4813,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.aiplatform_v1beta1.ScheduleServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ScheduleService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4111,7 +4875,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. @@ -4122,8 +4886,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. @@ -4132,6 +4898,7 @@ def __call__( http_options = ( _BaseScheduleServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = self._interceptor.pre_list_operations(request, metadata) transcoded_request = _BaseScheduleServiceRestTransport._BaseListOperations._get_transcoded_request( http_options, request @@ -4142,6 +4909,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.aiplatform_v1beta1.ScheduleServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ScheduleService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ScheduleServiceRestTransport._ListOperations._get_response( self._host, @@ -4161,6 +4955,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.aiplatform_v1beta1.ScheduleServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ScheduleService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4202,7 +5017,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 wait operation method over HTTP. @@ -4213,8 +5028,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 WaitOperation method. @@ -4223,6 +5040,7 @@ def __call__( http_options = ( _BaseScheduleServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = self._interceptor.pre_wait_operation(request, metadata) transcoded_request = _BaseScheduleServiceRestTransport._BaseWaitOperation._get_transcoded_request( http_options, request @@ -4233,6 +5051,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.aiplatform_v1beta1.ScheduleServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ScheduleService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ScheduleServiceRestTransport._WaitOperation._get_response( self._host, @@ -4252,6 +5097,27 @@ def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = self._interceptor.post_wait_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.aiplatform_v1beta1.ScheduleServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ScheduleService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1beta1/services/schedule_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1beta1/services/schedule_service/transports/rest_asyncio.py index 3f4132de81..b9dbfde87a 100644 --- a/google/cloud/aiplatform_v1beta1/services/schedule_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/schedule_service/transports/rest_asyncio.py @@ -61,6 +61,18 @@ from .base import DEFAULT_CLIENT_INFO as BASE_DEFAULT_CLIENT_INFO + +import logging + +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__) + try: OptionalRetry = Union[retries.AsyncRetry, gapic_v1.method._MethodDefault, None] except AttributeError: # pragma: NO COVER @@ -145,8 +157,10 @@ async def post_update_schedule(self, response): async def pre_create_schedule( self, request: schedule_service.CreateScheduleRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[schedule_service.CreateScheduleRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + schedule_service.CreateScheduleRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for create_schedule Override in a subclass to manipulate the request or metadata @@ -168,8 +182,10 @@ async def post_create_schedule( async def pre_delete_schedule( self, request: schedule_service.DeleteScheduleRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[schedule_service.DeleteScheduleRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + schedule_service.DeleteScheduleRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for delete_schedule Override in a subclass to manipulate the request or metadata @@ -191,8 +207,10 @@ async def post_delete_schedule( async def pre_get_schedule( self, request: schedule_service.GetScheduleRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[schedule_service.GetScheduleRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + schedule_service.GetScheduleRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_schedule Override in a subclass to manipulate the request or metadata @@ -212,8 +230,10 @@ async def post_get_schedule(self, response: schedule.Schedule) -> schedule.Sched async def pre_list_schedules( self, request: schedule_service.ListSchedulesRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[schedule_service.ListSchedulesRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + schedule_service.ListSchedulesRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_schedules Override in a subclass to manipulate the request or metadata @@ -235,8 +255,10 @@ async def post_list_schedules( async def pre_pause_schedule( self, request: schedule_service.PauseScheduleRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[schedule_service.PauseScheduleRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + schedule_service.PauseScheduleRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for pause_schedule Override in a subclass to manipulate the request or metadata @@ -247,8 +269,10 @@ async def pre_pause_schedule( async def pre_resume_schedule( self, request: schedule_service.ResumeScheduleRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[schedule_service.ResumeScheduleRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + schedule_service.ResumeScheduleRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for resume_schedule Override in a subclass to manipulate the request or metadata @@ -259,8 +283,10 @@ async def pre_resume_schedule( async def pre_update_schedule( self, request: schedule_service.UpdateScheduleRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[schedule_service.UpdateScheduleRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + schedule_service.UpdateScheduleRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for update_schedule Override in a subclass to manipulate the request or metadata @@ -282,8 +308,10 @@ async def post_update_schedule( async def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -305,8 +333,10 @@ async def post_get_location( async def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -328,8 +358,10 @@ async def post_list_locations( async def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -351,8 +383,10 @@ async def post_get_iam_policy( async def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -374,8 +408,11 @@ async def post_set_iam_policy( async def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -397,8 +434,10 @@ async def post_test_iam_permissions( async def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -418,8 +457,10 @@ async def post_cancel_operation(self, response: None) -> None: async 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 @@ -439,8 +480,10 @@ async def post_delete_operation(self, response: None) -> None: async 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 @@ -462,8 +505,10 @@ async def post_get_operation( async 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 @@ -485,8 +530,10 @@ async def post_list_operations( async def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -704,7 +751,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> gca_schedule.Schedule: r"""Call the create schedule method over HTTP. @@ -715,8 +762,10 @@ async def __call__( 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: ~.gca_schedule.Schedule: @@ -730,6 +779,7 @@ async def __call__( http_options = ( _BaseScheduleServiceRestTransport._BaseCreateSchedule._get_http_options() ) + request, metadata = await self._interceptor.pre_create_schedule( request, metadata ) @@ -746,6 +796,33 @@ async 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.aiplatform_v1beta1.ScheduleServiceClient.CreateSchedule", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ScheduleService", + "rpcName": "CreateSchedule", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncScheduleServiceRestTransport._CreateSchedule._get_response( @@ -776,6 +853,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_create_schedule(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gca_schedule.Schedule.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.ScheduleServiceAsyncClient.create_schedule", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ScheduleService", + "rpcName": "CreateSchedule", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _DeleteSchedule( @@ -814,7 +913,7 @@ async 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 schedule method over HTTP. @@ -825,8 +924,10 @@ async def __call__( 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: @@ -839,6 +940,7 @@ async def __call__( http_options = ( _BaseScheduleServiceRestTransport._BaseDeleteSchedule._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_schedule( request, metadata ) @@ -851,6 +953,33 @@ async 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.aiplatform_v1beta1.ScheduleServiceClient.DeleteSchedule", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ScheduleService", + "rpcName": "DeleteSchedule", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncScheduleServiceRestTransport._DeleteSchedule._get_response( @@ -880,6 +1009,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_delete_schedule(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.ScheduleServiceAsyncClient.delete_schedule", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ScheduleService", + "rpcName": "DeleteSchedule", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _GetSchedule( @@ -917,7 +1068,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> schedule.Schedule: r"""Call the get schedule method over HTTP. @@ -928,8 +1079,10 @@ async def __call__( 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: ~.schedule.Schedule: @@ -943,6 +1096,7 @@ async def __call__( http_options = ( _BaseScheduleServiceRestTransport._BaseGetSchedule._get_http_options() ) + request, metadata = await self._interceptor.pre_get_schedule( request, metadata ) @@ -955,6 +1109,33 @@ async 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.aiplatform_v1beta1.ScheduleServiceClient.GetSchedule", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ScheduleService", + "rpcName": "GetSchedule", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncScheduleServiceRestTransport._GetSchedule._get_response( @@ -984,6 +1165,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_get_schedule(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = schedule.Schedule.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.ScheduleServiceAsyncClient.get_schedule", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ScheduleService", + "rpcName": "GetSchedule", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ListSchedules( @@ -1022,7 +1225,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> schedule_service.ListSchedulesResponse: r"""Call the list schedules method over HTTP. @@ -1033,8 +1236,10 @@ async def __call__( 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: ~.schedule_service.ListSchedulesResponse: @@ -1046,6 +1251,7 @@ async def __call__( http_options = ( _BaseScheduleServiceRestTransport._BaseListSchedules._get_http_options() ) + request, metadata = await self._interceptor.pre_list_schedules( request, metadata ) @@ -1058,6 +1264,33 @@ async 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.aiplatform_v1beta1.ScheduleServiceClient.ListSchedules", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ScheduleService", + "rpcName": "ListSchedules", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncScheduleServiceRestTransport._ListSchedules._get_response( @@ -1087,6 +1320,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_list_schedules(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = schedule_service.ListSchedulesResponse.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.ScheduleServiceAsyncClient.list_schedules", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ScheduleService", + "rpcName": "ListSchedules", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _PauseSchedule( @@ -1126,7 +1383,7 @@ async 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 pause schedule method over HTTP. @@ -1137,13 +1394,16 @@ async def __call__( 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`. """ http_options = ( _BaseScheduleServiceRestTransport._BasePauseSchedule._get_http_options() ) + request, metadata = await self._interceptor.pre_pause_schedule( request, metadata ) @@ -1160,6 +1420,33 @@ async 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.aiplatform_v1beta1.ScheduleServiceClient.PauseSchedule", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ScheduleService", + "rpcName": "PauseSchedule", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncScheduleServiceRestTransport._PauseSchedule._get_response( @@ -1221,7 +1508,7 @@ async 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 resume schedule method over HTTP. @@ -1232,13 +1519,16 @@ async def __call__( 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`. """ http_options = ( _BaseScheduleServiceRestTransport._BaseResumeSchedule._get_http_options() ) + request, metadata = await self._interceptor.pre_resume_schedule( request, metadata ) @@ -1255,6 +1545,33 @@ async 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.aiplatform_v1beta1.ScheduleServiceClient.ResumeSchedule", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ScheduleService", + "rpcName": "ResumeSchedule", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncScheduleServiceRestTransport._ResumeSchedule._get_response( @@ -1316,7 +1633,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> gca_schedule.Schedule: r"""Call the update schedule method over HTTP. @@ -1327,8 +1644,10 @@ async def __call__( 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: ~.gca_schedule.Schedule: @@ -1342,6 +1661,7 @@ async def __call__( http_options = ( _BaseScheduleServiceRestTransport._BaseUpdateSchedule._get_http_options() ) + request, metadata = await self._interceptor.pre_update_schedule( request, metadata ) @@ -1358,6 +1678,33 @@ async 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.aiplatform_v1beta1.ScheduleServiceClient.UpdateSchedule", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ScheduleService", + "rpcName": "UpdateSchedule", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncScheduleServiceRestTransport._UpdateSchedule._get_response( @@ -1388,6 +1735,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_update_schedule(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gca_schedule.Schedule.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.ScheduleServiceAsyncClient.update_schedule", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ScheduleService", + "rpcName": "UpdateSchedule", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp @property @@ -1963,6 +2332,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -2179,6 +2552,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -2385,6 +2762,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}", @@ -2601,6 +2982,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, ], "google.longrunning.Operations.ListOperations": [ { @@ -2799,6 +3184,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*}/operations", @@ -3015,6 +3404,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*}/operations", + }, ], "google.longrunning.Operations.WaitOperation": [ { @@ -3213,6 +3606,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "post", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}:wait", @@ -3425,6 +3822,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, ], } @@ -3526,7 +3927,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -3537,8 +3938,10 @@ async def __call__( 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: locations_pb2.Location: Response from GetLocation method. @@ -3547,6 +3950,7 @@ async def __call__( http_options = ( _BaseScheduleServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_location( request, metadata ) @@ -3559,6 +3963,33 @@ async 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.aiplatform_v1beta1.ScheduleServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ScheduleService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncScheduleServiceRestTransport._GetLocation._get_response( @@ -3586,6 +4017,27 @@ async def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_location(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.aiplatform_v1beta1.ScheduleServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ScheduleService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3628,7 +4080,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -3639,8 +4091,10 @@ async def __call__( 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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -3649,6 +4103,7 @@ async def __call__( http_options = ( _BaseScheduleServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_locations( request, metadata ) @@ -3661,6 +4116,33 @@ async 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.aiplatform_v1beta1.ScheduleServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ScheduleService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncScheduleServiceRestTransport._ListLocations._get_response( @@ -3688,6 +4170,27 @@ async def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_list_locations(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.aiplatform_v1beta1.ScheduleServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ScheduleService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3731,7 +4234,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -3742,8 +4245,10 @@ async def __call__( 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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -3752,6 +4257,7 @@ async def __call__( http_options = ( _BaseScheduleServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_get_iam_policy( request, metadata ) @@ -3768,6 +4274,33 @@ async 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.aiplatform_v1beta1.ScheduleServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ScheduleService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncScheduleServiceRestTransport._GetIamPolicy._get_response( @@ -3796,6 +4329,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_iam_policy(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.aiplatform_v1beta1.ScheduleServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ScheduleService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3839,7 +4393,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -3850,8 +4404,10 @@ async def __call__( 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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -3860,6 +4416,7 @@ async def __call__( http_options = ( _BaseScheduleServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_set_iam_policy( request, metadata ) @@ -3876,6 +4433,33 @@ async 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.aiplatform_v1beta1.ScheduleServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ScheduleService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncScheduleServiceRestTransport._SetIamPolicy._get_response( @@ -3904,6 +4488,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_set_iam_policy(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.aiplatform_v1beta1.ScheduleServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ScheduleService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3947,7 +4552,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -3958,8 +4563,10 @@ async def __call__( 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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -3968,6 +4575,7 @@ async def __call__( http_options = ( _BaseScheduleServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = await self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -3984,6 +4592,33 @@ async 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.aiplatform_v1beta1.ScheduleServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ScheduleService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncScheduleServiceRestTransport._TestIamPermissions._get_response( self._host, @@ -4010,6 +4645,27 @@ async def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_test_iam_permissions(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.aiplatform_v1beta1.ScheduleServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ScheduleService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4052,7 +4708,7 @@ async 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 cancel operation method over HTTP. @@ -4063,13 +4719,16 @@ async def __call__( 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`. """ http_options = ( _BaseScheduleServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_cancel_operation( request, metadata ) @@ -4082,6 +4741,33 @@ async 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.aiplatform_v1beta1.ScheduleServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ScheduleService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncScheduleServiceRestTransport._CancelOperation._get_response( @@ -4147,7 +4833,7 @@ async 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. @@ -4158,13 +4844,16 @@ async def __call__( 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`. """ http_options = ( _BaseScheduleServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_operation( request, metadata ) @@ -4177,6 +4866,33 @@ async 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.aiplatform_v1beta1.ScheduleServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ScheduleService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncScheduleServiceRestTransport._DeleteOperation._get_response( @@ -4242,7 +4958,7 @@ async 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. @@ -4253,8 +4969,10 @@ async def __call__( 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: Response from GetOperation method. @@ -4263,6 +4981,7 @@ async def __call__( http_options = ( _BaseScheduleServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_operation( request, metadata ) @@ -4275,6 +4994,33 @@ async 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.aiplatform_v1beta1.ScheduleServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ScheduleService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncScheduleServiceRestTransport._GetOperation._get_response( @@ -4302,6 +5048,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1beta1.ScheduleServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ScheduleService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4344,7 +5111,7 @@ async 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. @@ -4355,8 +5122,10 @@ async def __call__( 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 from ListOperations method. @@ -4365,6 +5134,7 @@ async def __call__( http_options = ( _BaseScheduleServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_operations( request, metadata ) @@ -4377,6 +5147,33 @@ async 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.aiplatform_v1beta1.ScheduleServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ScheduleService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncScheduleServiceRestTransport._ListOperations._get_response( @@ -4404,6 +5201,27 @@ async def __call__( resp = operations_pb2.ListOperationsResponse() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1beta1.ScheduleServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ScheduleService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4446,7 +5264,7 @@ async 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 wait operation method over HTTP. @@ -4457,8 +5275,10 @@ async def __call__( 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: Response from WaitOperation method. @@ -4467,6 +5287,7 @@ async def __call__( http_options = ( _BaseScheduleServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_wait_operation( request, metadata ) @@ -4479,6 +5300,33 @@ async 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.aiplatform_v1beta1.ScheduleServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ScheduleService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncScheduleServiceRestTransport._WaitOperation._get_response( @@ -4506,6 +5354,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_wait_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.aiplatform_v1beta1.ScheduleServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.ScheduleService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1beta1/services/schedule_service/transports/rest_base.py b/google/cloud/aiplatform_v1beta1/services/schedule_service/transports/rest_base.py index 5f28d4d79f..fc61126a3c 100644 --- a/google/cloud/aiplatform_v1beta1/services/schedule_service/transports/rest_base.py +++ b/google/cloud/aiplatform_v1beta1/services/schedule_service/transports/rest_base.py @@ -1383,6 +1383,10 @@ def _get_http_options(): "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -1599,6 +1603,10 @@ def _get_http_options(): "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -1824,6 +1832,10 @@ def _get_http_options(): "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}", @@ -2040,6 +2052,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, ] return http_options @@ -2257,6 +2273,10 @@ def _get_http_options(): "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*}/operations", @@ -2473,6 +2493,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*}/operations", + }, ] return http_options @@ -2690,6 +2714,10 @@ def _get_http_options(): "method": "post", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}:wait", @@ -2902,6 +2930,10 @@ def _get_http_options(): "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, ] return http_options diff --git a/google/cloud/aiplatform_v1beta1/services/specialist_pool_service/async_client.py b/google/cloud/aiplatform_v1beta1/services/specialist_pool_service/async_client.py index 665220809f..e3b7a4e96c 100644 --- a/google/cloud/aiplatform_v1beta1/services/specialist_pool_service/async_client.py +++ b/google/cloud/aiplatform_v1beta1/services/specialist_pool_service/async_client.py @@ -13,6 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging as std_logging from collections import OrderedDict import re from typing import ( @@ -60,6 +61,15 @@ from .transports.grpc_asyncio import SpecialistPoolServiceGrpcAsyncIOTransport from .client import SpecialistPoolServiceClient +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 SpecialistPoolServiceAsyncClient: """A service for creating and managing Customer SpecialistPools. @@ -281,6 +291,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.aiplatform_v1beta1.SpecialistPoolServiceAsyncClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.SpecialistPoolService", + "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.aiplatform.v1beta1.SpecialistPoolService", + "credentialsType": None, + }, + ) + async def create_specialist_pool( self, request: Optional[ @@ -291,7 +323,7 @@ async def create_specialist_pool( specialist_pool: Optional[gca_specialist_pool.SpecialistPool] = 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"""Creates a SpecialistPool. @@ -352,8 +384,10 @@ async def sample_create_specialist_pool(): 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: @@ -434,7 +468,7 @@ async def get_specialist_pool( 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]]] = (), ) -> specialist_pool.SpecialistPool: r"""Gets a SpecialistPool. @@ -479,8 +513,10 @@ async def sample_get_specialist_pool(): 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.aiplatform_v1beta1.types.SpecialistPool: @@ -553,7 +589,7 @@ async def list_specialist_pools( 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.ListSpecialistPoolsAsyncPager: r"""Lists SpecialistPools in a Location. @@ -599,8 +635,10 @@ async def sample_list_specialist_pools(): 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.aiplatform_v1beta1.services.specialist_pool_service.pagers.ListSpecialistPoolsAsyncPager: @@ -677,7 +715,7 @@ async def delete_specialist_pool( 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"""Deletes a SpecialistPool as well as all Specialists in the pool. @@ -727,8 +765,10 @@ async def sample_delete_specialist_pool(): 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: @@ -810,7 +850,7 @@ async def update_specialist_pool( 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"""Updates a SpecialistPool. @@ -869,8 +909,10 @@ async def sample_update_specialist_pool(): 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: @@ -950,7 +992,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. @@ -961,8 +1003,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. @@ -1003,7 +1047,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. @@ -1014,8 +1058,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. @@ -1056,7 +1102,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. @@ -1072,8 +1118,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 """ @@ -1110,7 +1158,7 @@ async def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -1125,8 +1173,10 @@ async def cancel_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 """ @@ -1163,7 +1213,7 @@ async def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -1180,8 +1230,10 @@ async def wait_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. @@ -1222,7 +1274,7 @@ async def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -1235,8 +1287,10 @@ async def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -1341,7 +1395,7 @@ async def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -1355,8 +1409,10 @@ async def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -1461,7 +1517,7 @@ async def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -1476,8 +1532,10 @@ async def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -1521,7 +1579,7 @@ async def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -1532,8 +1590,10 @@ async def get_location( 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: ~.location_pb2.Location: Location object. @@ -1574,7 +1634,7 @@ async def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -1585,8 +1645,10 @@ async def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1beta1/services/specialist_pool_service/client.py b/google/cloud/aiplatform_v1beta1/services/specialist_pool_service/client.py index b480cb7cfa..c448e2dd57 100644 --- a/google/cloud/aiplatform_v1beta1/services/specialist_pool_service/client.py +++ b/google/cloud/aiplatform_v1beta1/services/specialist_pool_service/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 ( @@ -48,6 +49,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 as gac_operation # type: ignore from google.api_core import operation_async # type: ignore from google.cloud.aiplatform_v1beta1.services.specialist_pool_service import pagers @@ -614,6 +624,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( @@ -705,6 +719,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.aiplatform_v1beta1.SpecialistPoolServiceClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.SpecialistPoolService", + "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.aiplatform.v1beta1.SpecialistPoolService", + "credentialsType": None, + }, + ) + def create_specialist_pool( self, request: Optional[ @@ -715,7 +752,7 @@ def create_specialist_pool( specialist_pool: Optional[gca_specialist_pool.SpecialistPool] = 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]]] = (), ) -> gac_operation.Operation: r"""Creates a SpecialistPool. @@ -776,8 +813,10 @@ def sample_create_specialist_pool(): 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: @@ -855,7 +894,7 @@ def get_specialist_pool( 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]]] = (), ) -> specialist_pool.SpecialistPool: r"""Gets a SpecialistPool. @@ -900,8 +939,10 @@ def sample_get_specialist_pool(): 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.aiplatform_v1beta1.types.SpecialistPool: @@ -971,7 +1012,7 @@ def list_specialist_pools( 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.ListSpecialistPoolsPager: r"""Lists SpecialistPools in a Location. @@ -1017,8 +1058,10 @@ def sample_list_specialist_pools(): 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.aiplatform_v1beta1.services.specialist_pool_service.pagers.ListSpecialistPoolsPager: @@ -1092,7 +1135,7 @@ def delete_specialist_pool( 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]]] = (), ) -> gac_operation.Operation: r"""Deletes a SpecialistPool as well as all Specialists in the pool. @@ -1142,8 +1185,10 @@ def sample_delete_specialist_pool(): 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: @@ -1222,7 +1267,7 @@ def update_specialist_pool( 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]]] = (), ) -> gac_operation.Operation: r"""Updates a SpecialistPool. @@ -1281,8 +1326,10 @@ def sample_update_specialist_pool(): 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: @@ -1372,7 +1419,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. @@ -1383,8 +1430,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. @@ -1425,7 +1474,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. @@ -1436,8 +1485,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. @@ -1478,7 +1529,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. @@ -1494,8 +1545,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 """ @@ -1532,7 +1585,7 @@ def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -1547,8 +1600,10 @@ def cancel_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 """ @@ -1585,7 +1640,7 @@ def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -1602,8 +1657,10 @@ def wait_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. @@ -1644,7 +1701,7 @@ def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -1657,8 +1714,10 @@ def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -1763,7 +1822,7 @@ def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -1777,8 +1836,10 @@ def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -1883,7 +1944,7 @@ def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -1898,8 +1959,10 @@ def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -1941,7 +2004,7 @@ def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -1952,8 +2015,10 @@ def get_location( 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: ~.location_pb2.Location: Location object. @@ -1994,7 +2059,7 @@ def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -2005,8 +2070,10 @@ def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1beta1/services/specialist_pool_service/pagers.py b/google/cloud/aiplatform_v1beta1/services/specialist_pool_service/pagers.py index b78d12a6a5..c1f45ac9f4 100644 --- a/google/cloud/aiplatform_v1beta1/services/specialist_pool_service/pagers.py +++ b/google/cloud/aiplatform_v1beta1/services/specialist_pool_service/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 = specialist_pool_service.ListSpecialistPoolsRequest(request) @@ -143,7 +145,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. @@ -157,8 +159,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 = specialist_pool_service.ListSpecialistPoolsRequest(request) diff --git a/google/cloud/aiplatform_v1beta1/services/specialist_pool_service/transports/grpc.py b/google/cloud/aiplatform_v1beta1/services/specialist_pool_service/transports/grpc.py index 03fd181049..9819120bc7 100644 --- a/google/cloud/aiplatform_v1beta1/services/specialist_pool_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1beta1/services/specialist_pool_service/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 import warnings from typing import Callable, Dict, Optional, Sequence, Tuple, Union @@ -22,8 +25,11 @@ import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from google.cloud.aiplatform_v1beta1.types import specialist_pool from google.cloud.aiplatform_v1beta1.types import specialist_pool_service @@ -33,6 +39,81 @@ from google.longrunning import operations_pb2 # type: ignore from .base import SpecialistPoolServiceTransport, DEFAULT_CLIENT_INFO +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.aiplatform.v1beta1.SpecialistPoolService", + "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.aiplatform.v1beta1.SpecialistPoolService", + "rpcName": client_call_details.method, + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class SpecialistPoolServiceGrpcTransport(SpecialistPoolServiceTransport): """gRPC backend transport for SpecialistPoolService. @@ -192,7 +273,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 @@ -256,7 +342,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 @@ -282,7 +370,7 @@ def create_specialist_pool( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_specialist_pool" not in self._stubs: - self._stubs["create_specialist_pool"] = self.grpc_channel.unary_unary( + self._stubs["create_specialist_pool"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.SpecialistPoolService/CreateSpecialistPool", request_serializer=specialist_pool_service.CreateSpecialistPoolRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -311,7 +399,7 @@ def get_specialist_pool( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_specialist_pool" not in self._stubs: - self._stubs["get_specialist_pool"] = self.grpc_channel.unary_unary( + self._stubs["get_specialist_pool"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.SpecialistPoolService/GetSpecialistPool", request_serializer=specialist_pool_service.GetSpecialistPoolRequest.serialize, response_deserializer=specialist_pool.SpecialistPool.deserialize, @@ -340,7 +428,7 @@ def list_specialist_pools( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_specialist_pools" not in self._stubs: - self._stubs["list_specialist_pools"] = self.grpc_channel.unary_unary( + self._stubs["list_specialist_pools"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.SpecialistPoolService/ListSpecialistPools", request_serializer=specialist_pool_service.ListSpecialistPoolsRequest.serialize, response_deserializer=specialist_pool_service.ListSpecialistPoolsResponse.deserialize, @@ -369,7 +457,7 @@ def delete_specialist_pool( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_specialist_pool" not in self._stubs: - self._stubs["delete_specialist_pool"] = self.grpc_channel.unary_unary( + self._stubs["delete_specialist_pool"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.SpecialistPoolService/DeleteSpecialistPool", request_serializer=specialist_pool_service.DeleteSpecialistPoolRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -397,7 +485,7 @@ def update_specialist_pool( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_specialist_pool" not in self._stubs: - self._stubs["update_specialist_pool"] = self.grpc_channel.unary_unary( + self._stubs["update_specialist_pool"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.SpecialistPoolService/UpdateSpecialistPool", request_serializer=specialist_pool_service.UpdateSpecialistPoolRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -405,7 +493,7 @@ def update_specialist_pool( return self._stubs["update_specialist_pool"] def close(self): - self.grpc_channel.close() + self._logged_channel.close() @property def delete_operation( @@ -417,7 +505,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, @@ -434,7 +522,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -451,7 +539,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -468,7 +556,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, @@ -487,7 +575,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, @@ -506,7 +594,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -523,7 +611,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -548,7 +636,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -574,7 +662,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -603,7 +691,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1beta1/services/specialist_pool_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1beta1/services/specialist_pool_service/transports/grpc_asyncio.py index 7665e3d318..ccec5e327d 100644 --- a/google/cloud/aiplatform_v1beta1/services/specialist_pool_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/specialist_pool_service/transports/grpc_asyncio.py @@ -14,6 +14,9 @@ # limitations under the License. # import inspect +import json +import pickle +import logging as std_logging import warnings from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union @@ -24,8 +27,11 @@ from google.api_core import operations_v1 from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from grpc.experimental import aio # type: ignore from google.cloud.aiplatform_v1beta1.types import specialist_pool @@ -37,6 +43,82 @@ from .base import SpecialistPoolServiceTransport, DEFAULT_CLIENT_INFO from .grpc import SpecialistPoolServiceGrpcTransport +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.aiplatform.v1beta1.SpecialistPoolService", + "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.aiplatform.v1beta1.SpecialistPoolService", + "rpcName": str(client_call_details.method), + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class SpecialistPoolServiceGrpcAsyncIOTransport(SpecialistPoolServiceTransport): """gRPC AsyncIO backend transport for SpecialistPoolService. @@ -239,10 +321,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 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. @@ -293,7 +378,7 @@ def create_specialist_pool( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_specialist_pool" not in self._stubs: - self._stubs["create_specialist_pool"] = self.grpc_channel.unary_unary( + self._stubs["create_specialist_pool"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.SpecialistPoolService/CreateSpecialistPool", request_serializer=specialist_pool_service.CreateSpecialistPoolRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -322,7 +407,7 @@ def get_specialist_pool( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_specialist_pool" not in self._stubs: - self._stubs["get_specialist_pool"] = self.grpc_channel.unary_unary( + self._stubs["get_specialist_pool"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.SpecialistPoolService/GetSpecialistPool", request_serializer=specialist_pool_service.GetSpecialistPoolRequest.serialize, response_deserializer=specialist_pool.SpecialistPool.deserialize, @@ -351,7 +436,7 @@ def list_specialist_pools( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_specialist_pools" not in self._stubs: - self._stubs["list_specialist_pools"] = self.grpc_channel.unary_unary( + self._stubs["list_specialist_pools"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.SpecialistPoolService/ListSpecialistPools", request_serializer=specialist_pool_service.ListSpecialistPoolsRequest.serialize, response_deserializer=specialist_pool_service.ListSpecialistPoolsResponse.deserialize, @@ -381,7 +466,7 @@ def delete_specialist_pool( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_specialist_pool" not in self._stubs: - self._stubs["delete_specialist_pool"] = self.grpc_channel.unary_unary( + self._stubs["delete_specialist_pool"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.SpecialistPoolService/DeleteSpecialistPool", request_serializer=specialist_pool_service.DeleteSpecialistPoolRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -410,7 +495,7 @@ def update_specialist_pool( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_specialist_pool" not in self._stubs: - self._stubs["update_specialist_pool"] = self.grpc_channel.unary_unary( + self._stubs["update_specialist_pool"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.SpecialistPoolService/UpdateSpecialistPool", request_serializer=specialist_pool_service.UpdateSpecialistPoolRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -503,7 +588,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: @@ -519,7 +604,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, @@ -536,7 +621,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -553,7 +638,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -570,7 +655,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, @@ -589,7 +674,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, @@ -608,7 +693,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -625,7 +710,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -650,7 +735,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -676,7 +761,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -705,7 +790,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1beta1/services/specialist_pool_service/transports/rest.py b/google/cloud/aiplatform_v1beta1/services/specialist_pool_service/transports/rest.py index 3aae159102..c6ce7016fe 100644 --- a/google/cloud/aiplatform_v1beta1/services/specialist_pool_service/transports/rest.py +++ b/google/cloud/aiplatform_v1beta1/services/specialist_pool_service/transports/rest.py @@ -13,9 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging +import json # type: ignore from google.auth.transport.requests import AuthorizedSession # type: ignore -import json # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.api_core import exceptions as core_exceptions from google.api_core import retry as retries @@ -48,6 +49,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, @@ -120,9 +129,10 @@ def post_update_specialist_pool(self, response): def pre_create_specialist_pool( self, request: specialist_pool_service.CreateSpecialistPoolRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - specialist_pool_service.CreateSpecialistPoolRequest, Sequence[Tuple[str, str]] + specialist_pool_service.CreateSpecialistPoolRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for create_specialist_pool @@ -145,9 +155,10 @@ def post_create_specialist_pool( def pre_delete_specialist_pool( self, request: specialist_pool_service.DeleteSpecialistPoolRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - specialist_pool_service.DeleteSpecialistPoolRequest, Sequence[Tuple[str, str]] + specialist_pool_service.DeleteSpecialistPoolRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for delete_specialist_pool @@ -170,9 +181,10 @@ def post_delete_specialist_pool( def pre_get_specialist_pool( self, request: specialist_pool_service.GetSpecialistPoolRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - specialist_pool_service.GetSpecialistPoolRequest, Sequence[Tuple[str, str]] + specialist_pool_service.GetSpecialistPoolRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for get_specialist_pool @@ -195,9 +207,10 @@ def post_get_specialist_pool( def pre_list_specialist_pools( self, request: specialist_pool_service.ListSpecialistPoolsRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - specialist_pool_service.ListSpecialistPoolsRequest, Sequence[Tuple[str, str]] + specialist_pool_service.ListSpecialistPoolsRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for list_specialist_pools @@ -220,9 +233,10 @@ def post_list_specialist_pools( def pre_update_specialist_pool( self, request: specialist_pool_service.UpdateSpecialistPoolRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - specialist_pool_service.UpdateSpecialistPoolRequest, Sequence[Tuple[str, str]] + specialist_pool_service.UpdateSpecialistPoolRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for update_specialist_pool @@ -245,8 +259,10 @@ def post_update_specialist_pool( def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -268,8 +284,10 @@ def post_get_location( def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -291,8 +309,10 @@ def post_list_locations( def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -312,8 +332,10 @@ def post_get_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -333,8 +355,11 @@ def post_set_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -356,8 +381,10 @@ def post_test_iam_permissions( def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -377,8 +404,10 @@ def post_cancel_operation(self, response: None) -> None: 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 @@ -398,8 +427,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 @@ -421,8 +452,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 @@ -444,8 +477,10 @@ def post_list_operations( def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -1130,6 +1165,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -1346,6 +1385,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -1552,6 +1595,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}", @@ -1768,6 +1815,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, ], "google.longrunning.Operations.ListOperations": [ { @@ -1966,6 +2017,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*}/operations", @@ -2182,6 +2237,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*}/operations", + }, ], "google.longrunning.Operations.WaitOperation": [ { @@ -2380,6 +2439,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "post", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}:wait", @@ -2592,6 +2655,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, ], } @@ -2648,7 +2715,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 specialist pool method over HTTP. @@ -2659,8 +2726,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: @@ -2673,6 +2742,7 @@ def __call__( http_options = ( _BaseSpecialistPoolServiceRestTransport._BaseCreateSpecialistPool._get_http_options() ) + request, metadata = self._interceptor.pre_create_specialist_pool( request, metadata ) @@ -2689,6 +2759,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.aiplatform_v1beta1.SpecialistPoolServiceClient.CreateSpecialistPool", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.SpecialistPoolService", + "rpcName": "CreateSpecialistPool", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( SpecialistPoolServiceRestTransport._CreateSpecialistPool._get_response( @@ -2710,7 +2807,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_specialist_pool(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.aiplatform_v1beta1.SpecialistPoolServiceClient.create_specialist_pool", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.SpecialistPoolService", + "rpcName": "CreateSpecialistPool", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _DeleteSpecialistPool( @@ -2749,7 +2868,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 specialist pool method over HTTP. @@ -2760,8 +2879,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: @@ -2774,6 +2895,7 @@ def __call__( http_options = ( _BaseSpecialistPoolServiceRestTransport._BaseDeleteSpecialistPool._get_http_options() ) + request, metadata = self._interceptor.pre_delete_specialist_pool( request, metadata ) @@ -2786,6 +2908,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.aiplatform_v1beta1.SpecialistPoolServiceClient.DeleteSpecialistPool", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.SpecialistPoolService", + "rpcName": "DeleteSpecialistPool", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( SpecialistPoolServiceRestTransport._DeleteSpecialistPool._get_response( @@ -2806,7 +2955,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_specialist_pool(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.aiplatform_v1beta1.SpecialistPoolServiceClient.delete_specialist_pool", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.SpecialistPoolService", + "rpcName": "DeleteSpecialistPool", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _GetSpecialistPool( @@ -2845,7 +3016,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]]] = (), ) -> specialist_pool.SpecialistPool: r"""Call the get specialist pool method over HTTP. @@ -2856,8 +3027,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: ~.specialist_pool.SpecialistPool: @@ -2879,6 +3052,7 @@ def __call__( http_options = ( _BaseSpecialistPoolServiceRestTransport._BaseGetSpecialistPool._get_http_options() ) + request, metadata = self._interceptor.pre_get_specialist_pool( request, metadata ) @@ -2891,6 +3065,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.aiplatform_v1beta1.SpecialistPoolServiceClient.GetSpecialistPool", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.SpecialistPoolService", + "rpcName": "GetSpecialistPool", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( SpecialistPoolServiceRestTransport._GetSpecialistPool._get_response( @@ -2913,7 +3114,29 @@ def __call__( pb_resp = specialist_pool.SpecialistPool.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_specialist_pool(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = specialist_pool.SpecialistPool.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.aiplatform_v1beta1.SpecialistPoolServiceClient.get_specialist_pool", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.SpecialistPoolService", + "rpcName": "GetSpecialistPool", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListSpecialistPools( @@ -2952,7 +3175,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]]] = (), ) -> specialist_pool_service.ListSpecialistPoolsResponse: r"""Call the list specialist pools method over HTTP. @@ -2963,8 +3186,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: ~.specialist_pool_service.ListSpecialistPoolsResponse: @@ -2976,6 +3201,7 @@ def __call__( http_options = ( _BaseSpecialistPoolServiceRestTransport._BaseListSpecialistPools._get_http_options() ) + request, metadata = self._interceptor.pre_list_specialist_pools( request, metadata ) @@ -2988,6 +3214,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.aiplatform_v1beta1.SpecialistPoolServiceClient.ListSpecialistPools", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.SpecialistPoolService", + "rpcName": "ListSpecialistPools", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( SpecialistPoolServiceRestTransport._ListSpecialistPools._get_response( @@ -3010,7 +3263,33 @@ def __call__( pb_resp = specialist_pool_service.ListSpecialistPoolsResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_specialist_pools(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + specialist_pool_service.ListSpecialistPoolsResponse.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.aiplatform_v1beta1.SpecialistPoolServiceClient.list_specialist_pools", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.SpecialistPoolService", + "rpcName": "ListSpecialistPools", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _UpdateSpecialistPool( @@ -3050,7 +3329,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 specialist pool method over HTTP. @@ -3061,8 +3340,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: @@ -3075,6 +3356,7 @@ def __call__( http_options = ( _BaseSpecialistPoolServiceRestTransport._BaseUpdateSpecialistPool._get_http_options() ) + request, metadata = self._interceptor.pre_update_specialist_pool( request, metadata ) @@ -3091,6 +3373,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.aiplatform_v1beta1.SpecialistPoolServiceClient.UpdateSpecialistPool", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.SpecialistPoolService", + "rpcName": "UpdateSpecialistPool", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( SpecialistPoolServiceRestTransport._UpdateSpecialistPool._get_response( @@ -3112,7 +3421,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_specialist_pool(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.aiplatform_v1beta1.SpecialistPoolServiceClient.update_specialist_pool", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.SpecialistPoolService", + "rpcName": "UpdateSpecialistPool", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp @property @@ -3207,7 +3538,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]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -3218,8 +3549,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: locations_pb2.Location: Response from GetLocation method. @@ -3228,6 +3561,7 @@ def __call__( http_options = ( _BaseSpecialistPoolServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = self._interceptor.pre_get_location(request, metadata) transcoded_request = _BaseSpecialistPoolServiceRestTransport._BaseGetLocation._get_transcoded_request( http_options, request @@ -3238,6 +3572,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.aiplatform_v1beta1.SpecialistPoolServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.SpecialistPoolService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = SpecialistPoolServiceRestTransport._GetLocation._get_response( self._host, @@ -3257,6 +3618,27 @@ def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_location(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.aiplatform_v1beta1.SpecialistPoolServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.SpecialistPoolService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3299,7 +3681,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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -3310,8 +3692,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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -3320,6 +3704,7 @@ def __call__( http_options = ( _BaseSpecialistPoolServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = self._interceptor.pre_list_locations(request, metadata) transcoded_request = _BaseSpecialistPoolServiceRestTransport._BaseListLocations._get_transcoded_request( http_options, request @@ -3330,6 +3715,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.aiplatform_v1beta1.SpecialistPoolServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.SpecialistPoolService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = SpecialistPoolServiceRestTransport._ListLocations._get_response( self._host, @@ -3349,6 +3761,27 @@ def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_list_locations(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.aiplatform_v1beta1.SpecialistPoolServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.SpecialistPoolService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3392,7 +3825,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]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -3403,8 +3836,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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -3413,6 +3848,7 @@ def __call__( http_options = ( _BaseSpecialistPoolServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_get_iam_policy(request, metadata) transcoded_request = _BaseSpecialistPoolServiceRestTransport._BaseGetIamPolicy._get_transcoded_request( http_options, request @@ -3427,6 +3863,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.aiplatform_v1beta1.SpecialistPoolServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.SpecialistPoolService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = SpecialistPoolServiceRestTransport._GetIamPolicy._get_response( self._host, @@ -3447,6 +3910,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_iam_policy(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.aiplatform_v1beta1.SpecialistPoolServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.SpecialistPoolService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3490,7 +3974,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]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -3501,8 +3985,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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -3511,6 +3997,7 @@ def __call__( http_options = ( _BaseSpecialistPoolServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_set_iam_policy(request, metadata) transcoded_request = _BaseSpecialistPoolServiceRestTransport._BaseSetIamPolicy._get_transcoded_request( http_options, request @@ -3525,6 +4012,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.aiplatform_v1beta1.SpecialistPoolServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.SpecialistPoolService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = SpecialistPoolServiceRestTransport._SetIamPolicy._get_response( self._host, @@ -3545,6 +4059,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_set_iam_policy(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.aiplatform_v1beta1.SpecialistPoolServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.SpecialistPoolService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3588,7 +4123,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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -3599,8 +4134,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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -3609,6 +4146,7 @@ def __call__( http_options = ( _BaseSpecialistPoolServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -3625,6 +4163,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.aiplatform_v1beta1.SpecialistPoolServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.SpecialistPoolService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( SpecialistPoolServiceRestTransport._TestIamPermissions._get_response( @@ -3647,6 +4212,27 @@ def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_test_iam_permissions(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.aiplatform_v1beta1.SpecialistPoolServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.SpecialistPoolService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3689,7 +4275,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 cancel operation method over HTTP. @@ -3700,13 +4286,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 = ( _BaseSpecialistPoolServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = self._interceptor.pre_cancel_operation( request, metadata ) @@ -3719,6 +4308,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.aiplatform_v1beta1.SpecialistPoolServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.SpecialistPoolService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( SpecialistPoolServiceRestTransport._CancelOperation._get_response( @@ -3778,7 +4394,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. @@ -3789,13 +4405,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 = ( _BaseSpecialistPoolServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = self._interceptor.pre_delete_operation( request, metadata ) @@ -3808,6 +4427,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.aiplatform_v1beta1.SpecialistPoolServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.SpecialistPoolService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( SpecialistPoolServiceRestTransport._DeleteOperation._get_response( @@ -3867,7 +4513,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. @@ -3878,8 +4524,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. @@ -3888,6 +4536,7 @@ def __call__( http_options = ( _BaseSpecialistPoolServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = self._interceptor.pre_get_operation(request, metadata) transcoded_request = _BaseSpecialistPoolServiceRestTransport._BaseGetOperation._get_transcoded_request( http_options, request @@ -3898,6 +4547,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.aiplatform_v1beta1.SpecialistPoolServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.SpecialistPoolService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = SpecialistPoolServiceRestTransport._GetOperation._get_response( self._host, @@ -3917,6 +4593,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.aiplatform_v1beta1.SpecialistPoolServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.SpecialistPoolService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3959,7 +4656,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. @@ -3970,8 +4667,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. @@ -3980,6 +4679,7 @@ def __call__( http_options = ( _BaseSpecialistPoolServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = self._interceptor.pre_list_operations(request, metadata) transcoded_request = _BaseSpecialistPoolServiceRestTransport._BaseListOperations._get_transcoded_request( http_options, request @@ -3990,6 +4690,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.aiplatform_v1beta1.SpecialistPoolServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.SpecialistPoolService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = SpecialistPoolServiceRestTransport._ListOperations._get_response( self._host, @@ -4009,6 +4736,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.aiplatform_v1beta1.SpecialistPoolServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.SpecialistPoolService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4051,7 +4799,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 wait operation method over HTTP. @@ -4062,8 +4810,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 WaitOperation method. @@ -4072,6 +4822,7 @@ def __call__( http_options = ( _BaseSpecialistPoolServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = self._interceptor.pre_wait_operation(request, metadata) transcoded_request = _BaseSpecialistPoolServiceRestTransport._BaseWaitOperation._get_transcoded_request( http_options, request @@ -4082,6 +4833,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.aiplatform_v1beta1.SpecialistPoolServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.SpecialistPoolService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = SpecialistPoolServiceRestTransport._WaitOperation._get_response( self._host, @@ -4101,6 +4879,27 @@ def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = self._interceptor.post_wait_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.aiplatform_v1beta1.SpecialistPoolServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.SpecialistPoolService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1beta1/services/specialist_pool_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1beta1/services/specialist_pool_service/transports/rest_asyncio.py index 18c223c28e..19d838e723 100644 --- a/google/cloud/aiplatform_v1beta1/services/specialist_pool_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/specialist_pool_service/transports/rest_asyncio.py @@ -59,6 +59,18 @@ from .base import DEFAULT_CLIENT_INFO as BASE_DEFAULT_CLIENT_INFO + +import logging + +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__) + try: OptionalRetry = Union[retries.AsyncRetry, gapic_v1.method._MethodDefault, None] except AttributeError: # pragma: NO COVER @@ -135,9 +147,10 @@ async def post_update_specialist_pool(self, response): async def pre_create_specialist_pool( self, request: specialist_pool_service.CreateSpecialistPoolRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - specialist_pool_service.CreateSpecialistPoolRequest, Sequence[Tuple[str, str]] + specialist_pool_service.CreateSpecialistPoolRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for create_specialist_pool @@ -160,9 +173,10 @@ async def post_create_specialist_pool( async def pre_delete_specialist_pool( self, request: specialist_pool_service.DeleteSpecialistPoolRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - specialist_pool_service.DeleteSpecialistPoolRequest, Sequence[Tuple[str, str]] + specialist_pool_service.DeleteSpecialistPoolRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for delete_specialist_pool @@ -185,9 +199,10 @@ async def post_delete_specialist_pool( async def pre_get_specialist_pool( self, request: specialist_pool_service.GetSpecialistPoolRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - specialist_pool_service.GetSpecialistPoolRequest, Sequence[Tuple[str, str]] + specialist_pool_service.GetSpecialistPoolRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for get_specialist_pool @@ -210,9 +225,10 @@ async def post_get_specialist_pool( async def pre_list_specialist_pools( self, request: specialist_pool_service.ListSpecialistPoolsRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - specialist_pool_service.ListSpecialistPoolsRequest, Sequence[Tuple[str, str]] + specialist_pool_service.ListSpecialistPoolsRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for list_specialist_pools @@ -235,9 +251,10 @@ async def post_list_specialist_pools( async def pre_update_specialist_pool( self, request: specialist_pool_service.UpdateSpecialistPoolRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - specialist_pool_service.UpdateSpecialistPoolRequest, Sequence[Tuple[str, str]] + specialist_pool_service.UpdateSpecialistPoolRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for update_specialist_pool @@ -260,8 +277,10 @@ async def post_update_specialist_pool( async def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -283,8 +302,10 @@ async def post_get_location( async def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -306,8 +327,10 @@ async def post_list_locations( async def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -329,8 +352,10 @@ async def post_get_iam_policy( async def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -352,8 +377,11 @@ async def post_set_iam_policy( async def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -375,8 +403,10 @@ async def post_test_iam_permissions( async def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -396,8 +426,10 @@ async def post_cancel_operation(self, response: None) -> None: async 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 @@ -417,8 +449,10 @@ async def post_delete_operation(self, response: None) -> None: async 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 @@ -440,8 +474,10 @@ async def post_get_operation( async 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 @@ -463,8 +499,10 @@ async def post_list_operations( async def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -675,7 +713,7 @@ async 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 specialist pool method over HTTP. @@ -686,8 +724,10 @@ async def __call__( 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: @@ -700,6 +740,7 @@ async def __call__( http_options = ( _BaseSpecialistPoolServiceRestTransport._BaseCreateSpecialistPool._get_http_options() ) + request, metadata = await self._interceptor.pre_create_specialist_pool( request, metadata ) @@ -716,6 +757,33 @@ async 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.aiplatform_v1beta1.SpecialistPoolServiceClient.CreateSpecialistPool", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.SpecialistPoolService", + "rpcName": "CreateSpecialistPool", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncSpecialistPoolServiceRestTransport._CreateSpecialistPool._get_response( self._host, @@ -744,6 +812,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_create_specialist_pool(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.SpecialistPoolServiceAsyncClient.create_specialist_pool", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.SpecialistPoolService", + "rpcName": "CreateSpecialistPool", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _DeleteSpecialistPool( @@ -782,7 +872,7 @@ async 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 specialist pool method over HTTP. @@ -793,8 +883,10 @@ async def __call__( 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: @@ -807,6 +899,7 @@ async def __call__( http_options = ( _BaseSpecialistPoolServiceRestTransport._BaseDeleteSpecialistPool._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_specialist_pool( request, metadata ) @@ -819,6 +912,33 @@ async 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.aiplatform_v1beta1.SpecialistPoolServiceClient.DeleteSpecialistPool", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.SpecialistPoolService", + "rpcName": "DeleteSpecialistPool", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncSpecialistPoolServiceRestTransport._DeleteSpecialistPool._get_response( self._host, @@ -846,6 +966,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_delete_specialist_pool(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.SpecialistPoolServiceAsyncClient.delete_specialist_pool", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.SpecialistPoolService", + "rpcName": "DeleteSpecialistPool", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _GetSpecialistPool( @@ -884,7 +1026,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> specialist_pool.SpecialistPool: r"""Call the get specialist pool method over HTTP. @@ -895,8 +1037,10 @@ async def __call__( 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: ~.specialist_pool.SpecialistPool: @@ -918,6 +1062,7 @@ async def __call__( http_options = ( _BaseSpecialistPoolServiceRestTransport._BaseGetSpecialistPool._get_http_options() ) + request, metadata = await self._interceptor.pre_get_specialist_pool( request, metadata ) @@ -930,6 +1075,33 @@ async 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.aiplatform_v1beta1.SpecialistPoolServiceClient.GetSpecialistPool", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.SpecialistPoolService", + "rpcName": "GetSpecialistPool", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncSpecialistPoolServiceRestTransport._GetSpecialistPool._get_response( self._host, @@ -957,6 +1129,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_get_specialist_pool(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = specialist_pool.SpecialistPool.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.SpecialistPoolServiceAsyncClient.get_specialist_pool", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.SpecialistPoolService", + "rpcName": "GetSpecialistPool", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ListSpecialistPools( @@ -995,7 +1189,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> specialist_pool_service.ListSpecialistPoolsResponse: r"""Call the list specialist pools method over HTTP. @@ -1006,8 +1200,10 @@ async def __call__( 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: ~.specialist_pool_service.ListSpecialistPoolsResponse: @@ -1019,6 +1215,7 @@ async def __call__( http_options = ( _BaseSpecialistPoolServiceRestTransport._BaseListSpecialistPools._get_http_options() ) + request, metadata = await self._interceptor.pre_list_specialist_pools( request, metadata ) @@ -1031,6 +1228,33 @@ async 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.aiplatform_v1beta1.SpecialistPoolServiceClient.ListSpecialistPools", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.SpecialistPoolService", + "rpcName": "ListSpecialistPools", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncSpecialistPoolServiceRestTransport._ListSpecialistPools._get_response( self._host, @@ -1058,6 +1282,32 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_list_specialist_pools(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + specialist_pool_service.ListSpecialistPoolsResponse.to_json( + response + ) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.SpecialistPoolServiceAsyncClient.list_specialist_pools", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.SpecialistPoolService", + "rpcName": "ListSpecialistPools", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _UpdateSpecialistPool( @@ -1097,7 +1347,7 @@ async 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 specialist pool method over HTTP. @@ -1108,8 +1358,10 @@ async def __call__( 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: @@ -1122,6 +1374,7 @@ async def __call__( http_options = ( _BaseSpecialistPoolServiceRestTransport._BaseUpdateSpecialistPool._get_http_options() ) + request, metadata = await self._interceptor.pre_update_specialist_pool( request, metadata ) @@ -1138,6 +1391,33 @@ async 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.aiplatform_v1beta1.SpecialistPoolServiceClient.UpdateSpecialistPool", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.SpecialistPoolService", + "rpcName": "UpdateSpecialistPool", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncSpecialistPoolServiceRestTransport._UpdateSpecialistPool._get_response( self._host, @@ -1166,6 +1446,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_update_specialist_pool(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.SpecialistPoolServiceAsyncClient.update_specialist_pool", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.SpecialistPoolService", + "rpcName": "UpdateSpecialistPool", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp @property @@ -1741,6 +2043,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -1957,6 +2263,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -2163,6 +2473,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}", @@ -2379,6 +2693,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, ], "google.longrunning.Operations.ListOperations": [ { @@ -2577,6 +2895,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*}/operations", @@ -2793,6 +3115,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*}/operations", + }, ], "google.longrunning.Operations.WaitOperation": [ { @@ -2991,6 +3317,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "post", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}:wait", @@ -3203,6 +3533,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, ], } @@ -3303,7 +3637,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -3314,8 +3648,10 @@ async def __call__( 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: locations_pb2.Location: Response from GetLocation method. @@ -3324,6 +3660,7 @@ async def __call__( http_options = ( _BaseSpecialistPoolServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_location( request, metadata ) @@ -3336,6 +3673,33 @@ async 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.aiplatform_v1beta1.SpecialistPoolServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.SpecialistPoolService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncSpecialistPoolServiceRestTransport._GetLocation._get_response( self._host, @@ -3361,6 +3725,27 @@ async def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_location(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.aiplatform_v1beta1.SpecialistPoolServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.SpecialistPoolService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3403,7 +3788,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -3414,8 +3799,10 @@ async def __call__( 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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -3424,6 +3811,7 @@ async def __call__( http_options = ( _BaseSpecialistPoolServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_locations( request, metadata ) @@ -3436,6 +3824,33 @@ async 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.aiplatform_v1beta1.SpecialistPoolServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.SpecialistPoolService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncSpecialistPoolServiceRestTransport._ListLocations._get_response( self._host, @@ -3461,6 +3876,27 @@ async def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_list_locations(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.aiplatform_v1beta1.SpecialistPoolServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.SpecialistPoolService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3504,7 +3940,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -3515,8 +3951,10 @@ async def __call__( 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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -3525,6 +3963,7 @@ async def __call__( http_options = ( _BaseSpecialistPoolServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_get_iam_policy( request, metadata ) @@ -3541,6 +3980,33 @@ async 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.aiplatform_v1beta1.SpecialistPoolServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.SpecialistPoolService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncSpecialistPoolServiceRestTransport._GetIamPolicy._get_response( self._host, @@ -3567,6 +4033,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_iam_policy(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.aiplatform_v1beta1.SpecialistPoolServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.SpecialistPoolService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3610,7 +4097,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -3621,8 +4108,10 @@ async def __call__( 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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -3631,6 +4120,7 @@ async def __call__( http_options = ( _BaseSpecialistPoolServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_set_iam_policy( request, metadata ) @@ -3647,6 +4137,33 @@ async 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.aiplatform_v1beta1.SpecialistPoolServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.SpecialistPoolService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncSpecialistPoolServiceRestTransport._SetIamPolicy._get_response( self._host, @@ -3673,6 +4190,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_set_iam_policy(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.aiplatform_v1beta1.SpecialistPoolServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.SpecialistPoolService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3716,7 +4254,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -3727,8 +4265,10 @@ async def __call__( 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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -3737,6 +4277,7 @@ async def __call__( http_options = ( _BaseSpecialistPoolServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = await self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -3753,6 +4294,33 @@ async 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.aiplatform_v1beta1.SpecialistPoolServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.SpecialistPoolService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncSpecialistPoolServiceRestTransport._TestIamPermissions._get_response( self._host, @@ -3779,6 +4347,27 @@ async def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_test_iam_permissions(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.aiplatform_v1beta1.SpecialistPoolServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.SpecialistPoolService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3821,7 +4410,7 @@ async 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 cancel operation method over HTTP. @@ -3832,13 +4421,16 @@ async def __call__( 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`. """ http_options = ( _BaseSpecialistPoolServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_cancel_operation( request, metadata ) @@ -3851,6 +4443,33 @@ async 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.aiplatform_v1beta1.SpecialistPoolServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.SpecialistPoolService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncSpecialistPoolServiceRestTransport._CancelOperation._get_response( self._host, @@ -3914,7 +4533,7 @@ async 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. @@ -3925,13 +4544,16 @@ async def __call__( 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`. """ http_options = ( _BaseSpecialistPoolServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_operation( request, metadata ) @@ -3944,6 +4566,33 @@ async 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.aiplatform_v1beta1.SpecialistPoolServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.SpecialistPoolService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncSpecialistPoolServiceRestTransport._DeleteOperation._get_response( self._host, @@ -4007,7 +4656,7 @@ async 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. @@ -4018,8 +4667,10 @@ async def __call__( 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: Response from GetOperation method. @@ -4028,6 +4679,7 @@ async def __call__( http_options = ( _BaseSpecialistPoolServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_operation( request, metadata ) @@ -4040,6 +4692,33 @@ async 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.aiplatform_v1beta1.SpecialistPoolServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.SpecialistPoolService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncSpecialistPoolServiceRestTransport._GetOperation._get_response( self._host, @@ -4065,6 +4744,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1beta1.SpecialistPoolServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.SpecialistPoolService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4107,7 +4807,7 @@ async 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. @@ -4118,8 +4818,10 @@ async def __call__( 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 from ListOperations method. @@ -4128,6 +4830,7 @@ async def __call__( http_options = ( _BaseSpecialistPoolServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_operations( request, metadata ) @@ -4140,6 +4843,33 @@ async 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.aiplatform_v1beta1.SpecialistPoolServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.SpecialistPoolService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncSpecialistPoolServiceRestTransport._ListOperations._get_response( self._host, @@ -4165,6 +4895,27 @@ async def __call__( resp = operations_pb2.ListOperationsResponse() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1beta1.SpecialistPoolServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.SpecialistPoolService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4207,7 +4958,7 @@ async 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 wait operation method over HTTP. @@ -4218,8 +4969,10 @@ async def __call__( 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: Response from WaitOperation method. @@ -4228,6 +4981,7 @@ async def __call__( http_options = ( _BaseSpecialistPoolServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_wait_operation( request, metadata ) @@ -4240,6 +4994,33 @@ async 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.aiplatform_v1beta1.SpecialistPoolServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.SpecialistPoolService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncSpecialistPoolServiceRestTransport._WaitOperation._get_response( self._host, @@ -4265,6 +5046,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_wait_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.aiplatform_v1beta1.SpecialistPoolServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.SpecialistPoolService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1beta1/services/specialist_pool_service/transports/rest_base.py b/google/cloud/aiplatform_v1beta1/services/specialist_pool_service/transports/rest_base.py index 89dc94b48d..b15297e411 100644 --- a/google/cloud/aiplatform_v1beta1/services/specialist_pool_service/transports/rest_base.py +++ b/google/cloud/aiplatform_v1beta1/services/specialist_pool_service/transports/rest_base.py @@ -1267,6 +1267,10 @@ def _get_http_options(): "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -1483,6 +1487,10 @@ def _get_http_options(): "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -1708,6 +1716,10 @@ def _get_http_options(): "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}", @@ -1924,6 +1936,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, ] return http_options @@ -2141,6 +2157,10 @@ def _get_http_options(): "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*}/operations", @@ -2357,6 +2377,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*}/operations", + }, ] return http_options @@ -2574,6 +2598,10 @@ def _get_http_options(): "method": "post", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}:wait", @@ -2786,6 +2814,10 @@ def _get_http_options(): "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, ] return http_options diff --git a/google/cloud/aiplatform_v1beta1/services/tensorboard_service/async_client.py b/google/cloud/aiplatform_v1beta1/services/tensorboard_service/async_client.py index f286cfe418..cc4636611a 100644 --- a/google/cloud/aiplatform_v1beta1/services/tensorboard_service/async_client.py +++ b/google/cloud/aiplatform_v1beta1/services/tensorboard_service/async_client.py @@ -13,6 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging as std_logging from collections import OrderedDict import re from typing import ( @@ -75,6 +76,15 @@ from .transports.grpc_asyncio import TensorboardServiceGrpcAsyncIOTransport from .client import TensorboardServiceClient +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 TensorboardServiceAsyncClient: """TensorboardService""" @@ -302,6 +312,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.aiplatform_v1beta1.TensorboardServiceAsyncClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "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.aiplatform.v1beta1.TensorboardService", + "credentialsType": None, + }, + ) + async def create_tensorboard( self, request: Optional[ @@ -312,7 +344,7 @@ async def create_tensorboard( tensorboard: Optional[gca_tensorboard.Tensorboard] = 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"""Creates a Tensorboard. @@ -370,8 +402,10 @@ async def sample_create_tensorboard(): 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: @@ -448,7 +482,7 @@ async def get_tensorboard( 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]]] = (), ) -> tensorboard.Tensorboard: r"""Gets a Tensorboard. @@ -492,8 +526,10 @@ async def sample_get_tensorboard(): 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.aiplatform_v1beta1.types.Tensorboard: @@ -561,7 +597,7 @@ async def update_tensorboard( 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"""Updates a Tensorboard. @@ -625,8 +661,10 @@ async def sample_update_tensorboard(): 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: @@ -705,7 +743,7 @@ async def list_tensorboards( 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.ListTensorboardsAsyncPager: r"""Lists Tensorboards in a Location. @@ -751,8 +789,10 @@ async def sample_list_tensorboards(): 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.aiplatform_v1beta1.services.tensorboard_service.pagers.ListTensorboardsAsyncPager: @@ -829,7 +869,7 @@ async def delete_tensorboard( 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"""Deletes a Tensorboard. @@ -878,8 +918,10 @@ async def sample_delete_tensorboard(): 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: @@ -960,7 +1002,7 @@ async def read_tensorboard_usage( tensorboard: 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]]] = (), ) -> tensorboard_service.ReadTensorboardUsageResponse: r"""Returns a list of monthly active users for a given TensorBoard instance. @@ -1005,8 +1047,10 @@ async def sample_read_tensorboard_usage(): 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.aiplatform_v1beta1.types.ReadTensorboardUsageResponse: @@ -1071,7 +1115,7 @@ async def read_tensorboard_size( tensorboard: 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]]] = (), ) -> tensorboard_service.ReadTensorboardSizeResponse: r"""Returns the storage size for a given TensorBoard instance. @@ -1116,8 +1160,10 @@ async def sample_read_tensorboard_size(): 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.aiplatform_v1beta1.types.ReadTensorboardSizeResponse: @@ -1186,7 +1232,7 @@ async def create_tensorboard_experiment( tensorboard_experiment_id: 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]]] = (), ) -> gca_tensorboard_experiment.TensorboardExperiment: r"""Creates a TensorboardExperiment. @@ -1248,8 +1294,10 @@ async def sample_create_tensorboard_experiment(): 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.aiplatform_v1beta1.types.TensorboardExperiment: @@ -1322,7 +1370,7 @@ async def get_tensorboard_experiment( 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]]] = (), ) -> tensorboard_experiment.TensorboardExperiment: r"""Gets a TensorboardExperiment. @@ -1367,8 +1415,10 @@ async def sample_get_tensorboard_experiment(): 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.aiplatform_v1beta1.types.TensorboardExperiment: @@ -1436,7 +1486,7 @@ async def update_tensorboard_experiment( 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]]] = (), ) -> gca_tensorboard_experiment.TensorboardExperiment: r"""Updates a TensorboardExperiment. @@ -1493,8 +1543,10 @@ async def sample_update_tensorboard_experiment(): 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.aiplatform_v1beta1.types.TensorboardExperiment: @@ -1565,7 +1617,7 @@ async def list_tensorboard_experiments( 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.ListTensorboardExperimentsAsyncPager: r"""Lists TensorboardExperiments in a Location. @@ -1611,8 +1663,10 @@ async def sample_list_tensorboard_experiments(): 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.aiplatform_v1beta1.services.tensorboard_service.pagers.ListTensorboardExperimentsAsyncPager: @@ -1691,7 +1745,7 @@ async def delete_tensorboard_experiment( 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"""Deletes a TensorboardExperiment. @@ -1740,8 +1794,10 @@ async def sample_delete_tensorboard_experiment(): 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: @@ -1826,7 +1882,7 @@ async def create_tensorboard_run( tensorboard_run_id: 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]]] = (), ) -> gca_tensorboard_run.TensorboardRun: r"""Creates a TensorboardRun. @@ -1894,8 +1950,10 @@ async def sample_create_tensorboard_run(): 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.aiplatform_v1beta1.types.TensorboardRun: @@ -1967,7 +2025,7 @@ async def batch_create_tensorboard_runs( ] = 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]]] = (), ) -> tensorboard_service.BatchCreateTensorboardRunsResponse: r"""Batch create TensorboardRuns. @@ -2030,8 +2088,10 @@ async def sample_batch_create_tensorboard_runs(): 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.aiplatform_v1beta1.types.BatchCreateTensorboardRunsResponse: @@ -2098,7 +2158,7 @@ async def get_tensorboard_run( 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]]] = (), ) -> tensorboard_run.TensorboardRun: r"""Gets a TensorboardRun. @@ -2143,8 +2203,10 @@ async def sample_get_tensorboard_run(): 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.aiplatform_v1beta1.types.TensorboardRun: @@ -2210,7 +2272,7 @@ async def update_tensorboard_run( 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]]] = (), ) -> gca_tensorboard_run.TensorboardRun: r"""Updates a TensorboardRun. @@ -2270,8 +2332,10 @@ async def sample_update_tensorboard_run(): 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.aiplatform_v1beta1.types.TensorboardRun: @@ -2340,7 +2404,7 @@ async def list_tensorboard_runs( 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.ListTensorboardRunsAsyncPager: r"""Lists TensorboardRuns in a Location. @@ -2386,8 +2450,10 @@ async def sample_list_tensorboard_runs(): 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.aiplatform_v1beta1.services.tensorboard_service.pagers.ListTensorboardRunsAsyncPager: @@ -2464,7 +2530,7 @@ async def delete_tensorboard_run( 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"""Deletes a TensorboardRun. @@ -2513,8 +2579,10 @@ async def sample_delete_tensorboard_run(): 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: @@ -2598,7 +2666,7 @@ async def batch_create_tensorboard_time_series( ] = 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]]] = (), ) -> tensorboard_service.BatchCreateTensorboardTimeSeriesResponse: r"""Batch create TensorboardTimeSeries that belong to a TensorboardExperiment. @@ -2663,8 +2731,10 @@ async def sample_batch_create_tensorboard_time_series(): 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.aiplatform_v1beta1.types.BatchCreateTensorboardTimeSeriesResponse: @@ -2736,7 +2806,7 @@ async def create_tensorboard_time_series( ] = 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]]] = (), ) -> gca_tensorboard_time_series.TensorboardTimeSeries: r"""Creates a TensorboardTimeSeries. @@ -2793,8 +2863,10 @@ async def sample_create_tensorboard_time_series(): 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.aiplatform_v1beta1.types.TensorboardTimeSeries: @@ -2861,7 +2933,7 @@ async def get_tensorboard_time_series( 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]]] = (), ) -> tensorboard_time_series.TensorboardTimeSeries: r"""Gets a TensorboardTimeSeries. @@ -2906,8 +2978,10 @@ async def sample_get_tensorboard_time_series(): 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.aiplatform_v1beta1.types.TensorboardTimeSeries: @@ -2973,7 +3047,7 @@ async def update_tensorboard_time_series( 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]]] = (), ) -> gca_tensorboard_time_series.TensorboardTimeSeries: r"""Updates a TensorboardTimeSeries. @@ -3035,8 +3109,10 @@ async def sample_update_tensorboard_time_series(): 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.aiplatform_v1beta1.types.TensorboardTimeSeries: @@ -3110,7 +3186,7 @@ async def list_tensorboard_time_series( 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.ListTensorboardTimeSeriesAsyncPager: r"""Lists TensorboardTimeSeries in a Location. @@ -3156,8 +3232,10 @@ async def sample_list_tensorboard_time_series(): 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.aiplatform_v1beta1.services.tensorboard_service.pagers.ListTensorboardTimeSeriesAsyncPager: @@ -3236,7 +3314,7 @@ async def delete_tensorboard_time_series( 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"""Deletes a TensorboardTimeSeries. @@ -3285,8 +3363,10 @@ async def sample_delete_tensorboard_time_series(): 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: @@ -3369,7 +3449,7 @@ async def batch_read_tensorboard_time_series_data( tensorboard: 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]]] = (), ) -> tensorboard_service.BatchReadTensorboardTimeSeriesDataResponse: r"""Reads multiple TensorboardTimeSeries' data. The data point number limit is 1000 for scalars, 100 for tensors @@ -3424,8 +3504,10 @@ async def sample_batch_read_tensorboard_time_series_data(): 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.aiplatform_v1beta1.types.BatchReadTensorboardTimeSeriesDataResponse: @@ -3494,7 +3576,7 @@ async def read_tensorboard_time_series_data( tensorboard_time_series: 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]]] = (), ) -> tensorboard_service.ReadTensorboardTimeSeriesDataResponse: r"""Reads a TensorboardTimeSeries' data. By default, if the number of data points stored is less than 1000, all data is returned. @@ -3543,8 +3625,10 @@ async def sample_read_tensorboard_time_series_data(): 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.aiplatform_v1beta1.types.ReadTensorboardTimeSeriesDataResponse: @@ -3611,7 +3695,7 @@ def read_tensorboard_blob_data( time_series: 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]]] = (), ) -> Awaitable[AsyncIterable[tensorboard_service.ReadTensorboardBlobDataResponse]]: r"""Gets bytes of TensorboardBlobs. This is to allow reading blob data stored in consumer @@ -3660,8 +3744,10 @@ async def sample_read_tensorboard_blob_data(): 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: AsyncIterable[google.cloud.aiplatform_v1beta1.types.ReadTensorboardBlobDataResponse]: @@ -3729,7 +3815,7 @@ async def write_tensorboard_experiment_data( ] = 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]]] = (), ) -> tensorboard_service.WriteTensorboardExperimentDataResponse: r"""Write time series data points of multiple TensorboardTimeSeries in multiple TensorboardRun's. If @@ -3789,8 +3875,10 @@ async def sample_write_tensorboard_experiment_data(): 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.aiplatform_v1beta1.types.WriteTensorboardExperimentDataResponse: @@ -3862,7 +3950,7 @@ async def write_tensorboard_run_data( ] = 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]]] = (), ) -> tensorboard_service.WriteTensorboardRunDataResponse: r"""Write time series data points into multiple TensorboardTimeSeries under a TensorboardRun. If any @@ -3927,8 +4015,10 @@ async def sample_write_tensorboard_run_data(): 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.aiplatform_v1beta1.types.WriteTensorboardRunDataResponse: @@ -3995,7 +4085,7 @@ async def export_tensorboard_time_series_data( tensorboard_time_series: 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.ExportTensorboardTimeSeriesDataAsyncPager: r"""Exports a TensorboardTimeSeries' data. Data is returned in paginated responses. @@ -4042,8 +4132,10 @@ async def sample_export_tensorboard_time_series_data(): 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.aiplatform_v1beta1.services.tensorboard_service.pagers.ExportTensorboardTimeSeriesDataAsyncPager: @@ -4123,7 +4215,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. @@ -4134,8 +4226,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. @@ -4176,7 +4270,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. @@ -4187,8 +4281,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. @@ -4229,7 +4325,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. @@ -4245,8 +4341,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 """ @@ -4283,7 +4381,7 @@ async def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -4298,8 +4396,10 @@ async def cancel_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 """ @@ -4336,7 +4436,7 @@ async def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -4353,8 +4453,10 @@ async def wait_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. @@ -4395,7 +4497,7 @@ async def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -4408,8 +4510,10 @@ async def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -4514,7 +4618,7 @@ async def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -4528,8 +4632,10 @@ async def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -4634,7 +4740,7 @@ async def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -4649,8 +4755,10 @@ async def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -4694,7 +4802,7 @@ async def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -4705,8 +4813,10 @@ async def get_location( 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: ~.location_pb2.Location: Location object. @@ -4747,7 +4857,7 @@ async def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -4758,8 +4868,10 @@ async def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1beta1/services/tensorboard_service/client.py b/google/cloud/aiplatform_v1beta1/services/tensorboard_service/client.py index cec9e265dc..d23e6fe17d 100644 --- a/google/cloud/aiplatform_v1beta1/services/tensorboard_service/client.py +++ b/google/cloud/aiplatform_v1beta1/services/tensorboard_service/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 ( @@ -49,6 +50,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 as gac_operation # type: ignore from google.api_core import operation_async # type: ignore from google.cloud.aiplatform_v1beta1.services.tensorboard_service import pagers @@ -700,6 +710,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( @@ -791,6 +805,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.aiplatform_v1beta1.TensorboardServiceClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "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.aiplatform.v1beta1.TensorboardService", + "credentialsType": None, + }, + ) + def create_tensorboard( self, request: Optional[ @@ -801,7 +838,7 @@ def create_tensorboard( tensorboard: Optional[gca_tensorboard.Tensorboard] = 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]]] = (), ) -> gac_operation.Operation: r"""Creates a Tensorboard. @@ -859,8 +896,10 @@ def sample_create_tensorboard(): 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: @@ -934,7 +973,7 @@ def get_tensorboard( 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]]] = (), ) -> tensorboard.Tensorboard: r"""Gets a Tensorboard. @@ -978,8 +1017,10 @@ def sample_get_tensorboard(): 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.aiplatform_v1beta1.types.Tensorboard: @@ -1044,7 +1085,7 @@ def update_tensorboard( 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]]] = (), ) -> gac_operation.Operation: r"""Updates a Tensorboard. @@ -1108,8 +1149,10 @@ def sample_update_tensorboard(): 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: @@ -1185,7 +1228,7 @@ def list_tensorboards( 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.ListTensorboardsPager: r"""Lists Tensorboards in a Location. @@ -1231,8 +1274,10 @@ def sample_list_tensorboards(): 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.aiplatform_v1beta1.services.tensorboard_service.pagers.ListTensorboardsPager: @@ -1306,7 +1351,7 @@ def delete_tensorboard( 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]]] = (), ) -> gac_operation.Operation: r"""Deletes a Tensorboard. @@ -1355,8 +1400,10 @@ def sample_delete_tensorboard(): 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: @@ -1434,7 +1481,7 @@ def read_tensorboard_usage( tensorboard: 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]]] = (), ) -> tensorboard_service.ReadTensorboardUsageResponse: r"""Returns a list of monthly active users for a given TensorBoard instance. @@ -1479,8 +1526,10 @@ def sample_read_tensorboard_usage(): 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.aiplatform_v1beta1.types.ReadTensorboardUsageResponse: @@ -1542,7 +1591,7 @@ def read_tensorboard_size( tensorboard: 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]]] = (), ) -> tensorboard_service.ReadTensorboardSizeResponse: r"""Returns the storage size for a given TensorBoard instance. @@ -1587,8 +1636,10 @@ def sample_read_tensorboard_size(): 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.aiplatform_v1beta1.types.ReadTensorboardSizeResponse: @@ -1654,7 +1705,7 @@ def create_tensorboard_experiment( tensorboard_experiment_id: 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]]] = (), ) -> gca_tensorboard_experiment.TensorboardExperiment: r"""Creates a TensorboardExperiment. @@ -1716,8 +1767,10 @@ def sample_create_tensorboard_experiment(): 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.aiplatform_v1beta1.types.TensorboardExperiment: @@ -1789,7 +1842,7 @@ def get_tensorboard_experiment( 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]]] = (), ) -> tensorboard_experiment.TensorboardExperiment: r"""Gets a TensorboardExperiment. @@ -1834,8 +1887,10 @@ def sample_get_tensorboard_experiment(): 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.aiplatform_v1beta1.types.TensorboardExperiment: @@ -1902,7 +1957,7 @@ def update_tensorboard_experiment( 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]]] = (), ) -> gca_tensorboard_experiment.TensorboardExperiment: r"""Updates a TensorboardExperiment. @@ -1959,8 +2014,10 @@ def sample_update_tensorboard_experiment(): 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.aiplatform_v1beta1.types.TensorboardExperiment: @@ -2030,7 +2087,7 @@ def list_tensorboard_experiments( 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.ListTensorboardExperimentsPager: r"""Lists TensorboardExperiments in a Location. @@ -2076,8 +2133,10 @@ def sample_list_tensorboard_experiments(): 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.aiplatform_v1beta1.services.tensorboard_service.pagers.ListTensorboardExperimentsPager: @@ -2155,7 +2214,7 @@ def delete_tensorboard_experiment( 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]]] = (), ) -> gac_operation.Operation: r"""Deletes a TensorboardExperiment. @@ -2204,8 +2263,10 @@ def sample_delete_tensorboard_experiment(): 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: @@ -2289,7 +2350,7 @@ def create_tensorboard_run( tensorboard_run_id: 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]]] = (), ) -> gca_tensorboard_run.TensorboardRun: r"""Creates a TensorboardRun. @@ -2357,8 +2418,10 @@ def sample_create_tensorboard_run(): 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.aiplatform_v1beta1.types.TensorboardRun: @@ -2427,7 +2490,7 @@ def batch_create_tensorboard_runs( ] = 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]]] = (), ) -> tensorboard_service.BatchCreateTensorboardRunsResponse: r"""Batch create TensorboardRuns. @@ -2490,8 +2553,10 @@ def sample_batch_create_tensorboard_runs(): 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.aiplatform_v1beta1.types.BatchCreateTensorboardRunsResponse: @@ -2557,7 +2622,7 @@ def get_tensorboard_run( 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]]] = (), ) -> tensorboard_run.TensorboardRun: r"""Gets a TensorboardRun. @@ -2602,8 +2667,10 @@ def sample_get_tensorboard_run(): 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.aiplatform_v1beta1.types.TensorboardRun: @@ -2666,7 +2733,7 @@ def update_tensorboard_run( 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]]] = (), ) -> gca_tensorboard_run.TensorboardRun: r"""Updates a TensorboardRun. @@ -2726,8 +2793,10 @@ def sample_update_tensorboard_run(): 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.aiplatform_v1beta1.types.TensorboardRun: @@ -2793,7 +2862,7 @@ def list_tensorboard_runs( 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.ListTensorboardRunsPager: r"""Lists TensorboardRuns in a Location. @@ -2839,8 +2908,10 @@ def sample_list_tensorboard_runs(): 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.aiplatform_v1beta1.services.tensorboard_service.pagers.ListTensorboardRunsPager: @@ -2914,7 +2985,7 @@ def delete_tensorboard_run( 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]]] = (), ) -> gac_operation.Operation: r"""Deletes a TensorboardRun. @@ -2963,8 +3034,10 @@ def sample_delete_tensorboard_run(): 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: @@ -3045,7 +3118,7 @@ def batch_create_tensorboard_time_series( ] = 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]]] = (), ) -> tensorboard_service.BatchCreateTensorboardTimeSeriesResponse: r"""Batch create TensorboardTimeSeries that belong to a TensorboardExperiment. @@ -3110,8 +3183,10 @@ def sample_batch_create_tensorboard_time_series(): 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.aiplatform_v1beta1.types.BatchCreateTensorboardTimeSeriesResponse: @@ -3182,7 +3257,7 @@ def create_tensorboard_time_series( ] = 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]]] = (), ) -> gca_tensorboard_time_series.TensorboardTimeSeries: r"""Creates a TensorboardTimeSeries. @@ -3239,8 +3314,10 @@ def sample_create_tensorboard_time_series(): 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.aiplatform_v1beta1.types.TensorboardTimeSeries: @@ -3306,7 +3383,7 @@ def get_tensorboard_time_series( 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]]] = (), ) -> tensorboard_time_series.TensorboardTimeSeries: r"""Gets a TensorboardTimeSeries. @@ -3351,8 +3428,10 @@ def sample_get_tensorboard_time_series(): 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.aiplatform_v1beta1.types.TensorboardTimeSeries: @@ -3417,7 +3496,7 @@ def update_tensorboard_time_series( 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]]] = (), ) -> gca_tensorboard_time_series.TensorboardTimeSeries: r"""Updates a TensorboardTimeSeries. @@ -3479,8 +3558,10 @@ def sample_update_tensorboard_time_series(): 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.aiplatform_v1beta1.types.TensorboardTimeSeries: @@ -3553,7 +3634,7 @@ def list_tensorboard_time_series( 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.ListTensorboardTimeSeriesPager: r"""Lists TensorboardTimeSeries in a Location. @@ -3599,8 +3680,10 @@ def sample_list_tensorboard_time_series(): 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.aiplatform_v1beta1.services.tensorboard_service.pagers.ListTensorboardTimeSeriesPager: @@ -3678,7 +3761,7 @@ def delete_tensorboard_time_series( 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]]] = (), ) -> gac_operation.Operation: r"""Deletes a TensorboardTimeSeries. @@ -3727,8 +3810,10 @@ def sample_delete_tensorboard_time_series(): 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: @@ -3810,7 +3895,7 @@ def batch_read_tensorboard_time_series_data( tensorboard: 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]]] = (), ) -> tensorboard_service.BatchReadTensorboardTimeSeriesDataResponse: r"""Reads multiple TensorboardTimeSeries' data. The data point number limit is 1000 for scalars, 100 for tensors @@ -3865,8 +3950,10 @@ def sample_batch_read_tensorboard_time_series_data(): 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.aiplatform_v1beta1.types.BatchReadTensorboardTimeSeriesDataResponse: @@ -3934,7 +4021,7 @@ def read_tensorboard_time_series_data( tensorboard_time_series: 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]]] = (), ) -> tensorboard_service.ReadTensorboardTimeSeriesDataResponse: r"""Reads a TensorboardTimeSeries' data. By default, if the number of data points stored is less than 1000, all data is returned. @@ -3983,8 +4070,10 @@ def sample_read_tensorboard_time_series_data(): 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.aiplatform_v1beta1.types.ReadTensorboardTimeSeriesDataResponse: @@ -4050,7 +4139,7 @@ def read_tensorboard_blob_data( time_series: 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]]] = (), ) -> Iterable[tensorboard_service.ReadTensorboardBlobDataResponse]: r"""Gets bytes of TensorboardBlobs. This is to allow reading blob data stored in consumer @@ -4099,8 +4188,10 @@ def sample_read_tensorboard_blob_data(): 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: Iterable[google.cloud.aiplatform_v1beta1.types.ReadTensorboardBlobDataResponse]: @@ -4167,7 +4258,7 @@ def write_tensorboard_experiment_data( ] = 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]]] = (), ) -> tensorboard_service.WriteTensorboardExperimentDataResponse: r"""Write time series data points of multiple TensorboardTimeSeries in multiple TensorboardRun's. If @@ -4227,8 +4318,10 @@ def sample_write_tensorboard_experiment_data(): 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.aiplatform_v1beta1.types.WriteTensorboardExperimentDataResponse: @@ -4299,7 +4392,7 @@ def write_tensorboard_run_data( ] = 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]]] = (), ) -> tensorboard_service.WriteTensorboardRunDataResponse: r"""Write time series data points into multiple TensorboardTimeSeries under a TensorboardRun. If any @@ -4364,8 +4457,10 @@ def sample_write_tensorboard_run_data(): 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.aiplatform_v1beta1.types.WriteTensorboardRunDataResponse: @@ -4431,7 +4526,7 @@ def export_tensorboard_time_series_data( tensorboard_time_series: 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.ExportTensorboardTimeSeriesDataPager: r"""Exports a TensorboardTimeSeries' data. Data is returned in paginated responses. @@ -4478,8 +4573,10 @@ def sample_export_tensorboard_time_series_data(): 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.aiplatform_v1beta1.services.tensorboard_service.pagers.ExportTensorboardTimeSeriesDataPager: @@ -4571,7 +4668,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. @@ -4582,8 +4679,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. @@ -4624,7 +4723,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. @@ -4635,8 +4734,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. @@ -4677,7 +4778,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. @@ -4693,8 +4794,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 """ @@ -4731,7 +4834,7 @@ def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -4746,8 +4849,10 @@ def cancel_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 """ @@ -4784,7 +4889,7 @@ def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -4801,8 +4906,10 @@ def wait_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. @@ -4843,7 +4950,7 @@ def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -4856,8 +4963,10 @@ def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -4962,7 +5071,7 @@ def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -4976,8 +5085,10 @@ def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -5082,7 +5193,7 @@ def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -5097,8 +5208,10 @@ def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -5140,7 +5253,7 @@ def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -5151,8 +5264,10 @@ def get_location( 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: ~.location_pb2.Location: Location object. @@ -5193,7 +5308,7 @@ def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -5204,8 +5319,10 @@ def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1beta1/services/tensorboard_service/pagers.py b/google/cloud/aiplatform_v1beta1/services/tensorboard_service/pagers.py index 425e7088c4..945ab22bb5 100644 --- a/google/cloud/aiplatform_v1beta1/services/tensorboard_service/pagers.py +++ b/google/cloud/aiplatform_v1beta1/services/tensorboard_service/pagers.py @@ -71,7 +71,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. @@ -85,8 +85,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 = tensorboard_service.ListTensorboardsRequest(request) @@ -145,7 +147,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. @@ -159,8 +161,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 = tensorboard_service.ListTensorboardsRequest(request) @@ -225,7 +229,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. @@ -239,8 +243,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 = tensorboard_service.ListTensorboardExperimentsRequest(request) @@ -301,7 +307,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. @@ -315,8 +321,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 = tensorboard_service.ListTensorboardExperimentsRequest(request) @@ -381,7 +389,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. @@ -395,8 +403,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 = tensorboard_service.ListTensorboardRunsRequest(request) @@ -457,7 +467,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. @@ -471,8 +481,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 = tensorboard_service.ListTensorboardRunsRequest(request) @@ -537,7 +549,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. @@ -551,8 +563,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 = tensorboard_service.ListTensorboardTimeSeriesRequest(request) @@ -613,7 +627,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. @@ -627,8 +641,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 = tensorboard_service.ListTensorboardTimeSeriesRequest(request) @@ -695,7 +711,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. @@ -709,8 +725,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 = tensorboard_service.ExportTensorboardTimeSeriesDataRequest( @@ -775,7 +793,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. @@ -789,8 +807,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 = tensorboard_service.ExportTensorboardTimeSeriesDataRequest( diff --git a/google/cloud/aiplatform_v1beta1/services/tensorboard_service/transports/grpc.py b/google/cloud/aiplatform_v1beta1/services/tensorboard_service/transports/grpc.py index 2c842b2c83..c94c65cf2f 100644 --- a/google/cloud/aiplatform_v1beta1/services/tensorboard_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1beta1/services/tensorboard_service/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 import warnings from typing import Callable, Dict, Optional, Sequence, Tuple, Union @@ -22,8 +25,11 @@ import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from google.cloud.aiplatform_v1beta1.types import tensorboard from google.cloud.aiplatform_v1beta1.types import tensorboard_experiment @@ -43,6 +49,81 @@ from google.longrunning import operations_pb2 # type: ignore from .base import TensorboardServiceTransport, DEFAULT_CLIENT_INFO +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.aiplatform.v1beta1.TensorboardService", + "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.aiplatform.v1beta1.TensorboardService", + "rpcName": client_call_details.method, + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class TensorboardServiceGrpcTransport(TensorboardServiceTransport): """gRPC backend transport for TensorboardService. @@ -197,7 +278,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 @@ -261,7 +347,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 @@ -287,7 +375,7 @@ def create_tensorboard( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_tensorboard" not in self._stubs: - self._stubs["create_tensorboard"] = self.grpc_channel.unary_unary( + self._stubs["create_tensorboard"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.TensorboardService/CreateTensorboard", request_serializer=tensorboard_service.CreateTensorboardRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -313,7 +401,7 @@ def get_tensorboard( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_tensorboard" not in self._stubs: - self._stubs["get_tensorboard"] = self.grpc_channel.unary_unary( + self._stubs["get_tensorboard"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.TensorboardService/GetTensorboard", request_serializer=tensorboard_service.GetTensorboardRequest.serialize, response_deserializer=tensorboard.Tensorboard.deserialize, @@ -341,7 +429,7 @@ def update_tensorboard( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_tensorboard" not in self._stubs: - self._stubs["update_tensorboard"] = self.grpc_channel.unary_unary( + self._stubs["update_tensorboard"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.TensorboardService/UpdateTensorboard", request_serializer=tensorboard_service.UpdateTensorboardRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -370,7 +458,7 @@ def list_tensorboards( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_tensorboards" not in self._stubs: - self._stubs["list_tensorboards"] = self.grpc_channel.unary_unary( + self._stubs["list_tensorboards"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.TensorboardService/ListTensorboards", request_serializer=tensorboard_service.ListTensorboardsRequest.serialize, response_deserializer=tensorboard_service.ListTensorboardsResponse.deserialize, @@ -398,7 +486,7 @@ def delete_tensorboard( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_tensorboard" not in self._stubs: - self._stubs["delete_tensorboard"] = self.grpc_channel.unary_unary( + self._stubs["delete_tensorboard"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.TensorboardService/DeleteTensorboard", request_serializer=tensorboard_service.DeleteTensorboardRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -428,7 +516,7 @@ def read_tensorboard_usage( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "read_tensorboard_usage" not in self._stubs: - self._stubs["read_tensorboard_usage"] = self.grpc_channel.unary_unary( + self._stubs["read_tensorboard_usage"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.TensorboardService/ReadTensorboardUsage", request_serializer=tensorboard_service.ReadTensorboardUsageRequest.serialize, response_deserializer=tensorboard_service.ReadTensorboardUsageResponse.deserialize, @@ -458,7 +546,7 @@ def read_tensorboard_size( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "read_tensorboard_size" not in self._stubs: - self._stubs["read_tensorboard_size"] = self.grpc_channel.unary_unary( + self._stubs["read_tensorboard_size"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.TensorboardService/ReadTensorboardSize", request_serializer=tensorboard_service.ReadTensorboardSizeRequest.serialize, response_deserializer=tensorboard_service.ReadTensorboardSizeResponse.deserialize, @@ -489,7 +577,7 @@ def create_tensorboard_experiment( if "create_tensorboard_experiment" not in self._stubs: self._stubs[ "create_tensorboard_experiment" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.TensorboardService/CreateTensorboardExperiment", request_serializer=tensorboard_service.CreateTensorboardExperimentRequest.serialize, response_deserializer=gca_tensorboard_experiment.TensorboardExperiment.deserialize, @@ -518,7 +606,9 @@ def get_tensorboard_experiment( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_tensorboard_experiment" not in self._stubs: - self._stubs["get_tensorboard_experiment"] = self.grpc_channel.unary_unary( + self._stubs[ + "get_tensorboard_experiment" + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.TensorboardService/GetTensorboardExperiment", request_serializer=tensorboard_service.GetTensorboardExperimentRequest.serialize, response_deserializer=tensorboard_experiment.TensorboardExperiment.deserialize, @@ -549,7 +639,7 @@ def update_tensorboard_experiment( if "update_tensorboard_experiment" not in self._stubs: self._stubs[ "update_tensorboard_experiment" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.TensorboardService/UpdateTensorboardExperiment", request_serializer=tensorboard_service.UpdateTensorboardExperimentRequest.serialize, response_deserializer=gca_tensorboard_experiment.TensorboardExperiment.deserialize, @@ -578,7 +668,9 @@ def list_tensorboard_experiments( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_tensorboard_experiments" not in self._stubs: - self._stubs["list_tensorboard_experiments"] = self.grpc_channel.unary_unary( + self._stubs[ + "list_tensorboard_experiments" + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.TensorboardService/ListTensorboardExperiments", request_serializer=tensorboard_service.ListTensorboardExperimentsRequest.serialize, response_deserializer=tensorboard_service.ListTensorboardExperimentsResponse.deserialize, @@ -609,7 +701,7 @@ def delete_tensorboard_experiment( if "delete_tensorboard_experiment" not in self._stubs: self._stubs[ "delete_tensorboard_experiment" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.TensorboardService/DeleteTensorboardExperiment", request_serializer=tensorboard_service.DeleteTensorboardExperimentRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -638,7 +730,7 @@ def create_tensorboard_run( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_tensorboard_run" not in self._stubs: - self._stubs["create_tensorboard_run"] = self.grpc_channel.unary_unary( + self._stubs["create_tensorboard_run"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.TensorboardService/CreateTensorboardRun", request_serializer=tensorboard_service.CreateTensorboardRunRequest.serialize, response_deserializer=gca_tensorboard_run.TensorboardRun.deserialize, @@ -669,7 +761,7 @@ def batch_create_tensorboard_runs( if "batch_create_tensorboard_runs" not in self._stubs: self._stubs[ "batch_create_tensorboard_runs" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.TensorboardService/BatchCreateTensorboardRuns", request_serializer=tensorboard_service.BatchCreateTensorboardRunsRequest.serialize, response_deserializer=tensorboard_service.BatchCreateTensorboardRunsResponse.deserialize, @@ -697,7 +789,7 @@ def get_tensorboard_run( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_tensorboard_run" not in self._stubs: - self._stubs["get_tensorboard_run"] = self.grpc_channel.unary_unary( + self._stubs["get_tensorboard_run"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.TensorboardService/GetTensorboardRun", request_serializer=tensorboard_service.GetTensorboardRunRequest.serialize, response_deserializer=tensorboard_run.TensorboardRun.deserialize, @@ -726,7 +818,7 @@ def update_tensorboard_run( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_tensorboard_run" not in self._stubs: - self._stubs["update_tensorboard_run"] = self.grpc_channel.unary_unary( + self._stubs["update_tensorboard_run"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.TensorboardService/UpdateTensorboardRun", request_serializer=tensorboard_service.UpdateTensorboardRunRequest.serialize, response_deserializer=gca_tensorboard_run.TensorboardRun.deserialize, @@ -755,7 +847,7 @@ def list_tensorboard_runs( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_tensorboard_runs" not in self._stubs: - self._stubs["list_tensorboard_runs"] = self.grpc_channel.unary_unary( + self._stubs["list_tensorboard_runs"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.TensorboardService/ListTensorboardRuns", request_serializer=tensorboard_service.ListTensorboardRunsRequest.serialize, response_deserializer=tensorboard_service.ListTensorboardRunsResponse.deserialize, @@ -783,7 +875,7 @@ def delete_tensorboard_run( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_tensorboard_run" not in self._stubs: - self._stubs["delete_tensorboard_run"] = self.grpc_channel.unary_unary( + self._stubs["delete_tensorboard_run"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.TensorboardService/DeleteTensorboardRun", request_serializer=tensorboard_service.DeleteTensorboardRunRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -816,7 +908,7 @@ def batch_create_tensorboard_time_series( if "batch_create_tensorboard_time_series" not in self._stubs: self._stubs[ "batch_create_tensorboard_time_series" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.TensorboardService/BatchCreateTensorboardTimeSeries", request_serializer=tensorboard_service.BatchCreateTensorboardTimeSeriesRequest.serialize, response_deserializer=tensorboard_service.BatchCreateTensorboardTimeSeriesResponse.deserialize, @@ -847,7 +939,7 @@ def create_tensorboard_time_series( if "create_tensorboard_time_series" not in self._stubs: self._stubs[ "create_tensorboard_time_series" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.TensorboardService/CreateTensorboardTimeSeries", request_serializer=tensorboard_service.CreateTensorboardTimeSeriesRequest.serialize, response_deserializer=gca_tensorboard_time_series.TensorboardTimeSeries.deserialize, @@ -876,7 +968,9 @@ def get_tensorboard_time_series( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_tensorboard_time_series" not in self._stubs: - self._stubs["get_tensorboard_time_series"] = self.grpc_channel.unary_unary( + self._stubs[ + "get_tensorboard_time_series" + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.TensorboardService/GetTensorboardTimeSeries", request_serializer=tensorboard_service.GetTensorboardTimeSeriesRequest.serialize, response_deserializer=tensorboard_time_series.TensorboardTimeSeries.deserialize, @@ -907,7 +1001,7 @@ def update_tensorboard_time_series( if "update_tensorboard_time_series" not in self._stubs: self._stubs[ "update_tensorboard_time_series" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.TensorboardService/UpdateTensorboardTimeSeries", request_serializer=tensorboard_service.UpdateTensorboardTimeSeriesRequest.serialize, response_deserializer=gca_tensorboard_time_series.TensorboardTimeSeries.deserialize, @@ -936,7 +1030,9 @@ def list_tensorboard_time_series( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_tensorboard_time_series" not in self._stubs: - self._stubs["list_tensorboard_time_series"] = self.grpc_channel.unary_unary( + self._stubs[ + "list_tensorboard_time_series" + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.TensorboardService/ListTensorboardTimeSeries", request_serializer=tensorboard_service.ListTensorboardTimeSeriesRequest.serialize, response_deserializer=tensorboard_service.ListTensorboardTimeSeriesResponse.deserialize, @@ -967,7 +1063,7 @@ def delete_tensorboard_time_series( if "delete_tensorboard_time_series" not in self._stubs: self._stubs[ "delete_tensorboard_time_series" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.TensorboardService/DeleteTensorboardTimeSeries", request_serializer=tensorboard_service.DeleteTensorboardTimeSeriesRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -1004,7 +1100,7 @@ def batch_read_tensorboard_time_series_data( if "batch_read_tensorboard_time_series_data" not in self._stubs: self._stubs[ "batch_read_tensorboard_time_series_data" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.TensorboardService/BatchReadTensorboardTimeSeriesData", request_serializer=tensorboard_service.BatchReadTensorboardTimeSeriesDataRequest.serialize, response_deserializer=tensorboard_service.BatchReadTensorboardTimeSeriesDataResponse.deserialize, @@ -1040,7 +1136,7 @@ def read_tensorboard_time_series_data( if "read_tensorboard_time_series_data" not in self._stubs: self._stubs[ "read_tensorboard_time_series_data" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.TensorboardService/ReadTensorboardTimeSeriesData", request_serializer=tensorboard_service.ReadTensorboardTimeSeriesDataRequest.serialize, response_deserializer=tensorboard_service.ReadTensorboardTimeSeriesDataResponse.deserialize, @@ -1072,7 +1168,9 @@ def read_tensorboard_blob_data( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "read_tensorboard_blob_data" not in self._stubs: - self._stubs["read_tensorboard_blob_data"] = self.grpc_channel.unary_stream( + self._stubs[ + "read_tensorboard_blob_data" + ] = self._logged_channel.unary_stream( "/google.cloud.aiplatform.v1beta1.TensorboardService/ReadTensorboardBlobData", request_serializer=tensorboard_service.ReadTensorboardBlobDataRequest.serialize, response_deserializer=tensorboard_service.ReadTensorboardBlobDataResponse.deserialize, @@ -1106,7 +1204,7 @@ def write_tensorboard_experiment_data( if "write_tensorboard_experiment_data" not in self._stubs: self._stubs[ "write_tensorboard_experiment_data" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.TensorboardService/WriteTensorboardExperimentData", request_serializer=tensorboard_service.WriteTensorboardExperimentDataRequest.serialize, response_deserializer=tensorboard_service.WriteTensorboardExperimentDataResponse.deserialize, @@ -1137,7 +1235,9 @@ def write_tensorboard_run_data( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "write_tensorboard_run_data" not in self._stubs: - self._stubs["write_tensorboard_run_data"] = self.grpc_channel.unary_unary( + self._stubs[ + "write_tensorboard_run_data" + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.TensorboardService/WriteTensorboardRunData", request_serializer=tensorboard_service.WriteTensorboardRunDataRequest.serialize, response_deserializer=tensorboard_service.WriteTensorboardRunDataResponse.deserialize, @@ -1170,7 +1270,7 @@ def export_tensorboard_time_series_data( if "export_tensorboard_time_series_data" not in self._stubs: self._stubs[ "export_tensorboard_time_series_data" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.TensorboardService/ExportTensorboardTimeSeriesData", request_serializer=tensorboard_service.ExportTensorboardTimeSeriesDataRequest.serialize, response_deserializer=tensorboard_service.ExportTensorboardTimeSeriesDataResponse.deserialize, @@ -1178,7 +1278,7 @@ def export_tensorboard_time_series_data( return self._stubs["export_tensorboard_time_series_data"] def close(self): - self.grpc_channel.close() + self._logged_channel.close() @property def delete_operation( @@ -1190,7 +1290,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, @@ -1207,7 +1307,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -1224,7 +1324,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -1241,7 +1341,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, @@ -1260,7 +1360,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, @@ -1279,7 +1379,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -1296,7 +1396,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -1321,7 +1421,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -1347,7 +1447,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -1376,7 +1476,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1beta1/services/tensorboard_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1beta1/services/tensorboard_service/transports/grpc_asyncio.py index bc34abea87..f24858c880 100644 --- a/google/cloud/aiplatform_v1beta1/services/tensorboard_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/tensorboard_service/transports/grpc_asyncio.py @@ -14,6 +14,9 @@ # limitations under the License. # import inspect +import json +import pickle +import logging as std_logging import warnings from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union @@ -24,8 +27,11 @@ from google.api_core import operations_v1 from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from grpc.experimental import aio # type: ignore from google.cloud.aiplatform_v1beta1.types import tensorboard @@ -47,6 +53,82 @@ from .base import TensorboardServiceTransport, DEFAULT_CLIENT_INFO from .grpc import TensorboardServiceGrpcTransport +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.aiplatform.v1beta1.TensorboardService", + "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.aiplatform.v1beta1.TensorboardService", + "rpcName": str(client_call_details.method), + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class TensorboardServiceGrpcAsyncIOTransport(TensorboardServiceTransport): """gRPC AsyncIO backend transport for TensorboardService. @@ -244,10 +326,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 @@ -270,7 +355,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. @@ -298,7 +383,7 @@ def create_tensorboard( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_tensorboard" not in self._stubs: - self._stubs["create_tensorboard"] = self.grpc_channel.unary_unary( + self._stubs["create_tensorboard"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.TensorboardService/CreateTensorboard", request_serializer=tensorboard_service.CreateTensorboardRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -326,7 +411,7 @@ def get_tensorboard( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_tensorboard" not in self._stubs: - self._stubs["get_tensorboard"] = self.grpc_channel.unary_unary( + self._stubs["get_tensorboard"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.TensorboardService/GetTensorboard", request_serializer=tensorboard_service.GetTensorboardRequest.serialize, response_deserializer=tensorboard.Tensorboard.deserialize, @@ -355,7 +440,7 @@ def update_tensorboard( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_tensorboard" not in self._stubs: - self._stubs["update_tensorboard"] = self.grpc_channel.unary_unary( + self._stubs["update_tensorboard"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.TensorboardService/UpdateTensorboard", request_serializer=tensorboard_service.UpdateTensorboardRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -384,7 +469,7 @@ def list_tensorboards( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_tensorboards" not in self._stubs: - self._stubs["list_tensorboards"] = self.grpc_channel.unary_unary( + self._stubs["list_tensorboards"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.TensorboardService/ListTensorboards", request_serializer=tensorboard_service.ListTensorboardsRequest.serialize, response_deserializer=tensorboard_service.ListTensorboardsResponse.deserialize, @@ -413,7 +498,7 @@ def delete_tensorboard( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_tensorboard" not in self._stubs: - self._stubs["delete_tensorboard"] = self.grpc_channel.unary_unary( + self._stubs["delete_tensorboard"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.TensorboardService/DeleteTensorboard", request_serializer=tensorboard_service.DeleteTensorboardRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -443,7 +528,7 @@ def read_tensorboard_usage( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "read_tensorboard_usage" not in self._stubs: - self._stubs["read_tensorboard_usage"] = self.grpc_channel.unary_unary( + self._stubs["read_tensorboard_usage"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.TensorboardService/ReadTensorboardUsage", request_serializer=tensorboard_service.ReadTensorboardUsageRequest.serialize, response_deserializer=tensorboard_service.ReadTensorboardUsageResponse.deserialize, @@ -473,7 +558,7 @@ def read_tensorboard_size( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "read_tensorboard_size" not in self._stubs: - self._stubs["read_tensorboard_size"] = self.grpc_channel.unary_unary( + self._stubs["read_tensorboard_size"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.TensorboardService/ReadTensorboardSize", request_serializer=tensorboard_service.ReadTensorboardSizeRequest.serialize, response_deserializer=tensorboard_service.ReadTensorboardSizeResponse.deserialize, @@ -504,7 +589,7 @@ def create_tensorboard_experiment( if "create_tensorboard_experiment" not in self._stubs: self._stubs[ "create_tensorboard_experiment" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.TensorboardService/CreateTensorboardExperiment", request_serializer=tensorboard_service.CreateTensorboardExperimentRequest.serialize, response_deserializer=gca_tensorboard_experiment.TensorboardExperiment.deserialize, @@ -533,7 +618,9 @@ def get_tensorboard_experiment( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_tensorboard_experiment" not in self._stubs: - self._stubs["get_tensorboard_experiment"] = self.grpc_channel.unary_unary( + self._stubs[ + "get_tensorboard_experiment" + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.TensorboardService/GetTensorboardExperiment", request_serializer=tensorboard_service.GetTensorboardExperimentRequest.serialize, response_deserializer=tensorboard_experiment.TensorboardExperiment.deserialize, @@ -564,7 +651,7 @@ def update_tensorboard_experiment( if "update_tensorboard_experiment" not in self._stubs: self._stubs[ "update_tensorboard_experiment" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.TensorboardService/UpdateTensorboardExperiment", request_serializer=tensorboard_service.UpdateTensorboardExperimentRequest.serialize, response_deserializer=gca_tensorboard_experiment.TensorboardExperiment.deserialize, @@ -593,7 +680,9 @@ def list_tensorboard_experiments( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_tensorboard_experiments" not in self._stubs: - self._stubs["list_tensorboard_experiments"] = self.grpc_channel.unary_unary( + self._stubs[ + "list_tensorboard_experiments" + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.TensorboardService/ListTensorboardExperiments", request_serializer=tensorboard_service.ListTensorboardExperimentsRequest.serialize, response_deserializer=tensorboard_service.ListTensorboardExperimentsResponse.deserialize, @@ -624,7 +713,7 @@ def delete_tensorboard_experiment( if "delete_tensorboard_experiment" not in self._stubs: self._stubs[ "delete_tensorboard_experiment" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.TensorboardService/DeleteTensorboardExperiment", request_serializer=tensorboard_service.DeleteTensorboardExperimentRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -653,7 +742,7 @@ def create_tensorboard_run( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_tensorboard_run" not in self._stubs: - self._stubs["create_tensorboard_run"] = self.grpc_channel.unary_unary( + self._stubs["create_tensorboard_run"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.TensorboardService/CreateTensorboardRun", request_serializer=tensorboard_service.CreateTensorboardRunRequest.serialize, response_deserializer=gca_tensorboard_run.TensorboardRun.deserialize, @@ -684,7 +773,7 @@ def batch_create_tensorboard_runs( if "batch_create_tensorboard_runs" not in self._stubs: self._stubs[ "batch_create_tensorboard_runs" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.TensorboardService/BatchCreateTensorboardRuns", request_serializer=tensorboard_service.BatchCreateTensorboardRunsRequest.serialize, response_deserializer=tensorboard_service.BatchCreateTensorboardRunsResponse.deserialize, @@ -713,7 +802,7 @@ def get_tensorboard_run( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_tensorboard_run" not in self._stubs: - self._stubs["get_tensorboard_run"] = self.grpc_channel.unary_unary( + self._stubs["get_tensorboard_run"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.TensorboardService/GetTensorboardRun", request_serializer=tensorboard_service.GetTensorboardRunRequest.serialize, response_deserializer=tensorboard_run.TensorboardRun.deserialize, @@ -742,7 +831,7 @@ def update_tensorboard_run( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_tensorboard_run" not in self._stubs: - self._stubs["update_tensorboard_run"] = self.grpc_channel.unary_unary( + self._stubs["update_tensorboard_run"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.TensorboardService/UpdateTensorboardRun", request_serializer=tensorboard_service.UpdateTensorboardRunRequest.serialize, response_deserializer=gca_tensorboard_run.TensorboardRun.deserialize, @@ -771,7 +860,7 @@ def list_tensorboard_runs( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_tensorboard_runs" not in self._stubs: - self._stubs["list_tensorboard_runs"] = self.grpc_channel.unary_unary( + self._stubs["list_tensorboard_runs"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.TensorboardService/ListTensorboardRuns", request_serializer=tensorboard_service.ListTensorboardRunsRequest.serialize, response_deserializer=tensorboard_service.ListTensorboardRunsResponse.deserialize, @@ -800,7 +889,7 @@ def delete_tensorboard_run( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_tensorboard_run" not in self._stubs: - self._stubs["delete_tensorboard_run"] = self.grpc_channel.unary_unary( + self._stubs["delete_tensorboard_run"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.TensorboardService/DeleteTensorboardRun", request_serializer=tensorboard_service.DeleteTensorboardRunRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -833,7 +922,7 @@ def batch_create_tensorboard_time_series( if "batch_create_tensorboard_time_series" not in self._stubs: self._stubs[ "batch_create_tensorboard_time_series" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.TensorboardService/BatchCreateTensorboardTimeSeries", request_serializer=tensorboard_service.BatchCreateTensorboardTimeSeriesRequest.serialize, response_deserializer=tensorboard_service.BatchCreateTensorboardTimeSeriesResponse.deserialize, @@ -864,7 +953,7 @@ def create_tensorboard_time_series( if "create_tensorboard_time_series" not in self._stubs: self._stubs[ "create_tensorboard_time_series" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.TensorboardService/CreateTensorboardTimeSeries", request_serializer=tensorboard_service.CreateTensorboardTimeSeriesRequest.serialize, response_deserializer=gca_tensorboard_time_series.TensorboardTimeSeries.deserialize, @@ -893,7 +982,9 @@ def get_tensorboard_time_series( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_tensorboard_time_series" not in self._stubs: - self._stubs["get_tensorboard_time_series"] = self.grpc_channel.unary_unary( + self._stubs[ + "get_tensorboard_time_series" + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.TensorboardService/GetTensorboardTimeSeries", request_serializer=tensorboard_service.GetTensorboardTimeSeriesRequest.serialize, response_deserializer=tensorboard_time_series.TensorboardTimeSeries.deserialize, @@ -924,7 +1015,7 @@ def update_tensorboard_time_series( if "update_tensorboard_time_series" not in self._stubs: self._stubs[ "update_tensorboard_time_series" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.TensorboardService/UpdateTensorboardTimeSeries", request_serializer=tensorboard_service.UpdateTensorboardTimeSeriesRequest.serialize, response_deserializer=gca_tensorboard_time_series.TensorboardTimeSeries.deserialize, @@ -953,7 +1044,9 @@ def list_tensorboard_time_series( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_tensorboard_time_series" not in self._stubs: - self._stubs["list_tensorboard_time_series"] = self.grpc_channel.unary_unary( + self._stubs[ + "list_tensorboard_time_series" + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.TensorboardService/ListTensorboardTimeSeries", request_serializer=tensorboard_service.ListTensorboardTimeSeriesRequest.serialize, response_deserializer=tensorboard_service.ListTensorboardTimeSeriesResponse.deserialize, @@ -984,7 +1077,7 @@ def delete_tensorboard_time_series( if "delete_tensorboard_time_series" not in self._stubs: self._stubs[ "delete_tensorboard_time_series" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.TensorboardService/DeleteTensorboardTimeSeries", request_serializer=tensorboard_service.DeleteTensorboardTimeSeriesRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -1021,7 +1114,7 @@ def batch_read_tensorboard_time_series_data( if "batch_read_tensorboard_time_series_data" not in self._stubs: self._stubs[ "batch_read_tensorboard_time_series_data" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.TensorboardService/BatchReadTensorboardTimeSeriesData", request_serializer=tensorboard_service.BatchReadTensorboardTimeSeriesDataRequest.serialize, response_deserializer=tensorboard_service.BatchReadTensorboardTimeSeriesDataResponse.deserialize, @@ -1057,7 +1150,7 @@ def read_tensorboard_time_series_data( if "read_tensorboard_time_series_data" not in self._stubs: self._stubs[ "read_tensorboard_time_series_data" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.TensorboardService/ReadTensorboardTimeSeriesData", request_serializer=tensorboard_service.ReadTensorboardTimeSeriesDataRequest.serialize, response_deserializer=tensorboard_service.ReadTensorboardTimeSeriesDataResponse.deserialize, @@ -1089,7 +1182,9 @@ def read_tensorboard_blob_data( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "read_tensorboard_blob_data" not in self._stubs: - self._stubs["read_tensorboard_blob_data"] = self.grpc_channel.unary_stream( + self._stubs[ + "read_tensorboard_blob_data" + ] = self._logged_channel.unary_stream( "/google.cloud.aiplatform.v1beta1.TensorboardService/ReadTensorboardBlobData", request_serializer=tensorboard_service.ReadTensorboardBlobDataRequest.serialize, response_deserializer=tensorboard_service.ReadTensorboardBlobDataResponse.deserialize, @@ -1123,7 +1218,7 @@ def write_tensorboard_experiment_data( if "write_tensorboard_experiment_data" not in self._stubs: self._stubs[ "write_tensorboard_experiment_data" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.TensorboardService/WriteTensorboardExperimentData", request_serializer=tensorboard_service.WriteTensorboardExperimentDataRequest.serialize, response_deserializer=tensorboard_service.WriteTensorboardExperimentDataResponse.deserialize, @@ -1154,7 +1249,9 @@ def write_tensorboard_run_data( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "write_tensorboard_run_data" not in self._stubs: - self._stubs["write_tensorboard_run_data"] = self.grpc_channel.unary_unary( + self._stubs[ + "write_tensorboard_run_data" + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.TensorboardService/WriteTensorboardRunData", request_serializer=tensorboard_service.WriteTensorboardRunDataRequest.serialize, response_deserializer=tensorboard_service.WriteTensorboardRunDataResponse.deserialize, @@ -1187,7 +1284,7 @@ def export_tensorboard_time_series_data( if "export_tensorboard_time_series_data" not in self._stubs: self._stubs[ "export_tensorboard_time_series_data" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.TensorboardService/ExportTensorboardTimeSeriesData", request_serializer=tensorboard_service.ExportTensorboardTimeSeriesDataRequest.serialize, response_deserializer=tensorboard_service.ExportTensorboardTimeSeriesDataResponse.deserialize, @@ -1405,7 +1502,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: @@ -1421,7 +1518,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, @@ -1438,7 +1535,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -1455,7 +1552,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -1472,7 +1569,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, @@ -1491,7 +1588,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, @@ -1510,7 +1607,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -1527,7 +1624,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -1552,7 +1649,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -1578,7 +1675,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -1607,7 +1704,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1beta1/services/tensorboard_service/transports/rest.py b/google/cloud/aiplatform_v1beta1/services/tensorboard_service/transports/rest.py index b6872969af..fe6cba2856 100644 --- a/google/cloud/aiplatform_v1beta1/services/tensorboard_service/transports/rest.py +++ b/google/cloud/aiplatform_v1beta1/services/tensorboard_service/transports/rest.py @@ -13,9 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging +import json # type: ignore from google.auth.transport.requests import AuthorizedSession # type: ignore -import json # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.api_core import exceptions as core_exceptions from google.api_core import retry as retries @@ -58,6 +59,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, @@ -330,9 +339,10 @@ def post_write_tensorboard_run_data(self, response): def pre_batch_create_tensorboard_runs( self, request: tensorboard_service.BatchCreateTensorboardRunsRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - tensorboard_service.BatchCreateTensorboardRunsRequest, Sequence[Tuple[str, str]] + tensorboard_service.BatchCreateTensorboardRunsRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for batch_create_tensorboard_runs @@ -355,10 +365,10 @@ def post_batch_create_tensorboard_runs( def pre_batch_create_tensorboard_time_series( self, request: tensorboard_service.BatchCreateTensorboardTimeSeriesRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ tensorboard_service.BatchCreateTensorboardTimeSeriesRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for batch_create_tensorboard_time_series @@ -381,10 +391,10 @@ def post_batch_create_tensorboard_time_series( def pre_batch_read_tensorboard_time_series_data( self, request: tensorboard_service.BatchReadTensorboardTimeSeriesDataRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ tensorboard_service.BatchReadTensorboardTimeSeriesDataRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for batch_read_tensorboard_time_series_data @@ -407,8 +417,11 @@ def post_batch_read_tensorboard_time_series_data( def pre_create_tensorboard( self, request: tensorboard_service.CreateTensorboardRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[tensorboard_service.CreateTensorboardRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + tensorboard_service.CreateTensorboardRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for create_tensorboard Override in a subclass to manipulate the request or metadata @@ -430,10 +443,10 @@ def post_create_tensorboard( def pre_create_tensorboard_experiment( self, request: tensorboard_service.CreateTensorboardExperimentRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ tensorboard_service.CreateTensorboardExperimentRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for create_tensorboard_experiment @@ -456,9 +469,10 @@ def post_create_tensorboard_experiment( def pre_create_tensorboard_run( self, request: tensorboard_service.CreateTensorboardRunRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - tensorboard_service.CreateTensorboardRunRequest, Sequence[Tuple[str, str]] + tensorboard_service.CreateTensorboardRunRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for create_tensorboard_run @@ -481,10 +495,10 @@ def post_create_tensorboard_run( def pre_create_tensorboard_time_series( self, request: tensorboard_service.CreateTensorboardTimeSeriesRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ tensorboard_service.CreateTensorboardTimeSeriesRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for create_tensorboard_time_series @@ -507,8 +521,11 @@ def post_create_tensorboard_time_series( def pre_delete_tensorboard( self, request: tensorboard_service.DeleteTensorboardRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[tensorboard_service.DeleteTensorboardRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + tensorboard_service.DeleteTensorboardRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for delete_tensorboard Override in a subclass to manipulate the request or metadata @@ -530,10 +547,10 @@ def post_delete_tensorboard( def pre_delete_tensorboard_experiment( self, request: tensorboard_service.DeleteTensorboardExperimentRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ tensorboard_service.DeleteTensorboardExperimentRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for delete_tensorboard_experiment @@ -556,9 +573,10 @@ def post_delete_tensorboard_experiment( def pre_delete_tensorboard_run( self, request: tensorboard_service.DeleteTensorboardRunRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - tensorboard_service.DeleteTensorboardRunRequest, Sequence[Tuple[str, str]] + tensorboard_service.DeleteTensorboardRunRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for delete_tensorboard_run @@ -581,10 +599,10 @@ def post_delete_tensorboard_run( def pre_delete_tensorboard_time_series( self, request: tensorboard_service.DeleteTensorboardTimeSeriesRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ tensorboard_service.DeleteTensorboardTimeSeriesRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for delete_tensorboard_time_series @@ -607,10 +625,10 @@ def post_delete_tensorboard_time_series( def pre_export_tensorboard_time_series_data( self, request: tensorboard_service.ExportTensorboardTimeSeriesDataRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ tensorboard_service.ExportTensorboardTimeSeriesDataRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for export_tensorboard_time_series_data @@ -633,8 +651,11 @@ def post_export_tensorboard_time_series_data( def pre_get_tensorboard( self, request: tensorboard_service.GetTensorboardRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[tensorboard_service.GetTensorboardRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + tensorboard_service.GetTensorboardRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for get_tensorboard Override in a subclass to manipulate the request or metadata @@ -656,9 +677,10 @@ def post_get_tensorboard( def pre_get_tensorboard_experiment( self, request: tensorboard_service.GetTensorboardExperimentRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - tensorboard_service.GetTensorboardExperimentRequest, Sequence[Tuple[str, str]] + tensorboard_service.GetTensorboardExperimentRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for get_tensorboard_experiment @@ -681,8 +703,11 @@ def post_get_tensorboard_experiment( def pre_get_tensorboard_run( self, request: tensorboard_service.GetTensorboardRunRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[tensorboard_service.GetTensorboardRunRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + tensorboard_service.GetTensorboardRunRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for get_tensorboard_run Override in a subclass to manipulate the request or metadata @@ -704,9 +729,10 @@ def post_get_tensorboard_run( def pre_get_tensorboard_time_series( self, request: tensorboard_service.GetTensorboardTimeSeriesRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - tensorboard_service.GetTensorboardTimeSeriesRequest, Sequence[Tuple[str, str]] + tensorboard_service.GetTensorboardTimeSeriesRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for get_tensorboard_time_series @@ -729,9 +755,10 @@ def post_get_tensorboard_time_series( def pre_list_tensorboard_experiments( self, request: tensorboard_service.ListTensorboardExperimentsRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - tensorboard_service.ListTensorboardExperimentsRequest, Sequence[Tuple[str, str]] + tensorboard_service.ListTensorboardExperimentsRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for list_tensorboard_experiments @@ -754,9 +781,10 @@ def post_list_tensorboard_experiments( def pre_list_tensorboard_runs( self, request: tensorboard_service.ListTensorboardRunsRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - tensorboard_service.ListTensorboardRunsRequest, Sequence[Tuple[str, str]] + tensorboard_service.ListTensorboardRunsRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for list_tensorboard_runs @@ -779,8 +807,11 @@ def post_list_tensorboard_runs( def pre_list_tensorboards( self, request: tensorboard_service.ListTensorboardsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[tensorboard_service.ListTensorboardsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + tensorboard_service.ListTensorboardsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for list_tensorboards Override in a subclass to manipulate the request or metadata @@ -802,9 +833,10 @@ def post_list_tensorboards( def pre_list_tensorboard_time_series( self, request: tensorboard_service.ListTensorboardTimeSeriesRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - tensorboard_service.ListTensorboardTimeSeriesRequest, Sequence[Tuple[str, str]] + tensorboard_service.ListTensorboardTimeSeriesRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for list_tensorboard_time_series @@ -827,9 +859,10 @@ def post_list_tensorboard_time_series( def pre_read_tensorboard_blob_data( self, request: tensorboard_service.ReadTensorboardBlobDataRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - tensorboard_service.ReadTensorboardBlobDataRequest, Sequence[Tuple[str, str]] + tensorboard_service.ReadTensorboardBlobDataRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for read_tensorboard_blob_data @@ -852,9 +885,10 @@ def post_read_tensorboard_blob_data( def pre_read_tensorboard_size( self, request: tensorboard_service.ReadTensorboardSizeRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - tensorboard_service.ReadTensorboardSizeRequest, Sequence[Tuple[str, str]] + tensorboard_service.ReadTensorboardSizeRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for read_tensorboard_size @@ -877,10 +911,10 @@ def post_read_tensorboard_size( def pre_read_tensorboard_time_series_data( self, request: tensorboard_service.ReadTensorboardTimeSeriesDataRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ tensorboard_service.ReadTensorboardTimeSeriesDataRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for read_tensorboard_time_series_data @@ -903,9 +937,10 @@ def post_read_tensorboard_time_series_data( def pre_read_tensorboard_usage( self, request: tensorboard_service.ReadTensorboardUsageRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - tensorboard_service.ReadTensorboardUsageRequest, Sequence[Tuple[str, str]] + tensorboard_service.ReadTensorboardUsageRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for read_tensorboard_usage @@ -928,8 +963,11 @@ def post_read_tensorboard_usage( def pre_update_tensorboard( self, request: tensorboard_service.UpdateTensorboardRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[tensorboard_service.UpdateTensorboardRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + tensorboard_service.UpdateTensorboardRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for update_tensorboard Override in a subclass to manipulate the request or metadata @@ -951,10 +989,10 @@ def post_update_tensorboard( def pre_update_tensorboard_experiment( self, request: tensorboard_service.UpdateTensorboardExperimentRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ tensorboard_service.UpdateTensorboardExperimentRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for update_tensorboard_experiment @@ -977,9 +1015,10 @@ def post_update_tensorboard_experiment( def pre_update_tensorboard_run( self, request: tensorboard_service.UpdateTensorboardRunRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - tensorboard_service.UpdateTensorboardRunRequest, Sequence[Tuple[str, str]] + tensorboard_service.UpdateTensorboardRunRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for update_tensorboard_run @@ -1002,10 +1041,10 @@ def post_update_tensorboard_run( def pre_update_tensorboard_time_series( self, request: tensorboard_service.UpdateTensorboardTimeSeriesRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ tensorboard_service.UpdateTensorboardTimeSeriesRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for update_tensorboard_time_series @@ -1028,10 +1067,10 @@ def post_update_tensorboard_time_series( def pre_write_tensorboard_experiment_data( self, request: tensorboard_service.WriteTensorboardExperimentDataRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ tensorboard_service.WriteTensorboardExperimentDataRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for write_tensorboard_experiment_data @@ -1054,9 +1093,10 @@ def post_write_tensorboard_experiment_data( def pre_write_tensorboard_run_data( self, request: tensorboard_service.WriteTensorboardRunDataRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - tensorboard_service.WriteTensorboardRunDataRequest, Sequence[Tuple[str, str]] + tensorboard_service.WriteTensorboardRunDataRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for write_tensorboard_run_data @@ -1079,8 +1119,10 @@ def post_write_tensorboard_run_data( def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -1102,8 +1144,10 @@ def post_get_location( def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -1125,8 +1169,10 @@ def post_list_locations( def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -1146,8 +1192,10 @@ def post_get_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -1167,8 +1215,11 @@ def post_set_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -1190,8 +1241,10 @@ def post_test_iam_permissions( def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -1211,8 +1264,10 @@ def post_cancel_operation(self, response: None) -> None: 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 @@ -1232,8 +1287,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 @@ -1255,8 +1312,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 @@ -1278,8 +1337,10 @@ def post_list_operations( def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -1959,6 +2020,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -2175,6 +2240,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -2381,6 +2450,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}", @@ -2597,6 +2670,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, ], "google.longrunning.Operations.ListOperations": [ { @@ -2795,6 +2872,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*}/operations", @@ -3011,6 +3092,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*}/operations", + }, ], "google.longrunning.Operations.WaitOperation": [ { @@ -3209,6 +3294,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "post", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}:wait", @@ -3421,6 +3510,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, ], } @@ -3477,7 +3570,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]]] = (), ) -> tensorboard_service.BatchCreateTensorboardRunsResponse: r"""Call the batch create tensorboard runs method over HTTP. @@ -3489,8 +3582,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: ~.tensorboard_service.BatchCreateTensorboardRunsResponse: @@ -3502,6 +3597,7 @@ def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseBatchCreateTensorboardRuns._get_http_options() ) + request, metadata = self._interceptor.pre_batch_create_tensorboard_runs( request, metadata ) @@ -3518,6 +3614,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.aiplatform_v1beta1.TensorboardServiceClient.BatchCreateTensorboardRuns", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "BatchCreateTensorboardRuns", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = TensorboardServiceRestTransport._BatchCreateTensorboardRuns._get_response( self._host, @@ -3539,7 +3662,33 @@ def __call__( pb_resp = tensorboard_service.BatchCreateTensorboardRunsResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_batch_create_tensorboard_runs(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + tensorboard_service.BatchCreateTensorboardRunsResponse.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.aiplatform_v1beta1.TensorboardServiceClient.batch_create_tensorboard_runs", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "BatchCreateTensorboardRuns", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _BatchCreateTensorboardTimeSeries( @@ -3581,7 +3730,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]]] = (), ) -> tensorboard_service.BatchCreateTensorboardTimeSeriesResponse: r"""Call the batch create tensorboard time series method over HTTP. @@ -3593,8 +3742,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: ~.tensorboard_service.BatchCreateTensorboardTimeSeriesResponse: @@ -3606,6 +3757,7 @@ def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseBatchCreateTensorboardTimeSeries._get_http_options() ) + ( request, metadata, @@ -3625,6 +3777,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.aiplatform_v1beta1.TensorboardServiceClient.BatchCreateTensorboardTimeSeries", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "BatchCreateTensorboardTimeSeries", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = TensorboardServiceRestTransport._BatchCreateTensorboardTimeSeries._get_response( self._host, @@ -3648,7 +3827,31 @@ def __call__( ) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_batch_create_tensorboard_time_series(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = tensorboard_service.BatchCreateTensorboardTimeSeriesResponse.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.aiplatform_v1beta1.TensorboardServiceClient.batch_create_tensorboard_time_series", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "BatchCreateTensorboardTimeSeries", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _BatchReadTensorboardTimeSeriesData( @@ -3689,7 +3892,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]]] = (), ) -> tensorboard_service.BatchReadTensorboardTimeSeriesDataResponse: r"""Call the batch read tensorboard time series data method over HTTP. @@ -3701,8 +3904,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: ~.tensorboard_service.BatchReadTensorboardTimeSeriesDataResponse: @@ -3714,6 +3919,7 @@ def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseBatchReadTensorboardTimeSeriesData._get_http_options() ) + ( request, metadata, @@ -3729,6 +3935,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.aiplatform_v1beta1.TensorboardServiceClient.BatchReadTensorboardTimeSeriesData", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "BatchReadTensorboardTimeSeriesData", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = TensorboardServiceRestTransport._BatchReadTensorboardTimeSeriesData._get_response( self._host, @@ -3751,7 +3984,31 @@ def __call__( ) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_batch_read_tensorboard_time_series_data(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = tensorboard_service.BatchReadTensorboardTimeSeriesDataResponse.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.aiplatform_v1beta1.TensorboardServiceClient.batch_read_tensorboard_time_series_data", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "BatchReadTensorboardTimeSeriesData", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _CreateTensorboard( @@ -3791,7 +4048,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 tensorboard method over HTTP. @@ -3802,8 +4059,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: @@ -3816,6 +4075,7 @@ def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseCreateTensorboard._get_http_options() ) + request, metadata = self._interceptor.pre_create_tensorboard( request, metadata ) @@ -3832,6 +4092,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.aiplatform_v1beta1.TensorboardServiceClient.CreateTensorboard", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "CreateTensorboard", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = TensorboardServiceRestTransport._CreateTensorboard._get_response( self._host, @@ -3851,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_create_tensorboard(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.aiplatform_v1beta1.TensorboardServiceClient.create_tensorboard", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "CreateTensorboard", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _CreateTensorboardExperiment( @@ -3891,7 +4200,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]]] = (), ) -> gca_tensorboard_experiment.TensorboardExperiment: r"""Call the create tensorboard experiment method over HTTP. @@ -3903,8 +4212,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: ~.gca_tensorboard_experiment.TensorboardExperiment: @@ -3918,6 +4229,7 @@ def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseCreateTensorboardExperiment._get_http_options() ) + request, metadata = self._interceptor.pre_create_tensorboard_experiment( request, metadata ) @@ -3934,6 +4246,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.aiplatform_v1beta1.TensorboardServiceClient.CreateTensorboardExperiment", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "CreateTensorboardExperiment", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = TensorboardServiceRestTransport._CreateTensorboardExperiment._get_response( self._host, @@ -3955,7 +4294,33 @@ def __call__( pb_resp = gca_tensorboard_experiment.TensorboardExperiment.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_create_tensorboard_experiment(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + gca_tensorboard_experiment.TensorboardExperiment.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.aiplatform_v1beta1.TensorboardServiceClient.create_tensorboard_experiment", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "CreateTensorboardExperiment", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _CreateTensorboardRun( @@ -3995,7 +4360,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]]] = (), ) -> gca_tensorboard_run.TensorboardRun: r"""Call the create tensorboard run method over HTTP. @@ -4006,8 +4371,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: ~.gca_tensorboard_run.TensorboardRun: @@ -4021,6 +4388,7 @@ def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseCreateTensorboardRun._get_http_options() ) + request, metadata = self._interceptor.pre_create_tensorboard_run( request, metadata ) @@ -4037,6 +4405,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.aiplatform_v1beta1.TensorboardServiceClient.CreateTensorboardRun", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "CreateTensorboardRun", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( TensorboardServiceRestTransport._CreateTensorboardRun._get_response( @@ -4060,7 +4455,31 @@ def __call__( pb_resp = gca_tensorboard_run.TensorboardRun.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_create_tensorboard_run(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gca_tensorboard_run.TensorboardRun.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.aiplatform_v1beta1.TensorboardServiceClient.create_tensorboard_run", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "CreateTensorboardRun", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _CreateTensorboardTimeSeries( @@ -4100,7 +4519,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]]] = (), ) -> gca_tensorboard_time_series.TensorboardTimeSeries: r"""Call the create tensorboard time series method over HTTP. @@ -4112,8 +4531,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: ~.gca_tensorboard_time_series.TensorboardTimeSeries: @@ -4125,6 +4546,7 @@ def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseCreateTensorboardTimeSeries._get_http_options() ) + request, metadata = self._interceptor.pre_create_tensorboard_time_series( request, metadata ) @@ -4141,6 +4563,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.aiplatform_v1beta1.TensorboardServiceClient.CreateTensorboardTimeSeries", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "CreateTensorboardTimeSeries", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = TensorboardServiceRestTransport._CreateTensorboardTimeSeries._get_response( self._host, @@ -4162,7 +4611,33 @@ def __call__( pb_resp = gca_tensorboard_time_series.TensorboardTimeSeries.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_create_tensorboard_time_series(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + gca_tensorboard_time_series.TensorboardTimeSeries.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.aiplatform_v1beta1.TensorboardServiceClient.create_tensorboard_time_series", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "CreateTensorboardTimeSeries", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _DeleteTensorboard( @@ -4201,7 +4676,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 tensorboard method over HTTP. @@ -4212,8 +4687,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: @@ -4226,6 +4703,7 @@ def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseDeleteTensorboard._get_http_options() ) + request, metadata = self._interceptor.pre_delete_tensorboard( request, metadata ) @@ -4238,6 +4716,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.aiplatform_v1beta1.TensorboardServiceClient.DeleteTensorboard", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "DeleteTensorboard", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = TensorboardServiceRestTransport._DeleteTensorboard._get_response( self._host, @@ -4256,7 +4761,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_tensorboard(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.aiplatform_v1beta1.TensorboardServiceClient.delete_tensorboard", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "DeleteTensorboard", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _DeleteTensorboardExperiment( @@ -4295,7 +4822,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 tensorboard experiment method over HTTP. @@ -4307,8 +4834,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: @@ -4321,6 +4850,7 @@ def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseDeleteTensorboardExperiment._get_http_options() ) + request, metadata = self._interceptor.pre_delete_tensorboard_experiment( request, metadata ) @@ -4333,6 +4863,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.aiplatform_v1beta1.TensorboardServiceClient.DeleteTensorboardExperiment", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "DeleteTensorboardExperiment", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = TensorboardServiceRestTransport._DeleteTensorboardExperiment._get_response( self._host, @@ -4351,7 +4908,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_tensorboard_experiment(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.aiplatform_v1beta1.TensorboardServiceClient.delete_tensorboard_experiment", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "DeleteTensorboardExperiment", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _DeleteTensorboardRun( @@ -4390,7 +4969,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 tensorboard run method over HTTP. @@ -4401,8 +4980,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: @@ -4415,6 +4996,7 @@ def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseDeleteTensorboardRun._get_http_options() ) + request, metadata = self._interceptor.pre_delete_tensorboard_run( request, metadata ) @@ -4427,6 +5009,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.aiplatform_v1beta1.TensorboardServiceClient.DeleteTensorboardRun", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "DeleteTensorboardRun", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( TensorboardServiceRestTransport._DeleteTensorboardRun._get_response( @@ -4447,7 +5056,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_tensorboard_run(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.aiplatform_v1beta1.TensorboardServiceClient.delete_tensorboard_run", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "DeleteTensorboardRun", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _DeleteTensorboardTimeSeries( @@ -4486,7 +5117,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 tensorboard time series method over HTTP. @@ -4498,8 +5129,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: @@ -4512,6 +5145,7 @@ def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseDeleteTensorboardTimeSeries._get_http_options() ) + request, metadata = self._interceptor.pre_delete_tensorboard_time_series( request, metadata ) @@ -4524,6 +5158,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.aiplatform_v1beta1.TensorboardServiceClient.DeleteTensorboardTimeSeries", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "DeleteTensorboardTimeSeries", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = TensorboardServiceRestTransport._DeleteTensorboardTimeSeries._get_response( self._host, @@ -4542,7 +5203,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_tensorboard_time_series(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.aiplatform_v1beta1.TensorboardServiceClient.delete_tensorboard_time_series", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "DeleteTensorboardTimeSeries", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ExportTensorboardTimeSeriesData( @@ -4584,7 +5267,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]]] = (), ) -> tensorboard_service.ExportTensorboardTimeSeriesDataResponse: r"""Call the export tensorboard time series data method over HTTP. @@ -4596,8 +5279,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: ~.tensorboard_service.ExportTensorboardTimeSeriesDataResponse: @@ -4609,6 +5294,7 @@ def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseExportTensorboardTimeSeriesData._get_http_options() ) + ( request, metadata, @@ -4628,6 +5314,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.aiplatform_v1beta1.TensorboardServiceClient.ExportTensorboardTimeSeriesData", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "ExportTensorboardTimeSeriesData", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = TensorboardServiceRestTransport._ExportTensorboardTimeSeriesData._get_response( self._host, @@ -4651,7 +5364,31 @@ def __call__( ) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_export_tensorboard_time_series_data(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = tensorboard_service.ExportTensorboardTimeSeriesDataResponse.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.aiplatform_v1beta1.TensorboardServiceClient.export_tensorboard_time_series_data", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "ExportTensorboardTimeSeriesData", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _GetTensorboard( @@ -4690,7 +5427,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]]] = (), ) -> tensorboard.Tensorboard: r"""Call the get tensorboard method over HTTP. @@ -4701,8 +5438,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: ~.tensorboard.Tensorboard: @@ -4718,6 +5457,7 @@ def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseGetTensorboard._get_http_options() ) + request, metadata = self._interceptor.pre_get_tensorboard(request, metadata) transcoded_request = _BaseTensorboardServiceRestTransport._BaseGetTensorboard._get_transcoded_request( http_options, request @@ -4728,6 +5468,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.aiplatform_v1beta1.TensorboardServiceClient.GetTensorboard", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "GetTensorboard", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = TensorboardServiceRestTransport._GetTensorboard._get_response( self._host, @@ -4748,7 +5515,29 @@ def __call__( pb_resp = tensorboard.Tensorboard.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_tensorboard(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = tensorboard.Tensorboard.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.aiplatform_v1beta1.TensorboardServiceClient.get_tensorboard", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "GetTensorboard", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _GetTensorboardExperiment( @@ -4787,7 +5576,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]]] = (), ) -> tensorboard_experiment.TensorboardExperiment: r"""Call the get tensorboard experiment method over HTTP. @@ -4799,8 +5588,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: ~.tensorboard_experiment.TensorboardExperiment: @@ -4814,6 +5605,7 @@ def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseGetTensorboardExperiment._get_http_options() ) + request, metadata = self._interceptor.pre_get_tensorboard_experiment( request, metadata ) @@ -4826,6 +5618,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.aiplatform_v1beta1.TensorboardServiceClient.GetTensorboardExperiment", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "GetTensorboardExperiment", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( TensorboardServiceRestTransport._GetTensorboardExperiment._get_response( @@ -4848,7 +5667,31 @@ def __call__( pb_resp = tensorboard_experiment.TensorboardExperiment.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_tensorboard_experiment(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + tensorboard_experiment.TensorboardExperiment.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.aiplatform_v1beta1.TensorboardServiceClient.get_tensorboard_experiment", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "GetTensorboardExperiment", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _GetTensorboardRun( @@ -4887,7 +5730,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]]] = (), ) -> tensorboard_run.TensorboardRun: r"""Call the get tensorboard run method over HTTP. @@ -4898,8 +5741,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: ~.tensorboard_run.TensorboardRun: @@ -4913,6 +5758,7 @@ def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseGetTensorboardRun._get_http_options() ) + request, metadata = self._interceptor.pre_get_tensorboard_run( request, metadata ) @@ -4925,6 +5771,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.aiplatform_v1beta1.TensorboardServiceClient.GetTensorboardRun", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "GetTensorboardRun", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = TensorboardServiceRestTransport._GetTensorboardRun._get_response( self._host, @@ -4945,7 +5818,29 @@ def __call__( pb_resp = tensorboard_run.TensorboardRun.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_tensorboard_run(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = tensorboard_run.TensorboardRun.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.aiplatform_v1beta1.TensorboardServiceClient.get_tensorboard_run", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "GetTensorboardRun", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _GetTensorboardTimeSeries( @@ -4984,7 +5879,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]]] = (), ) -> tensorboard_time_series.TensorboardTimeSeries: r"""Call the get tensorboard time series method over HTTP. @@ -4996,8 +5891,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: ~.tensorboard_time_series.TensorboardTimeSeries: @@ -5009,6 +5906,7 @@ def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseGetTensorboardTimeSeries._get_http_options() ) + request, metadata = self._interceptor.pre_get_tensorboard_time_series( request, metadata ) @@ -5021,6 +5919,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.aiplatform_v1beta1.TensorboardServiceClient.GetTensorboardTimeSeries", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "GetTensorboardTimeSeries", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( TensorboardServiceRestTransport._GetTensorboardTimeSeries._get_response( @@ -5043,7 +5968,31 @@ def __call__( pb_resp = tensorboard_time_series.TensorboardTimeSeries.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_tensorboard_time_series(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + tensorboard_time_series.TensorboardTimeSeries.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.aiplatform_v1beta1.TensorboardServiceClient.get_tensorboard_time_series", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "GetTensorboardTimeSeries", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListTensorboardExperiments( @@ -5082,7 +6031,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]]] = (), ) -> tensorboard_service.ListTensorboardExperimentsResponse: r"""Call the list tensorboard experiments method over HTTP. @@ -5094,8 +6043,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: ~.tensorboard_service.ListTensorboardExperimentsResponse: @@ -5107,6 +6058,7 @@ def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseListTensorboardExperiments._get_http_options() ) + request, metadata = self._interceptor.pre_list_tensorboard_experiments( request, metadata ) @@ -5119,6 +6071,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.aiplatform_v1beta1.TensorboardServiceClient.ListTensorboardExperiments", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "ListTensorboardExperiments", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = TensorboardServiceRestTransport._ListTensorboardExperiments._get_response( self._host, @@ -5139,7 +6118,33 @@ def __call__( pb_resp = tensorboard_service.ListTensorboardExperimentsResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_tensorboard_experiments(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + tensorboard_service.ListTensorboardExperimentsResponse.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.aiplatform_v1beta1.TensorboardServiceClient.list_tensorboard_experiments", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "ListTensorboardExperiments", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListTensorboardRuns( @@ -5178,7 +6183,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]]] = (), ) -> tensorboard_service.ListTensorboardRunsResponse: r"""Call the list tensorboard runs method over HTTP. @@ -5189,8 +6194,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: ~.tensorboard_service.ListTensorboardRunsResponse: @@ -5202,6 +6209,7 @@ def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseListTensorboardRuns._get_http_options() ) + request, metadata = self._interceptor.pre_list_tensorboard_runs( request, metadata ) @@ -5214,6 +6222,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.aiplatform_v1beta1.TensorboardServiceClient.ListTensorboardRuns", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "ListTensorboardRuns", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( TensorboardServiceRestTransport._ListTensorboardRuns._get_response( @@ -5236,7 +6271,33 @@ def __call__( pb_resp = tensorboard_service.ListTensorboardRunsResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_tensorboard_runs(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + tensorboard_service.ListTensorboardRunsResponse.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.aiplatform_v1beta1.TensorboardServiceClient.list_tensorboard_runs", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "ListTensorboardRuns", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListTensorboards( @@ -5275,7 +6336,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]]] = (), ) -> tensorboard_service.ListTensorboardsResponse: r"""Call the list tensorboards method over HTTP. @@ -5286,8 +6347,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: ~.tensorboard_service.ListTensorboardsResponse: @@ -5299,6 +6362,7 @@ def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseListTensorboards._get_http_options() ) + request, metadata = self._interceptor.pre_list_tensorboards( request, metadata ) @@ -5311,6 +6375,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.aiplatform_v1beta1.TensorboardServiceClient.ListTensorboards", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "ListTensorboards", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = TensorboardServiceRestTransport._ListTensorboards._get_response( self._host, @@ -5331,7 +6422,31 @@ def __call__( pb_resp = tensorboard_service.ListTensorboardsResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_tensorboards(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + tensorboard_service.ListTensorboardsResponse.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.aiplatform_v1beta1.TensorboardServiceClient.list_tensorboards", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "ListTensorboards", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListTensorboardTimeSeries( @@ -5370,7 +6485,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]]] = (), ) -> tensorboard_service.ListTensorboardTimeSeriesResponse: r"""Call the list tensorboard time series method over HTTP. @@ -5382,8 +6497,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: ~.tensorboard_service.ListTensorboardTimeSeriesResponse: @@ -5395,6 +6512,7 @@ def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseListTensorboardTimeSeries._get_http_options() ) + request, metadata = self._interceptor.pre_list_tensorboard_time_series( request, metadata ) @@ -5407,6 +6525,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.aiplatform_v1beta1.TensorboardServiceClient.ListTensorboardTimeSeries", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "ListTensorboardTimeSeries", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = TensorboardServiceRestTransport._ListTensorboardTimeSeries._get_response( self._host, @@ -5427,7 +6572,33 @@ def __call__( pb_resp = tensorboard_service.ListTensorboardTimeSeriesResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_tensorboard_time_series(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + tensorboard_service.ListTensorboardTimeSeriesResponse.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.aiplatform_v1beta1.TensorboardServiceClient.list_tensorboard_time_series", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "ListTensorboardTimeSeries", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ReadTensorboardBlobData( @@ -5467,7 +6638,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]]] = (), ) -> rest_streaming.ResponseIterator: r"""Call the read tensorboard blob data method over HTTP. @@ -5479,8 +6650,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: ~.tensorboard_service.ReadTensorboardBlobDataResponse: @@ -5492,6 +6665,7 @@ def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseReadTensorboardBlobData._get_http_options() ) + request, metadata = self._interceptor.pre_read_tensorboard_blob_data( request, metadata ) @@ -5504,6 +6678,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.aiplatform_v1beta1.TensorboardServiceClient.ReadTensorboardBlobData", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "ReadTensorboardBlobData", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( TensorboardServiceRestTransport._ReadTensorboardBlobData._get_response( @@ -5525,6 +6726,7 @@ def __call__( resp = rest_streaming.ResponseIterator( response, tensorboard_service.ReadTensorboardBlobDataResponse ) + resp = self._interceptor.post_read_tensorboard_blob_data(resp) return resp @@ -5564,7 +6766,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]]] = (), ) -> tensorboard_service.ReadTensorboardSizeResponse: r"""Call the read tensorboard size method over HTTP. @@ -5575,8 +6777,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: ~.tensorboard_service.ReadTensorboardSizeResponse: @@ -5588,6 +6792,7 @@ def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseReadTensorboardSize._get_http_options() ) + request, metadata = self._interceptor.pre_read_tensorboard_size( request, metadata ) @@ -5600,6 +6805,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.aiplatform_v1beta1.TensorboardServiceClient.ReadTensorboardSize", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "ReadTensorboardSize", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( TensorboardServiceRestTransport._ReadTensorboardSize._get_response( @@ -5622,7 +6854,33 @@ def __call__( pb_resp = tensorboard_service.ReadTensorboardSizeResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_read_tensorboard_size(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + tensorboard_service.ReadTensorboardSizeResponse.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.aiplatform_v1beta1.TensorboardServiceClient.read_tensorboard_size", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "ReadTensorboardSize", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ReadTensorboardTimeSeriesData( @@ -5661,7 +6919,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]]] = (), ) -> tensorboard_service.ReadTensorboardTimeSeriesDataResponse: r"""Call the read tensorboard time series data method over HTTP. @@ -5673,8 +6931,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: ~.tensorboard_service.ReadTensorboardTimeSeriesDataResponse: @@ -5686,6 +6946,7 @@ def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseReadTensorboardTimeSeriesData._get_http_options() ) + request, metadata = self._interceptor.pre_read_tensorboard_time_series_data( request, metadata ) @@ -5698,6 +6959,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.aiplatform_v1beta1.TensorboardServiceClient.ReadTensorboardTimeSeriesData", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "ReadTensorboardTimeSeriesData", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = TensorboardServiceRestTransport._ReadTensorboardTimeSeriesData._get_response( self._host, @@ -5718,7 +7006,31 @@ def __call__( pb_resp = tensorboard_service.ReadTensorboardTimeSeriesDataResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_read_tensorboard_time_series_data(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = tensorboard_service.ReadTensorboardTimeSeriesDataResponse.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.aiplatform_v1beta1.TensorboardServiceClient.read_tensorboard_time_series_data", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "ReadTensorboardTimeSeriesData", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ReadTensorboardUsage( @@ -5757,7 +7069,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]]] = (), ) -> tensorboard_service.ReadTensorboardUsageResponse: r"""Call the read tensorboard usage method over HTTP. @@ -5768,8 +7080,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: ~.tensorboard_service.ReadTensorboardUsageResponse: @@ -5781,6 +7095,7 @@ def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseReadTensorboardUsage._get_http_options() ) + request, metadata = self._interceptor.pre_read_tensorboard_usage( request, metadata ) @@ -5793,6 +7108,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.aiplatform_v1beta1.TensorboardServiceClient.ReadTensorboardUsage", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "ReadTensorboardUsage", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( TensorboardServiceRestTransport._ReadTensorboardUsage._get_response( @@ -5815,7 +7157,33 @@ def __call__( pb_resp = tensorboard_service.ReadTensorboardUsageResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_read_tensorboard_usage(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + tensorboard_service.ReadTensorboardUsageResponse.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.aiplatform_v1beta1.TensorboardServiceClient.read_tensorboard_usage", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "ReadTensorboardUsage", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _UpdateTensorboard( @@ -5855,7 +7223,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 tensorboard method over HTTP. @@ -5866,8 +7234,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: @@ -5880,6 +7250,7 @@ def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseUpdateTensorboard._get_http_options() ) + request, metadata = self._interceptor.pre_update_tensorboard( request, metadata ) @@ -5896,6 +7267,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.aiplatform_v1beta1.TensorboardServiceClient.UpdateTensorboard", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "UpdateTensorboard", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = TensorboardServiceRestTransport._UpdateTensorboard._get_response( self._host, @@ -5915,7 +7313,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_tensorboard(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.aiplatform_v1beta1.TensorboardServiceClient.update_tensorboard", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "UpdateTensorboard", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _UpdateTensorboardExperiment( @@ -5955,7 +7375,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]]] = (), ) -> gca_tensorboard_experiment.TensorboardExperiment: r"""Call the update tensorboard experiment method over HTTP. @@ -5967,8 +7387,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: ~.gca_tensorboard_experiment.TensorboardExperiment: @@ -5982,6 +7404,7 @@ def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseUpdateTensorboardExperiment._get_http_options() ) + request, metadata = self._interceptor.pre_update_tensorboard_experiment( request, metadata ) @@ -5998,6 +7421,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.aiplatform_v1beta1.TensorboardServiceClient.UpdateTensorboardExperiment", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "UpdateTensorboardExperiment", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = TensorboardServiceRestTransport._UpdateTensorboardExperiment._get_response( self._host, @@ -6019,7 +7469,33 @@ def __call__( pb_resp = gca_tensorboard_experiment.TensorboardExperiment.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_update_tensorboard_experiment(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + gca_tensorboard_experiment.TensorboardExperiment.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.aiplatform_v1beta1.TensorboardServiceClient.update_tensorboard_experiment", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "UpdateTensorboardExperiment", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _UpdateTensorboardRun( @@ -6059,7 +7535,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]]] = (), ) -> gca_tensorboard_run.TensorboardRun: r"""Call the update tensorboard run method over HTTP. @@ -6070,8 +7546,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: ~.gca_tensorboard_run.TensorboardRun: @@ -6085,6 +7563,7 @@ def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseUpdateTensorboardRun._get_http_options() ) + request, metadata = self._interceptor.pre_update_tensorboard_run( request, metadata ) @@ -6101,6 +7580,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.aiplatform_v1beta1.TensorboardServiceClient.UpdateTensorboardRun", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "UpdateTensorboardRun", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( TensorboardServiceRestTransport._UpdateTensorboardRun._get_response( @@ -6124,7 +7630,31 @@ def __call__( pb_resp = gca_tensorboard_run.TensorboardRun.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_update_tensorboard_run(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gca_tensorboard_run.TensorboardRun.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.aiplatform_v1beta1.TensorboardServiceClient.update_tensorboard_run", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "UpdateTensorboardRun", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _UpdateTensorboardTimeSeries( @@ -6164,7 +7694,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]]] = (), ) -> gca_tensorboard_time_series.TensorboardTimeSeries: r"""Call the update tensorboard time series method over HTTP. @@ -6176,8 +7706,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: ~.gca_tensorboard_time_series.TensorboardTimeSeries: @@ -6189,6 +7721,7 @@ def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseUpdateTensorboardTimeSeries._get_http_options() ) + request, metadata = self._interceptor.pre_update_tensorboard_time_series( request, metadata ) @@ -6205,6 +7738,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.aiplatform_v1beta1.TensorboardServiceClient.UpdateTensorboardTimeSeries", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "UpdateTensorboardTimeSeries", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = TensorboardServiceRestTransport._UpdateTensorboardTimeSeries._get_response( self._host, @@ -6226,7 +7786,33 @@ def __call__( pb_resp = gca_tensorboard_time_series.TensorboardTimeSeries.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_update_tensorboard_time_series(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + gca_tensorboard_time_series.TensorboardTimeSeries.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.aiplatform_v1beta1.TensorboardServiceClient.update_tensorboard_time_series", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "UpdateTensorboardTimeSeries", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _WriteTensorboardExperimentData( @@ -6268,7 +7854,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]]] = (), ) -> tensorboard_service.WriteTensorboardExperimentDataResponse: r"""Call the write tensorboard experiment data method over HTTP. @@ -6280,8 +7866,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: ~.tensorboard_service.WriteTensorboardExperimentDataResponse: @@ -6293,6 +7881,7 @@ def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseWriteTensorboardExperimentData._get_http_options() ) + request, metadata = self._interceptor.pre_write_tensorboard_experiment_data( request, metadata ) @@ -6309,6 +7898,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.aiplatform_v1beta1.TensorboardServiceClient.WriteTensorboardExperimentData", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "WriteTensorboardExperimentData", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = TensorboardServiceRestTransport._WriteTensorboardExperimentData._get_response( self._host, @@ -6332,7 +7948,31 @@ def __call__( ) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_write_tensorboard_experiment_data(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = tensorboard_service.WriteTensorboardExperimentDataResponse.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.aiplatform_v1beta1.TensorboardServiceClient.write_tensorboard_experiment_data", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "WriteTensorboardExperimentData", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _WriteTensorboardRunData( @@ -6372,7 +8012,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]]] = (), ) -> tensorboard_service.WriteTensorboardRunDataResponse: r"""Call the write tensorboard run data method over HTTP. @@ -6384,8 +8024,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: ~.tensorboard_service.WriteTensorboardRunDataResponse: @@ -6397,6 +8039,7 @@ def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseWriteTensorboardRunData._get_http_options() ) + request, metadata = self._interceptor.pre_write_tensorboard_run_data( request, metadata ) @@ -6413,6 +8056,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.aiplatform_v1beta1.TensorboardServiceClient.WriteTensorboardRunData", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "WriteTensorboardRunData", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( TensorboardServiceRestTransport._WriteTensorboardRunData._get_response( @@ -6436,7 +8106,33 @@ def __call__( pb_resp = tensorboard_service.WriteTensorboardRunDataResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_write_tensorboard_run_data(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + tensorboard_service.WriteTensorboardRunDataResponse.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.aiplatform_v1beta1.TensorboardServiceClient.write_tensorboard_run_data", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "WriteTensorboardRunData", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp @property @@ -6801,7 +8497,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]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -6812,8 +8508,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: locations_pb2.Location: Response from GetLocation method. @@ -6822,6 +8520,7 @@ def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = self._interceptor.pre_get_location(request, metadata) transcoded_request = _BaseTensorboardServiceRestTransport._BaseGetLocation._get_transcoded_request( http_options, request @@ -6832,6 +8531,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.aiplatform_v1beta1.TensorboardServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = TensorboardServiceRestTransport._GetLocation._get_response( self._host, @@ -6851,6 +8577,27 @@ def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_location(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.aiplatform_v1beta1.TensorboardServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -6893,7 +8640,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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -6904,8 +8651,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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -6914,6 +8663,7 @@ def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = self._interceptor.pre_list_locations(request, metadata) transcoded_request = _BaseTensorboardServiceRestTransport._BaseListLocations._get_transcoded_request( http_options, request @@ -6924,6 +8674,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.aiplatform_v1beta1.TensorboardServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = TensorboardServiceRestTransport._ListLocations._get_response( self._host, @@ -6943,6 +8720,27 @@ def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_list_locations(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.aiplatform_v1beta1.TensorboardServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -6986,7 +8784,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]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -6997,8 +8795,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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -7007,6 +8807,7 @@ def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_get_iam_policy(request, metadata) transcoded_request = _BaseTensorboardServiceRestTransport._BaseGetIamPolicy._get_transcoded_request( http_options, request @@ -7021,6 +8822,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.aiplatform_v1beta1.TensorboardServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = TensorboardServiceRestTransport._GetIamPolicy._get_response( self._host, @@ -7041,6 +8869,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_iam_policy(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.aiplatform_v1beta1.TensorboardServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -7084,7 +8933,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]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -7095,8 +8944,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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -7105,6 +8956,7 @@ def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_set_iam_policy(request, metadata) transcoded_request = _BaseTensorboardServiceRestTransport._BaseSetIamPolicy._get_transcoded_request( http_options, request @@ -7119,6 +8971,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.aiplatform_v1beta1.TensorboardServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = TensorboardServiceRestTransport._SetIamPolicy._get_response( self._host, @@ -7139,6 +9018,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_set_iam_policy(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.aiplatform_v1beta1.TensorboardServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -7182,7 +9082,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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -7193,8 +9093,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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -7203,6 +9105,7 @@ def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -7219,6 +9122,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.aiplatform_v1beta1.TensorboardServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( TensorboardServiceRestTransport._TestIamPermissions._get_response( @@ -7241,6 +9171,27 @@ def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_test_iam_permissions(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.aiplatform_v1beta1.TensorboardServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -7283,7 +9234,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 cancel operation method over HTTP. @@ -7294,13 +9245,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 = ( _BaseTensorboardServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = self._interceptor.pre_cancel_operation( request, metadata ) @@ -7313,6 +9267,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.aiplatform_v1beta1.TensorboardServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = TensorboardServiceRestTransport._CancelOperation._get_response( self._host, @@ -7370,7 +9351,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. @@ -7381,13 +9362,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 = ( _BaseTensorboardServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = self._interceptor.pre_delete_operation( request, metadata ) @@ -7400,6 +9384,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.aiplatform_v1beta1.TensorboardServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = TensorboardServiceRestTransport._DeleteOperation._get_response( self._host, @@ -7457,7 +9468,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. @@ -7468,8 +9479,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. @@ -7478,6 +9491,7 @@ def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = self._interceptor.pre_get_operation(request, metadata) transcoded_request = _BaseTensorboardServiceRestTransport._BaseGetOperation._get_transcoded_request( http_options, request @@ -7488,6 +9502,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.aiplatform_v1beta1.TensorboardServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = TensorboardServiceRestTransport._GetOperation._get_response( self._host, @@ -7507,6 +9548,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.aiplatform_v1beta1.TensorboardServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -7549,7 +9611,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. @@ -7560,8 +9622,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. @@ -7570,6 +9634,7 @@ def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = self._interceptor.pre_list_operations(request, metadata) transcoded_request = _BaseTensorboardServiceRestTransport._BaseListOperations._get_transcoded_request( http_options, request @@ -7580,6 +9645,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.aiplatform_v1beta1.TensorboardServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = TensorboardServiceRestTransport._ListOperations._get_response( self._host, @@ -7599,6 +9691,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.aiplatform_v1beta1.TensorboardServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -7641,7 +9754,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 wait operation method over HTTP. @@ -7652,8 +9765,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 WaitOperation method. @@ -7662,6 +9777,7 @@ def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = self._interceptor.pre_wait_operation(request, metadata) transcoded_request = _BaseTensorboardServiceRestTransport._BaseWaitOperation._get_transcoded_request( http_options, request @@ -7672,6 +9788,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.aiplatform_v1beta1.TensorboardServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = TensorboardServiceRestTransport._WaitOperation._get_response( self._host, @@ -7691,6 +9834,27 @@ def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = self._interceptor.post_wait_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.aiplatform_v1beta1.TensorboardServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1beta1/services/tensorboard_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1beta1/services/tensorboard_service/transports/rest_asyncio.py index 345cf39c86..5721e422d0 100644 --- a/google/cloud/aiplatform_v1beta1/services/tensorboard_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/tensorboard_service/transports/rest_asyncio.py @@ -69,6 +69,18 @@ from .base import DEFAULT_CLIENT_INFO as BASE_DEFAULT_CLIENT_INFO + +import logging + +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__) + try: OptionalRetry = Union[retries.AsyncRetry, gapic_v1.method._MethodDefault, None] except AttributeError: # pragma: NO COVER @@ -345,9 +357,10 @@ async def post_write_tensorboard_run_data(self, response): async def pre_batch_create_tensorboard_runs( self, request: tensorboard_service.BatchCreateTensorboardRunsRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - tensorboard_service.BatchCreateTensorboardRunsRequest, Sequence[Tuple[str, str]] + tensorboard_service.BatchCreateTensorboardRunsRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for batch_create_tensorboard_runs @@ -370,10 +383,10 @@ async def post_batch_create_tensorboard_runs( async def pre_batch_create_tensorboard_time_series( self, request: tensorboard_service.BatchCreateTensorboardTimeSeriesRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ tensorboard_service.BatchCreateTensorboardTimeSeriesRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for batch_create_tensorboard_time_series @@ -396,10 +409,10 @@ async def post_batch_create_tensorboard_time_series( async def pre_batch_read_tensorboard_time_series_data( self, request: tensorboard_service.BatchReadTensorboardTimeSeriesDataRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ tensorboard_service.BatchReadTensorboardTimeSeriesDataRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for batch_read_tensorboard_time_series_data @@ -422,8 +435,11 @@ async def post_batch_read_tensorboard_time_series_data( async def pre_create_tensorboard( self, request: tensorboard_service.CreateTensorboardRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[tensorboard_service.CreateTensorboardRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + tensorboard_service.CreateTensorboardRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for create_tensorboard Override in a subclass to manipulate the request or metadata @@ -445,10 +461,10 @@ async def post_create_tensorboard( async def pre_create_tensorboard_experiment( self, request: tensorboard_service.CreateTensorboardExperimentRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ tensorboard_service.CreateTensorboardExperimentRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for create_tensorboard_experiment @@ -471,9 +487,10 @@ async def post_create_tensorboard_experiment( async def pre_create_tensorboard_run( self, request: tensorboard_service.CreateTensorboardRunRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - tensorboard_service.CreateTensorboardRunRequest, Sequence[Tuple[str, str]] + tensorboard_service.CreateTensorboardRunRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for create_tensorboard_run @@ -496,10 +513,10 @@ async def post_create_tensorboard_run( async def pre_create_tensorboard_time_series( self, request: tensorboard_service.CreateTensorboardTimeSeriesRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ tensorboard_service.CreateTensorboardTimeSeriesRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for create_tensorboard_time_series @@ -522,8 +539,11 @@ async def post_create_tensorboard_time_series( async def pre_delete_tensorboard( self, request: tensorboard_service.DeleteTensorboardRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[tensorboard_service.DeleteTensorboardRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + tensorboard_service.DeleteTensorboardRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for delete_tensorboard Override in a subclass to manipulate the request or metadata @@ -545,10 +565,10 @@ async def post_delete_tensorboard( async def pre_delete_tensorboard_experiment( self, request: tensorboard_service.DeleteTensorboardExperimentRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ tensorboard_service.DeleteTensorboardExperimentRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for delete_tensorboard_experiment @@ -571,9 +591,10 @@ async def post_delete_tensorboard_experiment( async def pre_delete_tensorboard_run( self, request: tensorboard_service.DeleteTensorboardRunRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - tensorboard_service.DeleteTensorboardRunRequest, Sequence[Tuple[str, str]] + tensorboard_service.DeleteTensorboardRunRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for delete_tensorboard_run @@ -596,10 +617,10 @@ async def post_delete_tensorboard_run( async def pre_delete_tensorboard_time_series( self, request: tensorboard_service.DeleteTensorboardTimeSeriesRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ tensorboard_service.DeleteTensorboardTimeSeriesRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for delete_tensorboard_time_series @@ -622,10 +643,10 @@ async def post_delete_tensorboard_time_series( async def pre_export_tensorboard_time_series_data( self, request: tensorboard_service.ExportTensorboardTimeSeriesDataRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ tensorboard_service.ExportTensorboardTimeSeriesDataRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for export_tensorboard_time_series_data @@ -648,8 +669,11 @@ async def post_export_tensorboard_time_series_data( async def pre_get_tensorboard( self, request: tensorboard_service.GetTensorboardRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[tensorboard_service.GetTensorboardRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + tensorboard_service.GetTensorboardRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for get_tensorboard Override in a subclass to manipulate the request or metadata @@ -671,9 +695,10 @@ async def post_get_tensorboard( async def pre_get_tensorboard_experiment( self, request: tensorboard_service.GetTensorboardExperimentRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - tensorboard_service.GetTensorboardExperimentRequest, Sequence[Tuple[str, str]] + tensorboard_service.GetTensorboardExperimentRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for get_tensorboard_experiment @@ -696,8 +721,11 @@ async def post_get_tensorboard_experiment( async def pre_get_tensorboard_run( self, request: tensorboard_service.GetTensorboardRunRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[tensorboard_service.GetTensorboardRunRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + tensorboard_service.GetTensorboardRunRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for get_tensorboard_run Override in a subclass to manipulate the request or metadata @@ -719,9 +747,10 @@ async def post_get_tensorboard_run( async def pre_get_tensorboard_time_series( self, request: tensorboard_service.GetTensorboardTimeSeriesRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - tensorboard_service.GetTensorboardTimeSeriesRequest, Sequence[Tuple[str, str]] + tensorboard_service.GetTensorboardTimeSeriesRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for get_tensorboard_time_series @@ -744,9 +773,10 @@ async def post_get_tensorboard_time_series( async def pre_list_tensorboard_experiments( self, request: tensorboard_service.ListTensorboardExperimentsRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - tensorboard_service.ListTensorboardExperimentsRequest, Sequence[Tuple[str, str]] + tensorboard_service.ListTensorboardExperimentsRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for list_tensorboard_experiments @@ -769,9 +799,10 @@ async def post_list_tensorboard_experiments( async def pre_list_tensorboard_runs( self, request: tensorboard_service.ListTensorboardRunsRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - tensorboard_service.ListTensorboardRunsRequest, Sequence[Tuple[str, str]] + tensorboard_service.ListTensorboardRunsRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for list_tensorboard_runs @@ -794,8 +825,11 @@ async def post_list_tensorboard_runs( async def pre_list_tensorboards( self, request: tensorboard_service.ListTensorboardsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[tensorboard_service.ListTensorboardsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + tensorboard_service.ListTensorboardsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for list_tensorboards Override in a subclass to manipulate the request or metadata @@ -817,9 +851,10 @@ async def post_list_tensorboards( async def pre_list_tensorboard_time_series( self, request: tensorboard_service.ListTensorboardTimeSeriesRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - tensorboard_service.ListTensorboardTimeSeriesRequest, Sequence[Tuple[str, str]] + tensorboard_service.ListTensorboardTimeSeriesRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for list_tensorboard_time_series @@ -842,9 +877,10 @@ async def post_list_tensorboard_time_series( async def pre_read_tensorboard_blob_data( self, request: tensorboard_service.ReadTensorboardBlobDataRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - tensorboard_service.ReadTensorboardBlobDataRequest, Sequence[Tuple[str, str]] + tensorboard_service.ReadTensorboardBlobDataRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for read_tensorboard_blob_data @@ -867,9 +903,10 @@ async def post_read_tensorboard_blob_data( async def pre_read_tensorboard_size( self, request: tensorboard_service.ReadTensorboardSizeRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - tensorboard_service.ReadTensorboardSizeRequest, Sequence[Tuple[str, str]] + tensorboard_service.ReadTensorboardSizeRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for read_tensorboard_size @@ -892,10 +929,10 @@ async def post_read_tensorboard_size( async def pre_read_tensorboard_time_series_data( self, request: tensorboard_service.ReadTensorboardTimeSeriesDataRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ tensorboard_service.ReadTensorboardTimeSeriesDataRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for read_tensorboard_time_series_data @@ -918,9 +955,10 @@ async def post_read_tensorboard_time_series_data( async def pre_read_tensorboard_usage( self, request: tensorboard_service.ReadTensorboardUsageRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - tensorboard_service.ReadTensorboardUsageRequest, Sequence[Tuple[str, str]] + tensorboard_service.ReadTensorboardUsageRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for read_tensorboard_usage @@ -943,8 +981,11 @@ async def post_read_tensorboard_usage( async def pre_update_tensorboard( self, request: tensorboard_service.UpdateTensorboardRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[tensorboard_service.UpdateTensorboardRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + tensorboard_service.UpdateTensorboardRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for update_tensorboard Override in a subclass to manipulate the request or metadata @@ -966,10 +1007,10 @@ async def post_update_tensorboard( async def pre_update_tensorboard_experiment( self, request: tensorboard_service.UpdateTensorboardExperimentRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ tensorboard_service.UpdateTensorboardExperimentRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for update_tensorboard_experiment @@ -992,9 +1033,10 @@ async def post_update_tensorboard_experiment( async def pre_update_tensorboard_run( self, request: tensorboard_service.UpdateTensorboardRunRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - tensorboard_service.UpdateTensorboardRunRequest, Sequence[Tuple[str, str]] + tensorboard_service.UpdateTensorboardRunRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for update_tensorboard_run @@ -1017,10 +1059,10 @@ async def post_update_tensorboard_run( async def pre_update_tensorboard_time_series( self, request: tensorboard_service.UpdateTensorboardTimeSeriesRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ tensorboard_service.UpdateTensorboardTimeSeriesRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for update_tensorboard_time_series @@ -1043,10 +1085,10 @@ async def post_update_tensorboard_time_series( async def pre_write_tensorboard_experiment_data( self, request: tensorboard_service.WriteTensorboardExperimentDataRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ tensorboard_service.WriteTensorboardExperimentDataRequest, - Sequence[Tuple[str, str]], + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for write_tensorboard_experiment_data @@ -1069,9 +1111,10 @@ async def post_write_tensorboard_experiment_data( async def pre_write_tensorboard_run_data( self, request: tensorboard_service.WriteTensorboardRunDataRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - tensorboard_service.WriteTensorboardRunDataRequest, Sequence[Tuple[str, str]] + tensorboard_service.WriteTensorboardRunDataRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for write_tensorboard_run_data @@ -1094,8 +1137,10 @@ async def post_write_tensorboard_run_data( async def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -1117,8 +1162,10 @@ async def post_get_location( async def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -1140,8 +1187,10 @@ async def post_list_locations( async def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -1163,8 +1212,10 @@ async def post_get_iam_policy( async def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -1186,8 +1237,11 @@ async def post_set_iam_policy( async def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -1209,8 +1263,10 @@ async def post_test_iam_permissions( async def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -1230,8 +1286,10 @@ async def post_cancel_operation(self, response: None) -> None: async 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 @@ -1251,8 +1309,10 @@ async def post_delete_operation(self, response: None) -> None: async 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 @@ -1274,8 +1334,10 @@ async def post_get_operation( async 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 @@ -1297,8 +1359,10 @@ async def post_list_operations( async def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -1631,7 +1695,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> tensorboard_service.BatchCreateTensorboardRunsResponse: r"""Call the batch create tensorboard runs method over HTTP. @@ -1643,8 +1707,10 @@ async def __call__( 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: ~.tensorboard_service.BatchCreateTensorboardRunsResponse: @@ -1656,6 +1722,7 @@ async def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseBatchCreateTensorboardRuns._get_http_options() ) + ( request, metadata, @@ -1675,6 +1742,33 @@ async 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.aiplatform_v1beta1.TensorboardServiceClient.BatchCreateTensorboardRuns", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "BatchCreateTensorboardRuns", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncTensorboardServiceRestTransport._BatchCreateTensorboardRuns._get_response( self._host, @@ -1703,6 +1797,32 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_batch_create_tensorboard_runs(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + tensorboard_service.BatchCreateTensorboardRunsResponse.to_json( + response + ) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.TensorboardServiceAsyncClient.batch_create_tensorboard_runs", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "BatchCreateTensorboardRuns", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _BatchCreateTensorboardTimeSeries( @@ -1744,7 +1864,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> tensorboard_service.BatchCreateTensorboardTimeSeriesResponse: r"""Call the batch create tensorboard time series method over HTTP. @@ -1756,8 +1876,10 @@ async def __call__( 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: ~.tensorboard_service.BatchCreateTensorboardTimeSeriesResponse: @@ -1769,6 +1891,7 @@ async def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseBatchCreateTensorboardTimeSeries._get_http_options() ) + ( request, metadata, @@ -1788,6 +1911,33 @@ async 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.aiplatform_v1beta1.TensorboardServiceClient.BatchCreateTensorboardTimeSeries", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "BatchCreateTensorboardTimeSeries", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncTensorboardServiceRestTransport._BatchCreateTensorboardTimeSeries._get_response( self._host, @@ -1820,6 +1970,30 @@ async def __call__( resp = await self._interceptor.post_batch_create_tensorboard_time_series( resp ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = tensorboard_service.BatchCreateTensorboardTimeSeriesResponse.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.TensorboardServiceAsyncClient.batch_create_tensorboard_time_series", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "BatchCreateTensorboardTimeSeries", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _BatchReadTensorboardTimeSeriesData( @@ -1860,7 +2034,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> tensorboard_service.BatchReadTensorboardTimeSeriesDataResponse: r"""Call the batch read tensorboard time series data method over HTTP. @@ -1872,8 +2046,10 @@ async def __call__( 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: ~.tensorboard_service.BatchReadTensorboardTimeSeriesDataResponse: @@ -1885,6 +2061,7 @@ async def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseBatchReadTensorboardTimeSeriesData._get_http_options() ) + ( request, metadata, @@ -1900,6 +2077,33 @@ async 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.aiplatform_v1beta1.TensorboardServiceClient.BatchReadTensorboardTimeSeriesData", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "BatchReadTensorboardTimeSeriesData", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncTensorboardServiceRestTransport._BatchReadTensorboardTimeSeriesData._get_response( self._host, @@ -1931,6 +2135,30 @@ async def __call__( resp = await self._interceptor.post_batch_read_tensorboard_time_series_data( resp ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = tensorboard_service.BatchReadTensorboardTimeSeriesDataResponse.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.TensorboardServiceAsyncClient.batch_read_tensorboard_time_series_data", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "BatchReadTensorboardTimeSeriesData", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _CreateTensorboard( @@ -1970,7 +2198,7 @@ async 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 tensorboard method over HTTP. @@ -1981,8 +2209,10 @@ async def __call__( 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: @@ -1995,6 +2225,7 @@ async def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseCreateTensorboard._get_http_options() ) + request, metadata = await self._interceptor.pre_create_tensorboard( request, metadata ) @@ -2011,6 +2242,33 @@ async 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.aiplatform_v1beta1.TensorboardServiceClient.CreateTensorboard", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "CreateTensorboard", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncTensorboardServiceRestTransport._CreateTensorboard._get_response( self._host, @@ -2039,6 +2297,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_create_tensorboard(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.TensorboardServiceAsyncClient.create_tensorboard", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "CreateTensorboard", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _CreateTensorboardExperiment( @@ -2080,7 +2360,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> gca_tensorboard_experiment.TensorboardExperiment: r"""Call the create tensorboard experiment method over HTTP. @@ -2092,8 +2372,10 @@ async def __call__( 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: ~.gca_tensorboard_experiment.TensorboardExperiment: @@ -2107,6 +2389,7 @@ async def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseCreateTensorboardExperiment._get_http_options() ) + ( request, metadata, @@ -2126,6 +2409,33 @@ async 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.aiplatform_v1beta1.TensorboardServiceClient.CreateTensorboardExperiment", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "CreateTensorboardExperiment", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncTensorboardServiceRestTransport._CreateTensorboardExperiment._get_response( self._host, @@ -2154,6 +2464,32 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_create_tensorboard_experiment(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + gca_tensorboard_experiment.TensorboardExperiment.to_json( + response + ) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.TensorboardServiceAsyncClient.create_tensorboard_experiment", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "CreateTensorboardExperiment", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _CreateTensorboardRun( @@ -2193,7 +2529,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> gca_tensorboard_run.TensorboardRun: r"""Call the create tensorboard run method over HTTP. @@ -2204,8 +2540,10 @@ async def __call__( 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: ~.gca_tensorboard_run.TensorboardRun: @@ -2219,6 +2557,7 @@ async def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseCreateTensorboardRun._get_http_options() ) + request, metadata = await self._interceptor.pre_create_tensorboard_run( request, metadata ) @@ -2235,6 +2574,33 @@ async 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.aiplatform_v1beta1.TensorboardServiceClient.CreateTensorboardRun", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "CreateTensorboardRun", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncTensorboardServiceRestTransport._CreateTensorboardRun._get_response( self._host, @@ -2263,6 +2629,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_create_tensorboard_run(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gca_tensorboard_run.TensorboardRun.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.TensorboardServiceAsyncClient.create_tensorboard_run", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "CreateTensorboardRun", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _CreateTensorboardTimeSeries( @@ -2304,7 +2694,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> gca_tensorboard_time_series.TensorboardTimeSeries: r"""Call the create tensorboard time series method over HTTP. @@ -2316,8 +2706,10 @@ async def __call__( 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: ~.gca_tensorboard_time_series.TensorboardTimeSeries: @@ -2329,6 +2721,7 @@ async def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseCreateTensorboardTimeSeries._get_http_options() ) + ( request, metadata, @@ -2348,6 +2741,33 @@ async 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.aiplatform_v1beta1.TensorboardServiceClient.CreateTensorboardTimeSeries", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "CreateTensorboardTimeSeries", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncTensorboardServiceRestTransport._CreateTensorboardTimeSeries._get_response( self._host, @@ -2376,6 +2796,32 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_create_tensorboard_time_series(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + gca_tensorboard_time_series.TensorboardTimeSeries.to_json( + response + ) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.TensorboardServiceAsyncClient.create_tensorboard_time_series", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "CreateTensorboardTimeSeries", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _DeleteTensorboard( @@ -2414,7 +2860,7 @@ async 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 tensorboard method over HTTP. @@ -2425,8 +2871,10 @@ async def __call__( 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: @@ -2439,6 +2887,7 @@ async def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseDeleteTensorboard._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_tensorboard( request, metadata ) @@ -2451,6 +2900,33 @@ async 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.aiplatform_v1beta1.TensorboardServiceClient.DeleteTensorboard", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "DeleteTensorboard", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncTensorboardServiceRestTransport._DeleteTensorboard._get_response( self._host, @@ -2478,6 +2954,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_delete_tensorboard(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.TensorboardServiceAsyncClient.delete_tensorboard", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "DeleteTensorboard", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _DeleteTensorboardExperiment( @@ -2518,7 +3016,7 @@ async 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 tensorboard experiment method over HTTP. @@ -2530,8 +3028,10 @@ async def __call__( 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: @@ -2544,6 +3044,7 @@ async def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseDeleteTensorboardExperiment._get_http_options() ) + ( request, metadata, @@ -2559,6 +3060,33 @@ async 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.aiplatform_v1beta1.TensorboardServiceClient.DeleteTensorboardExperiment", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "DeleteTensorboardExperiment", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncTensorboardServiceRestTransport._DeleteTensorboardExperiment._get_response( self._host, @@ -2586,6 +3114,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_delete_tensorboard_experiment(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.TensorboardServiceAsyncClient.delete_tensorboard_experiment", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "DeleteTensorboardExperiment", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _DeleteTensorboardRun( @@ -2624,7 +3174,7 @@ async 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 tensorboard run method over HTTP. @@ -2635,8 +3185,10 @@ async def __call__( 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: @@ -2649,6 +3201,7 @@ async def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseDeleteTensorboardRun._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_tensorboard_run( request, metadata ) @@ -2661,6 +3214,33 @@ async 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.aiplatform_v1beta1.TensorboardServiceClient.DeleteTensorboardRun", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "DeleteTensorboardRun", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncTensorboardServiceRestTransport._DeleteTensorboardRun._get_response( self._host, @@ -2688,6 +3268,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_delete_tensorboard_run(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.TensorboardServiceAsyncClient.delete_tensorboard_run", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "DeleteTensorboardRun", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _DeleteTensorboardTimeSeries( @@ -2728,7 +3330,7 @@ async 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 tensorboard time series method over HTTP. @@ -2740,8 +3342,10 @@ async def __call__( 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: @@ -2754,6 +3358,7 @@ async def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseDeleteTensorboardTimeSeries._get_http_options() ) + ( request, metadata, @@ -2769,6 +3374,33 @@ async 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.aiplatform_v1beta1.TensorboardServiceClient.DeleteTensorboardTimeSeries", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "DeleteTensorboardTimeSeries", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncTensorboardServiceRestTransport._DeleteTensorboardTimeSeries._get_response( self._host, @@ -2796,6 +3428,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_delete_tensorboard_time_series(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.TensorboardServiceAsyncClient.delete_tensorboard_time_series", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "DeleteTensorboardTimeSeries", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ExportTensorboardTimeSeriesData( @@ -2837,7 +3491,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> tensorboard_service.ExportTensorboardTimeSeriesDataResponse: r"""Call the export tensorboard time series data method over HTTP. @@ -2849,8 +3503,10 @@ async def __call__( 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: ~.tensorboard_service.ExportTensorboardTimeSeriesDataResponse: @@ -2862,6 +3518,7 @@ async def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseExportTensorboardTimeSeriesData._get_http_options() ) + ( request, metadata, @@ -2881,6 +3538,33 @@ async 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.aiplatform_v1beta1.TensorboardServiceClient.ExportTensorboardTimeSeriesData", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "ExportTensorboardTimeSeriesData", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncTensorboardServiceRestTransport._ExportTensorboardTimeSeriesData._get_response( self._host, @@ -2913,6 +3597,30 @@ async def __call__( resp = await self._interceptor.post_export_tensorboard_time_series_data( resp ) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = tensorboard_service.ExportTensorboardTimeSeriesDataResponse.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.TensorboardServiceAsyncClient.export_tensorboard_time_series_data", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "ExportTensorboardTimeSeriesData", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _GetTensorboard( @@ -2951,7 +3659,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> tensorboard.Tensorboard: r"""Call the get tensorboard method over HTTP. @@ -2962,8 +3670,10 @@ async def __call__( 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: ~.tensorboard.Tensorboard: @@ -2979,6 +3689,7 @@ async def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseGetTensorboard._get_http_options() ) + request, metadata = await self._interceptor.pre_get_tensorboard( request, metadata ) @@ -2991,6 +3702,33 @@ async 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.aiplatform_v1beta1.TensorboardServiceClient.GetTensorboard", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "GetTensorboard", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncTensorboardServiceRestTransport._GetTensorboard._get_response( self._host, @@ -3018,6 +3756,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_get_tensorboard(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = tensorboard.Tensorboard.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.TensorboardServiceAsyncClient.get_tensorboard", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "GetTensorboard", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _GetTensorboardExperiment( @@ -3056,7 +3816,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> tensorboard_experiment.TensorboardExperiment: r"""Call the get tensorboard experiment method over HTTP. @@ -3068,8 +3828,10 @@ async def __call__( 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: ~.tensorboard_experiment.TensorboardExperiment: @@ -3083,6 +3845,7 @@ async def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseGetTensorboardExperiment._get_http_options() ) + request, metadata = await self._interceptor.pre_get_tensorboard_experiment( request, metadata ) @@ -3095,6 +3858,33 @@ async 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.aiplatform_v1beta1.TensorboardServiceClient.GetTensorboardExperiment", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "GetTensorboardExperiment", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncTensorboardServiceRestTransport._GetTensorboardExperiment._get_response( self._host, @@ -3122,6 +3912,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_get_tensorboard_experiment(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + tensorboard_experiment.TensorboardExperiment.to_json(response) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.TensorboardServiceAsyncClient.get_tensorboard_experiment", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "GetTensorboardExperiment", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _GetTensorboardRun( @@ -3160,7 +3974,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> tensorboard_run.TensorboardRun: r"""Call the get tensorboard run method over HTTP. @@ -3171,8 +3985,10 @@ async def __call__( 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: ~.tensorboard_run.TensorboardRun: @@ -3186,6 +4002,7 @@ async def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseGetTensorboardRun._get_http_options() ) + request, metadata = await self._interceptor.pre_get_tensorboard_run( request, metadata ) @@ -3198,6 +4015,33 @@ async 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.aiplatform_v1beta1.TensorboardServiceClient.GetTensorboardRun", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "GetTensorboardRun", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncTensorboardServiceRestTransport._GetTensorboardRun._get_response( self._host, @@ -3225,6 +4069,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_get_tensorboard_run(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = tensorboard_run.TensorboardRun.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.TensorboardServiceAsyncClient.get_tensorboard_run", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "GetTensorboardRun", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _GetTensorboardTimeSeries( @@ -3263,7 +4129,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> tensorboard_time_series.TensorboardTimeSeries: r"""Call the get tensorboard time series method over HTTP. @@ -3275,8 +4141,10 @@ async def __call__( 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: ~.tensorboard_time_series.TensorboardTimeSeries: @@ -3288,6 +4156,7 @@ async def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseGetTensorboardTimeSeries._get_http_options() ) + request, metadata = await self._interceptor.pre_get_tensorboard_time_series( request, metadata ) @@ -3300,6 +4169,33 @@ async 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.aiplatform_v1beta1.TensorboardServiceClient.GetTensorboardTimeSeries", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "GetTensorboardTimeSeries", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncTensorboardServiceRestTransport._GetTensorboardTimeSeries._get_response( self._host, @@ -3327,6 +4223,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_get_tensorboard_time_series(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + tensorboard_time_series.TensorboardTimeSeries.to_json(response) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.TensorboardServiceAsyncClient.get_tensorboard_time_series", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "GetTensorboardTimeSeries", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ListTensorboardExperiments( @@ -3367,7 +4287,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> tensorboard_service.ListTensorboardExperimentsResponse: r"""Call the list tensorboard experiments method over HTTP. @@ -3379,8 +4299,10 @@ async def __call__( 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: ~.tensorboard_service.ListTensorboardExperimentsResponse: @@ -3392,6 +4314,7 @@ async def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseListTensorboardExperiments._get_http_options() ) + ( request, metadata, @@ -3407,6 +4330,33 @@ async 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.aiplatform_v1beta1.TensorboardServiceClient.ListTensorboardExperiments", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "ListTensorboardExperiments", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncTensorboardServiceRestTransport._ListTensorboardExperiments._get_response( self._host, @@ -3434,6 +4384,32 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_list_tensorboard_experiments(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + tensorboard_service.ListTensorboardExperimentsResponse.to_json( + response + ) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.TensorboardServiceAsyncClient.list_tensorboard_experiments", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "ListTensorboardExperiments", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ListTensorboardRuns( @@ -3472,7 +4448,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> tensorboard_service.ListTensorboardRunsResponse: r"""Call the list tensorboard runs method over HTTP. @@ -3483,8 +4459,10 @@ async def __call__( 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: ~.tensorboard_service.ListTensorboardRunsResponse: @@ -3496,6 +4474,7 @@ async def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseListTensorboardRuns._get_http_options() ) + request, metadata = await self._interceptor.pre_list_tensorboard_runs( request, metadata ) @@ -3508,6 +4487,33 @@ async 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.aiplatform_v1beta1.TensorboardServiceClient.ListTensorboardRuns", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "ListTensorboardRuns", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncTensorboardServiceRestTransport._ListTensorboardRuns._get_response( self._host, @@ -3535,6 +4541,32 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_list_tensorboard_runs(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + tensorboard_service.ListTensorboardRunsResponse.to_json( + response + ) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.TensorboardServiceAsyncClient.list_tensorboard_runs", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "ListTensorboardRuns", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ListTensorboards( @@ -3573,7 +4605,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> tensorboard_service.ListTensorboardsResponse: r"""Call the list tensorboards method over HTTP. @@ -3584,8 +4616,10 @@ async def __call__( 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: ~.tensorboard_service.ListTensorboardsResponse: @@ -3597,6 +4631,7 @@ async def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseListTensorboards._get_http_options() ) + request, metadata = await self._interceptor.pre_list_tensorboards( request, metadata ) @@ -3609,6 +4644,33 @@ async 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.aiplatform_v1beta1.TensorboardServiceClient.ListTensorboards", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "ListTensorboards", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncTensorboardServiceRestTransport._ListTensorboards._get_response( self._host, @@ -3636,6 +4698,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_list_tensorboards(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + tensorboard_service.ListTensorboardsResponse.to_json(response) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.TensorboardServiceAsyncClient.list_tensorboards", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "ListTensorboards", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ListTensorboardTimeSeries( @@ -3676,7 +4762,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> tensorboard_service.ListTensorboardTimeSeriesResponse: r"""Call the list tensorboard time series method over HTTP. @@ -3688,8 +4774,10 @@ async def __call__( 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: ~.tensorboard_service.ListTensorboardTimeSeriesResponse: @@ -3701,6 +4789,7 @@ async def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseListTensorboardTimeSeries._get_http_options() ) + ( request, metadata, @@ -3716,6 +4805,33 @@ async 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.aiplatform_v1beta1.TensorboardServiceClient.ListTensorboardTimeSeries", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "ListTensorboardTimeSeries", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncTensorboardServiceRestTransport._ListTensorboardTimeSeries._get_response( self._host, @@ -3743,6 +4859,32 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_list_tensorboard_time_series(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + tensorboard_service.ListTensorboardTimeSeriesResponse.to_json( + response + ) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.TensorboardServiceAsyncClient.list_tensorboard_time_series", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "ListTensorboardTimeSeries", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ReadTensorboardBlobData( @@ -3781,7 +4923,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> rest_streaming_async.AsyncResponseIterator: r"""Call the read tensorboard blob data method over HTTP. @@ -3793,8 +4935,10 @@ async def __call__( 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: ~.tensorboard_service.ReadTensorboardBlobDataResponse: @@ -3806,6 +4950,7 @@ async def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseReadTensorboardBlobData._get_http_options() ) + request, metadata = await self._interceptor.pre_read_tensorboard_blob_data( request, metadata ) @@ -3818,6 +4963,33 @@ async 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.aiplatform_v1beta1.TensorboardServiceClient.ReadTensorboardBlobData", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "ReadTensorboardBlobData", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncTensorboardServiceRestTransport._ReadTensorboardBlobData._get_response( self._host, @@ -3882,7 +5054,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> tensorboard_service.ReadTensorboardSizeResponse: r"""Call the read tensorboard size method over HTTP. @@ -3893,8 +5065,10 @@ async def __call__( 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: ~.tensorboard_service.ReadTensorboardSizeResponse: @@ -3906,6 +5080,7 @@ async def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseReadTensorboardSize._get_http_options() ) + request, metadata = await self._interceptor.pre_read_tensorboard_size( request, metadata ) @@ -3918,6 +5093,33 @@ async 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.aiplatform_v1beta1.TensorboardServiceClient.ReadTensorboardSize", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "ReadTensorboardSize", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncTensorboardServiceRestTransport._ReadTensorboardSize._get_response( self._host, @@ -3945,6 +5147,32 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_read_tensorboard_size(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + tensorboard_service.ReadTensorboardSizeResponse.to_json( + response + ) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.TensorboardServiceAsyncClient.read_tensorboard_size", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "ReadTensorboardSize", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ReadTensorboardTimeSeriesData( @@ -3985,7 +5213,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> tensorboard_service.ReadTensorboardTimeSeriesDataResponse: r"""Call the read tensorboard time series data method over HTTP. @@ -3997,8 +5225,10 @@ async def __call__( 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: ~.tensorboard_service.ReadTensorboardTimeSeriesDataResponse: @@ -4010,6 +5240,7 @@ async def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseReadTensorboardTimeSeriesData._get_http_options() ) + ( request, metadata, @@ -4025,6 +5256,33 @@ async 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.aiplatform_v1beta1.TensorboardServiceClient.ReadTensorboardTimeSeriesData", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "ReadTensorboardTimeSeriesData", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncTensorboardServiceRestTransport._ReadTensorboardTimeSeriesData._get_response( self._host, @@ -4052,6 +5310,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_read_tensorboard_time_series_data(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = tensorboard_service.ReadTensorboardTimeSeriesDataResponse.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.TensorboardServiceAsyncClient.read_tensorboard_time_series_data", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "ReadTensorboardTimeSeriesData", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ReadTensorboardUsage( @@ -4090,7 +5372,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> tensorboard_service.ReadTensorboardUsageResponse: r"""Call the read tensorboard usage method over HTTP. @@ -4101,8 +5383,10 @@ async def __call__( 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: ~.tensorboard_service.ReadTensorboardUsageResponse: @@ -4114,6 +5398,7 @@ async def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseReadTensorboardUsage._get_http_options() ) + request, metadata = await self._interceptor.pre_read_tensorboard_usage( request, metadata ) @@ -4126,6 +5411,33 @@ async 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.aiplatform_v1beta1.TensorboardServiceClient.ReadTensorboardUsage", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "ReadTensorboardUsage", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncTensorboardServiceRestTransport._ReadTensorboardUsage._get_response( self._host, @@ -4153,6 +5465,32 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_read_tensorboard_usage(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + tensorboard_service.ReadTensorboardUsageResponse.to_json( + response + ) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.TensorboardServiceAsyncClient.read_tensorboard_usage", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "ReadTensorboardUsage", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _UpdateTensorboard( @@ -4192,7 +5530,7 @@ async 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 tensorboard method over HTTP. @@ -4203,8 +5541,10 @@ async def __call__( 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: @@ -4217,6 +5557,7 @@ async def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseUpdateTensorboard._get_http_options() ) + request, metadata = await self._interceptor.pre_update_tensorboard( request, metadata ) @@ -4233,6 +5574,33 @@ async 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.aiplatform_v1beta1.TensorboardServiceClient.UpdateTensorboard", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "UpdateTensorboard", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncTensorboardServiceRestTransport._UpdateTensorboard._get_response( self._host, @@ -4261,6 +5629,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_update_tensorboard(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.TensorboardServiceAsyncClient.update_tensorboard", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "UpdateTensorboard", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _UpdateTensorboardExperiment( @@ -4302,7 +5692,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> gca_tensorboard_experiment.TensorboardExperiment: r"""Call the update tensorboard experiment method over HTTP. @@ -4314,8 +5704,10 @@ async def __call__( 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: ~.gca_tensorboard_experiment.TensorboardExperiment: @@ -4329,6 +5721,7 @@ async def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseUpdateTensorboardExperiment._get_http_options() ) + ( request, metadata, @@ -4348,6 +5741,33 @@ async 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.aiplatform_v1beta1.TensorboardServiceClient.UpdateTensorboardExperiment", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "UpdateTensorboardExperiment", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncTensorboardServiceRestTransport._UpdateTensorboardExperiment._get_response( self._host, @@ -4376,6 +5796,32 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_update_tensorboard_experiment(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + gca_tensorboard_experiment.TensorboardExperiment.to_json( + response + ) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.TensorboardServiceAsyncClient.update_tensorboard_experiment", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "UpdateTensorboardExperiment", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _UpdateTensorboardRun( @@ -4415,7 +5861,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> gca_tensorboard_run.TensorboardRun: r"""Call the update tensorboard run method over HTTP. @@ -4426,8 +5872,10 @@ async def __call__( 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: ~.gca_tensorboard_run.TensorboardRun: @@ -4441,6 +5889,7 @@ async def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseUpdateTensorboardRun._get_http_options() ) + request, metadata = await self._interceptor.pre_update_tensorboard_run( request, metadata ) @@ -4457,6 +5906,33 @@ async 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.aiplatform_v1beta1.TensorboardServiceClient.UpdateTensorboardRun", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "UpdateTensorboardRun", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncTensorboardServiceRestTransport._UpdateTensorboardRun._get_response( self._host, @@ -4485,6 +5961,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_update_tensorboard_run(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gca_tensorboard_run.TensorboardRun.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.TensorboardServiceAsyncClient.update_tensorboard_run", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "UpdateTensorboardRun", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _UpdateTensorboardTimeSeries( @@ -4526,7 +6026,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> gca_tensorboard_time_series.TensorboardTimeSeries: r"""Call the update tensorboard time series method over HTTP. @@ -4538,8 +6038,10 @@ async def __call__( 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: ~.gca_tensorboard_time_series.TensorboardTimeSeries: @@ -4551,6 +6053,7 @@ async def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseUpdateTensorboardTimeSeries._get_http_options() ) + ( request, metadata, @@ -4570,6 +6073,33 @@ async 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.aiplatform_v1beta1.TensorboardServiceClient.UpdateTensorboardTimeSeries", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "UpdateTensorboardTimeSeries", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncTensorboardServiceRestTransport._UpdateTensorboardTimeSeries._get_response( self._host, @@ -4598,6 +6128,32 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_update_tensorboard_time_series(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + gca_tensorboard_time_series.TensorboardTimeSeries.to_json( + response + ) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.TensorboardServiceAsyncClient.update_tensorboard_time_series", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "UpdateTensorboardTimeSeries", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _WriteTensorboardExperimentData( @@ -4639,7 +6195,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> tensorboard_service.WriteTensorboardExperimentDataResponse: r"""Call the write tensorboard experiment data method over HTTP. @@ -4651,8 +6207,10 @@ async def __call__( 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: ~.tensorboard_service.WriteTensorboardExperimentDataResponse: @@ -4664,6 +6222,7 @@ async def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseWriteTensorboardExperimentData._get_http_options() ) + ( request, metadata, @@ -4683,6 +6242,33 @@ async 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.aiplatform_v1beta1.TensorboardServiceClient.WriteTensorboardExperimentData", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "WriteTensorboardExperimentData", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncTensorboardServiceRestTransport._WriteTensorboardExperimentData._get_response( self._host, @@ -4713,6 +6299,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_write_tensorboard_experiment_data(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = tensorboard_service.WriteTensorboardExperimentDataResponse.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.TensorboardServiceAsyncClient.write_tensorboard_experiment_data", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "WriteTensorboardExperimentData", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _WriteTensorboardRunData( @@ -4752,7 +6362,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> tensorboard_service.WriteTensorboardRunDataResponse: r"""Call the write tensorboard run data method over HTTP. @@ -4764,8 +6374,10 @@ async def __call__( 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: ~.tensorboard_service.WriteTensorboardRunDataResponse: @@ -4777,6 +6389,7 @@ async def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseWriteTensorboardRunData._get_http_options() ) + request, metadata = await self._interceptor.pre_write_tensorboard_run_data( request, metadata ) @@ -4793,6 +6406,33 @@ async 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.aiplatform_v1beta1.TensorboardServiceClient.WriteTensorboardRunData", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "WriteTensorboardRunData", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncTensorboardServiceRestTransport._WriteTensorboardRunData._get_response( self._host, @@ -4821,6 +6461,32 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_write_tensorboard_run_data(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + tensorboard_service.WriteTensorboardRunDataResponse.to_json( + response + ) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.TensorboardServiceAsyncClient.write_tensorboard_run_data", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "WriteTensorboardRunData", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp @property @@ -5396,6 +7062,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -5612,6 +7282,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -5818,6 +7492,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}", @@ -6034,6 +7712,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, ], "google.longrunning.Operations.ListOperations": [ { @@ -6232,6 +7914,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*}/operations", @@ -6448,6 +8134,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*}/operations", + }, ], "google.longrunning.Operations.WaitOperation": [ { @@ -6646,6 +8336,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "post", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}:wait", @@ -6858,6 +8552,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, ], } @@ -7178,7 +8876,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -7189,8 +8887,10 @@ async def __call__( 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: locations_pb2.Location: Response from GetLocation method. @@ -7199,6 +8899,7 @@ async def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_location( request, metadata ) @@ -7211,6 +8912,33 @@ async 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.aiplatform_v1beta1.TensorboardServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncTensorboardServiceRestTransport._GetLocation._get_response( @@ -7238,6 +8966,27 @@ async def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_location(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.aiplatform_v1beta1.TensorboardServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -7280,7 +9029,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -7291,8 +9040,10 @@ async def __call__( 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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -7301,6 +9052,7 @@ async def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_locations( request, metadata ) @@ -7313,6 +9065,33 @@ async 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.aiplatform_v1beta1.TensorboardServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncTensorboardServiceRestTransport._ListLocations._get_response( @@ -7340,6 +9119,27 @@ async def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_list_locations(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.aiplatform_v1beta1.TensorboardServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -7383,7 +9183,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -7394,8 +9194,10 @@ async def __call__( 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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -7404,6 +9206,7 @@ async def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_get_iam_policy( request, metadata ) @@ -7420,6 +9223,33 @@ async 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.aiplatform_v1beta1.TensorboardServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncTensorboardServiceRestTransport._GetIamPolicy._get_response( @@ -7448,6 +9278,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_iam_policy(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.aiplatform_v1beta1.TensorboardServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -7491,7 +9342,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -7502,8 +9353,10 @@ async def __call__( 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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -7512,6 +9365,7 @@ async def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_set_iam_policy( request, metadata ) @@ -7528,6 +9382,33 @@ async 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.aiplatform_v1beta1.TensorboardServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncTensorboardServiceRestTransport._SetIamPolicy._get_response( @@ -7556,6 +9437,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_set_iam_policy(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.aiplatform_v1beta1.TensorboardServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -7599,7 +9501,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -7610,8 +9512,10 @@ async def __call__( 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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -7620,6 +9524,7 @@ async def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = await self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -7636,6 +9541,33 @@ async 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.aiplatform_v1beta1.TensorboardServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncTensorboardServiceRestTransport._TestIamPermissions._get_response( self._host, @@ -7662,6 +9594,27 @@ async def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_test_iam_permissions(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.aiplatform_v1beta1.TensorboardServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -7704,7 +9657,7 @@ async 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 cancel operation method over HTTP. @@ -7715,13 +9668,16 @@ async def __call__( 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`. """ http_options = ( _BaseTensorboardServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_cancel_operation( request, metadata ) @@ -7734,6 +9690,33 @@ async 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.aiplatform_v1beta1.TensorboardServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncTensorboardServiceRestTransport._CancelOperation._get_response( self._host, @@ -7797,7 +9780,7 @@ async 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. @@ -7808,13 +9791,16 @@ async def __call__( 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`. """ http_options = ( _BaseTensorboardServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_operation( request, metadata ) @@ -7827,6 +9813,33 @@ async 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.aiplatform_v1beta1.TensorboardServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncTensorboardServiceRestTransport._DeleteOperation._get_response( self._host, @@ -7890,7 +9903,7 @@ async 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. @@ -7901,8 +9914,10 @@ async def __call__( 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: Response from GetOperation method. @@ -7911,6 +9926,7 @@ async def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_operation( request, metadata ) @@ -7923,6 +9939,33 @@ async 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.aiplatform_v1beta1.TensorboardServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncTensorboardServiceRestTransport._GetOperation._get_response( @@ -7950,6 +9993,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1beta1.TensorboardServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -7992,7 +10056,7 @@ async 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. @@ -8003,8 +10067,10 @@ async def __call__( 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 from ListOperations method. @@ -8013,6 +10079,7 @@ async def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_operations( request, metadata ) @@ -8025,6 +10092,33 @@ async 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.aiplatform_v1beta1.TensorboardServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncTensorboardServiceRestTransport._ListOperations._get_response( self._host, @@ -8050,6 +10144,27 @@ async def __call__( resp = operations_pb2.ListOperationsResponse() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1beta1.TensorboardServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -8092,7 +10207,7 @@ async 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 wait operation method over HTTP. @@ -8103,8 +10218,10 @@ async def __call__( 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: Response from WaitOperation method. @@ -8113,6 +10230,7 @@ async def __call__( http_options = ( _BaseTensorboardServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_wait_operation( request, metadata ) @@ -8125,6 +10243,33 @@ async 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.aiplatform_v1beta1.TensorboardServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncTensorboardServiceRestTransport._WaitOperation._get_response( @@ -8152,6 +10297,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_wait_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.aiplatform_v1beta1.TensorboardServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.TensorboardService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1beta1/services/tensorboard_service/transports/rest_base.py b/google/cloud/aiplatform_v1beta1/services/tensorboard_service/transports/rest_base.py index 27e594acd3..a361aa5f08 100644 --- a/google/cloud/aiplatform_v1beta1/services/tensorboard_service/transports/rest_base.py +++ b/google/cloud/aiplatform_v1beta1/services/tensorboard_service/transports/rest_base.py @@ -2604,6 +2604,10 @@ def _get_http_options(): "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -2820,6 +2824,10 @@ def _get_http_options(): "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -3045,6 +3053,10 @@ def _get_http_options(): "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}", @@ -3261,6 +3273,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, ] return http_options @@ -3478,6 +3494,10 @@ def _get_http_options(): "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*}/operations", @@ -3694,6 +3714,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*}/operations", + }, ] return http_options @@ -3911,6 +3935,10 @@ def _get_http_options(): "method": "post", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}:wait", @@ -4123,6 +4151,10 @@ def _get_http_options(): "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, ] return http_options diff --git a/google/cloud/aiplatform_v1beta1/services/vertex_rag_data_service/async_client.py b/google/cloud/aiplatform_v1beta1/services/vertex_rag_data_service/async_client.py index df7b16135f..bcc3af6113 100644 --- a/google/cloud/aiplatform_v1beta1/services/vertex_rag_data_service/async_client.py +++ b/google/cloud/aiplatform_v1beta1/services/vertex_rag_data_service/async_client.py @@ -13,6 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging as std_logging from collections import OrderedDict import re from typing import ( @@ -61,6 +62,15 @@ from .transports.grpc_asyncio import VertexRagDataServiceGrpcAsyncIOTransport from .client import VertexRagDataServiceClient +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 VertexRagDataServiceAsyncClient: """A service for managing user data for RAG.""" @@ -282,6 +292,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.aiplatform_v1beta1.VertexRagDataServiceAsyncClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagDataService", + "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.aiplatform.v1beta1.VertexRagDataService", + "credentialsType": None, + }, + ) + async def create_rag_corpus( self, request: Optional[ @@ -292,7 +324,7 @@ async def create_rag_corpus( rag_corpus: Optional[vertex_rag_data.RagCorpus] = 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"""Creates a RagCorpus. @@ -350,8 +382,10 @@ async def sample_create_rag_corpus(): 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: @@ -426,7 +460,7 @@ async def update_rag_corpus( rag_corpus: Optional[vertex_rag_data.RagCorpus] = 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"""Updates a RagCorpus. @@ -477,8 +511,10 @@ async def sample_update_rag_corpus(): 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: @@ -553,7 +589,7 @@ async def get_rag_corpus( 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]]] = (), ) -> vertex_rag_data.RagCorpus: r"""Gets a RagCorpus. @@ -597,8 +633,10 @@ async def sample_get_rag_corpus(): 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.aiplatform_v1beta1.types.RagCorpus: @@ -662,7 +700,7 @@ async def list_rag_corpora( 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.ListRagCorporaAsyncPager: r"""Lists RagCorpora in a Location. @@ -708,8 +746,10 @@ async def sample_list_rag_corpora(): 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.aiplatform_v1beta1.services.vertex_rag_data_service.pagers.ListRagCorporaAsyncPager: @@ -786,7 +826,7 @@ async def delete_rag_corpus( 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"""Deletes a RagCorpus. @@ -835,8 +875,10 @@ async def sample_delete_rag_corpus(): 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: @@ -919,7 +961,7 @@ async def upload_rag_file( upload_rag_file_config: Optional[vertex_rag_data.UploadRagFileConfig] = 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]]] = (), ) -> vertex_rag_data_service.UploadRagFileResponse: r"""Upload a file into a RagCorpus. @@ -982,8 +1024,10 @@ async def sample_upload_rag_file(): 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.aiplatform_v1beta1.types.UploadRagFileResponse: @@ -1051,7 +1095,7 @@ async def import_rag_files( import_rag_files_config: Optional[vertex_rag_data.ImportRagFilesConfig] = 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"""Import files from Google Cloud Storage or Google Drive into a RagCorpus. @@ -1114,8 +1158,10 @@ async def sample_import_rag_files(): 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: @@ -1190,7 +1236,7 @@ async def get_rag_file( 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]]] = (), ) -> vertex_rag_data.RagFile: r"""Gets a RagFile. @@ -1234,8 +1280,10 @@ async def sample_get_rag_file(): 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.aiplatform_v1beta1.types.RagFile: @@ -1298,7 +1346,7 @@ async def list_rag_files( 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.ListRagFilesAsyncPager: r"""Lists RagFiles in a RagCorpus. @@ -1344,8 +1392,10 @@ async def sample_list_rag_files(): 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.aiplatform_v1beta1.services.vertex_rag_data_service.pagers.ListRagFilesAsyncPager: @@ -1422,7 +1472,7 @@ async def delete_rag_file( 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"""Deletes a RagFile. @@ -1471,8 +1521,10 @@ async def sample_delete_rag_file(): 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: @@ -1550,7 +1602,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. @@ -1561,8 +1613,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. @@ -1603,7 +1657,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. @@ -1614,8 +1668,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. @@ -1656,7 +1712,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. @@ -1672,8 +1728,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 """ @@ -1710,7 +1768,7 @@ async def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -1725,8 +1783,10 @@ async def cancel_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 """ @@ -1763,7 +1823,7 @@ async def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -1780,8 +1840,10 @@ async def wait_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. @@ -1822,7 +1884,7 @@ async def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -1835,8 +1897,10 @@ async def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -1941,7 +2005,7 @@ async def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -1955,8 +2019,10 @@ async def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -2061,7 +2127,7 @@ async def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -2076,8 +2142,10 @@ async def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -2121,7 +2189,7 @@ async def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -2132,8 +2200,10 @@ async def get_location( 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: ~.location_pb2.Location: Location object. @@ -2174,7 +2244,7 @@ async def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -2185,8 +2255,10 @@ async def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1beta1/services/vertex_rag_data_service/client.py b/google/cloud/aiplatform_v1beta1/services/vertex_rag_data_service/client.py index 32bc862bf7..5ecbc06b7b 100644 --- a/google/cloud/aiplatform_v1beta1/services/vertex_rag_data_service/client.py +++ b/google/cloud/aiplatform_v1beta1/services/vertex_rag_data_service/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 ( @@ -48,6 +49,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 as gac_operation # type: ignore from google.api_core import operation_async # type: ignore from google.cloud.aiplatform_v1beta1.services.vertex_rag_data_service import pagers @@ -697,6 +707,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( @@ -788,6 +802,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.aiplatform_v1beta1.VertexRagDataServiceClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagDataService", + "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.aiplatform.v1beta1.VertexRagDataService", + "credentialsType": None, + }, + ) + def create_rag_corpus( self, request: Optional[ @@ -798,7 +835,7 @@ def create_rag_corpus( rag_corpus: Optional[vertex_rag_data.RagCorpus] = 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]]] = (), ) -> gac_operation.Operation: r"""Creates a RagCorpus. @@ -856,8 +893,10 @@ def sample_create_rag_corpus(): 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: @@ -929,7 +968,7 @@ def update_rag_corpus( rag_corpus: Optional[vertex_rag_data.RagCorpus] = 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]]] = (), ) -> gac_operation.Operation: r"""Updates a RagCorpus. @@ -980,8 +1019,10 @@ def sample_update_rag_corpus(): 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: @@ -1053,7 +1094,7 @@ def get_rag_corpus( 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]]] = (), ) -> vertex_rag_data.RagCorpus: r"""Gets a RagCorpus. @@ -1097,8 +1138,10 @@ def sample_get_rag_corpus(): 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.aiplatform_v1beta1.types.RagCorpus: @@ -1159,7 +1202,7 @@ def list_rag_corpora( 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.ListRagCorporaPager: r"""Lists RagCorpora in a Location. @@ -1205,8 +1248,10 @@ def sample_list_rag_corpora(): 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.aiplatform_v1beta1.services.vertex_rag_data_service.pagers.ListRagCorporaPager: @@ -1280,7 +1325,7 @@ def delete_rag_corpus( 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]]] = (), ) -> gac_operation.Operation: r"""Deletes a RagCorpus. @@ -1329,8 +1374,10 @@ def sample_delete_rag_corpus(): 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: @@ -1410,7 +1457,7 @@ def upload_rag_file( upload_rag_file_config: Optional[vertex_rag_data.UploadRagFileConfig] = 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]]] = (), ) -> vertex_rag_data_service.UploadRagFileResponse: r"""Upload a file into a RagCorpus. @@ -1473,8 +1520,10 @@ def sample_upload_rag_file(): 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.aiplatform_v1beta1.types.UploadRagFileResponse: @@ -1539,7 +1588,7 @@ def import_rag_files( import_rag_files_config: Optional[vertex_rag_data.ImportRagFilesConfig] = 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]]] = (), ) -> gac_operation.Operation: r"""Import files from Google Cloud Storage or Google Drive into a RagCorpus. @@ -1602,8 +1651,10 @@ def sample_import_rag_files(): 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: @@ -1675,7 +1726,7 @@ def get_rag_file( 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]]] = (), ) -> vertex_rag_data.RagFile: r"""Gets a RagFile. @@ -1719,8 +1770,10 @@ def sample_get_rag_file(): 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.aiplatform_v1beta1.types.RagFile: @@ -1780,7 +1833,7 @@ def list_rag_files( 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.ListRagFilesPager: r"""Lists RagFiles in a RagCorpus. @@ -1826,8 +1879,10 @@ def sample_list_rag_files(): 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.aiplatform_v1beta1.services.vertex_rag_data_service.pagers.ListRagFilesPager: @@ -1901,7 +1956,7 @@ def delete_rag_file( 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]]] = (), ) -> gac_operation.Operation: r"""Deletes a RagFile. @@ -1950,8 +2005,10 @@ def sample_delete_rag_file(): 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: @@ -2039,7 +2096,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. @@ -2050,8 +2107,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. @@ -2092,7 +2151,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. @@ -2103,8 +2162,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. @@ -2145,7 +2206,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. @@ -2161,8 +2222,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 """ @@ -2199,7 +2262,7 @@ def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -2214,8 +2277,10 @@ def cancel_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 """ @@ -2252,7 +2317,7 @@ def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -2269,8 +2334,10 @@ def wait_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. @@ -2311,7 +2378,7 @@ def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -2324,8 +2391,10 @@ def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -2430,7 +2499,7 @@ def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -2444,8 +2513,10 @@ def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -2550,7 +2621,7 @@ def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -2565,8 +2636,10 @@ def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -2608,7 +2681,7 @@ def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -2619,8 +2692,10 @@ def get_location( 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: ~.location_pb2.Location: Location object. @@ -2661,7 +2736,7 @@ def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -2672,8 +2747,10 @@ def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1beta1/services/vertex_rag_data_service/pagers.py b/google/cloud/aiplatform_v1beta1/services/vertex_rag_data_service/pagers.py index da6eb3df02..7181aac787 100644 --- a/google/cloud/aiplatform_v1beta1/services/vertex_rag_data_service/pagers.py +++ b/google/cloud/aiplatform_v1beta1/services/vertex_rag_data_service/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 = vertex_rag_data_service.ListRagCorporaRequest(request) @@ -143,7 +145,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. @@ -157,8 +159,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 = vertex_rag_data_service.ListRagCorporaRequest(request) @@ -223,7 +227,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. @@ -237,8 +241,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 = vertex_rag_data_service.ListRagFilesRequest(request) @@ -297,7 +303,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. @@ -311,8 +317,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 = vertex_rag_data_service.ListRagFilesRequest(request) diff --git a/google/cloud/aiplatform_v1beta1/services/vertex_rag_data_service/transports/grpc.py b/google/cloud/aiplatform_v1beta1/services/vertex_rag_data_service/transports/grpc.py index f91cdcdb64..3953507fac 100644 --- a/google/cloud/aiplatform_v1beta1/services/vertex_rag_data_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1beta1/services/vertex_rag_data_service/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 import warnings from typing import Callable, Dict, Optional, Sequence, Tuple, Union @@ -22,8 +25,11 @@ import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from google.cloud.aiplatform_v1beta1.types import vertex_rag_data from google.cloud.aiplatform_v1beta1.types import vertex_rag_data_service @@ -33,6 +39,81 @@ from google.longrunning import operations_pb2 # type: ignore from .base import VertexRagDataServiceTransport, DEFAULT_CLIENT_INFO +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.aiplatform.v1beta1.VertexRagDataService", + "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.aiplatform.v1beta1.VertexRagDataService", + "rpcName": client_call_details.method, + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class VertexRagDataServiceGrpcTransport(VertexRagDataServiceTransport): """gRPC backend transport for VertexRagDataService. @@ -187,7 +268,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 @@ -251,7 +337,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 @@ -277,7 +365,7 @@ def create_rag_corpus( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_rag_corpus" not in self._stubs: - self._stubs["create_rag_corpus"] = self.grpc_channel.unary_unary( + self._stubs["create_rag_corpus"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.VertexRagDataService/CreateRagCorpus", request_serializer=vertex_rag_data_service.CreateRagCorpusRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -305,7 +393,7 @@ def update_rag_corpus( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_rag_corpus" not in self._stubs: - self._stubs["update_rag_corpus"] = self.grpc_channel.unary_unary( + self._stubs["update_rag_corpus"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.VertexRagDataService/UpdateRagCorpus", request_serializer=vertex_rag_data_service.UpdateRagCorpusRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -333,7 +421,7 @@ def get_rag_corpus( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_rag_corpus" not in self._stubs: - self._stubs["get_rag_corpus"] = self.grpc_channel.unary_unary( + self._stubs["get_rag_corpus"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.VertexRagDataService/GetRagCorpus", request_serializer=vertex_rag_data_service.GetRagCorpusRequest.serialize, response_deserializer=vertex_rag_data.RagCorpus.deserialize, @@ -362,7 +450,7 @@ def list_rag_corpora( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_rag_corpora" not in self._stubs: - self._stubs["list_rag_corpora"] = self.grpc_channel.unary_unary( + self._stubs["list_rag_corpora"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.VertexRagDataService/ListRagCorpora", request_serializer=vertex_rag_data_service.ListRagCorporaRequest.serialize, response_deserializer=vertex_rag_data_service.ListRagCorporaResponse.deserialize, @@ -390,7 +478,7 @@ def delete_rag_corpus( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_rag_corpus" not in self._stubs: - self._stubs["delete_rag_corpus"] = self.grpc_channel.unary_unary( + self._stubs["delete_rag_corpus"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.VertexRagDataService/DeleteRagCorpus", request_serializer=vertex_rag_data_service.DeleteRagCorpusRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -419,7 +507,7 @@ def upload_rag_file( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "upload_rag_file" not in self._stubs: - self._stubs["upload_rag_file"] = self.grpc_channel.unary_unary( + self._stubs["upload_rag_file"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.VertexRagDataService/UploadRagFile", request_serializer=vertex_rag_data_service.UploadRagFileRequest.serialize, response_deserializer=vertex_rag_data_service.UploadRagFileResponse.deserialize, @@ -448,7 +536,7 @@ def import_rag_files( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "import_rag_files" not in self._stubs: - self._stubs["import_rag_files"] = self.grpc_channel.unary_unary( + self._stubs["import_rag_files"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.VertexRagDataService/ImportRagFiles", request_serializer=vertex_rag_data_service.ImportRagFilesRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -474,7 +562,7 @@ def get_rag_file( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_rag_file" not in self._stubs: - self._stubs["get_rag_file"] = self.grpc_channel.unary_unary( + self._stubs["get_rag_file"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.VertexRagDataService/GetRagFile", request_serializer=vertex_rag_data_service.GetRagFileRequest.serialize, response_deserializer=vertex_rag_data.RagFile.deserialize, @@ -503,7 +591,7 @@ def list_rag_files( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_rag_files" not in self._stubs: - self._stubs["list_rag_files"] = self.grpc_channel.unary_unary( + self._stubs["list_rag_files"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.VertexRagDataService/ListRagFiles", request_serializer=vertex_rag_data_service.ListRagFilesRequest.serialize, response_deserializer=vertex_rag_data_service.ListRagFilesResponse.deserialize, @@ -531,7 +619,7 @@ def delete_rag_file( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_rag_file" not in self._stubs: - self._stubs["delete_rag_file"] = self.grpc_channel.unary_unary( + self._stubs["delete_rag_file"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.VertexRagDataService/DeleteRagFile", request_serializer=vertex_rag_data_service.DeleteRagFileRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -539,7 +627,7 @@ def delete_rag_file( return self._stubs["delete_rag_file"] def close(self): - self.grpc_channel.close() + self._logged_channel.close() @property def delete_operation( @@ -551,7 +639,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, @@ -568,7 +656,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -585,7 +673,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -602,7 +690,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, @@ -621,7 +709,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, @@ -640,7 +728,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -657,7 +745,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -682,7 +770,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -708,7 +796,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -737,7 +825,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1beta1/services/vertex_rag_data_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1beta1/services/vertex_rag_data_service/transports/grpc_asyncio.py index f5e90e2ed4..8464e8e2a8 100644 --- a/google/cloud/aiplatform_v1beta1/services/vertex_rag_data_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/vertex_rag_data_service/transports/grpc_asyncio.py @@ -14,6 +14,9 @@ # limitations under the License. # import inspect +import json +import pickle +import logging as std_logging import warnings from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union @@ -24,8 +27,11 @@ from google.api_core import operations_v1 from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from grpc.experimental import aio # type: ignore from google.cloud.aiplatform_v1beta1.types import vertex_rag_data @@ -37,6 +43,82 @@ from .base import VertexRagDataServiceTransport, DEFAULT_CLIENT_INFO from .grpc import VertexRagDataServiceGrpcTransport +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.aiplatform.v1beta1.VertexRagDataService", + "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.aiplatform.v1beta1.VertexRagDataService", + "rpcName": str(client_call_details.method), + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class VertexRagDataServiceGrpcAsyncIOTransport(VertexRagDataServiceTransport): """gRPC AsyncIO backend transport for VertexRagDataService. @@ -234,10 +316,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 @@ -260,7 +345,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. @@ -288,7 +373,7 @@ def create_rag_corpus( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_rag_corpus" not in self._stubs: - self._stubs["create_rag_corpus"] = self.grpc_channel.unary_unary( + self._stubs["create_rag_corpus"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.VertexRagDataService/CreateRagCorpus", request_serializer=vertex_rag_data_service.CreateRagCorpusRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -317,7 +402,7 @@ def update_rag_corpus( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "update_rag_corpus" not in self._stubs: - self._stubs["update_rag_corpus"] = self.grpc_channel.unary_unary( + self._stubs["update_rag_corpus"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.VertexRagDataService/UpdateRagCorpus", request_serializer=vertex_rag_data_service.UpdateRagCorpusRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -346,7 +431,7 @@ def get_rag_corpus( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_rag_corpus" not in self._stubs: - self._stubs["get_rag_corpus"] = self.grpc_channel.unary_unary( + self._stubs["get_rag_corpus"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.VertexRagDataService/GetRagCorpus", request_serializer=vertex_rag_data_service.GetRagCorpusRequest.serialize, response_deserializer=vertex_rag_data.RagCorpus.deserialize, @@ -375,7 +460,7 @@ def list_rag_corpora( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_rag_corpora" not in self._stubs: - self._stubs["list_rag_corpora"] = self.grpc_channel.unary_unary( + self._stubs["list_rag_corpora"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.VertexRagDataService/ListRagCorpora", request_serializer=vertex_rag_data_service.ListRagCorporaRequest.serialize, response_deserializer=vertex_rag_data_service.ListRagCorporaResponse.deserialize, @@ -404,7 +489,7 @@ def delete_rag_corpus( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_rag_corpus" not in self._stubs: - self._stubs["delete_rag_corpus"] = self.grpc_channel.unary_unary( + self._stubs["delete_rag_corpus"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.VertexRagDataService/DeleteRagCorpus", request_serializer=vertex_rag_data_service.DeleteRagCorpusRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -433,7 +518,7 @@ def upload_rag_file( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "upload_rag_file" not in self._stubs: - self._stubs["upload_rag_file"] = self.grpc_channel.unary_unary( + self._stubs["upload_rag_file"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.VertexRagDataService/UploadRagFile", request_serializer=vertex_rag_data_service.UploadRagFileRequest.serialize, response_deserializer=vertex_rag_data_service.UploadRagFileResponse.deserialize, @@ -463,7 +548,7 @@ def import_rag_files( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "import_rag_files" not in self._stubs: - self._stubs["import_rag_files"] = self.grpc_channel.unary_unary( + self._stubs["import_rag_files"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.VertexRagDataService/ImportRagFiles", request_serializer=vertex_rag_data_service.ImportRagFilesRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -491,7 +576,7 @@ def get_rag_file( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_rag_file" not in self._stubs: - self._stubs["get_rag_file"] = self.grpc_channel.unary_unary( + self._stubs["get_rag_file"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.VertexRagDataService/GetRagFile", request_serializer=vertex_rag_data_service.GetRagFileRequest.serialize, response_deserializer=vertex_rag_data.RagFile.deserialize, @@ -520,7 +605,7 @@ def list_rag_files( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_rag_files" not in self._stubs: - self._stubs["list_rag_files"] = self.grpc_channel.unary_unary( + self._stubs["list_rag_files"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.VertexRagDataService/ListRagFiles", request_serializer=vertex_rag_data_service.ListRagFilesRequest.serialize, response_deserializer=vertex_rag_data_service.ListRagFilesResponse.deserialize, @@ -549,7 +634,7 @@ def delete_rag_file( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_rag_file" not in self._stubs: - self._stubs["delete_rag_file"] = self.grpc_channel.unary_unary( + self._stubs["delete_rag_file"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.VertexRagDataService/DeleteRagFile", request_serializer=vertex_rag_data_service.DeleteRagFileRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -667,7 +752,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: @@ -683,7 +768,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, @@ -700,7 +785,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -717,7 +802,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -734,7 +819,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, @@ -753,7 +838,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, @@ -772,7 +857,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -789,7 +874,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -814,7 +899,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -840,7 +925,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -869,7 +954,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1beta1/services/vertex_rag_data_service/transports/rest.py b/google/cloud/aiplatform_v1beta1/services/vertex_rag_data_service/transports/rest.py index fc7adf4d98..7425f02077 100644 --- a/google/cloud/aiplatform_v1beta1/services/vertex_rag_data_service/transports/rest.py +++ b/google/cloud/aiplatform_v1beta1/services/vertex_rag_data_service/transports/rest.py @@ -13,9 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging +import json # type: ignore from google.auth.transport.requests import AuthorizedSession # type: ignore -import json # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.api_core import exceptions as core_exceptions from google.api_core import retry as retries @@ -48,6 +49,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, @@ -160,9 +169,10 @@ def post_upload_rag_file(self, response): def pre_create_rag_corpus( self, request: vertex_rag_data_service.CreateRagCorpusRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - vertex_rag_data_service.CreateRagCorpusRequest, Sequence[Tuple[str, str]] + vertex_rag_data_service.CreateRagCorpusRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for create_rag_corpus @@ -185,9 +195,10 @@ def post_create_rag_corpus( def pre_delete_rag_corpus( self, request: vertex_rag_data_service.DeleteRagCorpusRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - vertex_rag_data_service.DeleteRagCorpusRequest, Sequence[Tuple[str, str]] + vertex_rag_data_service.DeleteRagCorpusRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for delete_rag_corpus @@ -210,8 +221,11 @@ def post_delete_rag_corpus( def pre_delete_rag_file( self, request: vertex_rag_data_service.DeleteRagFileRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[vertex_rag_data_service.DeleteRagFileRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + vertex_rag_data_service.DeleteRagFileRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for delete_rag_file Override in a subclass to manipulate the request or metadata @@ -233,8 +247,11 @@ def post_delete_rag_file( def pre_get_rag_corpus( self, request: vertex_rag_data_service.GetRagCorpusRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[vertex_rag_data_service.GetRagCorpusRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + vertex_rag_data_service.GetRagCorpusRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for get_rag_corpus Override in a subclass to manipulate the request or metadata @@ -256,8 +273,11 @@ def post_get_rag_corpus( def pre_get_rag_file( self, request: vertex_rag_data_service.GetRagFileRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[vertex_rag_data_service.GetRagFileRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + vertex_rag_data_service.GetRagFileRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for get_rag_file Override in a subclass to manipulate the request or metadata @@ -279,9 +299,10 @@ def post_get_rag_file( def pre_import_rag_files( self, request: vertex_rag_data_service.ImportRagFilesRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - vertex_rag_data_service.ImportRagFilesRequest, Sequence[Tuple[str, str]] + vertex_rag_data_service.ImportRagFilesRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for import_rag_files @@ -304,9 +325,10 @@ def post_import_rag_files( def pre_list_rag_corpora( self, request: vertex_rag_data_service.ListRagCorporaRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - vertex_rag_data_service.ListRagCorporaRequest, Sequence[Tuple[str, str]] + vertex_rag_data_service.ListRagCorporaRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for list_rag_corpora @@ -329,8 +351,11 @@ def post_list_rag_corpora( def pre_list_rag_files( self, request: vertex_rag_data_service.ListRagFilesRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[vertex_rag_data_service.ListRagFilesRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + vertex_rag_data_service.ListRagFilesRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for list_rag_files Override in a subclass to manipulate the request or metadata @@ -352,9 +377,10 @@ def post_list_rag_files( def pre_update_rag_corpus( self, request: vertex_rag_data_service.UpdateRagCorpusRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - vertex_rag_data_service.UpdateRagCorpusRequest, Sequence[Tuple[str, str]] + vertex_rag_data_service.UpdateRagCorpusRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for update_rag_corpus @@ -377,8 +403,11 @@ def post_update_rag_corpus( def pre_upload_rag_file( self, request: vertex_rag_data_service.UploadRagFileRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[vertex_rag_data_service.UploadRagFileRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + vertex_rag_data_service.UploadRagFileRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for upload_rag_file Override in a subclass to manipulate the request or metadata @@ -400,8 +429,10 @@ def post_upload_rag_file( def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -423,8 +454,10 @@ def post_get_location( def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -446,8 +479,10 @@ def post_list_locations( def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -467,8 +502,10 @@ def post_get_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -488,8 +525,11 @@ def post_set_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -511,8 +551,10 @@ def post_test_iam_permissions( def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -532,8 +574,10 @@ def post_cancel_operation(self, response: None) -> None: 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 @@ -553,8 +597,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 @@ -576,8 +622,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 @@ -599,8 +647,10 @@ def post_list_operations( def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -1280,6 +1330,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -1496,6 +1550,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -1702,6 +1760,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}", @@ -1918,6 +1980,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, ], "google.longrunning.Operations.ListOperations": [ { @@ -2116,6 +2182,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*}/operations", @@ -2332,6 +2402,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*}/operations", + }, ], "google.longrunning.Operations.WaitOperation": [ { @@ -2530,6 +2604,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "post", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}:wait", @@ -2742,6 +2820,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, ], } @@ -2798,7 +2880,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 rag corpus method over HTTP. @@ -2809,8 +2891,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: @@ -2823,6 +2907,7 @@ def __call__( http_options = ( _BaseVertexRagDataServiceRestTransport._BaseCreateRagCorpus._get_http_options() ) + request, metadata = self._interceptor.pre_create_rag_corpus( request, metadata ) @@ -2839,6 +2924,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.aiplatform_v1beta1.VertexRagDataServiceClient.CreateRagCorpus", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagDataService", + "rpcName": "CreateRagCorpus", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = VertexRagDataServiceRestTransport._CreateRagCorpus._get_response( self._host, @@ -2858,7 +2970,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_rag_corpus(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.aiplatform_v1beta1.VertexRagDataServiceClient.create_rag_corpus", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagDataService", + "rpcName": "CreateRagCorpus", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _DeleteRagCorpus( @@ -2897,7 +3031,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 rag corpus method over HTTP. @@ -2908,8 +3042,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: @@ -2922,6 +3058,7 @@ def __call__( http_options = ( _BaseVertexRagDataServiceRestTransport._BaseDeleteRagCorpus._get_http_options() ) + request, metadata = self._interceptor.pre_delete_rag_corpus( request, metadata ) @@ -2934,6 +3071,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.aiplatform_v1beta1.VertexRagDataServiceClient.DeleteRagCorpus", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagDataService", + "rpcName": "DeleteRagCorpus", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = VertexRagDataServiceRestTransport._DeleteRagCorpus._get_response( self._host, @@ -2952,7 +3116,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_rag_corpus(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.aiplatform_v1beta1.VertexRagDataServiceClient.delete_rag_corpus", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagDataService", + "rpcName": "DeleteRagCorpus", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _DeleteRagFile( @@ -2991,7 +3177,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 rag file method over HTTP. @@ -3002,8 +3188,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: @@ -3016,6 +3204,7 @@ def __call__( http_options = ( _BaseVertexRagDataServiceRestTransport._BaseDeleteRagFile._get_http_options() ) + request, metadata = self._interceptor.pre_delete_rag_file(request, metadata) transcoded_request = _BaseVertexRagDataServiceRestTransport._BaseDeleteRagFile._get_transcoded_request( http_options, request @@ -3026,6 +3215,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.aiplatform_v1beta1.VertexRagDataServiceClient.DeleteRagFile", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagDataService", + "rpcName": "DeleteRagFile", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = VertexRagDataServiceRestTransport._DeleteRagFile._get_response( self._host, @@ -3044,7 +3260,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_rag_file(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.aiplatform_v1beta1.VertexRagDataServiceClient.delete_rag_file", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagDataService", + "rpcName": "DeleteRagFile", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _GetRagCorpus( @@ -3083,7 +3321,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]]] = (), ) -> vertex_rag_data.RagCorpus: r"""Call the get rag corpus method over HTTP. @@ -3094,8 +3332,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: ~.vertex_rag_data.RagCorpus: @@ -3108,6 +3348,7 @@ def __call__( http_options = ( _BaseVertexRagDataServiceRestTransport._BaseGetRagCorpus._get_http_options() ) + request, metadata = self._interceptor.pre_get_rag_corpus(request, metadata) transcoded_request = _BaseVertexRagDataServiceRestTransport._BaseGetRagCorpus._get_transcoded_request( http_options, request @@ -3118,6 +3359,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.aiplatform_v1beta1.VertexRagDataServiceClient.GetRagCorpus", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagDataService", + "rpcName": "GetRagCorpus", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = VertexRagDataServiceRestTransport._GetRagCorpus._get_response( self._host, @@ -3138,7 +3406,29 @@ def __call__( pb_resp = vertex_rag_data.RagCorpus.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_rag_corpus(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = vertex_rag_data.RagCorpus.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.aiplatform_v1beta1.VertexRagDataServiceClient.get_rag_corpus", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagDataService", + "rpcName": "GetRagCorpus", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _GetRagFile( @@ -3177,7 +3467,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]]] = (), ) -> vertex_rag_data.RagFile: r"""Call the get rag file method over HTTP. @@ -3188,8 +3478,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: ~.vertex_rag_data.RagFile: @@ -3201,6 +3493,7 @@ def __call__( http_options = ( _BaseVertexRagDataServiceRestTransport._BaseGetRagFile._get_http_options() ) + request, metadata = self._interceptor.pre_get_rag_file(request, metadata) transcoded_request = _BaseVertexRagDataServiceRestTransport._BaseGetRagFile._get_transcoded_request( http_options, request @@ -3211,6 +3504,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.aiplatform_v1beta1.VertexRagDataServiceClient.GetRagFile", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagDataService", + "rpcName": "GetRagFile", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = VertexRagDataServiceRestTransport._GetRagFile._get_response( self._host, @@ -3231,7 +3551,29 @@ def __call__( pb_resp = vertex_rag_data.RagFile.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_rag_file(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = vertex_rag_data.RagFile.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.aiplatform_v1beta1.VertexRagDataServiceClient.get_rag_file", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagDataService", + "rpcName": "GetRagFile", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ImportRagFiles( @@ -3271,7 +3613,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 import rag files method over HTTP. @@ -3282,8 +3624,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: @@ -3296,6 +3640,7 @@ def __call__( http_options = ( _BaseVertexRagDataServiceRestTransport._BaseImportRagFiles._get_http_options() ) + request, metadata = self._interceptor.pre_import_rag_files( request, metadata ) @@ -3312,6 +3657,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.aiplatform_v1beta1.VertexRagDataServiceClient.ImportRagFiles", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagDataService", + "rpcName": "ImportRagFiles", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = VertexRagDataServiceRestTransport._ImportRagFiles._get_response( self._host, @@ -3331,7 +3703,29 @@ def __call__( # Return the response resp = operations_pb2.Operation() json_format.Parse(response.content, resp, ignore_unknown_fields=True) + resp = self._interceptor.post_import_rag_files(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.aiplatform_v1beta1.VertexRagDataServiceClient.import_rag_files", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagDataService", + "rpcName": "ImportRagFiles", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListRagCorpora( @@ -3370,7 +3764,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]]] = (), ) -> vertex_rag_data_service.ListRagCorporaResponse: r"""Call the list rag corpora method over HTTP. @@ -3381,8 +3775,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: ~.vertex_rag_data_service.ListRagCorporaResponse: @@ -3394,6 +3790,7 @@ def __call__( http_options = ( _BaseVertexRagDataServiceRestTransport._BaseListRagCorpora._get_http_options() ) + request, metadata = self._interceptor.pre_list_rag_corpora( request, metadata ) @@ -3406,6 +3803,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.aiplatform_v1beta1.VertexRagDataServiceClient.ListRagCorpora", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagDataService", + "rpcName": "ListRagCorpora", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = VertexRagDataServiceRestTransport._ListRagCorpora._get_response( self._host, @@ -3426,7 +3850,31 @@ def __call__( pb_resp = vertex_rag_data_service.ListRagCorporaResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_rag_corpora(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + vertex_rag_data_service.ListRagCorporaResponse.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.aiplatform_v1beta1.VertexRagDataServiceClient.list_rag_corpora", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagDataService", + "rpcName": "ListRagCorpora", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListRagFiles( @@ -3465,7 +3913,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]]] = (), ) -> vertex_rag_data_service.ListRagFilesResponse: r"""Call the list rag files method over HTTP. @@ -3476,8 +3924,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: ~.vertex_rag_data_service.ListRagFilesResponse: @@ -3489,6 +3939,7 @@ def __call__( http_options = ( _BaseVertexRagDataServiceRestTransport._BaseListRagFiles._get_http_options() ) + request, metadata = self._interceptor.pre_list_rag_files(request, metadata) transcoded_request = _BaseVertexRagDataServiceRestTransport._BaseListRagFiles._get_transcoded_request( http_options, request @@ -3499,6 +3950,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.aiplatform_v1beta1.VertexRagDataServiceClient.ListRagFiles", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagDataService", + "rpcName": "ListRagFiles", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = VertexRagDataServiceRestTransport._ListRagFiles._get_response( self._host, @@ -3519,7 +3997,31 @@ def __call__( pb_resp = vertex_rag_data_service.ListRagFilesResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_rag_files(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + vertex_rag_data_service.ListRagFilesResponse.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.aiplatform_v1beta1.VertexRagDataServiceClient.list_rag_files", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagDataService", + "rpcName": "ListRagFiles", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _UpdateRagCorpus( @@ -3559,7 +4061,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 rag corpus method over HTTP. @@ -3570,8 +4072,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: @@ -3584,6 +4088,7 @@ def __call__( http_options = ( _BaseVertexRagDataServiceRestTransport._BaseUpdateRagCorpus._get_http_options() ) + request, metadata = self._interceptor.pre_update_rag_corpus( request, metadata ) @@ -3600,6 +4105,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.aiplatform_v1beta1.VertexRagDataServiceClient.UpdateRagCorpus", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagDataService", + "rpcName": "UpdateRagCorpus", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = VertexRagDataServiceRestTransport._UpdateRagCorpus._get_response( self._host, @@ -3619,7 +4151,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_rag_corpus(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.aiplatform_v1beta1.VertexRagDataServiceClient.update_rag_corpus", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagDataService", + "rpcName": "UpdateRagCorpus", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _UploadRagFile( @@ -3659,7 +4213,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]]] = (), ) -> vertex_rag_data_service.UploadRagFileResponse: r"""Call the upload rag file method over HTTP. @@ -3670,8 +4224,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: ~.vertex_rag_data_service.UploadRagFileResponse: @@ -3683,6 +4239,7 @@ def __call__( http_options = ( _BaseVertexRagDataServiceRestTransport._BaseUploadRagFile._get_http_options() ) + request, metadata = self._interceptor.pre_upload_rag_file(request, metadata) transcoded_request = _BaseVertexRagDataServiceRestTransport._BaseUploadRagFile._get_transcoded_request( http_options, request @@ -3697,6 +4254,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.aiplatform_v1beta1.VertexRagDataServiceClient.UploadRagFile", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagDataService", + "rpcName": "UploadRagFile", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = VertexRagDataServiceRestTransport._UploadRagFile._get_response( self._host, @@ -3718,7 +4302,31 @@ def __call__( pb_resp = vertex_rag_data_service.UploadRagFileResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_upload_rag_file(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + vertex_rag_data_service.UploadRagFileResponse.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.aiplatform_v1beta1.VertexRagDataServiceClient.upload_rag_file", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagDataService", + "rpcName": "UploadRagFile", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp @property @@ -3862,7 +4470,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]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -3873,8 +4481,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: locations_pb2.Location: Response from GetLocation method. @@ -3883,6 +4493,7 @@ def __call__( http_options = ( _BaseVertexRagDataServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = self._interceptor.pre_get_location(request, metadata) transcoded_request = _BaseVertexRagDataServiceRestTransport._BaseGetLocation._get_transcoded_request( http_options, request @@ -3893,6 +4504,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.aiplatform_v1beta1.VertexRagDataServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagDataService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = VertexRagDataServiceRestTransport._GetLocation._get_response( self._host, @@ -3912,6 +4550,27 @@ def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_location(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.aiplatform_v1beta1.VertexRagDataServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagDataService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -3954,7 +4613,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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -3965,8 +4624,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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -3975,6 +4636,7 @@ def __call__( http_options = ( _BaseVertexRagDataServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = self._interceptor.pre_list_locations(request, metadata) transcoded_request = _BaseVertexRagDataServiceRestTransport._BaseListLocations._get_transcoded_request( http_options, request @@ -3985,6 +4647,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.aiplatform_v1beta1.VertexRagDataServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagDataService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = VertexRagDataServiceRestTransport._ListLocations._get_response( self._host, @@ -4004,6 +4693,27 @@ def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_list_locations(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.aiplatform_v1beta1.VertexRagDataServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagDataService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4047,7 +4757,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]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -4058,8 +4768,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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -4068,6 +4780,7 @@ def __call__( http_options = ( _BaseVertexRagDataServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_get_iam_policy(request, metadata) transcoded_request = _BaseVertexRagDataServiceRestTransport._BaseGetIamPolicy._get_transcoded_request( http_options, request @@ -4082,6 +4795,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.aiplatform_v1beta1.VertexRagDataServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagDataService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = VertexRagDataServiceRestTransport._GetIamPolicy._get_response( self._host, @@ -4102,6 +4842,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_iam_policy(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.aiplatform_v1beta1.VertexRagDataServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagDataService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4145,7 +4906,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]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -4156,8 +4917,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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -4166,6 +4929,7 @@ def __call__( http_options = ( _BaseVertexRagDataServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_set_iam_policy(request, metadata) transcoded_request = _BaseVertexRagDataServiceRestTransport._BaseSetIamPolicy._get_transcoded_request( http_options, request @@ -4180,6 +4944,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.aiplatform_v1beta1.VertexRagDataServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagDataService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = VertexRagDataServiceRestTransport._SetIamPolicy._get_response( self._host, @@ -4200,6 +4991,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_set_iam_policy(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.aiplatform_v1beta1.VertexRagDataServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagDataService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4243,7 +5055,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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -4254,8 +5066,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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -4264,6 +5078,7 @@ def __call__( http_options = ( _BaseVertexRagDataServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -4280,6 +5095,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.aiplatform_v1beta1.VertexRagDataServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagDataService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( VertexRagDataServiceRestTransport._TestIamPermissions._get_response( @@ -4302,6 +5144,27 @@ def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_test_iam_permissions(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.aiplatform_v1beta1.VertexRagDataServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagDataService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4344,7 +5207,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 cancel operation method over HTTP. @@ -4355,13 +5218,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 = ( _BaseVertexRagDataServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = self._interceptor.pre_cancel_operation( request, metadata ) @@ -4374,6 +5240,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.aiplatform_v1beta1.VertexRagDataServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagDataService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = VertexRagDataServiceRestTransport._CancelOperation._get_response( self._host, @@ -4431,7 +5324,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. @@ -4442,13 +5335,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 = ( _BaseVertexRagDataServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = self._interceptor.pre_delete_operation( request, metadata ) @@ -4461,6 +5357,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.aiplatform_v1beta1.VertexRagDataServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagDataService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = VertexRagDataServiceRestTransport._DeleteOperation._get_response( self._host, @@ -4518,7 +5441,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. @@ -4529,8 +5452,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. @@ -4539,6 +5464,7 @@ def __call__( http_options = ( _BaseVertexRagDataServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = self._interceptor.pre_get_operation(request, metadata) transcoded_request = _BaseVertexRagDataServiceRestTransport._BaseGetOperation._get_transcoded_request( http_options, request @@ -4549,6 +5475,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.aiplatform_v1beta1.VertexRagDataServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagDataService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = VertexRagDataServiceRestTransport._GetOperation._get_response( self._host, @@ -4568,6 +5521,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.aiplatform_v1beta1.VertexRagDataServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagDataService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4610,7 +5584,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. @@ -4621,8 +5595,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. @@ -4631,6 +5607,7 @@ def __call__( http_options = ( _BaseVertexRagDataServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = self._interceptor.pre_list_operations(request, metadata) transcoded_request = _BaseVertexRagDataServiceRestTransport._BaseListOperations._get_transcoded_request( http_options, request @@ -4641,6 +5618,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.aiplatform_v1beta1.VertexRagDataServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagDataService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = VertexRagDataServiceRestTransport._ListOperations._get_response( self._host, @@ -4660,6 +5664,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.aiplatform_v1beta1.VertexRagDataServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagDataService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4702,7 +5727,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 wait operation method over HTTP. @@ -4713,8 +5738,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 WaitOperation method. @@ -4723,6 +5750,7 @@ def __call__( http_options = ( _BaseVertexRagDataServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = self._interceptor.pre_wait_operation(request, metadata) transcoded_request = _BaseVertexRagDataServiceRestTransport._BaseWaitOperation._get_transcoded_request( http_options, request @@ -4733,6 +5761,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.aiplatform_v1beta1.VertexRagDataServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagDataService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = VertexRagDataServiceRestTransport._WaitOperation._get_response( self._host, @@ -4752,6 +5807,27 @@ def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = self._interceptor.post_wait_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.aiplatform_v1beta1.VertexRagDataServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagDataService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1beta1/services/vertex_rag_data_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1beta1/services/vertex_rag_data_service/transports/rest_asyncio.py index bb00bc4211..c4702b6d4e 100644 --- a/google/cloud/aiplatform_v1beta1/services/vertex_rag_data_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/vertex_rag_data_service/transports/rest_asyncio.py @@ -59,6 +59,18 @@ from .base import DEFAULT_CLIENT_INFO as BASE_DEFAULT_CLIENT_INFO + +import logging + +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__) + try: OptionalRetry = Union[retries.AsyncRetry, gapic_v1.method._MethodDefault, None] except AttributeError: # pragma: NO COVER @@ -175,9 +187,10 @@ async def post_upload_rag_file(self, response): async def pre_create_rag_corpus( self, request: vertex_rag_data_service.CreateRagCorpusRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - vertex_rag_data_service.CreateRagCorpusRequest, Sequence[Tuple[str, str]] + vertex_rag_data_service.CreateRagCorpusRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for create_rag_corpus @@ -200,9 +213,10 @@ async def post_create_rag_corpus( async def pre_delete_rag_corpus( self, request: vertex_rag_data_service.DeleteRagCorpusRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - vertex_rag_data_service.DeleteRagCorpusRequest, Sequence[Tuple[str, str]] + vertex_rag_data_service.DeleteRagCorpusRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for delete_rag_corpus @@ -225,8 +239,11 @@ async def post_delete_rag_corpus( async def pre_delete_rag_file( self, request: vertex_rag_data_service.DeleteRagFileRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[vertex_rag_data_service.DeleteRagFileRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + vertex_rag_data_service.DeleteRagFileRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for delete_rag_file Override in a subclass to manipulate the request or metadata @@ -248,8 +265,11 @@ async def post_delete_rag_file( async def pre_get_rag_corpus( self, request: vertex_rag_data_service.GetRagCorpusRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[vertex_rag_data_service.GetRagCorpusRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + vertex_rag_data_service.GetRagCorpusRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for get_rag_corpus Override in a subclass to manipulate the request or metadata @@ -271,8 +291,11 @@ async def post_get_rag_corpus( async def pre_get_rag_file( self, request: vertex_rag_data_service.GetRagFileRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[vertex_rag_data_service.GetRagFileRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + vertex_rag_data_service.GetRagFileRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for get_rag_file Override in a subclass to manipulate the request or metadata @@ -294,9 +317,10 @@ async def post_get_rag_file( async def pre_import_rag_files( self, request: vertex_rag_data_service.ImportRagFilesRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - vertex_rag_data_service.ImportRagFilesRequest, Sequence[Tuple[str, str]] + vertex_rag_data_service.ImportRagFilesRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for import_rag_files @@ -319,9 +343,10 @@ async def post_import_rag_files( async def pre_list_rag_corpora( self, request: vertex_rag_data_service.ListRagCorporaRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - vertex_rag_data_service.ListRagCorporaRequest, Sequence[Tuple[str, str]] + vertex_rag_data_service.ListRagCorporaRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for list_rag_corpora @@ -344,8 +369,11 @@ async def post_list_rag_corpora( async def pre_list_rag_files( self, request: vertex_rag_data_service.ListRagFilesRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[vertex_rag_data_service.ListRagFilesRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + vertex_rag_data_service.ListRagFilesRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for list_rag_files Override in a subclass to manipulate the request or metadata @@ -367,9 +395,10 @@ async def post_list_rag_files( async def pre_update_rag_corpus( self, request: vertex_rag_data_service.UpdateRagCorpusRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - vertex_rag_data_service.UpdateRagCorpusRequest, Sequence[Tuple[str, str]] + vertex_rag_data_service.UpdateRagCorpusRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for update_rag_corpus @@ -392,8 +421,11 @@ async def post_update_rag_corpus( async def pre_upload_rag_file( self, request: vertex_rag_data_service.UploadRagFileRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[vertex_rag_data_service.UploadRagFileRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + vertex_rag_data_service.UploadRagFileRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for upload_rag_file Override in a subclass to manipulate the request or metadata @@ -415,8 +447,10 @@ async def post_upload_rag_file( async def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -438,8 +472,10 @@ async def post_get_location( async def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -461,8 +497,10 @@ async def post_list_locations( async def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -484,8 +522,10 @@ async def post_get_iam_policy( async def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -507,8 +547,11 @@ async def post_set_iam_policy( async def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -530,8 +573,10 @@ async def post_test_iam_permissions( async def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -551,8 +596,10 @@ async def post_cancel_operation(self, response: None) -> None: async 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 @@ -572,8 +619,10 @@ async def post_delete_operation(self, response: None) -> None: async 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 @@ -595,8 +644,10 @@ async def post_get_operation( async 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 @@ -618,8 +669,10 @@ async def post_list_operations( async def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -850,7 +903,7 @@ async 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 rag corpus method over HTTP. @@ -861,8 +914,10 @@ async def __call__( 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: @@ -875,6 +930,7 @@ async def __call__( http_options = ( _BaseVertexRagDataServiceRestTransport._BaseCreateRagCorpus._get_http_options() ) + request, metadata = await self._interceptor.pre_create_rag_corpus( request, metadata ) @@ -891,6 +947,33 @@ async 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.aiplatform_v1beta1.VertexRagDataServiceClient.CreateRagCorpus", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagDataService", + "rpcName": "CreateRagCorpus", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncVertexRagDataServiceRestTransport._CreateRagCorpus._get_response( self._host, @@ -919,6 +1002,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_create_rag_corpus(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.VertexRagDataServiceAsyncClient.create_rag_corpus", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagDataService", + "rpcName": "CreateRagCorpus", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _DeleteRagCorpus( @@ -957,7 +1062,7 @@ async 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 rag corpus method over HTTP. @@ -968,8 +1073,10 @@ async def __call__( 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: @@ -982,6 +1089,7 @@ async def __call__( http_options = ( _BaseVertexRagDataServiceRestTransport._BaseDeleteRagCorpus._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_rag_corpus( request, metadata ) @@ -994,6 +1102,33 @@ async 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.aiplatform_v1beta1.VertexRagDataServiceClient.DeleteRagCorpus", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagDataService", + "rpcName": "DeleteRagCorpus", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncVertexRagDataServiceRestTransport._DeleteRagCorpus._get_response( self._host, @@ -1021,6 +1156,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_delete_rag_corpus(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.VertexRagDataServiceAsyncClient.delete_rag_corpus", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagDataService", + "rpcName": "DeleteRagCorpus", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _DeleteRagFile( @@ -1059,7 +1216,7 @@ async 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 rag file method over HTTP. @@ -1070,8 +1227,10 @@ async def __call__( 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: @@ -1084,6 +1243,7 @@ async def __call__( http_options = ( _BaseVertexRagDataServiceRestTransport._BaseDeleteRagFile._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_rag_file( request, metadata ) @@ -1096,6 +1256,33 @@ async 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.aiplatform_v1beta1.VertexRagDataServiceClient.DeleteRagFile", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagDataService", + "rpcName": "DeleteRagFile", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncVertexRagDataServiceRestTransport._DeleteRagFile._get_response( self._host, @@ -1123,6 +1310,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_delete_rag_file(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.VertexRagDataServiceAsyncClient.delete_rag_file", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagDataService", + "rpcName": "DeleteRagFile", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _GetRagCorpus( @@ -1161,7 +1370,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> vertex_rag_data.RagCorpus: r"""Call the get rag corpus method over HTTP. @@ -1172,8 +1381,10 @@ async def __call__( 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: ~.vertex_rag_data.RagCorpus: @@ -1186,6 +1397,7 @@ async def __call__( http_options = ( _BaseVertexRagDataServiceRestTransport._BaseGetRagCorpus._get_http_options() ) + request, metadata = await self._interceptor.pre_get_rag_corpus( request, metadata ) @@ -1198,6 +1410,33 @@ async 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.aiplatform_v1beta1.VertexRagDataServiceClient.GetRagCorpus", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagDataService", + "rpcName": "GetRagCorpus", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncVertexRagDataServiceRestTransport._GetRagCorpus._get_response( self._host, @@ -1225,6 +1464,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_get_rag_corpus(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = vertex_rag_data.RagCorpus.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.VertexRagDataServiceAsyncClient.get_rag_corpus", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagDataService", + "rpcName": "GetRagCorpus", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _GetRagFile( @@ -1263,7 +1524,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> vertex_rag_data.RagFile: r"""Call the get rag file method over HTTP. @@ -1274,8 +1535,10 @@ async def __call__( 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: ~.vertex_rag_data.RagFile: @@ -1287,6 +1550,7 @@ async def __call__( http_options = ( _BaseVertexRagDataServiceRestTransport._BaseGetRagFile._get_http_options() ) + request, metadata = await self._interceptor.pre_get_rag_file( request, metadata ) @@ -1299,6 +1563,33 @@ async 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.aiplatform_v1beta1.VertexRagDataServiceClient.GetRagFile", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagDataService", + "rpcName": "GetRagFile", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncVertexRagDataServiceRestTransport._GetRagFile._get_response( @@ -1328,6 +1619,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_get_rag_file(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = vertex_rag_data.RagFile.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.VertexRagDataServiceAsyncClient.get_rag_file", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagDataService", + "rpcName": "GetRagFile", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ImportRagFiles( @@ -1367,7 +1680,7 @@ async 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 import rag files method over HTTP. @@ -1378,8 +1691,10 @@ async def __call__( 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: @@ -1392,6 +1707,7 @@ async def __call__( http_options = ( _BaseVertexRagDataServiceRestTransport._BaseImportRagFiles._get_http_options() ) + request, metadata = await self._interceptor.pre_import_rag_files( request, metadata ) @@ -1408,6 +1724,33 @@ async 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.aiplatform_v1beta1.VertexRagDataServiceClient.ImportRagFiles", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagDataService", + "rpcName": "ImportRagFiles", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncVertexRagDataServiceRestTransport._ImportRagFiles._get_response( self._host, @@ -1436,6 +1779,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_import_rag_files(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.VertexRagDataServiceAsyncClient.import_rag_files", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagDataService", + "rpcName": "ImportRagFiles", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ListRagCorpora( @@ -1474,7 +1839,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> vertex_rag_data_service.ListRagCorporaResponse: r"""Call the list rag corpora method over HTTP. @@ -1485,8 +1850,10 @@ async def __call__( 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: ~.vertex_rag_data_service.ListRagCorporaResponse: @@ -1498,6 +1865,7 @@ async def __call__( http_options = ( _BaseVertexRagDataServiceRestTransport._BaseListRagCorpora._get_http_options() ) + request, metadata = await self._interceptor.pre_list_rag_corpora( request, metadata ) @@ -1510,6 +1878,33 @@ async 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.aiplatform_v1beta1.VertexRagDataServiceClient.ListRagCorpora", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagDataService", + "rpcName": "ListRagCorpora", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncVertexRagDataServiceRestTransport._ListRagCorpora._get_response( self._host, @@ -1537,6 +1932,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_list_rag_corpora(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + vertex_rag_data_service.ListRagCorporaResponse.to_json(response) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.VertexRagDataServiceAsyncClient.list_rag_corpora", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagDataService", + "rpcName": "ListRagCorpora", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ListRagFiles( @@ -1575,7 +1994,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> vertex_rag_data_service.ListRagFilesResponse: r"""Call the list rag files method over HTTP. @@ -1586,8 +2005,10 @@ async def __call__( 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: ~.vertex_rag_data_service.ListRagFilesResponse: @@ -1599,6 +2020,7 @@ async def __call__( http_options = ( _BaseVertexRagDataServiceRestTransport._BaseListRagFiles._get_http_options() ) + request, metadata = await self._interceptor.pre_list_rag_files( request, metadata ) @@ -1611,6 +2033,33 @@ async 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.aiplatform_v1beta1.VertexRagDataServiceClient.ListRagFiles", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagDataService", + "rpcName": "ListRagFiles", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncVertexRagDataServiceRestTransport._ListRagFiles._get_response( self._host, @@ -1638,6 +2087,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_list_rag_files(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + vertex_rag_data_service.ListRagFilesResponse.to_json(response) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.VertexRagDataServiceAsyncClient.list_rag_files", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagDataService", + "rpcName": "ListRagFiles", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _UpdateRagCorpus( @@ -1677,7 +2150,7 @@ async 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 rag corpus method over HTTP. @@ -1688,8 +2161,10 @@ async def __call__( 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: @@ -1702,6 +2177,7 @@ async def __call__( http_options = ( _BaseVertexRagDataServiceRestTransport._BaseUpdateRagCorpus._get_http_options() ) + request, metadata = await self._interceptor.pre_update_rag_corpus( request, metadata ) @@ -1718,6 +2194,33 @@ async 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.aiplatform_v1beta1.VertexRagDataServiceClient.UpdateRagCorpus", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagDataService", + "rpcName": "UpdateRagCorpus", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncVertexRagDataServiceRestTransport._UpdateRagCorpus._get_response( self._host, @@ -1746,6 +2249,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_update_rag_corpus(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.VertexRagDataServiceAsyncClient.update_rag_corpus", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagDataService", + "rpcName": "UpdateRagCorpus", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _UploadRagFile( @@ -1785,7 +2310,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> vertex_rag_data_service.UploadRagFileResponse: r"""Call the upload rag file method over HTTP. @@ -1796,8 +2321,10 @@ async def __call__( 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: ~.vertex_rag_data_service.UploadRagFileResponse: @@ -1809,6 +2336,7 @@ async def __call__( http_options = ( _BaseVertexRagDataServiceRestTransport._BaseUploadRagFile._get_http_options() ) + request, metadata = await self._interceptor.pre_upload_rag_file( request, metadata ) @@ -1825,6 +2353,33 @@ async 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.aiplatform_v1beta1.VertexRagDataServiceClient.UploadRagFile", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagDataService", + "rpcName": "UploadRagFile", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncVertexRagDataServiceRestTransport._UploadRagFile._get_response( self._host, @@ -1853,6 +2408,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_upload_rag_file(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + vertex_rag_data_service.UploadRagFileResponse.to_json(response) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.VertexRagDataServiceAsyncClient.upload_rag_file", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagDataService", + "rpcName": "UploadRagFile", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp @property @@ -2428,6 +3007,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -2644,6 +3227,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -2850,6 +3437,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}", @@ -3066,6 +3657,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, ], "google.longrunning.Operations.ListOperations": [ { @@ -3264,6 +3859,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*}/operations", @@ -3480,6 +4079,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*}/operations", + }, ], "google.longrunning.Operations.WaitOperation": [ { @@ -3678,6 +4281,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "post", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}:wait", @@ -3890,6 +4497,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, ], } @@ -4029,7 +4640,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -4040,8 +4651,10 @@ async def __call__( 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: locations_pb2.Location: Response from GetLocation method. @@ -4050,6 +4663,7 @@ async def __call__( http_options = ( _BaseVertexRagDataServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_location( request, metadata ) @@ -4062,6 +4676,33 @@ async 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.aiplatform_v1beta1.VertexRagDataServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagDataService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncVertexRagDataServiceRestTransport._GetLocation._get_response( @@ -4089,6 +4730,27 @@ async def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_location(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.aiplatform_v1beta1.VertexRagDataServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagDataService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4131,7 +4793,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -4142,8 +4804,10 @@ async def __call__( 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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -4152,6 +4816,7 @@ async def __call__( http_options = ( _BaseVertexRagDataServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_locations( request, metadata ) @@ -4164,6 +4829,33 @@ async 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.aiplatform_v1beta1.VertexRagDataServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagDataService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncVertexRagDataServiceRestTransport._ListLocations._get_response( self._host, @@ -4189,6 +4881,27 @@ async def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_list_locations(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.aiplatform_v1beta1.VertexRagDataServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagDataService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4232,7 +4945,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -4243,8 +4956,10 @@ async def __call__( 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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -4253,6 +4968,7 @@ async def __call__( http_options = ( _BaseVertexRagDataServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_get_iam_policy( request, metadata ) @@ -4269,6 +4985,33 @@ async 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.aiplatform_v1beta1.VertexRagDataServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagDataService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncVertexRagDataServiceRestTransport._GetIamPolicy._get_response( self._host, @@ -4295,6 +5038,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_iam_policy(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.aiplatform_v1beta1.VertexRagDataServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagDataService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4338,7 +5102,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -4349,8 +5113,10 @@ async def __call__( 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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -4359,6 +5125,7 @@ async def __call__( http_options = ( _BaseVertexRagDataServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_set_iam_policy( request, metadata ) @@ -4375,6 +5142,33 @@ async 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.aiplatform_v1beta1.VertexRagDataServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagDataService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncVertexRagDataServiceRestTransport._SetIamPolicy._get_response( self._host, @@ -4401,6 +5195,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_set_iam_policy(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.aiplatform_v1beta1.VertexRagDataServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagDataService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4444,7 +5259,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -4455,8 +5270,10 @@ async def __call__( 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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -4465,6 +5282,7 @@ async def __call__( http_options = ( _BaseVertexRagDataServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = await self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -4481,6 +5299,33 @@ async 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.aiplatform_v1beta1.VertexRagDataServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagDataService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncVertexRagDataServiceRestTransport._TestIamPermissions._get_response( self._host, @@ -4507,6 +5352,27 @@ async def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_test_iam_permissions(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.aiplatform_v1beta1.VertexRagDataServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagDataService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4549,7 +5415,7 @@ async 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 cancel operation method over HTTP. @@ -4560,13 +5426,16 @@ async def __call__( 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`. """ http_options = ( _BaseVertexRagDataServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_cancel_operation( request, metadata ) @@ -4579,6 +5448,33 @@ async 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.aiplatform_v1beta1.VertexRagDataServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagDataService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncVertexRagDataServiceRestTransport._CancelOperation._get_response( self._host, @@ -4642,7 +5538,7 @@ async 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. @@ -4653,13 +5549,16 @@ async def __call__( 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`. """ http_options = ( _BaseVertexRagDataServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_operation( request, metadata ) @@ -4672,6 +5571,33 @@ async 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.aiplatform_v1beta1.VertexRagDataServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagDataService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncVertexRagDataServiceRestTransport._DeleteOperation._get_response( self._host, @@ -4735,7 +5661,7 @@ async 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. @@ -4746,8 +5672,10 @@ async def __call__( 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: Response from GetOperation method. @@ -4756,6 +5684,7 @@ async def __call__( http_options = ( _BaseVertexRagDataServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_operation( request, metadata ) @@ -4768,6 +5697,33 @@ async 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.aiplatform_v1beta1.VertexRagDataServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagDataService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncVertexRagDataServiceRestTransport._GetOperation._get_response( self._host, @@ -4793,6 +5749,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1beta1.VertexRagDataServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagDataService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4835,7 +5812,7 @@ async 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. @@ -4846,8 +5823,10 @@ async def __call__( 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 from ListOperations method. @@ -4856,6 +5835,7 @@ async def __call__( http_options = ( _BaseVertexRagDataServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_operations( request, metadata ) @@ -4868,6 +5848,33 @@ async 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.aiplatform_v1beta1.VertexRagDataServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagDataService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncVertexRagDataServiceRestTransport._ListOperations._get_response( self._host, @@ -4893,6 +5900,27 @@ async def __call__( resp = operations_pb2.ListOperationsResponse() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1beta1.VertexRagDataServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagDataService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4935,7 +5963,7 @@ async 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 wait operation method over HTTP. @@ -4946,8 +5974,10 @@ async def __call__( 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: Response from WaitOperation method. @@ -4956,6 +5986,7 @@ async def __call__( http_options = ( _BaseVertexRagDataServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_wait_operation( request, metadata ) @@ -4968,6 +5999,33 @@ async 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.aiplatform_v1beta1.VertexRagDataServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagDataService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncVertexRagDataServiceRestTransport._WaitOperation._get_response( self._host, @@ -4993,6 +6051,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_wait_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.aiplatform_v1beta1.VertexRagDataServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagDataService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1beta1/services/vertex_rag_data_service/transports/rest_base.py b/google/cloud/aiplatform_v1beta1/services/vertex_rag_data_service/transports/rest_base.py index b108e21393..6a273582ef 100644 --- a/google/cloud/aiplatform_v1beta1/services/vertex_rag_data_service/transports/rest_base.py +++ b/google/cloud/aiplatform_v1beta1/services/vertex_rag_data_service/transports/rest_base.py @@ -1520,6 +1520,10 @@ def _get_http_options(): "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -1736,6 +1740,10 @@ def _get_http_options(): "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -1961,6 +1969,10 @@ def _get_http_options(): "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}", @@ -2177,6 +2189,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, ] return http_options @@ -2394,6 +2410,10 @@ def _get_http_options(): "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*}/operations", @@ -2610,6 +2630,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*}/operations", + }, ] return http_options @@ -2827,6 +2851,10 @@ def _get_http_options(): "method": "post", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}:wait", @@ -3039,6 +3067,10 @@ def _get_http_options(): "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, ] return http_options diff --git a/google/cloud/aiplatform_v1beta1/services/vertex_rag_service/async_client.py b/google/cloud/aiplatform_v1beta1/services/vertex_rag_service/async_client.py index 71217e1078..cfd5f38b88 100644 --- a/google/cloud/aiplatform_v1beta1/services/vertex_rag_service/async_client.py +++ b/google/cloud/aiplatform_v1beta1/services/vertex_rag_service/async_client.py @@ -13,6 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging as std_logging from collections import OrderedDict import re from typing import ( @@ -55,6 +56,15 @@ from .transports.grpc_asyncio import VertexRagServiceGrpcAsyncIOTransport from .client import VertexRagServiceClient +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 VertexRagServiceAsyncClient: """A service for retrieving relevant contexts.""" @@ -262,6 +272,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.aiplatform_v1beta1.VertexRagServiceAsyncClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagService", + "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.aiplatform.v1beta1.VertexRagService", + "credentialsType": None, + }, + ) + async def retrieve_contexts( self, request: Optional[ @@ -272,7 +304,7 @@ async def retrieve_contexts( query: Optional[vertex_rag_service.RagQuery] = 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]]] = (), ) -> vertex_rag_service.RetrieveContextsResponse: r"""Retrieves relevant contexts for a query. @@ -327,8 +359,10 @@ async def sample_retrieve_contexts(): 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.aiplatform_v1beta1.types.RetrieveContextsResponse: @@ -393,7 +427,7 @@ async def augment_prompt( vertex_rag_store: Optional[tool.VertexRagStore] = 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]]] = (), ) -> vertex_rag_service.AugmentPromptResponse: r"""Given an input prompt, it returns augmented prompt from vertex rag store to guide LLM towards generating @@ -454,8 +488,10 @@ async def sample_augment_prompt(): 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.aiplatform_v1beta1.types.AugmentPromptResponse: @@ -522,7 +558,7 @@ async def corroborate_content( facts: Optional[MutableSequence[vertex_rag_service.Fact]] = 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]]] = (), ) -> vertex_rag_service.CorroborateContentResponse: r"""Given an input text, it returns a score that evaluates the factuality of the text. It also extracts @@ -587,8 +623,10 @@ async def sample_corroborate_content(): 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.aiplatform_v1beta1.types.CorroborateContentResponse: @@ -652,7 +690,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. @@ -663,8 +701,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. @@ -705,7 +745,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. @@ -716,8 +756,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. @@ -758,7 +800,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. @@ -774,8 +816,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 """ @@ -812,7 +856,7 @@ async def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -827,8 +871,10 @@ async def cancel_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 """ @@ -865,7 +911,7 @@ async def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -882,8 +928,10 @@ async def wait_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. @@ -924,7 +972,7 @@ async def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -937,8 +985,10 @@ async def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -1043,7 +1093,7 @@ async def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -1057,8 +1107,10 @@ async def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -1163,7 +1215,7 @@ async def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -1178,8 +1230,10 @@ async def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -1223,7 +1277,7 @@ async def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -1234,8 +1288,10 @@ async def get_location( 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: ~.location_pb2.Location: Location object. @@ -1276,7 +1332,7 @@ async def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -1287,8 +1343,10 @@ async def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1beta1/services/vertex_rag_service/client.py b/google/cloud/aiplatform_v1beta1/services/vertex_rag_service/client.py index f743319e95..25fc1040ef 100644 --- a/google/cloud/aiplatform_v1beta1/services/vertex_rag_service/client.py +++ b/google/cloud/aiplatform_v1beta1/services/vertex_rag_service/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 ( @@ -48,6 +49,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.cloud.aiplatform_v1beta1.types import content from google.cloud.aiplatform_v1beta1.types import content as gca_content from google.cloud.aiplatform_v1beta1.types import tool @@ -599,6 +609,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( @@ -690,6 +704,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.aiplatform_v1beta1.VertexRagServiceClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagService", + "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.aiplatform.v1beta1.VertexRagService", + "credentialsType": None, + }, + ) + def retrieve_contexts( self, request: Optional[ @@ -700,7 +737,7 @@ def retrieve_contexts( query: Optional[vertex_rag_service.RagQuery] = 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]]] = (), ) -> vertex_rag_service.RetrieveContextsResponse: r"""Retrieves relevant contexts for a query. @@ -755,8 +792,10 @@ def sample_retrieve_contexts(): 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.aiplatform_v1beta1.types.RetrieveContextsResponse: @@ -818,7 +857,7 @@ def augment_prompt( vertex_rag_store: Optional[tool.VertexRagStore] = 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]]] = (), ) -> vertex_rag_service.AugmentPromptResponse: r"""Given an input prompt, it returns augmented prompt from vertex rag store to guide LLM towards generating @@ -879,8 +918,10 @@ def sample_augment_prompt(): 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.aiplatform_v1beta1.types.AugmentPromptResponse: @@ -944,7 +985,7 @@ def corroborate_content( facts: Optional[MutableSequence[vertex_rag_service.Fact]] = 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]]] = (), ) -> vertex_rag_service.CorroborateContentResponse: r"""Given an input text, it returns a score that evaluates the factuality of the text. It also extracts @@ -1009,8 +1050,10 @@ def sample_corroborate_content(): 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.aiplatform_v1beta1.types.CorroborateContentResponse: @@ -1084,7 +1127,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. @@ -1095,8 +1138,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. @@ -1137,7 +1182,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. @@ -1148,8 +1193,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. @@ -1190,7 +1237,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. @@ -1206,8 +1253,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 """ @@ -1244,7 +1293,7 @@ def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -1259,8 +1308,10 @@ def cancel_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 """ @@ -1297,7 +1348,7 @@ def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -1314,8 +1365,10 @@ def wait_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. @@ -1356,7 +1409,7 @@ def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -1369,8 +1422,10 @@ def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -1475,7 +1530,7 @@ def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -1489,8 +1544,10 @@ def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -1595,7 +1652,7 @@ def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -1610,8 +1667,10 @@ def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -1653,7 +1712,7 @@ def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -1664,8 +1723,10 @@ def get_location( 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: ~.location_pb2.Location: Location object. @@ -1706,7 +1767,7 @@ def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -1717,8 +1778,10 @@ def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1beta1/services/vertex_rag_service/transports/grpc.py b/google/cloud/aiplatform_v1beta1/services/vertex_rag_service/transports/grpc.py index 1019b6fbee..5ee9b22538 100644 --- a/google/cloud/aiplatform_v1beta1/services/vertex_rag_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1beta1/services/vertex_rag_service/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 import warnings from typing import Callable, Dict, Optional, Sequence, Tuple, Union @@ -21,8 +24,11 @@ import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from google.cloud.aiplatform_v1beta1.types import vertex_rag_service from google.cloud.location import locations_pb2 # type: ignore @@ -31,6 +37,81 @@ from google.longrunning import operations_pb2 # type: ignore from .base import VertexRagServiceTransport, DEFAULT_CLIENT_INFO +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.aiplatform.v1beta1.VertexRagService", + "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.aiplatform.v1beta1.VertexRagService", + "rpcName": client_call_details.method, + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class VertexRagServiceGrpcTransport(VertexRagServiceTransport): """gRPC backend transport for VertexRagService. @@ -184,7 +265,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 @@ -261,7 +347,7 @@ def retrieve_contexts( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "retrieve_contexts" not in self._stubs: - self._stubs["retrieve_contexts"] = self.grpc_channel.unary_unary( + self._stubs["retrieve_contexts"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.VertexRagService/RetrieveContexts", request_serializer=vertex_rag_service.RetrieveContextsRequest.serialize, response_deserializer=vertex_rag_service.RetrieveContextsResponse.deserialize, @@ -292,7 +378,7 @@ def augment_prompt( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "augment_prompt" not in self._stubs: - self._stubs["augment_prompt"] = self.grpc_channel.unary_unary( + self._stubs["augment_prompt"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.VertexRagService/AugmentPrompt", request_serializer=vertex_rag_service.AugmentPromptRequest.serialize, response_deserializer=vertex_rag_service.AugmentPromptResponse.deserialize, @@ -324,7 +410,7 @@ def corroborate_content( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "corroborate_content" not in self._stubs: - self._stubs["corroborate_content"] = self.grpc_channel.unary_unary( + self._stubs["corroborate_content"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.VertexRagService/CorroborateContent", request_serializer=vertex_rag_service.CorroborateContentRequest.serialize, response_deserializer=vertex_rag_service.CorroborateContentResponse.deserialize, @@ -332,7 +418,7 @@ def corroborate_content( return self._stubs["corroborate_content"] def close(self): - self.grpc_channel.close() + self._logged_channel.close() @property def delete_operation( @@ -344,7 +430,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, @@ -361,7 +447,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -378,7 +464,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -395,7 +481,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, @@ -414,7 +500,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, @@ -433,7 +519,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -450,7 +536,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -475,7 +561,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -501,7 +587,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -530,7 +616,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1beta1/services/vertex_rag_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1beta1/services/vertex_rag_service/transports/grpc_asyncio.py index a070cffa62..5181413d29 100644 --- a/google/cloud/aiplatform_v1beta1/services/vertex_rag_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/vertex_rag_service/transports/grpc_asyncio.py @@ -14,6 +14,9 @@ # limitations under the License. # import inspect +import json +import pickle +import logging as std_logging import warnings from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union @@ -23,8 +26,11 @@ from google.api_core import retry_async as retries from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from grpc.experimental import aio # type: ignore from google.cloud.aiplatform_v1beta1.types import vertex_rag_service @@ -35,6 +41,82 @@ from .base import VertexRagServiceTransport, DEFAULT_CLIENT_INFO from .grpc import VertexRagServiceGrpcTransport +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.aiplatform.v1beta1.VertexRagService", + "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.aiplatform.v1beta1.VertexRagService", + "rpcName": str(client_call_details.method), + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class VertexRagServiceGrpcAsyncIOTransport(VertexRagServiceTransport): """gRPC AsyncIO backend transport for VertexRagService. @@ -231,10 +313,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 @@ -269,7 +354,7 @@ def retrieve_contexts( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "retrieve_contexts" not in self._stubs: - self._stubs["retrieve_contexts"] = self.grpc_channel.unary_unary( + self._stubs["retrieve_contexts"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.VertexRagService/RetrieveContexts", request_serializer=vertex_rag_service.RetrieveContextsRequest.serialize, response_deserializer=vertex_rag_service.RetrieveContextsResponse.deserialize, @@ -300,7 +385,7 @@ def augment_prompt( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "augment_prompt" not in self._stubs: - self._stubs["augment_prompt"] = self.grpc_channel.unary_unary( + self._stubs["augment_prompt"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.VertexRagService/AugmentPrompt", request_serializer=vertex_rag_service.AugmentPromptRequest.serialize, response_deserializer=vertex_rag_service.AugmentPromptResponse.deserialize, @@ -332,7 +417,7 @@ def corroborate_content( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "corroborate_content" not in self._stubs: - self._stubs["corroborate_content"] = self.grpc_channel.unary_unary( + self._stubs["corroborate_content"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.VertexRagService/CorroborateContent", request_serializer=vertex_rag_service.CorroborateContentRequest.serialize, response_deserializer=vertex_rag_service.CorroborateContentResponse.deserialize, @@ -415,7 +500,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: @@ -431,7 +516,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, @@ -448,7 +533,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -465,7 +550,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -482,7 +567,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, @@ -501,7 +586,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, @@ -520,7 +605,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -537,7 +622,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -562,7 +647,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -588,7 +673,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -617,7 +702,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1beta1/services/vertex_rag_service/transports/rest.py b/google/cloud/aiplatform_v1beta1/services/vertex_rag_service/transports/rest.py index f99c6e4ae9..c552f8ebfe 100644 --- a/google/cloud/aiplatform_v1beta1/services/vertex_rag_service/transports/rest.py +++ b/google/cloud/aiplatform_v1beta1/services/vertex_rag_service/transports/rest.py @@ -13,9 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging +import json # type: ignore from google.auth.transport.requests import AuthorizedSession # type: ignore -import json # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.api_core import exceptions as core_exceptions from google.api_core import retry as retries @@ -46,6 +47,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, @@ -102,8 +111,10 @@ def post_retrieve_contexts(self, response): def pre_augment_prompt( self, request: vertex_rag_service.AugmentPromptRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[vertex_rag_service.AugmentPromptRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + vertex_rag_service.AugmentPromptRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for augment_prompt Override in a subclass to manipulate the request or metadata @@ -125,8 +136,11 @@ def post_augment_prompt( def pre_corroborate_content( self, request: vertex_rag_service.CorroborateContentRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[vertex_rag_service.CorroborateContentRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + vertex_rag_service.CorroborateContentRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for corroborate_content Override in a subclass to manipulate the request or metadata @@ -148,8 +162,11 @@ def post_corroborate_content( def pre_retrieve_contexts( self, request: vertex_rag_service.RetrieveContextsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[vertex_rag_service.RetrieveContextsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + vertex_rag_service.RetrieveContextsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for retrieve_contexts Override in a subclass to manipulate the request or metadata @@ -171,8 +188,10 @@ def post_retrieve_contexts( def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -194,8 +213,10 @@ def post_get_location( def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -217,8 +238,10 @@ def post_list_locations( def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -238,8 +261,10 @@ def post_get_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -259,8 +284,11 @@ def post_set_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -282,8 +310,10 @@ def post_test_iam_permissions( def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -303,8 +333,10 @@ def post_cancel_operation(self, response: None) -> None: 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 @@ -324,8 +356,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 @@ -347,8 +381,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 @@ -370,8 +406,10 @@ def post_list_operations( def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -513,7 +551,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]]] = (), ) -> vertex_rag_service.AugmentPromptResponse: r"""Call the augment prompt method over HTTP. @@ -523,8 +561,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: ~.vertex_rag_service.AugmentPromptResponse: @@ -534,6 +574,7 @@ def __call__( http_options = ( _BaseVertexRagServiceRestTransport._BaseAugmentPrompt._get_http_options() ) + request, metadata = self._interceptor.pre_augment_prompt(request, metadata) transcoded_request = _BaseVertexRagServiceRestTransport._BaseAugmentPrompt._get_transcoded_request( http_options, request @@ -548,6 +589,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.aiplatform_v1beta1.VertexRagServiceClient.AugmentPrompt", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagService", + "rpcName": "AugmentPrompt", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = VertexRagServiceRestTransport._AugmentPrompt._get_response( self._host, @@ -569,7 +637,31 @@ def __call__( pb_resp = vertex_rag_service.AugmentPromptResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_augment_prompt(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = vertex_rag_service.AugmentPromptResponse.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.aiplatform_v1beta1.VertexRagServiceClient.augment_prompt", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagService", + "rpcName": "AugmentPrompt", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _CorroborateContent( @@ -609,7 +701,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]]] = (), ) -> vertex_rag_service.CorroborateContentResponse: r"""Call the corroborate content method over HTTP. @@ -620,8 +712,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: ~.vertex_rag_service.CorroborateContentResponse: @@ -633,6 +727,7 @@ def __call__( http_options = ( _BaseVertexRagServiceRestTransport._BaseCorroborateContent._get_http_options() ) + request, metadata = self._interceptor.pre_corroborate_content( request, metadata ) @@ -649,6 +744,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.aiplatform_v1beta1.VertexRagServiceClient.CorroborateContent", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagService", + "rpcName": "CorroborateContent", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = VertexRagServiceRestTransport._CorroborateContent._get_response( self._host, @@ -670,7 +792,31 @@ def __call__( pb_resp = vertex_rag_service.CorroborateContentResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_corroborate_content(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + vertex_rag_service.CorroborateContentResponse.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.aiplatform_v1beta1.VertexRagServiceClient.corroborate_content", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagService", + "rpcName": "CorroborateContent", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _RetrieveContexts( @@ -710,7 +856,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]]] = (), ) -> vertex_rag_service.RetrieveContextsResponse: r"""Call the retrieve contexts method over HTTP. @@ -721,8 +867,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: ~.vertex_rag_service.RetrieveContextsResponse: @@ -734,6 +882,7 @@ def __call__( http_options = ( _BaseVertexRagServiceRestTransport._BaseRetrieveContexts._get_http_options() ) + request, metadata = self._interceptor.pre_retrieve_contexts( request, metadata ) @@ -750,6 +899,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.aiplatform_v1beta1.VertexRagServiceClient.RetrieveContexts", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagService", + "rpcName": "RetrieveContexts", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = VertexRagServiceRestTransport._RetrieveContexts._get_response( self._host, @@ -771,7 +947,31 @@ def __call__( pb_resp = vertex_rag_service.RetrieveContextsResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_retrieve_contexts(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + vertex_rag_service.RetrieveContextsResponse.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.aiplatform_v1beta1.VertexRagServiceClient.retrieve_contexts", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagService", + "rpcName": "RetrieveContexts", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp @property @@ -846,7 +1046,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]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -857,8 +1057,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: locations_pb2.Location: Response from GetLocation method. @@ -867,6 +1069,7 @@ def __call__( http_options = ( _BaseVertexRagServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = self._interceptor.pre_get_location(request, metadata) transcoded_request = _BaseVertexRagServiceRestTransport._BaseGetLocation._get_transcoded_request( http_options, request @@ -877,6 +1080,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.aiplatform_v1beta1.VertexRagServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = VertexRagServiceRestTransport._GetLocation._get_response( self._host, @@ -896,6 +1126,27 @@ def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_location(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.aiplatform_v1beta1.VertexRagServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -937,7 +1188,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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -948,8 +1199,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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -958,6 +1211,7 @@ def __call__( http_options = ( _BaseVertexRagServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = self._interceptor.pre_list_locations(request, metadata) transcoded_request = _BaseVertexRagServiceRestTransport._BaseListLocations._get_transcoded_request( http_options, request @@ -968,6 +1222,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.aiplatform_v1beta1.VertexRagServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = VertexRagServiceRestTransport._ListLocations._get_response( self._host, @@ -987,6 +1268,27 @@ def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_list_locations(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.aiplatform_v1beta1.VertexRagServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1029,7 +1331,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]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -1040,8 +1342,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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -1050,6 +1354,7 @@ def __call__( http_options = ( _BaseVertexRagServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_get_iam_policy(request, metadata) transcoded_request = _BaseVertexRagServiceRestTransport._BaseGetIamPolicy._get_transcoded_request( http_options, request @@ -1064,6 +1369,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.aiplatform_v1beta1.VertexRagServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = VertexRagServiceRestTransport._GetIamPolicy._get_response( self._host, @@ -1084,6 +1416,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_iam_policy(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.aiplatform_v1beta1.VertexRagServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1126,7 +1479,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]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -1137,8 +1490,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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -1147,6 +1502,7 @@ def __call__( http_options = ( _BaseVertexRagServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_set_iam_policy(request, metadata) transcoded_request = _BaseVertexRagServiceRestTransport._BaseSetIamPolicy._get_transcoded_request( http_options, request @@ -1161,6 +1517,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.aiplatform_v1beta1.VertexRagServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = VertexRagServiceRestTransport._SetIamPolicy._get_response( self._host, @@ -1181,6 +1564,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_set_iam_policy(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.aiplatform_v1beta1.VertexRagServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1224,7 +1628,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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -1235,8 +1639,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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -1245,6 +1651,7 @@ def __call__( http_options = ( _BaseVertexRagServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -1261,6 +1668,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.aiplatform_v1beta1.VertexRagServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = VertexRagServiceRestTransport._TestIamPermissions._get_response( self._host, @@ -1281,6 +1715,27 @@ def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_test_iam_permissions(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.aiplatform_v1beta1.VertexRagServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1323,7 +1778,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 cancel operation method over HTTP. @@ -1334,13 +1789,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 = ( _BaseVertexRagServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = self._interceptor.pre_cancel_operation( request, metadata ) @@ -1353,6 +1811,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.aiplatform_v1beta1.VertexRagServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = VertexRagServiceRestTransport._CancelOperation._get_response( self._host, @@ -1410,7 +1895,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. @@ -1421,13 +1906,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 = ( _BaseVertexRagServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = self._interceptor.pre_delete_operation( request, metadata ) @@ -1440,6 +1928,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.aiplatform_v1beta1.VertexRagServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = VertexRagServiceRestTransport._DeleteOperation._get_response( self._host, @@ -1496,7 +2011,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. @@ -1507,8 +2022,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. @@ -1517,6 +2034,7 @@ def __call__( http_options = ( _BaseVertexRagServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = self._interceptor.pre_get_operation(request, metadata) transcoded_request = _BaseVertexRagServiceRestTransport._BaseGetOperation._get_transcoded_request( http_options, request @@ -1527,6 +2045,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.aiplatform_v1beta1.VertexRagServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = VertexRagServiceRestTransport._GetOperation._get_response( self._host, @@ -1546,6 +2091,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.aiplatform_v1beta1.VertexRagServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1587,7 +2153,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. @@ -1598,8 +2164,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. @@ -1608,6 +2176,7 @@ def __call__( http_options = ( _BaseVertexRagServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = self._interceptor.pre_list_operations(request, metadata) transcoded_request = _BaseVertexRagServiceRestTransport._BaseListOperations._get_transcoded_request( http_options, request @@ -1618,6 +2187,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.aiplatform_v1beta1.VertexRagServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = VertexRagServiceRestTransport._ListOperations._get_response( self._host, @@ -1637,6 +2233,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.aiplatform_v1beta1.VertexRagServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1678,7 +2295,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 wait operation method over HTTP. @@ -1689,8 +2306,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 WaitOperation method. @@ -1699,6 +2318,7 @@ def __call__( http_options = ( _BaseVertexRagServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = self._interceptor.pre_wait_operation(request, metadata) transcoded_request = _BaseVertexRagServiceRestTransport._BaseWaitOperation._get_transcoded_request( http_options, request @@ -1709,6 +2329,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.aiplatform_v1beta1.VertexRagServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = VertexRagServiceRestTransport._WaitOperation._get_response( self._host, @@ -1728,6 +2375,27 @@ def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = self._interceptor.post_wait_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.aiplatform_v1beta1.VertexRagServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1beta1/services/vertex_rag_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1beta1/services/vertex_rag_service/transports/rest_asyncio.py index 3f45b5d7e2..8074b6578c 100644 --- a/google/cloud/aiplatform_v1beta1/services/vertex_rag_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/vertex_rag_service/transports/rest_asyncio.py @@ -56,6 +56,18 @@ from .base import DEFAULT_CLIENT_INFO as BASE_DEFAULT_CLIENT_INFO + +import logging + +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__) + try: OptionalRetry = Union[retries.AsyncRetry, gapic_v1.method._MethodDefault, None] except AttributeError: # pragma: NO COVER @@ -116,8 +128,10 @@ async def post_retrieve_contexts(self, response): async def pre_augment_prompt( self, request: vertex_rag_service.AugmentPromptRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[vertex_rag_service.AugmentPromptRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + vertex_rag_service.AugmentPromptRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for augment_prompt Override in a subclass to manipulate the request or metadata @@ -139,8 +153,11 @@ async def post_augment_prompt( async def pre_corroborate_content( self, request: vertex_rag_service.CorroborateContentRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[vertex_rag_service.CorroborateContentRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + vertex_rag_service.CorroborateContentRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for corroborate_content Override in a subclass to manipulate the request or metadata @@ -162,8 +179,11 @@ async def post_corroborate_content( async def pre_retrieve_contexts( self, request: vertex_rag_service.RetrieveContextsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[vertex_rag_service.RetrieveContextsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + vertex_rag_service.RetrieveContextsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for retrieve_contexts Override in a subclass to manipulate the request or metadata @@ -185,8 +205,10 @@ async def post_retrieve_contexts( async def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -208,8 +230,10 @@ async def post_get_location( async def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -231,8 +255,10 @@ async def post_list_locations( async def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -254,8 +280,10 @@ async def post_get_iam_policy( async def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -277,8 +305,11 @@ async def post_set_iam_policy( async def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -300,8 +331,10 @@ async def post_test_iam_permissions( async def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -321,8 +354,10 @@ async def post_cancel_operation(self, response: None) -> None: async 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 @@ -342,8 +377,10 @@ async def post_delete_operation(self, response: None) -> None: async 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 @@ -365,8 +402,10 @@ async def post_get_operation( async 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 @@ -388,8 +427,10 @@ async def post_list_operations( async def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -582,7 +623,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> vertex_rag_service.AugmentPromptResponse: r"""Call the augment prompt method over HTTP. @@ -592,8 +633,10 @@ async def __call__( 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: ~.vertex_rag_service.AugmentPromptResponse: @@ -603,6 +646,7 @@ async def __call__( http_options = ( _BaseVertexRagServiceRestTransport._BaseAugmentPrompt._get_http_options() ) + request, metadata = await self._interceptor.pre_augment_prompt( request, metadata ) @@ -619,6 +663,33 @@ async 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.aiplatform_v1beta1.VertexRagServiceClient.AugmentPrompt", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagService", + "rpcName": "AugmentPrompt", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncVertexRagServiceRestTransport._AugmentPrompt._get_response( @@ -649,6 +720,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_augment_prompt(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = vertex_rag_service.AugmentPromptResponse.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.VertexRagServiceAsyncClient.augment_prompt", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagService", + "rpcName": "AugmentPrompt", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _CorroborateContent( @@ -688,7 +783,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> vertex_rag_service.CorroborateContentResponse: r"""Call the corroborate content method over HTTP. @@ -699,8 +794,10 @@ async def __call__( 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: ~.vertex_rag_service.CorroborateContentResponse: @@ -712,6 +809,7 @@ async def __call__( http_options = ( _BaseVertexRagServiceRestTransport._BaseCorroborateContent._get_http_options() ) + request, metadata = await self._interceptor.pre_corroborate_content( request, metadata ) @@ -728,6 +826,33 @@ async 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.aiplatform_v1beta1.VertexRagServiceClient.CorroborateContent", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagService", + "rpcName": "CorroborateContent", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncVertexRagServiceRestTransport._CorroborateContent._get_response( self._host, @@ -756,6 +881,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_corroborate_content(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + vertex_rag_service.CorroborateContentResponse.to_json(response) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.VertexRagServiceAsyncClient.corroborate_content", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagService", + "rpcName": "CorroborateContent", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _RetrieveContexts( @@ -795,7 +944,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> vertex_rag_service.RetrieveContextsResponse: r"""Call the retrieve contexts method over HTTP. @@ -806,8 +955,10 @@ async def __call__( 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: ~.vertex_rag_service.RetrieveContextsResponse: @@ -819,6 +970,7 @@ async def __call__( http_options = ( _BaseVertexRagServiceRestTransport._BaseRetrieveContexts._get_http_options() ) + request, metadata = await self._interceptor.pre_retrieve_contexts( request, metadata ) @@ -835,6 +987,33 @@ async 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.aiplatform_v1beta1.VertexRagServiceClient.RetrieveContexts", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagService", + "rpcName": "RetrieveContexts", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncVertexRagServiceRestTransport._RetrieveContexts._get_response( self._host, @@ -863,6 +1042,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_retrieve_contexts(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = ( + vertex_rag_service.RetrieveContextsResponse.to_json(response) + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.VertexRagServiceAsyncClient.retrieve_contexts", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagService", + "rpcName": "RetrieveContexts", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp @property @@ -932,7 +1135,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -943,8 +1146,10 @@ async def __call__( 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: locations_pb2.Location: Response from GetLocation method. @@ -953,6 +1158,7 @@ async def __call__( http_options = ( _BaseVertexRagServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_location( request, metadata ) @@ -965,6 +1171,33 @@ async 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.aiplatform_v1beta1.VertexRagServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncVertexRagServiceRestTransport._GetLocation._get_response( @@ -992,6 +1225,27 @@ async def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_location(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.aiplatform_v1beta1.VertexRagServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1034,7 +1288,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -1045,8 +1299,10 @@ async def __call__( 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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -1055,6 +1311,7 @@ async def __call__( http_options = ( _BaseVertexRagServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_locations( request, metadata ) @@ -1067,6 +1324,33 @@ async 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.aiplatform_v1beta1.VertexRagServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncVertexRagServiceRestTransport._ListLocations._get_response( @@ -1094,6 +1378,27 @@ async def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_list_locations(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.aiplatform_v1beta1.VertexRagServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1137,7 +1442,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -1148,8 +1453,10 @@ async def __call__( 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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -1158,6 +1465,7 @@ async def __call__( http_options = ( _BaseVertexRagServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_get_iam_policy( request, metadata ) @@ -1174,6 +1482,33 @@ async 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.aiplatform_v1beta1.VertexRagServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncVertexRagServiceRestTransport._GetIamPolicy._get_response( @@ -1202,6 +1537,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_iam_policy(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.aiplatform_v1beta1.VertexRagServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1245,7 +1601,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -1256,8 +1612,10 @@ async def __call__( 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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -1266,6 +1624,7 @@ async def __call__( http_options = ( _BaseVertexRagServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_set_iam_policy( request, metadata ) @@ -1282,6 +1641,33 @@ async 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.aiplatform_v1beta1.VertexRagServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncVertexRagServiceRestTransport._SetIamPolicy._get_response( @@ -1310,6 +1696,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_set_iam_policy(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.aiplatform_v1beta1.VertexRagServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1353,7 +1760,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -1364,8 +1771,10 @@ async def __call__( 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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -1374,6 +1783,7 @@ async def __call__( http_options = ( _BaseVertexRagServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = await self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -1390,6 +1800,33 @@ async 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.aiplatform_v1beta1.VertexRagServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncVertexRagServiceRestTransport._TestIamPermissions._get_response( self._host, @@ -1416,6 +1853,27 @@ async def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_test_iam_permissions(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.aiplatform_v1beta1.VertexRagServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1458,7 +1916,7 @@ async 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 cancel operation method over HTTP. @@ -1469,13 +1927,16 @@ async def __call__( 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`. """ http_options = ( _BaseVertexRagServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_cancel_operation( request, metadata ) @@ -1488,6 +1949,33 @@ async 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.aiplatform_v1beta1.VertexRagServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncVertexRagServiceRestTransport._CancelOperation._get_response( @@ -1553,7 +2041,7 @@ async 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. @@ -1564,13 +2052,16 @@ async def __call__( 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`. """ http_options = ( _BaseVertexRagServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_operation( request, metadata ) @@ -1583,6 +2074,33 @@ async 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.aiplatform_v1beta1.VertexRagServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncVertexRagServiceRestTransport._DeleteOperation._get_response( @@ -1648,7 +2166,7 @@ async 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. @@ -1659,8 +2177,10 @@ async def __call__( 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: Response from GetOperation method. @@ -1669,6 +2189,7 @@ async def __call__( http_options = ( _BaseVertexRagServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_operation( request, metadata ) @@ -1681,6 +2202,33 @@ async 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.aiplatform_v1beta1.VertexRagServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncVertexRagServiceRestTransport._GetOperation._get_response( @@ -1708,6 +2256,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1beta1.VertexRagServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1750,7 +2319,7 @@ async 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. @@ -1761,8 +2330,10 @@ async def __call__( 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 from ListOperations method. @@ -1771,6 +2342,7 @@ async def __call__( http_options = ( _BaseVertexRagServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_operations( request, metadata ) @@ -1783,6 +2355,33 @@ async 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.aiplatform_v1beta1.VertexRagServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncVertexRagServiceRestTransport._ListOperations._get_response( @@ -1810,6 +2409,27 @@ async def __call__( resp = operations_pb2.ListOperationsResponse() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1beta1.VertexRagServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -1852,7 +2472,7 @@ async 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 wait operation method over HTTP. @@ -1863,8 +2483,10 @@ async def __call__( 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: Response from WaitOperation method. @@ -1873,6 +2495,7 @@ async def __call__( http_options = ( _BaseVertexRagServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_wait_operation( request, metadata ) @@ -1885,6 +2508,33 @@ async 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.aiplatform_v1beta1.VertexRagServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncVertexRagServiceRestTransport._WaitOperation._get_response( @@ -1912,6 +2562,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_wait_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.aiplatform_v1beta1.VertexRagServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VertexRagService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1beta1/services/vertex_rag_service/transports/rest_base.py b/google/cloud/aiplatform_v1beta1/services/vertex_rag_service/transports/rest_base.py index e92777222b..47781f686e 100644 --- a/google/cloud/aiplatform_v1beta1/services/vertex_rag_service/transports/rest_base.py +++ b/google/cloud/aiplatform_v1beta1/services/vertex_rag_service/transports/rest_base.py @@ -1180,6 +1180,10 @@ def _get_http_options(): "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -1396,6 +1400,10 @@ def _get_http_options(): "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -1621,6 +1629,10 @@ def _get_http_options(): "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}", @@ -1837,6 +1849,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, ] return http_options @@ -2054,6 +2070,10 @@ def _get_http_options(): "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*}/operations", @@ -2270,6 +2290,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*}/operations", + }, ] return http_options @@ -2487,6 +2511,10 @@ def _get_http_options(): "method": "post", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}:wait", @@ -2699,6 +2727,10 @@ def _get_http_options(): "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, ] return http_options diff --git a/google/cloud/aiplatform_v1beta1/services/vizier_service/async_client.py b/google/cloud/aiplatform_v1beta1/services/vizier_service/async_client.py index a3f3a3c137..c2458a7810 100644 --- a/google/cloud/aiplatform_v1beta1/services/vizier_service/async_client.py +++ b/google/cloud/aiplatform_v1beta1/services/vizier_service/async_client.py @@ -13,6 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging as std_logging from collections import OrderedDict import re from typing import ( @@ -58,6 +59,15 @@ from .transports.grpc_asyncio import VizierServiceGrpcAsyncIOTransport from .client import VizierServiceClient +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 VizierServiceAsyncClient: """Vertex AI Vizier API. @@ -272,6 +282,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.aiplatform_v1beta1.VizierServiceAsyncClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VizierService", + "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.aiplatform.v1beta1.VizierService", + "credentialsType": None, + }, + ) + async def create_study( self, request: Optional[Union[vizier_service.CreateStudyRequest, dict]] = None, @@ -280,7 +312,7 @@ async def create_study( study: Optional[gca_study.Study] = 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]]] = (), ) -> gca_study.Study: r"""Creates a Study. A resource name will be generated after creation of the Study. @@ -342,8 +374,10 @@ async def sample_create_study(): 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.aiplatform_v1beta1.types.Study: @@ -404,7 +438,7 @@ async def get_study( 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]]] = (), ) -> study.Study: r"""Gets a Study by name. @@ -448,8 +482,10 @@ async def sample_get_study(): 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.aiplatform_v1beta1.types.Study: @@ -508,7 +544,7 @@ async def list_studies( 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.ListStudiesAsyncPager: r"""Lists all the studies in a region for an associated project. @@ -555,8 +591,10 @@ async def sample_list_studies(): 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.aiplatform_v1beta1.services.vizier_service.pagers.ListStudiesAsyncPager: @@ -631,7 +669,7 @@ async def delete_study( 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 Study. @@ -673,8 +711,10 @@ async def sample_delete_study(): 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 @@ -726,7 +766,7 @@ async def lookup_study( 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]]] = (), ) -> study.Study: r"""Looks a study up using the user-defined display_name field instead of the fully qualified resource name. @@ -773,8 +813,10 @@ async def sample_lookup_study(): 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.aiplatform_v1beta1.types.Study: @@ -832,7 +874,7 @@ async def suggest_trials( *, 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"""Adds one or more Trials to a Study, with parameter values suggested by Vertex AI Vizier. Returns a long-running operation @@ -879,8 +921,10 @@ async def sample_suggest_trials(): 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: @@ -938,7 +982,7 @@ async def create_trial( trial: Optional[study.Trial] = 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]]] = (), ) -> study.Trial: r"""Adds a user provided Trial to a Study. @@ -988,8 +1032,10 @@ async def sample_create_trial(): 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.aiplatform_v1beta1.types.Trial: @@ -1055,7 +1101,7 @@ async def get_trial( 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]]] = (), ) -> study.Trial: r"""Gets a Trial. @@ -1099,8 +1145,10 @@ async def sample_get_trial(): 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.aiplatform_v1beta1.types.Trial: @@ -1164,7 +1212,7 @@ async def list_trials( 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.ListTrialsAsyncPager: r"""Lists the Trials associated with a Study. @@ -1210,8 +1258,10 @@ async def sample_list_trials(): 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.aiplatform_v1beta1.services.vizier_service.pagers.ListTrialsAsyncPager: @@ -1287,7 +1337,7 @@ async def add_trial_measurement( *, 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]]] = (), ) -> study.Trial: r"""Adds a measurement of the objective metrics to a Trial. This measurement is assumed to have been taken @@ -1326,8 +1376,10 @@ async def sample_add_trial_measurement(): 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.aiplatform_v1beta1.types.Trial: @@ -1378,7 +1430,7 @@ async def complete_trial( *, 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]]] = (), ) -> study.Trial: r"""Marks a Trial as complete. @@ -1415,8 +1467,10 @@ async def sample_complete_trial(): 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.aiplatform_v1beta1.types.Trial: @@ -1466,7 +1520,7 @@ async def delete_trial( 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 Trial. @@ -1507,8 +1561,10 @@ async def sample_delete_trial(): 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 @@ -1561,7 +1617,7 @@ async def check_trial_early_stopping_state( *, 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"""Checks whether a Trial should stop or not. Returns a long-running operation. When the operation is successful, it @@ -1605,8 +1661,10 @@ async def sample_check_trial_early_stopping_state(): 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: @@ -1664,7 +1722,7 @@ async def stop_trial( *, 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]]] = (), ) -> study.Trial: r"""Stops a Trial. @@ -1701,8 +1759,10 @@ async def sample_stop_trial(): 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.aiplatform_v1beta1.types.Trial: @@ -1752,7 +1812,7 @@ async def list_optimal_trials( 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]]] = (), ) -> vizier_service.ListOptimalTrialsResponse: r"""Lists the pareto-optimal Trials for multi-objective Study or the optimal Trials for single-objective Study. The definition of @@ -1799,8 +1859,10 @@ async def sample_list_optimal_trials(): 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.aiplatform_v1beta1.types.ListOptimalTrialsResponse: @@ -1860,7 +1922,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. @@ -1871,8 +1933,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. @@ -1913,7 +1977,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. @@ -1924,8 +1988,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. @@ -1966,7 +2032,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. @@ -1982,8 +2048,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 """ @@ -2020,7 +2088,7 @@ async def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -2035,8 +2103,10 @@ async def cancel_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 """ @@ -2073,7 +2143,7 @@ async def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -2090,8 +2160,10 @@ async def wait_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. @@ -2132,7 +2204,7 @@ async def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -2145,8 +2217,10 @@ async def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -2251,7 +2325,7 @@ async def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -2265,8 +2339,10 @@ async def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -2371,7 +2447,7 @@ async def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -2386,8 +2462,10 @@ async def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -2431,7 +2509,7 @@ async def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -2442,8 +2520,10 @@ async def get_location( 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: ~.location_pb2.Location: Location object. @@ -2484,7 +2564,7 @@ async def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -2495,8 +2575,10 @@ async def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1beta1/services/vizier_service/client.py b/google/cloud/aiplatform_v1beta1/services/vizier_service/client.py index bbaabcedd2..5fc56b3bb8 100644 --- a/google/cloud/aiplatform_v1beta1/services/vizier_service/client.py +++ b/google/cloud/aiplatform_v1beta1/services/vizier_service/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 ( @@ -48,6 +49,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.cloud.aiplatform_v1beta1.services.vizier_service import pagers @@ -649,6 +659,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( @@ -739,6 +753,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.aiplatform_v1beta1.VizierServiceClient`.", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VizierService", + "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.aiplatform.v1beta1.VizierService", + "credentialsType": None, + }, + ) + def create_study( self, request: Optional[Union[vizier_service.CreateStudyRequest, dict]] = None, @@ -747,7 +784,7 @@ def create_study( study: Optional[gca_study.Study] = 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]]] = (), ) -> gca_study.Study: r"""Creates a Study. A resource name will be generated after creation of the Study. @@ -809,8 +846,10 @@ def sample_create_study(): 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.aiplatform_v1beta1.types.Study: @@ -868,7 +907,7 @@ def get_study( 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]]] = (), ) -> study.Study: r"""Gets a Study by name. @@ -912,8 +951,10 @@ def sample_get_study(): 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.aiplatform_v1beta1.types.Study: @@ -969,7 +1010,7 @@ def list_studies( 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.ListStudiesPager: r"""Lists all the studies in a region for an associated project. @@ -1016,8 +1057,10 @@ def sample_list_studies(): 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.aiplatform_v1beta1.services.vizier_service.pagers.ListStudiesPager: @@ -1089,7 +1132,7 @@ def delete_study( 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 Study. @@ -1131,8 +1174,10 @@ def sample_delete_study(): 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 @@ -1181,7 +1226,7 @@ def lookup_study( 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]]] = (), ) -> study.Study: r"""Looks a study up using the user-defined display_name field instead of the fully qualified resource name. @@ -1228,8 +1273,10 @@ def sample_lookup_study(): 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.aiplatform_v1beta1.types.Study: @@ -1284,7 +1331,7 @@ def suggest_trials( *, 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"""Adds one or more Trials to a Study, with parameter values suggested by Vertex AI Vizier. Returns a long-running operation @@ -1331,8 +1378,10 @@ def sample_suggest_trials(): 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: @@ -1388,7 +1437,7 @@ def create_trial( trial: Optional[study.Trial] = 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]]] = (), ) -> study.Trial: r"""Adds a user provided Trial to a Study. @@ -1438,8 +1487,10 @@ def sample_create_trial(): 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.aiplatform_v1beta1.types.Trial: @@ -1502,7 +1553,7 @@ def get_trial( 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]]] = (), ) -> study.Trial: r"""Gets a Trial. @@ -1546,8 +1597,10 @@ def sample_get_trial(): 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.aiplatform_v1beta1.types.Trial: @@ -1608,7 +1661,7 @@ def list_trials( 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.ListTrialsPager: r"""Lists the Trials associated with a Study. @@ -1654,8 +1707,10 @@ def sample_list_trials(): 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.aiplatform_v1beta1.services.vizier_service.pagers.ListTrialsPager: @@ -1728,7 +1783,7 @@ def add_trial_measurement( *, 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]]] = (), ) -> study.Trial: r"""Adds a measurement of the objective metrics to a Trial. This measurement is assumed to have been taken @@ -1767,8 +1822,10 @@ def sample_add_trial_measurement(): 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.aiplatform_v1beta1.types.Trial: @@ -1817,7 +1874,7 @@ def complete_trial( *, 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]]] = (), ) -> study.Trial: r"""Marks a Trial as complete. @@ -1854,8 +1911,10 @@ def sample_complete_trial(): 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.aiplatform_v1beta1.types.Trial: @@ -1903,7 +1962,7 @@ def delete_trial( 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 Trial. @@ -1944,8 +2003,10 @@ def sample_delete_trial(): 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 @@ -1995,7 +2056,7 @@ def check_trial_early_stopping_state( *, 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"""Checks whether a Trial should stop or not. Returns a long-running operation. When the operation is successful, it @@ -2039,8 +2100,10 @@ def sample_check_trial_early_stopping_state(): 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: @@ -2098,7 +2161,7 @@ def stop_trial( *, 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]]] = (), ) -> study.Trial: r"""Stops a Trial. @@ -2135,8 +2198,10 @@ def sample_stop_trial(): 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.aiplatform_v1beta1.types.Trial: @@ -2184,7 +2249,7 @@ def list_optimal_trials( 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]]] = (), ) -> vizier_service.ListOptimalTrialsResponse: r"""Lists the pareto-optimal Trials for multi-objective Study or the optimal Trials for single-objective Study. The definition of @@ -2231,8 +2296,10 @@ def sample_list_optimal_trials(): 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.aiplatform_v1beta1.types.ListOptimalTrialsResponse: @@ -2302,7 +2369,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. @@ -2313,8 +2380,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. @@ -2355,7 +2424,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. @@ -2366,8 +2435,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. @@ -2408,7 +2479,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. @@ -2424,8 +2495,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 """ @@ -2462,7 +2535,7 @@ def cancel_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"""Starts asynchronous cancellation on a long-running operation. @@ -2477,8 +2550,10 @@ def cancel_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 """ @@ -2515,7 +2590,7 @@ def wait_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"""Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. @@ -2532,8 +2607,10 @@ def wait_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. @@ -2574,7 +2651,7 @@ def set_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -2587,8 +2664,10 @@ def set_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -2693,7 +2772,7 @@ def get_iam_policy( *, 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]]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -2707,8 +2786,10 @@ def get_iam_policy( 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: ~.policy_pb2.Policy: Defines an Identity and Access Management (IAM) policy. @@ -2813,7 +2894,7 @@ def test_iam_permissions( *, 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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control policy for a function. @@ -2828,8 +2909,10 @@ def test_iam_permissions( 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: ~.iam_policy_pb2.TestIamPermissionsResponse: Response message for ``TestIamPermissions`` method. @@ -2871,7 +2954,7 @@ def get_location( *, 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]]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -2882,8 +2965,10 @@ def get_location( 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: ~.location_pb2.Location: Location object. @@ -2924,7 +3009,7 @@ def list_locations( *, 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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -2935,8 +3020,10 @@ def list_locations( 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: ~.location_pb2.ListLocationsResponse: Response message for ``ListLocations`` method. diff --git a/google/cloud/aiplatform_v1beta1/services/vizier_service/pagers.py b/google/cloud/aiplatform_v1beta1/services/vizier_service/pagers.py index a847b197be..5b3bc520e3 100644 --- a/google/cloud/aiplatform_v1beta1/services/vizier_service/pagers.py +++ b/google/cloud/aiplatform_v1beta1/services/vizier_service/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 = vizier_service.ListStudiesRequest(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 = vizier_service.ListStudiesRequest(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 = vizier_service.ListTrialsRequest(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 = vizier_service.ListTrialsRequest(request) diff --git a/google/cloud/aiplatform_v1beta1/services/vizier_service/transports/grpc.py b/google/cloud/aiplatform_v1beta1/services/vizier_service/transports/grpc.py index f36b6b7c1f..865eb62647 100644 --- a/google/cloud/aiplatform_v1beta1/services/vizier_service/transports/grpc.py +++ b/google/cloud/aiplatform_v1beta1/services/vizier_service/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 import warnings from typing import Callable, Dict, Optional, Sequence, Tuple, Union @@ -22,8 +25,11 @@ import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from google.cloud.aiplatform_v1beta1.types import study from google.cloud.aiplatform_v1beta1.types import study as gca_study @@ -35,6 +41,81 @@ from google.protobuf import empty_pb2 # type: ignore from .base import VizierServiceTransport, DEFAULT_CLIENT_INFO +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.aiplatform.v1beta1.VizierService", + "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.aiplatform.v1beta1.VizierService", + "rpcName": client_call_details.method, + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class VizierServiceGrpcTransport(VizierServiceTransport): """gRPC backend transport for VizierService. @@ -193,7 +274,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,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 @@ -282,7 +370,7 @@ def create_study( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_study" not in self._stubs: - self._stubs["create_study"] = self.grpc_channel.unary_unary( + self._stubs["create_study"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.VizierService/CreateStudy", request_serializer=vizier_service.CreateStudyRequest.serialize, response_deserializer=gca_study.Study.deserialize, @@ -306,7 +394,7 @@ def get_study(self) -> Callable[[vizier_service.GetStudyRequest], study.Study]: # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_study" not in self._stubs: - self._stubs["get_study"] = self.grpc_channel.unary_unary( + self._stubs["get_study"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.VizierService/GetStudy", request_serializer=vizier_service.GetStudyRequest.serialize, response_deserializer=study.Study.deserialize, @@ -335,7 +423,7 @@ def list_studies( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_studies" not in self._stubs: - self._stubs["list_studies"] = self.grpc_channel.unary_unary( + self._stubs["list_studies"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.VizierService/ListStudies", request_serializer=vizier_service.ListStudiesRequest.serialize, response_deserializer=vizier_service.ListStudiesResponse.deserialize, @@ -361,7 +449,7 @@ def delete_study( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_study" not in self._stubs: - self._stubs["delete_study"] = self.grpc_channel.unary_unary( + self._stubs["delete_study"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.VizierService/DeleteStudy", request_serializer=vizier_service.DeleteStudyRequest.serialize, response_deserializer=empty_pb2.Empty.FromString, @@ -388,7 +476,7 @@ def lookup_study( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "lookup_study" not in self._stubs: - self._stubs["lookup_study"] = self.grpc_channel.unary_unary( + self._stubs["lookup_study"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.VizierService/LookupStudy", request_serializer=vizier_service.LookupStudyRequest.serialize, response_deserializer=study.Study.deserialize, @@ -418,7 +506,7 @@ def suggest_trials( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "suggest_trials" not in self._stubs: - self._stubs["suggest_trials"] = self.grpc_channel.unary_unary( + self._stubs["suggest_trials"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.VizierService/SuggestTrials", request_serializer=vizier_service.SuggestTrialsRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -444,7 +532,7 @@ def create_trial( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_trial" not in self._stubs: - self._stubs["create_trial"] = self.grpc_channel.unary_unary( + self._stubs["create_trial"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.VizierService/CreateTrial", request_serializer=vizier_service.CreateTrialRequest.serialize, response_deserializer=study.Trial.deserialize, @@ -468,7 +556,7 @@ def get_trial(self) -> Callable[[vizier_service.GetTrialRequest], study.Trial]: # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_trial" not in self._stubs: - self._stubs["get_trial"] = self.grpc_channel.unary_unary( + self._stubs["get_trial"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.VizierService/GetTrial", request_serializer=vizier_service.GetTrialRequest.serialize, response_deserializer=study.Trial.deserialize, @@ -496,7 +584,7 @@ def list_trials( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_trials" not in self._stubs: - self._stubs["list_trials"] = self.grpc_channel.unary_unary( + self._stubs["list_trials"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.VizierService/ListTrials", request_serializer=vizier_service.ListTrialsRequest.serialize, response_deserializer=vizier_service.ListTrialsResponse.deserialize, @@ -524,7 +612,7 @@ def add_trial_measurement( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "add_trial_measurement" not in self._stubs: - self._stubs["add_trial_measurement"] = self.grpc_channel.unary_unary( + self._stubs["add_trial_measurement"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.VizierService/AddTrialMeasurement", request_serializer=vizier_service.AddTrialMeasurementRequest.serialize, response_deserializer=study.Trial.deserialize, @@ -550,7 +638,7 @@ def complete_trial( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "complete_trial" not in self._stubs: - self._stubs["complete_trial"] = self.grpc_channel.unary_unary( + self._stubs["complete_trial"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.VizierService/CompleteTrial", request_serializer=vizier_service.CompleteTrialRequest.serialize, response_deserializer=study.Trial.deserialize, @@ -576,7 +664,7 @@ def delete_trial( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_trial" not in self._stubs: - self._stubs["delete_trial"] = self.grpc_channel.unary_unary( + self._stubs["delete_trial"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.VizierService/DeleteTrial", request_serializer=vizier_service.DeleteTrialRequest.serialize, response_deserializer=empty_pb2.Empty.FromString, @@ -610,7 +698,7 @@ def check_trial_early_stopping_state( if "check_trial_early_stopping_state" not in self._stubs: self._stubs[ "check_trial_early_stopping_state" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.VizierService/CheckTrialEarlyStoppingState", request_serializer=vizier_service.CheckTrialEarlyStoppingStateRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -634,7 +722,7 @@ def stop_trial(self) -> Callable[[vizier_service.StopTrialRequest], study.Trial] # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "stop_trial" not in self._stubs: - self._stubs["stop_trial"] = self.grpc_channel.unary_unary( + self._stubs["stop_trial"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.VizierService/StopTrial", request_serializer=vizier_service.StopTrialRequest.serialize, response_deserializer=study.Trial.deserialize, @@ -666,7 +754,7 @@ def list_optimal_trials( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_optimal_trials" not in self._stubs: - self._stubs["list_optimal_trials"] = self.grpc_channel.unary_unary( + self._stubs["list_optimal_trials"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.VizierService/ListOptimalTrials", request_serializer=vizier_service.ListOptimalTrialsRequest.serialize, response_deserializer=vizier_service.ListOptimalTrialsResponse.deserialize, @@ -674,7 +762,7 @@ def list_optimal_trials( return self._stubs["list_optimal_trials"] def close(self): - self.grpc_channel.close() + self._logged_channel.close() @property def delete_operation( @@ -686,7 +774,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, @@ -703,7 +791,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -720,7 +808,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -737,7 +825,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, @@ -756,7 +844,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, @@ -775,7 +863,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -792,7 +880,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -817,7 +905,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -843,7 +931,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -872,7 +960,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1beta1/services/vizier_service/transports/grpc_asyncio.py b/google/cloud/aiplatform_v1beta1/services/vizier_service/transports/grpc_asyncio.py index 61e7c5013e..b549156303 100644 --- a/google/cloud/aiplatform_v1beta1/services/vizier_service/transports/grpc_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/vizier_service/transports/grpc_asyncio.py @@ -14,6 +14,9 @@ # limitations under the License. # import inspect +import json +import pickle +import logging as std_logging import warnings from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union @@ -24,8 +27,11 @@ from google.api_core import operations_v1 from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore +from google.protobuf.json_format import MessageToJson +import google.protobuf.message import grpc # type: ignore +import proto # type: ignore from grpc.experimental import aio # type: ignore from google.cloud.aiplatform_v1beta1.types import study @@ -39,6 +45,82 @@ from .base import VizierServiceTransport, DEFAULT_CLIENT_INFO from .grpc import VizierServiceGrpcTransport +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.aiplatform.v1beta1.VizierService", + "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.aiplatform.v1beta1.VizierService", + "rpcName": str(client_call_details.method), + "response": grpc_response, + "metadata": grpc_response["metadata"], + }, + ) + return response + class VizierServiceGrpcAsyncIOTransport(VizierServiceTransport): """gRPC AsyncIO backend transport for VizierService. @@ -240,10 +322,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 @@ -266,7 +351,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. @@ -292,7 +377,7 @@ def create_study( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_study" not in self._stubs: - self._stubs["create_study"] = self.grpc_channel.unary_unary( + self._stubs["create_study"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.VizierService/CreateStudy", request_serializer=vizier_service.CreateStudyRequest.serialize, response_deserializer=gca_study.Study.deserialize, @@ -318,7 +403,7 @@ def get_study( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_study" not in self._stubs: - self._stubs["get_study"] = self.grpc_channel.unary_unary( + self._stubs["get_study"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.VizierService/GetStudy", request_serializer=vizier_service.GetStudyRequest.serialize, response_deserializer=study.Study.deserialize, @@ -348,7 +433,7 @@ def list_studies( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_studies" not in self._stubs: - self._stubs["list_studies"] = self.grpc_channel.unary_unary( + self._stubs["list_studies"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.VizierService/ListStudies", request_serializer=vizier_service.ListStudiesRequest.serialize, response_deserializer=vizier_service.ListStudiesResponse.deserialize, @@ -374,7 +459,7 @@ def delete_study( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_study" not in self._stubs: - self._stubs["delete_study"] = self.grpc_channel.unary_unary( + self._stubs["delete_study"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.VizierService/DeleteStudy", request_serializer=vizier_service.DeleteStudyRequest.serialize, response_deserializer=empty_pb2.Empty.FromString, @@ -401,7 +486,7 @@ def lookup_study( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "lookup_study" not in self._stubs: - self._stubs["lookup_study"] = self.grpc_channel.unary_unary( + self._stubs["lookup_study"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.VizierService/LookupStudy", request_serializer=vizier_service.LookupStudyRequest.serialize, response_deserializer=study.Study.deserialize, @@ -433,7 +518,7 @@ def suggest_trials( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "suggest_trials" not in self._stubs: - self._stubs["suggest_trials"] = self.grpc_channel.unary_unary( + self._stubs["suggest_trials"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.VizierService/SuggestTrials", request_serializer=vizier_service.SuggestTrialsRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -459,7 +544,7 @@ def create_trial( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "create_trial" not in self._stubs: - self._stubs["create_trial"] = self.grpc_channel.unary_unary( + self._stubs["create_trial"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.VizierService/CreateTrial", request_serializer=vizier_service.CreateTrialRequest.serialize, response_deserializer=study.Trial.deserialize, @@ -485,7 +570,7 @@ def get_trial( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_trial" not in self._stubs: - self._stubs["get_trial"] = self.grpc_channel.unary_unary( + self._stubs["get_trial"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.VizierService/GetTrial", request_serializer=vizier_service.GetTrialRequest.serialize, response_deserializer=study.Trial.deserialize, @@ -513,7 +598,7 @@ def list_trials( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_trials" not in self._stubs: - self._stubs["list_trials"] = self.grpc_channel.unary_unary( + self._stubs["list_trials"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.VizierService/ListTrials", request_serializer=vizier_service.ListTrialsRequest.serialize, response_deserializer=vizier_service.ListTrialsResponse.deserialize, @@ -541,7 +626,7 @@ def add_trial_measurement( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "add_trial_measurement" not in self._stubs: - self._stubs["add_trial_measurement"] = self.grpc_channel.unary_unary( + self._stubs["add_trial_measurement"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.VizierService/AddTrialMeasurement", request_serializer=vizier_service.AddTrialMeasurementRequest.serialize, response_deserializer=study.Trial.deserialize, @@ -567,7 +652,7 @@ def complete_trial( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "complete_trial" not in self._stubs: - self._stubs["complete_trial"] = self.grpc_channel.unary_unary( + self._stubs["complete_trial"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.VizierService/CompleteTrial", request_serializer=vizier_service.CompleteTrialRequest.serialize, response_deserializer=study.Trial.deserialize, @@ -593,7 +678,7 @@ def delete_trial( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "delete_trial" not in self._stubs: - self._stubs["delete_trial"] = self.grpc_channel.unary_unary( + self._stubs["delete_trial"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.VizierService/DeleteTrial", request_serializer=vizier_service.DeleteTrialRequest.serialize, response_deserializer=empty_pb2.Empty.FromString, @@ -628,7 +713,7 @@ def check_trial_early_stopping_state( if "check_trial_early_stopping_state" not in self._stubs: self._stubs[ "check_trial_early_stopping_state" - ] = self.grpc_channel.unary_unary( + ] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.VizierService/CheckTrialEarlyStoppingState", request_serializer=vizier_service.CheckTrialEarlyStoppingStateRequest.serialize, response_deserializer=operations_pb2.Operation.FromString, @@ -654,7 +739,7 @@ def stop_trial( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "stop_trial" not in self._stubs: - self._stubs["stop_trial"] = self.grpc_channel.unary_unary( + self._stubs["stop_trial"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.VizierService/StopTrial", request_serializer=vizier_service.StopTrialRequest.serialize, response_deserializer=study.Trial.deserialize, @@ -686,7 +771,7 @@ def list_optimal_trials( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_optimal_trials" not in self._stubs: - self._stubs["list_optimal_trials"] = self.grpc_channel.unary_unary( + self._stubs["list_optimal_trials"] = self._logged_channel.unary_unary( "/google.cloud.aiplatform.v1beta1.VizierService/ListOptimalTrials", request_serializer=vizier_service.ListOptimalTrialsRequest.serialize, response_deserializer=vizier_service.ListOptimalTrialsResponse.deserialize, @@ -829,7 +914,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: @@ -845,7 +930,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, @@ -862,7 +947,7 @@ def cancel_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "cancel_operation" not in self._stubs: - self._stubs["cancel_operation"] = self.grpc_channel.unary_unary( + self._stubs["cancel_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/CancelOperation", request_serializer=operations_pb2.CancelOperationRequest.SerializeToString, response_deserializer=None, @@ -879,7 +964,7 @@ def wait_operation( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "wait_operation" not in self._stubs: - self._stubs["wait_operation"] = self.grpc_channel.unary_unary( + self._stubs["wait_operation"] = self._logged_channel.unary_unary( "/google.longrunning.Operations/WaitOperation", request_serializer=operations_pb2.WaitOperationRequest.SerializeToString, response_deserializer=None, @@ -896,7 +981,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, @@ -915,7 +1000,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, @@ -934,7 +1019,7 @@ def list_locations( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "list_locations" not in self._stubs: - self._stubs["list_locations"] = self.grpc_channel.unary_unary( + self._stubs["list_locations"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/ListLocations", request_serializer=locations_pb2.ListLocationsRequest.SerializeToString, response_deserializer=locations_pb2.ListLocationsResponse.FromString, @@ -951,7 +1036,7 @@ def get_location( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_location" not in self._stubs: - self._stubs["get_location"] = self.grpc_channel.unary_unary( + self._stubs["get_location"] = self._logged_channel.unary_unary( "/google.cloud.location.Locations/GetLocation", request_serializer=locations_pb2.GetLocationRequest.SerializeToString, response_deserializer=locations_pb2.Location.FromString, @@ -976,7 +1061,7 @@ def set_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "set_iam_policy" not in self._stubs: - self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["set_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/SetIamPolicy", request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -1002,7 +1087,7 @@ def get_iam_policy( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "get_iam_policy" not in self._stubs: - self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( + self._stubs["get_iam_policy"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/GetIamPolicy", request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString, response_deserializer=policy_pb2.Policy.FromString, @@ -1031,7 +1116,7 @@ def test_iam_permissions( # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. if "test_iam_permissions" not in self._stubs: - self._stubs["test_iam_permissions"] = self.grpc_channel.unary_unary( + self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary( "/google.iam.v1.IAMPolicy/TestIamPermissions", request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString, response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString, diff --git a/google/cloud/aiplatform_v1beta1/services/vizier_service/transports/rest.py b/google/cloud/aiplatform_v1beta1/services/vizier_service/transports/rest.py index c092f2f131..47cc6eeeba 100644 --- a/google/cloud/aiplatform_v1beta1/services/vizier_service/transports/rest.py +++ b/google/cloud/aiplatform_v1beta1/services/vizier_service/transports/rest.py @@ -13,9 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging +import json # type: ignore from google.auth.transport.requests import AuthorizedSession # type: ignore -import json # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.api_core import exceptions as core_exceptions from google.api_core import retry as retries @@ -50,6 +51,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, @@ -194,8 +203,11 @@ def post_suggest_trials(self, response): def pre_add_trial_measurement( self, request: vizier_service.AddTrialMeasurementRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[vizier_service.AddTrialMeasurementRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + vizier_service.AddTrialMeasurementRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for add_trial_measurement Override in a subclass to manipulate the request or metadata @@ -215,9 +227,10 @@ def post_add_trial_measurement(self, response: study.Trial) -> study.Trial: def pre_check_trial_early_stopping_state( self, request: vizier_service.CheckTrialEarlyStoppingStateRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - vizier_service.CheckTrialEarlyStoppingStateRequest, Sequence[Tuple[str, str]] + vizier_service.CheckTrialEarlyStoppingStateRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for check_trial_early_stopping_state @@ -240,8 +253,10 @@ def post_check_trial_early_stopping_state( def pre_complete_trial( self, request: vizier_service.CompleteTrialRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[vizier_service.CompleteTrialRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + vizier_service.CompleteTrialRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for complete_trial Override in a subclass to manipulate the request or metadata @@ -261,8 +276,10 @@ def post_complete_trial(self, response: study.Trial) -> study.Trial: def pre_create_study( self, request: vizier_service.CreateStudyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[vizier_service.CreateStudyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + vizier_service.CreateStudyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for create_study Override in a subclass to manipulate the request or metadata @@ -282,8 +299,10 @@ def post_create_study(self, response: gca_study.Study) -> gca_study.Study: def pre_create_trial( self, request: vizier_service.CreateTrialRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[vizier_service.CreateTrialRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + vizier_service.CreateTrialRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for create_trial Override in a subclass to manipulate the request or metadata @@ -303,8 +322,10 @@ def post_create_trial(self, response: study.Trial) -> study.Trial: def pre_delete_study( self, request: vizier_service.DeleteStudyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[vizier_service.DeleteStudyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + vizier_service.DeleteStudyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for delete_study Override in a subclass to manipulate the request or metadata @@ -315,8 +336,10 @@ def pre_delete_study( def pre_delete_trial( self, request: vizier_service.DeleteTrialRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[vizier_service.DeleteTrialRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + vizier_service.DeleteTrialRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for delete_trial Override in a subclass to manipulate the request or metadata @@ -327,8 +350,8 @@ def pre_delete_trial( def pre_get_study( self, request: vizier_service.GetStudyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[vizier_service.GetStudyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[vizier_service.GetStudyRequest, Sequence[Tuple[str, Union[str, bytes]]]]: """Pre-rpc interceptor for get_study Override in a subclass to manipulate the request or metadata @@ -348,8 +371,8 @@ def post_get_study(self, response: study.Study) -> study.Study: def pre_get_trial( self, request: vizier_service.GetTrialRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[vizier_service.GetTrialRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[vizier_service.GetTrialRequest, Sequence[Tuple[str, Union[str, bytes]]]]: """Pre-rpc interceptor for get_trial Override in a subclass to manipulate the request or metadata @@ -369,8 +392,10 @@ def post_get_trial(self, response: study.Trial) -> study.Trial: def pre_list_optimal_trials( self, request: vizier_service.ListOptimalTrialsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[vizier_service.ListOptimalTrialsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + vizier_service.ListOptimalTrialsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_optimal_trials Override in a subclass to manipulate the request or metadata @@ -392,8 +417,10 @@ def post_list_optimal_trials( def pre_list_studies( self, request: vizier_service.ListStudiesRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[vizier_service.ListStudiesRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + vizier_service.ListStudiesRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_studies Override in a subclass to manipulate the request or metadata @@ -415,8 +442,10 @@ def post_list_studies( def pre_list_trials( self, request: vizier_service.ListTrialsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[vizier_service.ListTrialsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + vizier_service.ListTrialsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_trials Override in a subclass to manipulate the request or metadata @@ -438,8 +467,10 @@ def post_list_trials( def pre_lookup_study( self, request: vizier_service.LookupStudyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[vizier_service.LookupStudyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + vizier_service.LookupStudyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for lookup_study Override in a subclass to manipulate the request or metadata @@ -459,8 +490,10 @@ def post_lookup_study(self, response: study.Study) -> study.Study: def pre_stop_trial( self, request: vizier_service.StopTrialRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[vizier_service.StopTrialRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + vizier_service.StopTrialRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for stop_trial Override in a subclass to manipulate the request or metadata @@ -480,8 +513,10 @@ def post_stop_trial(self, response: study.Trial) -> study.Trial: def pre_suggest_trials( self, request: vizier_service.SuggestTrialsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[vizier_service.SuggestTrialsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + vizier_service.SuggestTrialsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for suggest_trials Override in a subclass to manipulate the request or metadata @@ -503,8 +538,10 @@ def post_suggest_trials( def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -526,8 +563,10 @@ def post_get_location( def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -549,8 +588,10 @@ def post_list_locations( def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -570,8 +611,10 @@ def post_get_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -591,8 +634,11 @@ def post_set_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy: def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -614,8 +660,10 @@ def post_test_iam_permissions( def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -635,8 +683,10 @@ def post_cancel_operation(self, response: None) -> None: 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 @@ -656,8 +706,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 @@ -679,8 +731,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 @@ -702,8 +756,10 @@ def post_list_operations( def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -1387,6 +1443,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -1603,6 +1663,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -1809,6 +1873,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}", @@ -2025,6 +2093,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, ], "google.longrunning.Operations.ListOperations": [ { @@ -2223,6 +2295,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*}/operations", @@ -2439,6 +2515,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*}/operations", + }, ], "google.longrunning.Operations.WaitOperation": [ { @@ -2637,6 +2717,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "post", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}:wait", @@ -2849,6 +2933,10 @@ def operations_client(self) -> operations_v1.AbstractOperationsClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, ], } @@ -2904,7 +2992,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]]] = (), ) -> study.Trial: r"""Call the add trial measurement method over HTTP. @@ -2915,8 +3003,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: ~.study.Trial: @@ -2931,6 +3021,7 @@ def __call__( http_options = ( _BaseVizierServiceRestTransport._BaseAddTrialMeasurement._get_http_options() ) + request, metadata = self._interceptor.pre_add_trial_measurement( request, metadata ) @@ -2947,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.aiplatform_v1beta1.VizierServiceClient.AddTrialMeasurement", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VizierService", + "rpcName": "AddTrialMeasurement", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = VizierServiceRestTransport._AddTrialMeasurement._get_response( self._host, @@ -2968,7 +3086,29 @@ def __call__( pb_resp = study.Trial.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_add_trial_measurement(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = study.Trial.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.aiplatform_v1beta1.VizierServiceClient.add_trial_measurement", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VizierService", + "rpcName": "AddTrialMeasurement", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _CheckTrialEarlyStoppingState( @@ -3008,7 +3148,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 trial early stopping state method over HTTP. @@ -3020,8 +3160,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: @@ -3034,6 +3176,7 @@ def __call__( http_options = ( _BaseVizierServiceRestTransport._BaseCheckTrialEarlyStoppingState._get_http_options() ) + request, metadata = self._interceptor.pre_check_trial_early_stopping_state( request, metadata ) @@ -3050,6 +3193,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.aiplatform_v1beta1.VizierServiceClient.CheckTrialEarlyStoppingState", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VizierService", + "rpcName": "CheckTrialEarlyStoppingState", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( VizierServiceRestTransport._CheckTrialEarlyStoppingState._get_response( @@ -3071,7 +3241,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_trial_early_stopping_state(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.aiplatform_v1beta1.VizierServiceClient.check_trial_early_stopping_state", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VizierService", + "rpcName": "CheckTrialEarlyStoppingState", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _CompleteTrial( @@ -3110,7 +3302,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]]] = (), ) -> study.Trial: r"""Call the complete trial method over HTTP. @@ -3121,8 +3313,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: ~.study.Trial: @@ -3137,6 +3331,7 @@ def __call__( http_options = ( _BaseVizierServiceRestTransport._BaseCompleteTrial._get_http_options() ) + request, metadata = self._interceptor.pre_complete_trial(request, metadata) transcoded_request = _BaseVizierServiceRestTransport._BaseCompleteTrial._get_transcoded_request( http_options, request @@ -3151,6 +3346,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.aiplatform_v1beta1.VizierServiceClient.CompleteTrial", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VizierService", + "rpcName": "CompleteTrial", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = VizierServiceRestTransport._CompleteTrial._get_response( self._host, @@ -3172,7 +3394,29 @@ def __call__( pb_resp = study.Trial.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_complete_trial(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = study.Trial.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.aiplatform_v1beta1.VizierServiceClient.complete_trial", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VizierService", + "rpcName": "CompleteTrial", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _CreateStudy( @@ -3211,7 +3455,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]]] = (), ) -> gca_study.Study: r"""Call the create study method over HTTP. @@ -3222,8 +3466,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: ~.gca_study.Study: @@ -3233,6 +3479,7 @@ def __call__( http_options = ( _BaseVizierServiceRestTransport._BaseCreateStudy._get_http_options() ) + request, metadata = self._interceptor.pre_create_study(request, metadata) transcoded_request = _BaseVizierServiceRestTransport._BaseCreateStudy._get_transcoded_request( http_options, request @@ -3251,6 +3498,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 = 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.aiplatform_v1beta1.VizierServiceClient.CreateStudy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VizierService", + "rpcName": "CreateStudy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = VizierServiceRestTransport._CreateStudy._get_response( self._host, @@ -3272,7 +3546,29 @@ def __call__( pb_resp = gca_study.Study.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_create_study(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gca_study.Study.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.aiplatform_v1beta1.VizierServiceClient.create_study", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VizierService", + "rpcName": "CreateStudy", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _CreateTrial( @@ -3311,7 +3607,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]]] = (), ) -> study.Trial: r"""Call the create trial method over HTTP. @@ -3322,8 +3618,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: ~.study.Trial: @@ -3338,6 +3636,7 @@ def __call__( http_options = ( _BaseVizierServiceRestTransport._BaseCreateTrial._get_http_options() ) + request, metadata = self._interceptor.pre_create_trial(request, metadata) transcoded_request = _BaseVizierServiceRestTransport._BaseCreateTrial._get_transcoded_request( http_options, request @@ -3356,6 +3655,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 = 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.aiplatform_v1beta1.VizierServiceClient.CreateTrial", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VizierService", + "rpcName": "CreateTrial", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = VizierServiceRestTransport._CreateTrial._get_response( self._host, @@ -3377,7 +3703,29 @@ def __call__( pb_resp = study.Trial.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_create_trial(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = study.Trial.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.aiplatform_v1beta1.VizierServiceClient.create_trial", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VizierService", + "rpcName": "CreateTrial", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _DeleteStudy( @@ -3415,7 +3763,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 study method over HTTP. @@ -3426,13 +3774,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 = ( _BaseVizierServiceRestTransport._BaseDeleteStudy._get_http_options() ) + request, metadata = self._interceptor.pre_delete_study(request, metadata) transcoded_request = _BaseVizierServiceRestTransport._BaseDeleteStudy._get_transcoded_request( http_options, request @@ -3445,6 +3796,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.aiplatform_v1beta1.VizierServiceClient.DeleteStudy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VizierService", + "rpcName": "DeleteStudy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = VizierServiceRestTransport._DeleteStudy._get_response( self._host, @@ -3495,7 +3873,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 trial method over HTTP. @@ -3506,13 +3884,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 = ( _BaseVizierServiceRestTransport._BaseDeleteTrial._get_http_options() ) + request, metadata = self._interceptor.pre_delete_trial(request, metadata) transcoded_request = _BaseVizierServiceRestTransport._BaseDeleteTrial._get_transcoded_request( http_options, request @@ -3525,6 +3906,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.aiplatform_v1beta1.VizierServiceClient.DeleteTrial", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VizierService", + "rpcName": "DeleteTrial", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = VizierServiceRestTransport._DeleteTrial._get_response( self._host, @@ -3575,7 +3983,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]]] = (), ) -> study.Study: r"""Call the get study method over HTTP. @@ -3586,8 +3994,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: ~.study.Study: @@ -3597,6 +4007,7 @@ def __call__( http_options = ( _BaseVizierServiceRestTransport._BaseGetStudy._get_http_options() ) + request, metadata = self._interceptor.pre_get_study(request, metadata) transcoded_request = ( _BaseVizierServiceRestTransport._BaseGetStudy._get_transcoded_request( @@ -3611,6 +4022,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 = 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.aiplatform_v1beta1.VizierServiceClient.GetStudy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VizierService", + "rpcName": "GetStudy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = VizierServiceRestTransport._GetStudy._get_response( self._host, @@ -3631,7 +4069,29 @@ def __call__( pb_resp = study.Study.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_study(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = study.Study.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.aiplatform_v1beta1.VizierServiceClient.get_study", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VizierService", + "rpcName": "GetStudy", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _GetTrial( @@ -3669,7 +4129,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]]] = (), ) -> study.Trial: r"""Call the get trial method over HTTP. @@ -3680,8 +4140,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: ~.study.Trial: @@ -3696,6 +4158,7 @@ def __call__( http_options = ( _BaseVizierServiceRestTransport._BaseGetTrial._get_http_options() ) + request, metadata = self._interceptor.pre_get_trial(request, metadata) transcoded_request = ( _BaseVizierServiceRestTransport._BaseGetTrial._get_transcoded_request( @@ -3710,6 +4173,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 = 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.aiplatform_v1beta1.VizierServiceClient.GetTrial", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VizierService", + "rpcName": "GetTrial", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = VizierServiceRestTransport._GetTrial._get_response( self._host, @@ -3730,7 +4220,29 @@ def __call__( pb_resp = study.Trial.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_trial(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = study.Trial.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.aiplatform_v1beta1.VizierServiceClient.get_trial", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VizierService", + "rpcName": "GetTrial", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListOptimalTrials( @@ -3769,7 +4281,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]]] = (), ) -> vizier_service.ListOptimalTrialsResponse: r"""Call the list optimal trials method over HTTP. @@ -3780,8 +4292,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: ~.vizier_service.ListOptimalTrialsResponse: @@ -3793,6 +4307,7 @@ def __call__( http_options = ( _BaseVizierServiceRestTransport._BaseListOptimalTrials._get_http_options() ) + request, metadata = self._interceptor.pre_list_optimal_trials( request, metadata ) @@ -3809,6 +4324,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.aiplatform_v1beta1.VizierServiceClient.ListOptimalTrials", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VizierService", + "rpcName": "ListOptimalTrials", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = VizierServiceRestTransport._ListOptimalTrials._get_response( self._host, @@ -3830,7 +4372,31 @@ def __call__( pb_resp = vizier_service.ListOptimalTrialsResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_optimal_trials(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = vizier_service.ListOptimalTrialsResponse.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.aiplatform_v1beta1.VizierServiceClient.list_optimal_trials", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VizierService", + "rpcName": "ListOptimalTrials", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListStudies( @@ -3868,7 +4434,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]]] = (), ) -> vizier_service.ListStudiesResponse: r"""Call the list studies method over HTTP. @@ -3879,8 +4445,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: ~.vizier_service.ListStudiesResponse: @@ -3892,6 +4460,7 @@ def __call__( http_options = ( _BaseVizierServiceRestTransport._BaseListStudies._get_http_options() ) + request, metadata = self._interceptor.pre_list_studies(request, metadata) transcoded_request = _BaseVizierServiceRestTransport._BaseListStudies._get_transcoded_request( http_options, request @@ -3904,6 +4473,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 = 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.aiplatform_v1beta1.VizierServiceClient.ListStudies", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VizierService", + "rpcName": "ListStudies", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = VizierServiceRestTransport._ListStudies._get_response( self._host, @@ -3924,7 +4520,31 @@ def __call__( pb_resp = vizier_service.ListStudiesResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_studies(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = vizier_service.ListStudiesResponse.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.aiplatform_v1beta1.VizierServiceClient.list_studies", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VizierService", + "rpcName": "ListStudies", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _ListTrials( @@ -3962,7 +4582,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]]] = (), ) -> vizier_service.ListTrialsResponse: r"""Call the list trials method over HTTP. @@ -3973,8 +4593,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: ~.vizier_service.ListTrialsResponse: @@ -3986,6 +4608,7 @@ def __call__( http_options = ( _BaseVizierServiceRestTransport._BaseListTrials._get_http_options() ) + request, metadata = self._interceptor.pre_list_trials(request, metadata) transcoded_request = ( _BaseVizierServiceRestTransport._BaseListTrials._get_transcoded_request( @@ -4000,6 +4623,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 = 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.aiplatform_v1beta1.VizierServiceClient.ListTrials", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VizierService", + "rpcName": "ListTrials", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = VizierServiceRestTransport._ListTrials._get_response( self._host, @@ -4020,7 +4670,31 @@ def __call__( pb_resp = vizier_service.ListTrialsResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_list_trials(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = vizier_service.ListTrialsResponse.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.aiplatform_v1beta1.VizierServiceClient.list_trials", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VizierService", + "rpcName": "ListTrials", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _LookupStudy( @@ -4059,7 +4733,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]]] = (), ) -> study.Study: r"""Call the lookup study method over HTTP. @@ -4070,8 +4744,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: ~.study.Study: @@ -4081,6 +4757,7 @@ def __call__( http_options = ( _BaseVizierServiceRestTransport._BaseLookupStudy._get_http_options() ) + request, metadata = self._interceptor.pre_lookup_study(request, metadata) transcoded_request = _BaseVizierServiceRestTransport._BaseLookupStudy._get_transcoded_request( http_options, request @@ -4099,6 +4776,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 = 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.aiplatform_v1beta1.VizierServiceClient.LookupStudy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VizierService", + "rpcName": "LookupStudy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = VizierServiceRestTransport._LookupStudy._get_response( self._host, @@ -4120,7 +4824,29 @@ def __call__( pb_resp = study.Study.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_lookup_study(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = study.Study.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.aiplatform_v1beta1.VizierServiceClient.lookup_study", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VizierService", + "rpcName": "LookupStudy", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _StopTrial( @@ -4159,7 +4885,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]]] = (), ) -> study.Trial: r"""Call the stop trial method over HTTP. @@ -4170,8 +4896,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: ~.study.Trial: @@ -4186,6 +4914,7 @@ def __call__( http_options = ( _BaseVizierServiceRestTransport._BaseStopTrial._get_http_options() ) + request, metadata = self._interceptor.pre_stop_trial(request, metadata) transcoded_request = ( _BaseVizierServiceRestTransport._BaseStopTrial._get_transcoded_request( @@ -4206,6 +4935,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 = 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.aiplatform_v1beta1.VizierServiceClient.StopTrial", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VizierService", + "rpcName": "StopTrial", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = VizierServiceRestTransport._StopTrial._get_response( self._host, @@ -4227,7 +4983,29 @@ def __call__( pb_resp = study.Trial.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_stop_trial(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = study.Trial.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.aiplatform_v1beta1.VizierServiceClient.stop_trial", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VizierService", + "rpcName": "StopTrial", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp class _SuggestTrials( @@ -4266,7 +5044,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 suggest trials method over HTTP. @@ -4277,8 +5055,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: @@ -4291,6 +5071,7 @@ def __call__( http_options = ( _BaseVizierServiceRestTransport._BaseSuggestTrials._get_http_options() ) + request, metadata = self._interceptor.pre_suggest_trials(request, metadata) transcoded_request = _BaseVizierServiceRestTransport._BaseSuggestTrials._get_transcoded_request( http_options, request @@ -4305,6 +5086,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.aiplatform_v1beta1.VizierServiceClient.SuggestTrials", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VizierService", + "rpcName": "SuggestTrials", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = VizierServiceRestTransport._SuggestTrials._get_response( self._host, @@ -4324,7 +5132,29 @@ def __call__( # Return the response resp = operations_pb2.Operation() json_format.Parse(response.content, resp, ignore_unknown_fields=True) + resp = self._interceptor.post_suggest_trials(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.aiplatform_v1beta1.VizierServiceClient.suggest_trials", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VizierService", + "rpcName": "SuggestTrials", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) return resp @property @@ -4489,7 +5319,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]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -4500,8 +5330,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: locations_pb2.Location: Response from GetLocation method. @@ -4510,6 +5342,7 @@ def __call__( http_options = ( _BaseVizierServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = self._interceptor.pre_get_location(request, metadata) transcoded_request = _BaseVizierServiceRestTransport._BaseGetLocation._get_transcoded_request( http_options, request @@ -4522,6 +5355,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.aiplatform_v1beta1.VizierServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VizierService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = VizierServiceRestTransport._GetLocation._get_response( self._host, @@ -4541,6 +5401,27 @@ def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_location(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.aiplatform_v1beta1.VizierServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VizierService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4582,7 +5463,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]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -4593,8 +5474,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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -4603,6 +5486,7 @@ def __call__( http_options = ( _BaseVizierServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = self._interceptor.pre_list_locations(request, metadata) transcoded_request = _BaseVizierServiceRestTransport._BaseListLocations._get_transcoded_request( http_options, request @@ -4613,6 +5497,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.aiplatform_v1beta1.VizierServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VizierService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = VizierServiceRestTransport._ListLocations._get_response( self._host, @@ -4632,6 +5543,27 @@ def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_list_locations(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.aiplatform_v1beta1.VizierServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VizierService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4674,7 +5606,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]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -4685,8 +5617,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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -4695,6 +5629,7 @@ def __call__( http_options = ( _BaseVizierServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_get_iam_policy(request, metadata) transcoded_request = _BaseVizierServiceRestTransport._BaseGetIamPolicy._get_transcoded_request( http_options, request @@ -4709,6 +5644,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.aiplatform_v1beta1.VizierServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VizierService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = VizierServiceRestTransport._GetIamPolicy._get_response( self._host, @@ -4729,6 +5691,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_get_iam_policy(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.aiplatform_v1beta1.VizierServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VizierService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4771,7 +5754,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]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -4782,8 +5765,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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -4792,6 +5777,7 @@ def __call__( http_options = ( _BaseVizierServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = self._interceptor.pre_set_iam_policy(request, metadata) transcoded_request = _BaseVizierServiceRestTransport._BaseSetIamPolicy._get_transcoded_request( http_options, request @@ -4806,6 +5792,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.aiplatform_v1beta1.VizierServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VizierService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = VizierServiceRestTransport._SetIamPolicy._get_response( self._host, @@ -4826,6 +5839,27 @@ def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = self._interceptor.post_set_iam_policy(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.aiplatform_v1beta1.VizierServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VizierService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4868,7 +5902,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]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -4879,8 +5913,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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -4889,6 +5925,7 @@ def __call__( http_options = ( _BaseVizierServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -4905,6 +5942,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.aiplatform_v1beta1.VizierServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VizierService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = VizierServiceRestTransport._TestIamPermissions._get_response( self._host, @@ -4925,6 +5989,27 @@ def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = self._interceptor.post_test_iam_permissions(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.aiplatform_v1beta1.VizierServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VizierService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4966,7 +6051,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 cancel operation method over HTTP. @@ -4977,13 +6062,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 = ( _BaseVizierServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = self._interceptor.pre_cancel_operation( request, metadata ) @@ -4996,6 +6084,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.aiplatform_v1beta1.VizierServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VizierService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = VizierServiceRestTransport._CancelOperation._get_response( self._host, @@ -5052,7 +6167,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. @@ -5063,13 +6178,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 = ( _BaseVizierServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = self._interceptor.pre_delete_operation( request, metadata ) @@ -5082,6 +6200,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.aiplatform_v1beta1.VizierServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VizierService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = VizierServiceRestTransport._DeleteOperation._get_response( self._host, @@ -5138,7 +6283,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. @@ -5149,8 +6294,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. @@ -5159,6 +6306,7 @@ def __call__( http_options = ( _BaseVizierServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = self._interceptor.pre_get_operation(request, metadata) transcoded_request = _BaseVizierServiceRestTransport._BaseGetOperation._get_transcoded_request( http_options, request @@ -5169,6 +6317,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.aiplatform_v1beta1.VizierServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VizierService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = VizierServiceRestTransport._GetOperation._get_response( self._host, @@ -5188,6 +6363,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.aiplatform_v1beta1.VizierServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VizierService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5229,7 +6425,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. @@ -5240,8 +6436,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. @@ -5250,6 +6448,7 @@ def __call__( http_options = ( _BaseVizierServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = self._interceptor.pre_list_operations(request, metadata) transcoded_request = _BaseVizierServiceRestTransport._BaseListOperations._get_transcoded_request( http_options, request @@ -5260,6 +6459,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.aiplatform_v1beta1.VizierServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VizierService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = VizierServiceRestTransport._ListOperations._get_response( self._host, @@ -5279,6 +6505,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.aiplatform_v1beta1.VizierServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VizierService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5320,7 +6567,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 wait operation method over HTTP. @@ -5331,8 +6578,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 WaitOperation method. @@ -5341,6 +6590,7 @@ def __call__( http_options = ( _BaseVizierServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = self._interceptor.pre_wait_operation(request, metadata) transcoded_request = _BaseVizierServiceRestTransport._BaseWaitOperation._get_transcoded_request( http_options, request @@ -5351,6 +6601,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.aiplatform_v1beta1.VizierServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VizierService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = VizierServiceRestTransport._WaitOperation._get_response( self._host, @@ -5370,6 +6647,27 @@ def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = self._interceptor.post_wait_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.aiplatform_v1beta1.VizierServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VizierService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1beta1/services/vizier_service/transports/rest_asyncio.py b/google/cloud/aiplatform_v1beta1/services/vizier_service/transports/rest_asyncio.py index c3eccf8971..a472258357 100644 --- a/google/cloud/aiplatform_v1beta1/services/vizier_service/transports/rest_asyncio.py +++ b/google/cloud/aiplatform_v1beta1/services/vizier_service/transports/rest_asyncio.py @@ -61,6 +61,18 @@ from .base import DEFAULT_CLIENT_INFO as BASE_DEFAULT_CLIENT_INFO + +import logging + +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__) + try: OptionalRetry = Union[retries.AsyncRetry, gapic_v1.method._MethodDefault, None] except AttributeError: # pragma: NO COVER @@ -209,8 +221,11 @@ async def post_suggest_trials(self, response): async def pre_add_trial_measurement( self, request: vizier_service.AddTrialMeasurementRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[vizier_service.AddTrialMeasurementRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + vizier_service.AddTrialMeasurementRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for add_trial_measurement Override in a subclass to manipulate the request or metadata @@ -230,9 +245,10 @@ async def post_add_trial_measurement(self, response: study.Trial) -> study.Trial async def pre_check_trial_early_stopping_state( self, request: vizier_service.CheckTrialEarlyStoppingStateRequest, - metadata: Sequence[Tuple[str, str]], + metadata: Sequence[Tuple[str, Union[str, bytes]]], ) -> Tuple[ - vizier_service.CheckTrialEarlyStoppingStateRequest, Sequence[Tuple[str, str]] + vizier_service.CheckTrialEarlyStoppingStateRequest, + Sequence[Tuple[str, Union[str, bytes]]], ]: """Pre-rpc interceptor for check_trial_early_stopping_state @@ -255,8 +271,10 @@ async def post_check_trial_early_stopping_state( async def pre_complete_trial( self, request: vizier_service.CompleteTrialRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[vizier_service.CompleteTrialRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + vizier_service.CompleteTrialRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for complete_trial Override in a subclass to manipulate the request or metadata @@ -276,8 +294,10 @@ async def post_complete_trial(self, response: study.Trial) -> study.Trial: async def pre_create_study( self, request: vizier_service.CreateStudyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[vizier_service.CreateStudyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + vizier_service.CreateStudyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for create_study Override in a subclass to manipulate the request or metadata @@ -297,8 +317,10 @@ async def post_create_study(self, response: gca_study.Study) -> gca_study.Study: async def pre_create_trial( self, request: vizier_service.CreateTrialRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[vizier_service.CreateTrialRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + vizier_service.CreateTrialRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for create_trial Override in a subclass to manipulate the request or metadata @@ -318,8 +340,10 @@ async def post_create_trial(self, response: study.Trial) -> study.Trial: async def pre_delete_study( self, request: vizier_service.DeleteStudyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[vizier_service.DeleteStudyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + vizier_service.DeleteStudyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for delete_study Override in a subclass to manipulate the request or metadata @@ -330,8 +354,10 @@ async def pre_delete_study( async def pre_delete_trial( self, request: vizier_service.DeleteTrialRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[vizier_service.DeleteTrialRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + vizier_service.DeleteTrialRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for delete_trial Override in a subclass to manipulate the request or metadata @@ -342,8 +368,8 @@ async def pre_delete_trial( async def pre_get_study( self, request: vizier_service.GetStudyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[vizier_service.GetStudyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[vizier_service.GetStudyRequest, Sequence[Tuple[str, Union[str, bytes]]]]: """Pre-rpc interceptor for get_study Override in a subclass to manipulate the request or metadata @@ -363,8 +389,8 @@ async def post_get_study(self, response: study.Study) -> study.Study: async def pre_get_trial( self, request: vizier_service.GetTrialRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[vizier_service.GetTrialRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[vizier_service.GetTrialRequest, Sequence[Tuple[str, Union[str, bytes]]]]: """Pre-rpc interceptor for get_trial Override in a subclass to manipulate the request or metadata @@ -384,8 +410,10 @@ async def post_get_trial(self, response: study.Trial) -> study.Trial: async def pre_list_optimal_trials( self, request: vizier_service.ListOptimalTrialsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[vizier_service.ListOptimalTrialsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + vizier_service.ListOptimalTrialsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_optimal_trials Override in a subclass to manipulate the request or metadata @@ -407,8 +435,10 @@ async def post_list_optimal_trials( async def pre_list_studies( self, request: vizier_service.ListStudiesRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[vizier_service.ListStudiesRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + vizier_service.ListStudiesRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_studies Override in a subclass to manipulate the request or metadata @@ -430,8 +460,10 @@ async def post_list_studies( async def pre_list_trials( self, request: vizier_service.ListTrialsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[vizier_service.ListTrialsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + vizier_service.ListTrialsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_trials Override in a subclass to manipulate the request or metadata @@ -453,8 +485,10 @@ async def post_list_trials( async def pre_lookup_study( self, request: vizier_service.LookupStudyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[vizier_service.LookupStudyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + vizier_service.LookupStudyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for lookup_study Override in a subclass to manipulate the request or metadata @@ -474,8 +508,10 @@ async def post_lookup_study(self, response: study.Study) -> study.Study: async def pre_stop_trial( self, request: vizier_service.StopTrialRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[vizier_service.StopTrialRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + vizier_service.StopTrialRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for stop_trial Override in a subclass to manipulate the request or metadata @@ -495,8 +531,10 @@ async def post_stop_trial(self, response: study.Trial) -> study.Trial: async def pre_suggest_trials( self, request: vizier_service.SuggestTrialsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[vizier_service.SuggestTrialsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + vizier_service.SuggestTrialsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for suggest_trials Override in a subclass to manipulate the request or metadata @@ -518,8 +556,10 @@ async def post_suggest_trials( async def pre_get_location( self, request: locations_pb2.GetLocationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.GetLocationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_location Override in a subclass to manipulate the request or metadata @@ -541,8 +581,10 @@ async def post_get_location( async def pre_list_locations( self, request: locations_pb2.ListLocationsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[locations_pb2.ListLocationsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for list_locations Override in a subclass to manipulate the request or metadata @@ -564,8 +606,10 @@ async def post_list_locations( async def pre_get_iam_policy( self, request: iam_policy_pb2.GetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for get_iam_policy Override in a subclass to manipulate the request or metadata @@ -587,8 +631,10 @@ async def post_get_iam_policy( async def pre_set_iam_policy( self, request: iam_policy_pb2.SetIamPolicyRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for set_iam_policy Override in a subclass to manipulate the request or metadata @@ -610,8 +656,11 @@ async def post_set_iam_policy( async def pre_test_iam_permissions( self, request: iam_policy_pb2.TestIamPermissionsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + iam_policy_pb2.TestIamPermissionsRequest, + Sequence[Tuple[str, Union[str, bytes]]], + ]: """Pre-rpc interceptor for test_iam_permissions Override in a subclass to manipulate the request or metadata @@ -633,8 +682,10 @@ async def post_test_iam_permissions( async def pre_cancel_operation( self, request: operations_pb2.CancelOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.CancelOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for cancel_operation Override in a subclass to manipulate the request or metadata @@ -654,8 +705,10 @@ async def post_cancel_operation(self, response: None) -> None: async 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 @@ -675,8 +728,10 @@ async def post_delete_operation(self, response: None) -> None: async 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 @@ -698,8 +753,10 @@ async def post_get_operation( async 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 @@ -721,8 +778,10 @@ async def post_list_operations( async def pre_wait_operation( self, request: operations_pb2.WaitOperationRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[operations_pb2.WaitOperationRequest, Sequence[Tuple[str, str]]]: + metadata: Sequence[Tuple[str, Union[str, bytes]]], + ) -> Tuple[ + operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]] + ]: """Pre-rpc interceptor for wait_operation Override in a subclass to manipulate the request or metadata @@ -982,7 +1041,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> study.Trial: r"""Call the add trial measurement method over HTTP. @@ -993,8 +1052,10 @@ async def __call__( 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: ~.study.Trial: @@ -1009,6 +1070,7 @@ async def __call__( http_options = ( _BaseVizierServiceRestTransport._BaseAddTrialMeasurement._get_http_options() ) + request, metadata = await self._interceptor.pre_add_trial_measurement( request, metadata ) @@ -1025,6 +1087,33 @@ async 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.aiplatform_v1beta1.VizierServiceClient.AddTrialMeasurement", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VizierService", + "rpcName": "AddTrialMeasurement", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncVizierServiceRestTransport._AddTrialMeasurement._get_response( self._host, @@ -1053,6 +1142,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_add_trial_measurement(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = study.Trial.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.VizierServiceAsyncClient.add_trial_measurement", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VizierService", + "rpcName": "AddTrialMeasurement", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _CheckTrialEarlyStoppingState( @@ -1092,7 +1203,7 @@ async 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 trial early stopping state method over HTTP. @@ -1104,8 +1215,10 @@ async def __call__( 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: @@ -1118,6 +1231,7 @@ async def __call__( http_options = ( _BaseVizierServiceRestTransport._BaseCheckTrialEarlyStoppingState._get_http_options() ) + ( request, metadata, @@ -1137,6 +1251,33 @@ async 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.aiplatform_v1beta1.VizierServiceClient.CheckTrialEarlyStoppingState", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VizierService", + "rpcName": "CheckTrialEarlyStoppingState", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncVizierServiceRestTransport._CheckTrialEarlyStoppingState._get_response( self._host, @@ -1165,6 +1306,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_check_trial_early_stopping_state(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.VizierServiceAsyncClient.check_trial_early_stopping_state", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VizierService", + "rpcName": "CheckTrialEarlyStoppingState", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _CompleteTrial( @@ -1203,7 +1366,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> study.Trial: r"""Call the complete trial method over HTTP. @@ -1214,8 +1377,10 @@ async def __call__( 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: ~.study.Trial: @@ -1230,6 +1395,7 @@ async def __call__( http_options = ( _BaseVizierServiceRestTransport._BaseCompleteTrial._get_http_options() ) + request, metadata = await self._interceptor.pre_complete_trial( request, metadata ) @@ -1246,6 +1412,33 @@ async 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.aiplatform_v1beta1.VizierServiceClient.CompleteTrial", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VizierService", + "rpcName": "CompleteTrial", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncVizierServiceRestTransport._CompleteTrial._get_response( @@ -1276,6 +1469,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_complete_trial(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = study.Trial.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.VizierServiceAsyncClient.complete_trial", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VizierService", + "rpcName": "CompleteTrial", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _CreateStudy( @@ -1314,7 +1529,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> gca_study.Study: r"""Call the create study method over HTTP. @@ -1325,8 +1540,10 @@ async def __call__( 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: ~.gca_study.Study: @@ -1336,6 +1553,7 @@ async def __call__( http_options = ( _BaseVizierServiceRestTransport._BaseCreateStudy._get_http_options() ) + request, metadata = await self._interceptor.pre_create_study( request, metadata ) @@ -1356,6 +1574,33 @@ async 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 = 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.aiplatform_v1beta1.VizierServiceClient.CreateStudy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VizierService", + "rpcName": "CreateStudy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncVizierServiceRestTransport._CreateStudy._get_response( self._host, @@ -1384,6 +1629,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_create_study(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = gca_study.Study.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.VizierServiceAsyncClient.create_study", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VizierService", + "rpcName": "CreateStudy", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _CreateTrial( @@ -1422,7 +1689,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> study.Trial: r"""Call the create trial method over HTTP. @@ -1433,8 +1700,10 @@ async def __call__( 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: ~.study.Trial: @@ -1449,6 +1718,7 @@ async def __call__( http_options = ( _BaseVizierServiceRestTransport._BaseCreateTrial._get_http_options() ) + request, metadata = await self._interceptor.pre_create_trial( request, metadata ) @@ -1469,6 +1739,33 @@ async 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 = 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.aiplatform_v1beta1.VizierServiceClient.CreateTrial", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VizierService", + "rpcName": "CreateTrial", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncVizierServiceRestTransport._CreateTrial._get_response( self._host, @@ -1497,6 +1794,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_create_trial(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = study.Trial.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.VizierServiceAsyncClient.create_trial", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VizierService", + "rpcName": "CreateTrial", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _DeleteStudy( @@ -1534,7 +1853,7 @@ async 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 study method over HTTP. @@ -1545,13 +1864,16 @@ async def __call__( 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`. """ http_options = ( _BaseVizierServiceRestTransport._BaseDeleteStudy._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_study( request, metadata ) @@ -1566,6 +1888,33 @@ async 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.aiplatform_v1beta1.VizierServiceClient.DeleteStudy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VizierService", + "rpcName": "DeleteStudy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncVizierServiceRestTransport._DeleteStudy._get_response( self._host, @@ -1622,7 +1971,7 @@ async 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 trial method over HTTP. @@ -1633,13 +1982,16 @@ async def __call__( 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`. """ http_options = ( _BaseVizierServiceRestTransport._BaseDeleteTrial._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_trial( request, metadata ) @@ -1654,6 +2006,33 @@ async 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.aiplatform_v1beta1.VizierServiceClient.DeleteTrial", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VizierService", + "rpcName": "DeleteTrial", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncVizierServiceRestTransport._DeleteTrial._get_response( self._host, @@ -1710,7 +2089,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> study.Study: r"""Call the get study method over HTTP. @@ -1721,8 +2100,10 @@ async def __call__( 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: ~.study.Study: @@ -1732,6 +2113,7 @@ async def __call__( http_options = ( _BaseVizierServiceRestTransport._BaseGetStudy._get_http_options() ) + request, metadata = await self._interceptor.pre_get_study(request, metadata) transcoded_request = ( _BaseVizierServiceRestTransport._BaseGetStudy._get_transcoded_request( @@ -1746,6 +2128,33 @@ async 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 = 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.aiplatform_v1beta1.VizierServiceClient.GetStudy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VizierService", + "rpcName": "GetStudy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncVizierServiceRestTransport._GetStudy._get_response( self._host, @@ -1773,6 +2182,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_get_study(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = study.Study.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.VizierServiceAsyncClient.get_study", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VizierService", + "rpcName": "GetStudy", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _GetTrial( @@ -1810,7 +2241,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> study.Trial: r"""Call the get trial method over HTTP. @@ -1821,8 +2252,10 @@ async def __call__( 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: ~.study.Trial: @@ -1837,6 +2270,7 @@ async def __call__( http_options = ( _BaseVizierServiceRestTransport._BaseGetTrial._get_http_options() ) + request, metadata = await self._interceptor.pre_get_trial(request, metadata) transcoded_request = ( _BaseVizierServiceRestTransport._BaseGetTrial._get_transcoded_request( @@ -1851,6 +2285,33 @@ async 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 = 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.aiplatform_v1beta1.VizierServiceClient.GetTrial", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VizierService", + "rpcName": "GetTrial", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncVizierServiceRestTransport._GetTrial._get_response( self._host, @@ -1878,6 +2339,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_get_trial(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = study.Trial.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.VizierServiceAsyncClient.get_trial", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VizierService", + "rpcName": "GetTrial", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ListOptimalTrials( @@ -1917,7 +2400,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> vizier_service.ListOptimalTrialsResponse: r"""Call the list optimal trials method over HTTP. @@ -1928,8 +2411,10 @@ async def __call__( 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: ~.vizier_service.ListOptimalTrialsResponse: @@ -1941,6 +2426,7 @@ async def __call__( http_options = ( _BaseVizierServiceRestTransport._BaseListOptimalTrials._get_http_options() ) + request, metadata = await self._interceptor.pre_list_optimal_trials( request, metadata ) @@ -1957,6 +2443,33 @@ async 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.aiplatform_v1beta1.VizierServiceClient.ListOptimalTrials", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VizierService", + "rpcName": "ListOptimalTrials", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncVizierServiceRestTransport._ListOptimalTrials._get_response( @@ -1987,6 +2500,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_list_optimal_trials(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = vizier_service.ListOptimalTrialsResponse.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.VizierServiceAsyncClient.list_optimal_trials", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VizierService", + "rpcName": "ListOptimalTrials", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ListStudies( @@ -2024,7 +2561,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> vizier_service.ListStudiesResponse: r"""Call the list studies method over HTTP. @@ -2035,8 +2572,10 @@ async def __call__( 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: ~.vizier_service.ListStudiesResponse: @@ -2048,6 +2587,7 @@ async def __call__( http_options = ( _BaseVizierServiceRestTransport._BaseListStudies._get_http_options() ) + request, metadata = await self._interceptor.pre_list_studies( request, metadata ) @@ -2062,6 +2602,33 @@ async 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 = 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.aiplatform_v1beta1.VizierServiceClient.ListStudies", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VizierService", + "rpcName": "ListStudies", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncVizierServiceRestTransport._ListStudies._get_response( self._host, @@ -2089,6 +2656,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_list_studies(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = vizier_service.ListStudiesResponse.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.VizierServiceAsyncClient.list_studies", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VizierService", + "rpcName": "ListStudies", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _ListTrials( @@ -2126,7 +2717,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> vizier_service.ListTrialsResponse: r"""Call the list trials method over HTTP. @@ -2137,8 +2728,10 @@ async def __call__( 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: ~.vizier_service.ListTrialsResponse: @@ -2150,6 +2743,7 @@ async def __call__( http_options = ( _BaseVizierServiceRestTransport._BaseListTrials._get_http_options() ) + request, metadata = await self._interceptor.pre_list_trials( request, metadata ) @@ -2166,6 +2760,33 @@ async 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 = 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.aiplatform_v1beta1.VizierServiceClient.ListTrials", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VizierService", + "rpcName": "ListTrials", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncVizierServiceRestTransport._ListTrials._get_response( self._host, @@ -2193,6 +2814,30 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_list_trials(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = vizier_service.ListTrialsResponse.to_json( + response + ) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.VizierServiceAsyncClient.list_trials", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VizierService", + "rpcName": "ListTrials", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _LookupStudy( @@ -2231,7 +2876,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> study.Study: r"""Call the lookup study method over HTTP. @@ -2242,8 +2887,10 @@ async def __call__( 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: ~.study.Study: @@ -2253,6 +2900,7 @@ async def __call__( http_options = ( _BaseVizierServiceRestTransport._BaseLookupStudy._get_http_options() ) + request, metadata = await self._interceptor.pre_lookup_study( request, metadata ) @@ -2273,6 +2921,33 @@ async 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 = 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.aiplatform_v1beta1.VizierServiceClient.LookupStudy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VizierService", + "rpcName": "LookupStudy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncVizierServiceRestTransport._LookupStudy._get_response( self._host, @@ -2301,6 +2976,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_lookup_study(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = study.Study.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.VizierServiceAsyncClient.lookup_study", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VizierService", + "rpcName": "LookupStudy", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _StopTrial( @@ -2339,7 +3036,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> study.Trial: r"""Call the stop trial method over HTTP. @@ -2350,8 +3047,10 @@ async def __call__( 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: ~.study.Trial: @@ -2366,6 +3065,7 @@ async def __call__( http_options = ( _BaseVizierServiceRestTransport._BaseStopTrial._get_http_options() ) + request, metadata = await self._interceptor.pre_stop_trial( request, metadata ) @@ -2388,6 +3088,33 @@ async 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 = 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.aiplatform_v1beta1.VizierServiceClient.StopTrial", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VizierService", + "rpcName": "StopTrial", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncVizierServiceRestTransport._StopTrial._get_response( self._host, @@ -2416,6 +3143,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_stop_trial(resp) + if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( + logging.DEBUG + ): # pragma: NO COVER + try: + response_payload = study.Trial.to_json(response) + except: + response_payload = None + http_response = { + "payload": response_payload, + "headers": dict(response.headers), + "status": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.VizierServiceAsyncClient.stop_trial", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VizierService", + "rpcName": "StopTrial", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp class _SuggestTrials( @@ -2454,7 +3203,7 @@ async 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 suggest trials method over HTTP. @@ -2465,8 +3214,10 @@ async def __call__( 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: @@ -2479,6 +3230,7 @@ async def __call__( http_options = ( _BaseVizierServiceRestTransport._BaseSuggestTrials._get_http_options() ) + request, metadata = await self._interceptor.pre_suggest_trials( request, metadata ) @@ -2495,6 +3247,33 @@ async 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.aiplatform_v1beta1.VizierServiceClient.SuggestTrials", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VizierService", + "rpcName": "SuggestTrials", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncVizierServiceRestTransport._SuggestTrials._get_response( @@ -2525,6 +3304,28 @@ async def __call__( content = await response.read() json_format.Parse(content, pb_resp, ignore_unknown_fields=True) resp = await self._interceptor.post_suggest_trials(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": "OK", # need to obtain this properly + } + _LOGGER.debug( + "Received response for google.cloud.aiplatform_v1beta1.VizierServiceAsyncClient.suggest_trials", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VizierService", + "rpcName": "SuggestTrials", + "metadata": http_response["headers"], + "httpResponse": http_response, + }, + ) + return resp @property @@ -3100,6 +3901,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -3316,6 +4121,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -3522,6 +4331,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}", @@ -3738,6 +4551,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, ], "google.longrunning.Operations.ListOperations": [ { @@ -3936,6 +4753,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*}/operations", @@ -4152,6 +4973,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*}/operations", + }, ], "google.longrunning.Operations.WaitOperation": [ { @@ -4350,6 +5175,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "post", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}:wait", @@ -4562,6 +5391,10 @@ def operations_client(self) -> AsyncOperationsRestClient: "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, ], } @@ -4712,7 +5545,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.Location: r"""Call the get location method over HTTP. @@ -4723,8 +5556,10 @@ async def __call__( 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: locations_pb2.Location: Response from GetLocation method. @@ -4733,6 +5568,7 @@ async def __call__( http_options = ( _BaseVizierServiceRestTransport._BaseGetLocation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_location( request, metadata ) @@ -4747,6 +5583,33 @@ async 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.aiplatform_v1beta1.VizierServiceClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VizierService", + "rpcName": "GetLocation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = await AsyncVizierServiceRestTransport._GetLocation._get_response( self._host, @@ -4772,6 +5635,27 @@ async def __call__( resp = locations_pb2.Location() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_location(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.aiplatform_v1beta1.VizierServiceAsyncClient.GetLocation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VizierService", + "rpcName": "GetLocation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4813,7 +5697,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Call the list locations method over HTTP. @@ -4824,8 +5708,10 @@ async def __call__( 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: locations_pb2.ListLocationsResponse: Response from ListLocations method. @@ -4834,6 +5720,7 @@ async def __call__( http_options = ( _BaseVizierServiceRestTransport._BaseListLocations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_locations( request, metadata ) @@ -4846,6 +5733,33 @@ async 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.aiplatform_v1beta1.VizierServiceClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VizierService", + "rpcName": "ListLocations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncVizierServiceRestTransport._ListLocations._get_response( @@ -4873,6 +5787,27 @@ async def __call__( resp = locations_pb2.ListLocationsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_list_locations(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.aiplatform_v1beta1.VizierServiceAsyncClient.ListLocations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VizierService", + "rpcName": "ListLocations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -4915,7 +5850,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the get iam policy method over HTTP. @@ -4926,8 +5861,10 @@ async def __call__( 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: policy_pb2.Policy: Response from GetIamPolicy method. @@ -4936,6 +5873,7 @@ async def __call__( http_options = ( _BaseVizierServiceRestTransport._BaseGetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_get_iam_policy( request, metadata ) @@ -4952,6 +5890,33 @@ async 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.aiplatform_v1beta1.VizierServiceClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VizierService", + "rpcName": "GetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncVizierServiceRestTransport._GetIamPolicy._get_response( @@ -4980,6 +5945,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_get_iam_policy(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.aiplatform_v1beta1.VizierServiceAsyncClient.GetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VizierService", + "rpcName": "GetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5022,7 +6008,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> policy_pb2.Policy: r"""Call the set iam policy method over HTTP. @@ -5033,8 +6019,10 @@ async def __call__( 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: policy_pb2.Policy: Response from SetIamPolicy method. @@ -5043,6 +6031,7 @@ async def __call__( http_options = ( _BaseVizierServiceRestTransport._BaseSetIamPolicy._get_http_options() ) + request, metadata = await self._interceptor.pre_set_iam_policy( request, metadata ) @@ -5059,6 +6048,33 @@ async 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.aiplatform_v1beta1.VizierServiceClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VizierService", + "rpcName": "SetIamPolicy", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncVizierServiceRestTransport._SetIamPolicy._get_response( @@ -5087,6 +6103,27 @@ async def __call__( resp = policy_pb2.Policy() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_set_iam_policy(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.aiplatform_v1beta1.VizierServiceAsyncClient.SetIamPolicy", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VizierService", + "rpcName": "SetIamPolicy", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5130,7 +6167,7 @@ async def __call__( *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Call the test iam permissions method over HTTP. @@ -5141,8 +6178,10 @@ async def __call__( 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: iam_policy_pb2.TestIamPermissionsResponse: Response from TestIamPermissions method. @@ -5151,6 +6190,7 @@ async def __call__( http_options = ( _BaseVizierServiceRestTransport._BaseTestIamPermissions._get_http_options() ) + request, metadata = await self._interceptor.pre_test_iam_permissions( request, metadata ) @@ -5167,6 +6207,33 @@ async 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.aiplatform_v1beta1.VizierServiceClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VizierService", + "rpcName": "TestIamPermissions", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncVizierServiceRestTransport._TestIamPermissions._get_response( @@ -5195,6 +6262,27 @@ async def __call__( resp = iam_policy_pb2.TestIamPermissionsResponse() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_test_iam_permissions(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.aiplatform_v1beta1.VizierServiceAsyncClient.TestIamPermissions", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VizierService", + "rpcName": "TestIamPermissions", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5236,7 +6324,7 @@ async 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 cancel operation method over HTTP. @@ -5247,13 +6335,16 @@ async def __call__( 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`. """ http_options = ( _BaseVizierServiceRestTransport._BaseCancelOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_cancel_operation( request, metadata ) @@ -5266,6 +6357,33 @@ async 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.aiplatform_v1beta1.VizierServiceClient.CancelOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VizierService", + "rpcName": "CancelOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncVizierServiceRestTransport._CancelOperation._get_response( @@ -5330,7 +6448,7 @@ async 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. @@ -5341,13 +6459,16 @@ async def __call__( 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`. """ http_options = ( _BaseVizierServiceRestTransport._BaseDeleteOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_delete_operation( request, metadata ) @@ -5360,6 +6481,33 @@ async 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.aiplatform_v1beta1.VizierServiceClient.DeleteOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VizierService", + "rpcName": "DeleteOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncVizierServiceRestTransport._DeleteOperation._get_response( @@ -5424,7 +6572,7 @@ async 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. @@ -5435,8 +6583,10 @@ async def __call__( 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: Response from GetOperation method. @@ -5445,6 +6595,7 @@ async def __call__( http_options = ( _BaseVizierServiceRestTransport._BaseGetOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_get_operation( request, metadata ) @@ -5457,6 +6608,33 @@ async 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.aiplatform_v1beta1.VizierServiceClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VizierService", + "rpcName": "GetOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncVizierServiceRestTransport._GetOperation._get_response( @@ -5484,6 +6662,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1beta1.VizierServiceAsyncClient.GetOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VizierService", + "rpcName": "GetOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5525,7 +6724,7 @@ async 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. @@ -5536,8 +6735,10 @@ async def __call__( 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 from ListOperations method. @@ -5546,6 +6747,7 @@ async def __call__( http_options = ( _BaseVizierServiceRestTransport._BaseListOperations._get_http_options() ) + request, metadata = await self._interceptor.pre_list_operations( request, metadata ) @@ -5558,6 +6760,33 @@ async 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.aiplatform_v1beta1.VizierServiceClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VizierService", + "rpcName": "ListOperations", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncVizierServiceRestTransport._ListOperations._get_response( @@ -5585,6 +6814,27 @@ async def __call__( resp = operations_pb2.ListOperationsResponse() resp = json_format.Parse(content, resp) resp = await 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.aiplatform_v1beta1.VizierServiceAsyncClient.ListOperations", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VizierService", + "rpcName": "ListOperations", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property @@ -5626,7 +6876,7 @@ async 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 wait operation method over HTTP. @@ -5637,8 +6887,10 @@ async def __call__( 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: Response from WaitOperation method. @@ -5647,6 +6899,7 @@ async def __call__( http_options = ( _BaseVizierServiceRestTransport._BaseWaitOperation._get_http_options() ) + request, metadata = await self._interceptor.pre_wait_operation( request, metadata ) @@ -5659,6 +6912,33 @@ async 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.aiplatform_v1beta1.VizierServiceClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VizierService", + "rpcName": "WaitOperation", + "httpRequest": http_request, + "metadata": http_request["headers"], + }, + ) + # Send the request response = ( await AsyncVizierServiceRestTransport._WaitOperation._get_response( @@ -5686,6 +6966,27 @@ async def __call__( resp = operations_pb2.Operation() resp = json_format.Parse(content, resp) resp = await self._interceptor.post_wait_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.aiplatform_v1beta1.VizierServiceAsyncClient.WaitOperation", + extra={ + "serviceName": "google.cloud.aiplatform.v1beta1.VizierService", + "rpcName": "WaitOperation", + "httpResponse": http_response, + "metadata": http_response["headers"], + }, + ) return resp @property diff --git a/google/cloud/aiplatform_v1beta1/services/vizier_service/transports/rest_base.py b/google/cloud/aiplatform_v1beta1/services/vizier_service/transports/rest_base.py index 5de38369f1..19d76e5494 100644 --- a/google/cloud/aiplatform_v1beta1/services/vizier_service/transports/rest_base.py +++ b/google/cloud/aiplatform_v1beta1/services/vizier_service/transports/rest_base.py @@ -1807,6 +1807,10 @@ def _get_http_options(): "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/ui/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -2023,6 +2027,10 @@ def _get_http_options(): "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "delete", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "delete", "uri": "/v1beta1/{name=projects/*/locations/*/featureOnlineStores/*/featureViews/*/operations/*}", @@ -2248,6 +2256,10 @@ def _get_http_options(): "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}", @@ -2464,6 +2476,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}", + }, ] return http_options @@ -2681,6 +2697,10 @@ def _get_http_options(): "method": "get", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "get", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*}/operations", @@ -2897,6 +2917,10 @@ def _get_http_options(): "method": "get", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*}/operations", }, + { + "method": "get", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*}/operations", + }, ] return http_options @@ -3114,6 +3138,10 @@ def _get_http_options(): "method": "post", "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/ui/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, { "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/operations/*}:wait", @@ -3326,6 +3354,10 @@ def _get_http_options(): "method": "post", "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/features/*/operations/*}:wait", }, + { + "method": "post", + "uri": "/v1beta1/{name=projects/*/locations/*/featureGroups/*/featureMonitors/*/operations/*}:wait", + }, ] return http_options diff --git a/google/cloud/aiplatform_v1beta1/types/__init__.py b/google/cloud/aiplatform_v1beta1/types/__init__.py index 43ac8be8fe..0a9d913f27 100644 --- a/google/cloud/aiplatform_v1beta1/types/__init__.py +++ b/google/cloud/aiplatform_v1beta1/types/__init__.py @@ -50,12 +50,15 @@ GroundingSupport, LogprobsResult, Part, + PrebuiltVoiceConfig, RetrievalMetadata, SafetyRating, SafetySetting, SearchEntryPoint, Segment, + SpeechConfig, VideoMetadata, + VoiceConfig, HarmCategory, ) from .context import ( @@ -1308,12 +1311,15 @@ "GroundingSupport", "LogprobsResult", "Part", + "PrebuiltVoiceConfig", "RetrievalMetadata", "SafetyRating", "SafetySetting", "SearchEntryPoint", "Segment", + "SpeechConfig", "VideoMetadata", + "VoiceConfig", "HarmCategory", "Context", "ContainerSpec", diff --git a/google/cloud/aiplatform_v1beta1/types/accelerator_type.py b/google/cloud/aiplatform_v1beta1/types/accelerator_type.py index ec707a42c1..8f0b8e7c4b 100644 --- a/google/cloud/aiplatform_v1beta1/types/accelerator_type.py +++ b/google/cloud/aiplatform_v1beta1/types/accelerator_type.py @@ -55,6 +55,8 @@ class AcceleratorType(proto.Enum): Nvidia L4 GPU. NVIDIA_H100_80GB (13): Nvidia H100 80Gb GPU. + NVIDIA_H100_MEGA_80GB (14): + Nvidia H100 Mega 80Gb GPU. TPU_V2 (6): TPU v2. TPU_V3 (7): @@ -74,6 +76,7 @@ class AcceleratorType(proto.Enum): NVIDIA_A100_80GB = 9 NVIDIA_L4 = 11 NVIDIA_H100_80GB = 13 + NVIDIA_H100_MEGA_80GB = 14 TPU_V2 = 6 TPU_V3 = 7 TPU_V4_POD = 10 diff --git a/google/cloud/aiplatform_v1beta1/types/content.py b/google/cloud/aiplatform_v1beta1/types/content.py index a551cb0dfa..bddff7fc2a 100644 --- a/google/cloud/aiplatform_v1beta1/types/content.py +++ b/google/cloud/aiplatform_v1beta1/types/content.py @@ -34,6 +34,9 @@ "Blob", "FileData", "VideoMetadata", + "PrebuiltVoiceConfig", + "VoiceConfig", + "SpeechConfig", "GenerationConfig", "SafetySetting", "SafetyRating", @@ -288,6 +291,61 @@ class VideoMetadata(proto.Message): ) +class PrebuiltVoiceConfig(proto.Message): + r"""The configuration for the prebuilt speaker to use. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + voice_name (str): + The name of the preset voice to use. + + This field is a member of `oneof`_ ``_voice_name``. + """ + + voice_name: str = proto.Field( + proto.STRING, + number=1, + optional=True, + ) + + +class VoiceConfig(proto.Message): + r"""The configuration for the voice to use. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + prebuilt_voice_config (google.cloud.aiplatform_v1beta1.types.PrebuiltVoiceConfig): + The configuration for the prebuilt voice to + use. + + This field is a member of `oneof`_ ``voice_config``. + """ + + prebuilt_voice_config: "PrebuiltVoiceConfig" = proto.Field( + proto.MESSAGE, + number=1, + oneof="voice_config", + message="PrebuiltVoiceConfig", + ) + + +class SpeechConfig(proto.Message): + r"""The speech generation config. + + Attributes: + voice_config (google.cloud.aiplatform_v1beta1.types.VoiceConfig): + The configuration for the speaker to use. + """ + + voice_config: "VoiceConfig" = proto.Field( + proto.MESSAGE, + number=1, + message="VoiceConfig", + ) + + class GenerationConfig(proto.Message): r"""Generation config. @@ -370,8 +428,57 @@ class GenerationConfig(proto.Message): included in the request to the model. This field is a member of `oneof`_ ``_audio_timestamp``. + response_modalities (MutableSequence[google.cloud.aiplatform_v1beta1.types.GenerationConfig.Modality]): + Optional. The modalities of the response. + media_resolution (google.cloud.aiplatform_v1beta1.types.GenerationConfig.MediaResolution): + Optional. If specified, the media resolution + specified will be used. + + This field is a member of `oneof`_ ``_media_resolution``. + speech_config (google.cloud.aiplatform_v1beta1.types.SpeechConfig): + Optional. The speech generation config. + + This field is a member of `oneof`_ ``_speech_config``. """ + class Modality(proto.Enum): + r"""The modalities of the response. + + Values: + MODALITY_UNSPECIFIED (0): + Unspecified modality. Will be processed as + text. + TEXT (1): + Text modality. + IMAGE (2): + Image modality. + AUDIO (3): + Audio modality. + """ + MODALITY_UNSPECIFIED = 0 + TEXT = 1 + IMAGE = 2 + AUDIO = 3 + + class MediaResolution(proto.Enum): + r"""Media resolution for the input media. + + Values: + MEDIA_RESOLUTION_UNSPECIFIED (0): + Media resolution has not been set. + MEDIA_RESOLUTION_LOW (1): + Media resolution set to low (64 tokens). + MEDIA_RESOLUTION_MEDIUM (2): + Media resolution set to medium (256 tokens). + MEDIA_RESOLUTION_HIGH (3): + Media resolution set to high (zoomed + reframing with 256 tokens). + """ + MEDIA_RESOLUTION_UNSPECIFIED = 0 + MEDIA_RESOLUTION_LOW = 1 + MEDIA_RESOLUTION_MEDIUM = 2 + MEDIA_RESOLUTION_HIGH = 3 + class RoutingConfig(proto.Message): r"""The configuration for routing the request to a specific model. @@ -543,6 +650,23 @@ class ManualRoutingMode(proto.Message): number=20, optional=True, ) + response_modalities: MutableSequence[Modality] = proto.RepeatedField( + proto.ENUM, + number=21, + enum=Modality, + ) + media_resolution: MediaResolution = proto.Field( + proto.ENUM, + number=22, + optional=True, + enum=MediaResolution, + ) + speech_config: "SpeechConfig" = proto.Field( + proto.MESSAGE, + number=23, + optional=True, + message="SpeechConfig", + ) class SafetySetting(proto.Message): diff --git a/google/cloud/aiplatform_v1beta1/types/endpoint.py b/google/cloud/aiplatform_v1beta1/types/endpoint.py index 45bec5e6b9..0672f8d0f0 100644 --- a/google/cloud/aiplatform_v1beta1/types/endpoint.py +++ b/google/cloud/aiplatform_v1beta1/types/endpoint.py @@ -35,8 +35,8 @@ "DeployedModel", "PrivateEndpoints", "PredictRequestResponseLoggingConfig", - "FasterDeploymentConfig", "ClientConnectionConfig", + "FasterDeploymentConfig", }, ) @@ -377,12 +377,44 @@ class DeployedModel(proto.Message): is configured. faster_deployment_config (google.cloud.aiplatform_v1beta1.types.FasterDeploymentConfig): Configuration for faster model deployment. + status (google.cloud.aiplatform_v1beta1.types.DeployedModel.Status): + Output only. Runtime status of the deployed + model. system_labels (MutableMapping[str, str]): System labels to apply to Model Garden deployments. System labels are managed by Google for internal use only. """ + class Status(proto.Message): + r"""Runtime status of the deployed model. + + Attributes: + message (str): + Output only. The latest deployed model's + status message (if any). + last_update_time (google.protobuf.timestamp_pb2.Timestamp): + Output only. The time at which the status was + last updated. + available_replica_count (int): + Output only. The number of available replicas + of the deployed model. + """ + + message: str = proto.Field( + proto.STRING, + number=1, + ) + last_update_time: timestamp_pb2.Timestamp = proto.Field( + proto.MESSAGE, + number=2, + message=timestamp_pb2.Timestamp, + ) + available_replica_count: int = proto.Field( + proto.INT32, + number=3, + ) + dedicated_resources: machine_resources.DedicatedResources = proto.Field( proto.MESSAGE, number=7, @@ -452,6 +484,11 @@ class DeployedModel(proto.Message): number=23, message="FasterDeploymentConfig", ) + status: Status = proto.Field( + proto.MESSAGE, + number=26, + message=Status, + ) system_labels: MutableMapping[str, str] = proto.MapField( proto.STRING, proto.STRING, @@ -534,21 +571,6 @@ class PredictRequestResponseLoggingConfig(proto.Message): ) -class FasterDeploymentConfig(proto.Message): - r"""Configuration for faster model deployment. - - Attributes: - fast_tryout_enabled (bool): - If true, enable fast tryout feature for this - deployed model. - """ - - fast_tryout_enabled: bool = proto.Field( - proto.BOOL, - number=2, - ) - - class ClientConnectionConfig(proto.Message): r"""Configurations (e.g. inference timeout) that are applied on your endpoints. @@ -566,4 +588,19 @@ class ClientConnectionConfig(proto.Message): ) +class FasterDeploymentConfig(proto.Message): + r"""Configuration for faster model deployment. + + Attributes: + fast_tryout_enabled (bool): + If true, enable fast tryout feature for this + deployed model. + """ + + fast_tryout_enabled: bool = proto.Field( + proto.BOOL, + number=2, + ) + + __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/aiplatform_v1beta1/types/feature_group.py b/google/cloud/aiplatform_v1beta1/types/feature_group.py index ba594e1e92..a166fa1beb 100644 --- a/google/cloud/aiplatform_v1beta1/types/feature_group.py +++ b/google/cloud/aiplatform_v1beta1/types/feature_group.py @@ -76,8 +76,44 @@ class FeatureGroup(proto.Message): "aiplatform.googleapis.com/" and are immutable. description (str): Optional. Description of the FeatureGroup. + service_agent_type (google.cloud.aiplatform_v1beta1.types.FeatureGroup.ServiceAgentType): + Optional. Service agent type used during jobs under a + FeatureGroup. By default, the Vertex AI Service Agent is + used. When using an IAM Policy to isolate this FeatureGroup + within a project, a separate service account should be + provisioned by setting this field to + ``SERVICE_AGENT_TYPE_FEATURE_GROUP``. This will generate a + separate service account to access the BigQuery source + table. + service_account_email (str): + Output only. A Service Account unique to this + FeatureGroup. The role bigquery.dataViewer + should be granted to this service account to + allow Vertex AI Feature Store to access source + data while running jobs under this FeatureGroup. """ + class ServiceAgentType(proto.Enum): + r"""Service agent type used during jobs under a FeatureGroup. + + Values: + SERVICE_AGENT_TYPE_UNSPECIFIED (0): + By default, the project-level Vertex AI + Service Agent is enabled. + SERVICE_AGENT_TYPE_PROJECT (1): + Specifies the project-level Vertex AI Service + Agent + (https://cloud.google.com/vertex-ai/docs/general/access-control#service-agents). + SERVICE_AGENT_TYPE_FEATURE_GROUP (2): + Enable a FeatureGroup service account to be created by + Vertex AI and output in the field ``service_account_email``. + This service account will be used to read from the source + BigQuery table during jobs under a FeatureGroup. + """ + SERVICE_AGENT_TYPE_UNSPECIFIED = 0 + SERVICE_AGENT_TYPE_PROJECT = 1 + SERVICE_AGENT_TYPE_FEATURE_GROUP = 2 + class BigQuery(proto.Message): r"""Input source type for BigQuery Tables and Views. @@ -184,6 +220,15 @@ class TimeSeries(proto.Message): proto.STRING, number=6, ) + service_agent_type: ServiceAgentType = proto.Field( + proto.ENUM, + number=8, + enum=ServiceAgentType, + ) + service_account_email: str = proto.Field( + proto.STRING, + number=9, + ) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/aiplatform_v1beta1/types/machine_resources.py b/google/cloud/aiplatform_v1beta1/types/machine_resources.py index ed91580b2f..3123d742a0 100644 --- a/google/cloud/aiplatform_v1beta1/types/machine_resources.py +++ b/google/cloud/aiplatform_v1beta1/types/machine_resources.py @@ -143,6 +143,14 @@ class DedicatedResources(proto.Message): (max_replica_count \* number of cores in the selected machine type) and (max_replica_count \* number of GPUs per replica in the selected machine type). + required_replica_count (int): + Optional. Number of required available replicas for the + deployment to succeed. This field is only needed when + partial model deployment/mutation is desired. If set, the + model deploy/mutate operation will succeed once + available_replica_count reaches required_replica_count, and + the rest of the replicas will be retried. If not set, the + default required_replica_count will be min_replica_count. autoscaling_metric_specs (MutableSequence[google.cloud.aiplatform_v1beta1.types.AutoscalingMetricSpec]): Immutable. The metric specifications that overrides a resource utilization metric (CPU utilization, accelerator's @@ -189,6 +197,10 @@ class DedicatedResources(proto.Message): proto.INT32, number=3, ) + required_replica_count: int = proto.Field( + proto.INT32, + number=9, + ) autoscaling_metric_specs: MutableSequence[ "AutoscalingMetricSpec" ] = proto.RepeatedField( diff --git a/google/cloud/aiplatform_v1beta1/types/model_garden_service.py b/google/cloud/aiplatform_v1beta1/types/model_garden_service.py index c488828819..6872a1afa8 100644 --- a/google/cloud/aiplatform_v1beta1/types/model_garden_service.py +++ b/google/cloud/aiplatform_v1beta1/types/model_garden_service.py @@ -132,6 +132,9 @@ class ListPublisherModelsRequest(proto.Message): representing the language in which the publisher models' text information should be written in. If not set, by default English (en). + list_all_versions (bool): + Optional. List all publisher model versions + if the flag is set to true. """ parent: str = proto.Field( @@ -163,6 +166,10 @@ class ListPublisherModelsRequest(proto.Message): proto.STRING, number=7, ) + list_all_versions: bool = proto.Field( + proto.BOOL, + number=8, + ) class ListPublisherModelsResponse(proto.Message): diff --git a/google/cloud/aiplatform_v1beta1/types/notebook_execution_job.py b/google/cloud/aiplatform_v1beta1/types/notebook_execution_job.py index bb3e7e7cfd..90d1b524bb 100644 --- a/google/cloud/aiplatform_v1beta1/types/notebook_execution_job.py +++ b/google/cloud/aiplatform_v1beta1/types/notebook_execution_job.py @@ -86,6 +86,11 @@ class NotebookExecutionJob(proto.Message): The service account to run the execution as. This field is a member of `oneof`_ ``execution_identity``. + workbench_runtime (google.cloud.aiplatform_v1beta1.types.NotebookExecutionJob.WorkbenchRuntime): + The Workbench runtime configuration to use + for the notebook execution. + + This field is a member of `oneof`_ ``runtime_environment``. name (str): Output only. The resource name of this NotebookExecutionJob. Format: @@ -128,11 +133,14 @@ class NotebookExecutionJob(proto.Message): and examples of labels. System reserved label keys are prefixed with "aiplatform.googleapis.com/" and are immutable. + kernel_name (str): + The name of the kernel to use during notebook + execution. If unset, the default kernel is used. encryption_spec (google.cloud.aiplatform_v1beta1.types.EncryptionSpec): Customer-managed encryption key spec for the notebook execution job. This field is auto-populated if the - [NotebookService.NotebookRuntimeTemplate][] has an - encryption spec. + [NotebookRuntimeTemplate][google.cloud.aiplatform.v1beta1.NotebookRuntimeTemplate] + has an encryption spec. """ class DataformRepositorySource(proto.Message): @@ -224,6 +232,9 @@ class CustomEnvironmentSpec(proto.Message): message=gca_network_spec.NetworkSpec, ) + class WorkbenchRuntime(proto.Message): + r"""Configuration for a Workbench Instances-based environment.""" + dataform_repository_source: DataformRepositorySource = proto.Field( proto.MESSAGE, number=3, @@ -268,6 +279,12 @@ class CustomEnvironmentSpec(proto.Message): number=18, oneof="execution_identity", ) + workbench_runtime: WorkbenchRuntime = proto.Field( + proto.MESSAGE, + number=23, + oneof="runtime_environment", + message=WorkbenchRuntime, + ) name: str = proto.Field( proto.STRING, number=1, @@ -310,6 +327,10 @@ class CustomEnvironmentSpec(proto.Message): proto.STRING, number=19, ) + kernel_name: str = proto.Field( + proto.STRING, + number=20, + ) encryption_spec: gca_encryption_spec.EncryptionSpec = proto.Field( proto.MESSAGE, number=22, diff --git a/google/cloud/aiplatform_v1beta1/types/tool.py b/google/cloud/aiplatform_v1beta1/types/tool.py index 7ed1b49065..ec3dff120e 100644 --- a/google/cloud/aiplatform_v1beta1/types/tool.py +++ b/google/cloud/aiplatform_v1beta1/types/tool.py @@ -60,18 +60,23 @@ class Tool(proto.Message): declarations to be passed to the model along with the current user query. Model may decide to call a subset of these functions by populating - [FunctionCall][content.part.function_call] in the response. - User should provide a - [FunctionResponse][content.part.function_response] for each - function call in the next turn. Based on the function - responses, Model will generate the final response back to - the user. Maximum 128 function declarations can be provided. + [FunctionCall][google.cloud.aiplatform.v1beta1.Part.function_call] + in the response. User should provide a + [FunctionResponse][google.cloud.aiplatform.v1beta1.Part.function_response] + for each function call in the next turn. Based on the + function responses, Model will generate the final response + back to the user. Maximum 128 function declarations can be + provided. retrieval (google.cloud.aiplatform_v1beta1.types.Retrieval): Optional. Retrieval tool type. System will always execute the provided retrieval tool(s) to get external knowledge to answer the prompt. Retrieval results are presented to the model for generation. + google_search (google.cloud.aiplatform_v1beta1.types.Tool.GoogleSearch): + Optional. GoogleSearch tool type. + Tool to support Google Search in Model. Powered + by Google. google_search_retrieval (google.cloud.aiplatform_v1beta1.types.GoogleSearchRetrieval): Optional. GoogleSearchRetrieval tool type. Specialized retrieval tool that is powered by @@ -83,6 +88,12 @@ class Tool(proto.Message): Gemini Developer API services. """ + class GoogleSearch(proto.Message): + r"""GoogleSearch tool type. + Tool to support Google Search in Model. Powered by Google. + + """ + class CodeExecution(proto.Message): r"""Tool that executes code generated by the model, and automatically returns the result to the model. @@ -102,6 +113,11 @@ class CodeExecution(proto.Message): number=2, message="Retrieval", ) + google_search: GoogleSearch = proto.Field( + proto.MESSAGE, + number=7, + message=GoogleSearch, + ) google_search_retrieval: "GoogleSearchRetrieval" = proto.Field( proto.MESSAGE, number=3, @@ -206,9 +222,10 @@ class FunctionDeclaration(proto.Message): r"""Structured representation of a function declaration as defined by the `OpenAPI 3.0 specification `__. Included in - this declaration are the function name and parameters. This - FunctionDeclaration is a representation of a block of code that can - be used as a ``Tool`` by the model and executed by the client. + this declaration are the function name, description, parameters and + response type. This FunctionDeclaration is a representation of a + block of code that can be used as a ``Tool`` by the model and + executed by the client. Attributes: name (str): diff --git a/google/cloud/aiplatform_v1beta1/types/vertex_rag_data.py b/google/cloud/aiplatform_v1beta1/types/vertex_rag_data.py index d222ca675d..da4a358158 100644 --- a/google/cloud/aiplatform_v1beta1/types/vertex_rag_data.py +++ b/google/cloud/aiplatform_v1beta1/types/vertex_rag_data.py @@ -795,6 +795,10 @@ class RagFileParsingConfig(proto.Message): layout_parser (google.cloud.aiplatform_v1beta1.types.RagFileParsingConfig.LayoutParser): The Layout Parser to use for RagFiles. + This field is a member of `oneof`_ ``parser``. + llm_parser (google.cloud.aiplatform_v1beta1.types.RagFileParsingConfig.LlmParser): + The LLM Parser to use for RagFiles. + This field is a member of `oneof`_ ``parser``. use_advanced_pdf_parsing (bool): Whether to use advanced PDF parsing. @@ -845,6 +849,39 @@ class LayoutParser(proto.Message): number=2, ) + class LlmParser(proto.Message): + r"""Specifies the advanced parsing for RagFiles. + + Attributes: + model_name (str): + The name of a LLM model used for parsing. Format: + ``gemini-1.5-pro-002`` + max_parsing_requests_per_min (int): + The maximum number of requests the job is + allowed to make to the LLM model per minute. + Consult + https://cloud.google.com/vertex-ai/generative-ai/docs/quotas + and your document size to set an appropriate + value here. If unspecified, a default value of + 5000 QPM would be used. + custom_parsing_prompt (str): + The prompt to use for parsing. If not + specified, a default prompt will be used. + """ + + model_name: str = proto.Field( + proto.STRING, + number=1, + ) + max_parsing_requests_per_min: int = proto.Field( + proto.INT32, + number=2, + ) + custom_parsing_prompt: str = proto.Field( + proto.STRING, + number=3, + ) + advanced_parser: AdvancedParser = proto.Field( proto.MESSAGE, number=3, @@ -857,6 +894,12 @@ class LayoutParser(proto.Message): oneof="parser", message=LayoutParser, ) + llm_parser: LlmParser = proto.Field( + proto.MESSAGE, + number=5, + oneof="parser", + message=LlmParser, + ) use_advanced_pdf_parsing: bool = proto.Field( proto.BOOL, number=2, diff --git a/samples/generated_samples/snippet_metadata_google.cloud.aiplatform.v1.json b/samples/generated_samples/snippet_metadata_google.cloud.aiplatform.v1.json index bdd1ae4b3f..6b8a7d6f97 100644 --- a/samples/generated_samples/snippet_metadata_google.cloud.aiplatform.v1.json +++ b/samples/generated_samples/snippet_metadata_google.cloud.aiplatform.v1.json @@ -8,7 +8,7 @@ ], "language": "PYTHON", "name": "google-cloud-aiplatform", - "version": "1.74.0" + "version": "0.1.0" }, "snippets": [ { @@ -51,7 +51,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -135,7 +135,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -220,7 +220,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -304,7 +304,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -385,7 +385,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -465,7 +465,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -546,7 +546,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -626,7 +626,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -707,7 +707,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -787,7 +787,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -872,7 +872,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -956,7 +956,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -1037,7 +1037,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.AnnotationSpec", @@ -1117,7 +1117,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.AnnotationSpec", @@ -1198,7 +1198,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.DatasetVersion", @@ -1278,7 +1278,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.DatasetVersion", @@ -1359,7 +1359,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.Dataset", @@ -1439,7 +1439,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.Dataset", @@ -1524,7 +1524,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -1608,7 +1608,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -1689,7 +1689,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.services.dataset_service.pagers.ListAnnotationsAsyncPager", @@ -1769,7 +1769,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.services.dataset_service.pagers.ListAnnotationsPager", @@ -1850,7 +1850,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.services.dataset_service.pagers.ListDataItemsAsyncPager", @@ -1930,7 +1930,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.services.dataset_service.pagers.ListDataItemsPager", @@ -2011,7 +2011,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.services.dataset_service.pagers.ListDatasetVersionsAsyncPager", @@ -2091,7 +2091,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.services.dataset_service.pagers.ListDatasetVersionsPager", @@ -2172,7 +2172,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.services.dataset_service.pagers.ListDatasetsAsyncPager", @@ -2252,7 +2252,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.services.dataset_service.pagers.ListDatasetsPager", @@ -2333,7 +2333,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.services.dataset_service.pagers.ListSavedQueriesAsyncPager", @@ -2413,7 +2413,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.services.dataset_service.pagers.ListSavedQueriesPager", @@ -2494,7 +2494,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -2574,7 +2574,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -2651,7 +2651,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.services.dataset_service.pagers.SearchDataItemsAsyncPager", @@ -2727,7 +2727,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.services.dataset_service.pagers.SearchDataItemsPager", @@ -2812,7 +2812,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.DatasetVersion", @@ -2896,7 +2896,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.DatasetVersion", @@ -2981,7 +2981,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.Dataset", @@ -3065,7 +3065,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.Dataset", @@ -3154,7 +3154,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -3242,7 +3242,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -3323,7 +3323,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -3403,7 +3403,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -3484,7 +3484,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.DeploymentResourcePool", @@ -3564,7 +3564,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.DeploymentResourcePool", @@ -3645,7 +3645,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.services.deployment_resource_pool_service.pagers.ListDeploymentResourcePoolsAsyncPager", @@ -3725,7 +3725,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.services.deployment_resource_pool_service.pagers.ListDeploymentResourcePoolsPager", @@ -3806,7 +3806,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.services.deployment_resource_pool_service.pagers.QueryDeployedModelsAsyncPager", @@ -3886,7 +3886,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.services.deployment_resource_pool_service.pagers.QueryDeployedModelsPager", @@ -3971,7 +3971,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -4055,7 +4055,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -4144,7 +4144,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -4232,7 +4232,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -4313,7 +4313,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -4393,7 +4393,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -4482,7 +4482,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -4570,7 +4570,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -4651,7 +4651,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.Endpoint", @@ -4731,7 +4731,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.Endpoint", @@ -4812,7 +4812,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.services.endpoint_service.pagers.ListEndpointsAsyncPager", @@ -4892,7 +4892,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.services.endpoint_service.pagers.ListEndpointsPager", @@ -4981,7 +4981,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -5069,7 +5069,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -5158,7 +5158,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -5246,7 +5246,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -5327,7 +5327,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -5407,7 +5407,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -5492,7 +5492,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.Endpoint", @@ -5576,7 +5576,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.Endpoint", @@ -5653,7 +5653,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.EvaluateInstancesResponse", @@ -5729,7 +5729,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.EvaluateInstancesResponse", @@ -5818,7 +5818,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -5906,7 +5906,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -5995,7 +5995,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -6083,7 +6083,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -6168,7 +6168,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -6252,7 +6252,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -6333,7 +6333,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -6413,7 +6413,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -6494,7 +6494,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.FeatureOnlineStore", @@ -6574,7 +6574,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.FeatureOnlineStore", @@ -6655,7 +6655,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.FeatureViewSync", @@ -6735,7 +6735,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.FeatureViewSync", @@ -6816,7 +6816,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.FeatureView", @@ -6896,7 +6896,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.FeatureView", @@ -6977,7 +6977,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.services.feature_online_store_admin_service.pagers.ListFeatureOnlineStoresAsyncPager", @@ -7057,7 +7057,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.services.feature_online_store_admin_service.pagers.ListFeatureOnlineStoresPager", @@ -7138,7 +7138,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.services.feature_online_store_admin_service.pagers.ListFeatureViewSyncsAsyncPager", @@ -7218,7 +7218,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.services.feature_online_store_admin_service.pagers.ListFeatureViewSyncsPager", @@ -7299,7 +7299,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.services.feature_online_store_admin_service.pagers.ListFeatureViewsAsyncPager", @@ -7379,7 +7379,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.services.feature_online_store_admin_service.pagers.ListFeatureViewsPager", @@ -7460,7 +7460,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.SyncFeatureViewResponse", @@ -7540,7 +7540,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.SyncFeatureViewResponse", @@ -7625,7 +7625,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -7709,7 +7709,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -7794,7 +7794,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -7878,7 +7878,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -7963,7 +7963,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.FetchFeatureValuesResponse", @@ -8047,7 +8047,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.FetchFeatureValuesResponse", @@ -8124,7 +8124,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.SearchNearestEntitiesResponse", @@ -8200,7 +8200,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.SearchNearestEntitiesResponse", @@ -8285,7 +8285,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -8369,7 +8369,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -8458,7 +8458,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -8546,7 +8546,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -8635,7 +8635,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -8723,7 +8723,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -8808,7 +8808,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -8892,7 +8892,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -8973,7 +8973,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -9053,7 +9053,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -9134,7 +9134,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.FeatureGroup", @@ -9214,7 +9214,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.FeatureGroup", @@ -9295,7 +9295,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.Feature", @@ -9375,7 +9375,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.Feature", @@ -9456,7 +9456,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.services.feature_registry_service.pagers.ListFeatureGroupsAsyncPager", @@ -9536,7 +9536,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.services.feature_registry_service.pagers.ListFeatureGroupsPager", @@ -9617,7 +9617,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.services.feature_registry_service.pagers.ListFeaturesAsyncPager", @@ -9697,7 +9697,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.services.feature_registry_service.pagers.ListFeaturesPager", @@ -9782,7 +9782,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -9866,7 +9866,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -9951,7 +9951,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -10035,7 +10035,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -10116,7 +10116,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.ReadFeatureValuesResponse", @@ -10196,7 +10196,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.ReadFeatureValuesResponse", @@ -10277,7 +10277,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "Iterable[google.cloud.aiplatform_v1.types.ReadFeatureValuesResponse]", @@ -10357,7 +10357,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "Iterable[google.cloud.aiplatform_v1.types.ReadFeatureValuesResponse]", @@ -10442,7 +10442,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.WriteFeatureValuesResponse", @@ -10526,7 +10526,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.WriteFeatureValuesResponse", @@ -10611,7 +10611,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -10695,7 +10695,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -10776,7 +10776,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -10856,7 +10856,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -10945,7 +10945,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -11033,7 +11033,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -11122,7 +11122,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -11210,7 +11210,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -11299,7 +11299,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -11387,7 +11387,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -11472,7 +11472,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -11556,7 +11556,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -11637,7 +11637,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -11717,7 +11717,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -11798,7 +11798,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -11878,7 +11878,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -11963,7 +11963,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -12047,7 +12047,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -12128,7 +12128,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -12208,7 +12208,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -12289,7 +12289,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.EntityType", @@ -12369,7 +12369,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.EntityType", @@ -12450,7 +12450,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.Feature", @@ -12530,7 +12530,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.Feature", @@ -12611,7 +12611,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.Featurestore", @@ -12691,7 +12691,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.Featurestore", @@ -12772,7 +12772,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -12852,7 +12852,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -12933,7 +12933,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.services.featurestore_service.pagers.ListEntityTypesAsyncPager", @@ -13013,7 +13013,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.services.featurestore_service.pagers.ListEntityTypesPager", @@ -13094,7 +13094,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.services.featurestore_service.pagers.ListFeaturesAsyncPager", @@ -13174,7 +13174,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.services.featurestore_service.pagers.ListFeaturesPager", @@ -13255,7 +13255,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.services.featurestore_service.pagers.ListFeaturestoresAsyncPager", @@ -13335,7 +13335,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.services.featurestore_service.pagers.ListFeaturestoresPager", @@ -13420,7 +13420,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.services.featurestore_service.pagers.SearchFeaturesAsyncPager", @@ -13504,7 +13504,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.services.featurestore_service.pagers.SearchFeaturesPager", @@ -13589,7 +13589,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.EntityType", @@ -13673,7 +13673,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.EntityType", @@ -13758,7 +13758,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.Feature", @@ -13842,7 +13842,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.Feature", @@ -13927,7 +13927,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -14011,7 +14011,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -14092,7 +14092,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "shortName": "cancel_tuning_job" @@ -14169,7 +14169,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "shortName": "cancel_tuning_job" @@ -14251,7 +14251,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.TuningJob", @@ -14335,7 +14335,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.TuningJob", @@ -14416,7 +14416,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.TuningJob", @@ -14496,7 +14496,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.TuningJob", @@ -14577,7 +14577,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.services.gen_ai_tuning_service.pagers.ListTuningJobsAsyncPager", @@ -14657,7 +14657,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.services.gen_ai_tuning_service.pagers.ListTuningJobsPager", @@ -14742,7 +14742,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -14826,7 +14826,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -14911,7 +14911,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -14995,7 +14995,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -15076,7 +15076,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -15156,7 +15156,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -15241,7 +15241,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -15325,7 +15325,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -15406,7 +15406,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.IndexEndpoint", @@ -15486,7 +15486,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.IndexEndpoint", @@ -15567,7 +15567,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.services.index_endpoint_service.pagers.ListIndexEndpointsAsyncPager", @@ -15647,7 +15647,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.services.index_endpoint_service.pagers.ListIndexEndpointsPager", @@ -15732,7 +15732,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -15816,7 +15816,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -15901,7 +15901,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -15985,7 +15985,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -16070,7 +16070,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.IndexEndpoint", @@ -16154,7 +16154,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.IndexEndpoint", @@ -16239,7 +16239,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -16323,7 +16323,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -16404,7 +16404,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -16484,7 +16484,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -16565,7 +16565,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.Index", @@ -16645,7 +16645,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.Index", @@ -16726,7 +16726,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.services.index_service.pagers.ListIndexesAsyncPager", @@ -16806,7 +16806,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.services.index_service.pagers.ListIndexesPager", @@ -16883,7 +16883,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.RemoveDatapointsResponse", @@ -16959,7 +16959,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.RemoveDatapointsResponse", @@ -17044,7 +17044,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -17128,7 +17128,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -17205,7 +17205,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.UpsertDatapointsResponse", @@ -17281,7 +17281,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.UpsertDatapointsResponse", @@ -17362,7 +17362,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "shortName": "cancel_batch_prediction_job" @@ -17439,7 +17439,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "shortName": "cancel_batch_prediction_job" @@ -17517,7 +17517,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "shortName": "cancel_custom_job" @@ -17594,7 +17594,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "shortName": "cancel_custom_job" @@ -17672,7 +17672,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "shortName": "cancel_data_labeling_job" @@ -17749,7 +17749,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "shortName": "cancel_data_labeling_job" @@ -17827,7 +17827,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "shortName": "cancel_hyperparameter_tuning_job" @@ -17904,7 +17904,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "shortName": "cancel_hyperparameter_tuning_job" @@ -17982,7 +17982,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "shortName": "cancel_nas_job" @@ -18059,7 +18059,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "shortName": "cancel_nas_job" @@ -18141,7 +18141,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.BatchPredictionJob", @@ -18225,7 +18225,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.BatchPredictionJob", @@ -18310,7 +18310,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.CustomJob", @@ -18394,7 +18394,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.CustomJob", @@ -18479,7 +18479,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.DataLabelingJob", @@ -18563,7 +18563,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.DataLabelingJob", @@ -18648,7 +18648,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.HyperparameterTuningJob", @@ -18732,7 +18732,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.HyperparameterTuningJob", @@ -18817,7 +18817,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.ModelDeploymentMonitoringJob", @@ -18901,7 +18901,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.ModelDeploymentMonitoringJob", @@ -18986,7 +18986,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.NasJob", @@ -19070,7 +19070,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.NasJob", @@ -19151,7 +19151,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -19231,7 +19231,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -19312,7 +19312,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -19392,7 +19392,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -19473,7 +19473,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -19553,7 +19553,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -19634,7 +19634,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -19714,7 +19714,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -19795,7 +19795,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -19875,7 +19875,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -19956,7 +19956,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -20036,7 +20036,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -20117,7 +20117,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.BatchPredictionJob", @@ -20197,7 +20197,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.BatchPredictionJob", @@ -20278,7 +20278,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.CustomJob", @@ -20358,7 +20358,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.CustomJob", @@ -20439,7 +20439,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.DataLabelingJob", @@ -20519,7 +20519,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.DataLabelingJob", @@ -20600,7 +20600,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.HyperparameterTuningJob", @@ -20680,7 +20680,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.HyperparameterTuningJob", @@ -20761,7 +20761,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.ModelDeploymentMonitoringJob", @@ -20841,7 +20841,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.ModelDeploymentMonitoringJob", @@ -20922,7 +20922,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.NasJob", @@ -21002,7 +21002,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.NasJob", @@ -21083,7 +21083,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.NasTrialDetail", @@ -21163,7 +21163,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.NasTrialDetail", @@ -21244,7 +21244,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.services.job_service.pagers.ListBatchPredictionJobsAsyncPager", @@ -21324,7 +21324,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.services.job_service.pagers.ListBatchPredictionJobsPager", @@ -21405,7 +21405,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.services.job_service.pagers.ListCustomJobsAsyncPager", @@ -21485,7 +21485,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.services.job_service.pagers.ListCustomJobsPager", @@ -21566,7 +21566,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.services.job_service.pagers.ListDataLabelingJobsAsyncPager", @@ -21646,7 +21646,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.services.job_service.pagers.ListDataLabelingJobsPager", @@ -21727,7 +21727,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.services.job_service.pagers.ListHyperparameterTuningJobsAsyncPager", @@ -21807,7 +21807,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.services.job_service.pagers.ListHyperparameterTuningJobsPager", @@ -21888,7 +21888,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.services.job_service.pagers.ListModelDeploymentMonitoringJobsAsyncPager", @@ -21968,7 +21968,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.services.job_service.pagers.ListModelDeploymentMonitoringJobsPager", @@ -22049,7 +22049,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.services.job_service.pagers.ListNasJobsAsyncPager", @@ -22129,7 +22129,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.services.job_service.pagers.ListNasJobsPager", @@ -22210,7 +22210,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.services.job_service.pagers.ListNasTrialDetailsAsyncPager", @@ -22290,7 +22290,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.services.job_service.pagers.ListNasTrialDetailsPager", @@ -22371,7 +22371,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "shortName": "pause_model_deployment_monitoring_job" @@ -22448,7 +22448,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "shortName": "pause_model_deployment_monitoring_job" @@ -22526,7 +22526,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "shortName": "resume_model_deployment_monitoring_job" @@ -22603,7 +22603,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "shortName": "resume_model_deployment_monitoring_job" @@ -22685,7 +22685,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.services.job_service.pagers.SearchModelDeploymentMonitoringStatsAnomaliesAsyncPager", @@ -22769,7 +22769,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.services.job_service.pagers.SearchModelDeploymentMonitoringStatsAnomaliesPager", @@ -22854,7 +22854,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -22938,7 +22938,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -23023,7 +23023,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.ComputeTokensResponse", @@ -23107,7 +23107,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.ComputeTokensResponse", @@ -23192,7 +23192,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.CountTokensResponse", @@ -23276,7 +23276,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.CountTokensResponse", @@ -23353,7 +23353,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.FindNeighborsResponse", @@ -23429,7 +23429,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.FindNeighborsResponse", @@ -23506,7 +23506,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.ReadIndexDatapointsResponse", @@ -23582,7 +23582,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.ReadIndexDatapointsResponse", @@ -23671,7 +23671,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.AddContextArtifactsAndExecutionsResponse", @@ -23759,7 +23759,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.AddContextArtifactsAndExecutionsResponse", @@ -23844,7 +23844,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.AddContextChildrenResponse", @@ -23928,7 +23928,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.AddContextChildrenResponse", @@ -24013,7 +24013,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.AddExecutionEventsResponse", @@ -24097,7 +24097,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.AddExecutionEventsResponse", @@ -24186,7 +24186,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.Artifact", @@ -24274,7 +24274,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.Artifact", @@ -24363,7 +24363,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.Context", @@ -24451,7 +24451,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.Context", @@ -24540,7 +24540,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.Execution", @@ -24628,7 +24628,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.Execution", @@ -24717,7 +24717,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.MetadataSchema", @@ -24805,7 +24805,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.MetadataSchema", @@ -24894,7 +24894,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -24982,7 +24982,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -25063,7 +25063,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -25143,7 +25143,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -25224,7 +25224,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -25304,7 +25304,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -25385,7 +25385,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -25465,7 +25465,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -25546,7 +25546,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -25626,7 +25626,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -25707,7 +25707,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.Artifact", @@ -25787,7 +25787,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.Artifact", @@ -25868,7 +25868,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.Context", @@ -25948,7 +25948,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.Context", @@ -26029,7 +26029,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.Execution", @@ -26109,7 +26109,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.Execution", @@ -26190,7 +26190,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.MetadataSchema", @@ -26270,7 +26270,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.MetadataSchema", @@ -26351,7 +26351,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.MetadataStore", @@ -26431,7 +26431,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.MetadataStore", @@ -26512,7 +26512,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.services.metadata_service.pagers.ListArtifactsAsyncPager", @@ -26592,7 +26592,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.services.metadata_service.pagers.ListArtifactsPager", @@ -26673,7 +26673,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.services.metadata_service.pagers.ListContextsAsyncPager", @@ -26753,7 +26753,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.services.metadata_service.pagers.ListContextsPager", @@ -26834,7 +26834,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.services.metadata_service.pagers.ListExecutionsAsyncPager", @@ -26914,7 +26914,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.services.metadata_service.pagers.ListExecutionsPager", @@ -26995,7 +26995,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.services.metadata_service.pagers.ListMetadataSchemasAsyncPager", @@ -27075,7 +27075,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.services.metadata_service.pagers.ListMetadataSchemasPager", @@ -27156,7 +27156,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.services.metadata_service.pagers.ListMetadataStoresAsyncPager", @@ -27236,7 +27236,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.services.metadata_service.pagers.ListMetadataStoresPager", @@ -27317,7 +27317,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -27397,7 +27397,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -27478,7 +27478,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -27558,7 +27558,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -27639,7 +27639,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -27719,7 +27719,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -27800,7 +27800,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.LineageSubgraph", @@ -27880,7 +27880,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.LineageSubgraph", @@ -27961,7 +27961,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.LineageSubgraph", @@ -28041,7 +28041,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.LineageSubgraph", @@ -28122,7 +28122,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.LineageSubgraph", @@ -28202,7 +28202,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.LineageSubgraph", @@ -28287,7 +28287,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.RemoveContextChildrenResponse", @@ -28371,7 +28371,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.RemoveContextChildrenResponse", @@ -28456,7 +28456,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.Artifact", @@ -28540,7 +28540,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.Artifact", @@ -28625,7 +28625,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.Context", @@ -28709,7 +28709,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.Context", @@ -28794,7 +28794,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.Execution", @@ -28878,7 +28878,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.Execution", @@ -28963,7 +28963,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -29047,7 +29047,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -29128,7 +29128,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.services.migration_service.pagers.SearchMigratableResourcesAsyncPager", @@ -29208,7 +29208,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.services.migration_service.pagers.SearchMigratableResourcesPager", @@ -29289,7 +29289,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.PublisherModel", @@ -29369,7 +29369,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.PublisherModel", @@ -29454,7 +29454,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.BatchImportEvaluatedAnnotationsResponse", @@ -29538,7 +29538,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.BatchImportEvaluatedAnnotationsResponse", @@ -29623,7 +29623,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.BatchImportModelEvaluationSlicesResponse", @@ -29707,7 +29707,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.BatchImportModelEvaluationSlicesResponse", @@ -29792,7 +29792,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -29876,7 +29876,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -29957,7 +29957,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -30037,7 +30037,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -30118,7 +30118,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -30198,7 +30198,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -30283,7 +30283,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -30367,7 +30367,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -30448,7 +30448,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.ModelEvaluationSlice", @@ -30528,7 +30528,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.ModelEvaluationSlice", @@ -30609,7 +30609,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.ModelEvaluation", @@ -30689,7 +30689,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.ModelEvaluation", @@ -30770,7 +30770,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.Model", @@ -30850,7 +30850,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.Model", @@ -30935,7 +30935,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.ModelEvaluation", @@ -31019,7 +31019,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.ModelEvaluation", @@ -31100,7 +31100,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.services.model_service.pagers.ListModelEvaluationSlicesAsyncPager", @@ -31180,7 +31180,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.services.model_service.pagers.ListModelEvaluationSlicesPager", @@ -31261,7 +31261,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.services.model_service.pagers.ListModelEvaluationsAsyncPager", @@ -31341,7 +31341,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.services.model_service.pagers.ListModelEvaluationsPager", @@ -31422,7 +31422,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.services.model_service.pagers.ListModelVersionsAsyncPager", @@ -31502,7 +31502,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.services.model_service.pagers.ListModelVersionsPager", @@ -31583,7 +31583,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.services.model_service.pagers.ListModelsAsyncPager", @@ -31663,7 +31663,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.services.model_service.pagers.ListModelsPager", @@ -31748,7 +31748,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.Model", @@ -31832,7 +31832,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.Model", @@ -31913,7 +31913,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -31993,7 +31993,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -32078,7 +32078,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.Model", @@ -32162,7 +32162,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.Model", @@ -32247,7 +32247,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -32331,7 +32331,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -32424,7 +32424,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -32516,7 +32516,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -32605,7 +32605,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -32693,7 +32693,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -32782,7 +32782,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -32870,7 +32870,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -32951,7 +32951,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -33031,7 +33031,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -33112,7 +33112,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -33192,7 +33192,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -33273,7 +33273,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -33353,7 +33353,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -33434,7 +33434,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.NotebookExecutionJob", @@ -33514,7 +33514,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.NotebookExecutionJob", @@ -33595,7 +33595,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.NotebookRuntimeTemplate", @@ -33675,7 +33675,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.NotebookRuntimeTemplate", @@ -33756,7 +33756,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.NotebookRuntime", @@ -33836,7 +33836,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.NotebookRuntime", @@ -33917,7 +33917,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.services.notebook_service.pagers.ListNotebookExecutionJobsAsyncPager", @@ -33997,7 +33997,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.services.notebook_service.pagers.ListNotebookExecutionJobsPager", @@ -34078,7 +34078,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.services.notebook_service.pagers.ListNotebookRuntimeTemplatesAsyncPager", @@ -34158,7 +34158,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.services.notebook_service.pagers.ListNotebookRuntimeTemplatesPager", @@ -34239,7 +34239,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.services.notebook_service.pagers.ListNotebookRuntimesAsyncPager", @@ -34319,7 +34319,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.services.notebook_service.pagers.ListNotebookRuntimesPager", @@ -34400,7 +34400,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -34480,7 +34480,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -34561,7 +34561,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -34641,7 +34641,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -34726,7 +34726,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.NotebookRuntimeTemplate", @@ -34810,7 +34810,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.NotebookRuntimeTemplate", @@ -34891,7 +34891,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -34971,7 +34971,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -35060,7 +35060,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -35148,7 +35148,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -35229,7 +35229,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -35309,7 +35309,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -35390,7 +35390,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.PersistentResource", @@ -35470,7 +35470,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.PersistentResource", @@ -35551,7 +35551,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.services.persistent_resource_service.pagers.ListPersistentResourcesAsyncPager", @@ -35631,7 +35631,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.services.persistent_resource_service.pagers.ListPersistentResourcesPager", @@ -35712,7 +35712,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -35792,7 +35792,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -35877,7 +35877,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -35961,7 +35961,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -36046,7 +36046,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -36130,7 +36130,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -36215,7 +36215,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -36299,7 +36299,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -36380,7 +36380,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "shortName": "cancel_pipeline_job" @@ -36457,7 +36457,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "shortName": "cancel_pipeline_job" @@ -36535,7 +36535,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "shortName": "cancel_training_pipeline" @@ -36612,7 +36612,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "shortName": "cancel_training_pipeline" @@ -36698,7 +36698,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.PipelineJob", @@ -36786,7 +36786,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.PipelineJob", @@ -36871,7 +36871,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.TrainingPipeline", @@ -36955,7 +36955,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.TrainingPipeline", @@ -37036,7 +37036,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -37116,7 +37116,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -37197,7 +37197,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -37277,7 +37277,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -37358,7 +37358,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.PipelineJob", @@ -37438,7 +37438,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.PipelineJob", @@ -37519,7 +37519,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.TrainingPipeline", @@ -37599,7 +37599,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.TrainingPipeline", @@ -37680,7 +37680,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.services.pipeline_service.pagers.ListPipelineJobsAsyncPager", @@ -37760,7 +37760,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.services.pipeline_service.pagers.ListPipelineJobsPager", @@ -37841,7 +37841,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.services.pipeline_service.pagers.ListTrainingPipelinesAsyncPager", @@ -37921,7 +37921,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.services.pipeline_service.pagers.ListTrainingPipelinesPager", @@ -37998,7 +37998,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.DirectPredictResponse", @@ -38074,7 +38074,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.DirectPredictResponse", @@ -38151,7 +38151,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.DirectRawPredictResponse", @@ -38227,7 +38227,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.DirectRawPredictResponse", @@ -38320,7 +38320,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.ExplainResponse", @@ -38412,7 +38412,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.ExplainResponse", @@ -38497,7 +38497,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.GenerateContentResponse", @@ -38581,7 +38581,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.GenerateContentResponse", @@ -38670,7 +38670,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.PredictResponse", @@ -38758,7 +38758,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.PredictResponse", @@ -38843,7 +38843,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api.httpbody_pb2.HttpBody", @@ -38927,7 +38927,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api.httpbody_pb2.HttpBody", @@ -39004,7 +39004,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "Iterable[google.cloud.aiplatform_v1.types.StreamingPredictResponse]", @@ -39080,7 +39080,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "Iterable[google.cloud.aiplatform_v1.types.StreamingPredictResponse]", @@ -39157,7 +39157,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "Iterable[google.cloud.aiplatform_v1.types.StreamDirectPredictResponse]", @@ -39233,7 +39233,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "Iterable[google.cloud.aiplatform_v1.types.StreamDirectPredictResponse]", @@ -39310,7 +39310,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "Iterable[google.cloud.aiplatform_v1.types.StreamDirectRawPredictResponse]", @@ -39386,7 +39386,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "Iterable[google.cloud.aiplatform_v1.types.StreamDirectRawPredictResponse]", @@ -39471,7 +39471,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "Iterable[google.cloud.aiplatform_v1.types.GenerateContentResponse]", @@ -39555,7 +39555,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "Iterable[google.cloud.aiplatform_v1.types.GenerateContentResponse]", @@ -39640,7 +39640,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "Iterable[google.api.httpbody_pb2.HttpBody]", @@ -39724,7 +39724,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "Iterable[google.api.httpbody_pb2.HttpBody]", @@ -39801,7 +39801,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "Iterable[google.cloud.aiplatform_v1.types.StreamingPredictResponse]", @@ -39877,7 +39877,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "Iterable[google.cloud.aiplatform_v1.types.StreamingPredictResponse]", @@ -39954,7 +39954,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "Iterable[google.cloud.aiplatform_v1.types.StreamingRawPredictResponse]", @@ -40030,7 +40030,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "Iterable[google.cloud.aiplatform_v1.types.StreamingRawPredictResponse]", @@ -40115,7 +40115,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.Schedule", @@ -40199,7 +40199,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.Schedule", @@ -40280,7 +40280,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -40360,7 +40360,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -40441,7 +40441,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.Schedule", @@ -40521,7 +40521,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.Schedule", @@ -40602,7 +40602,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.services.schedule_service.pagers.ListSchedulesAsyncPager", @@ -40682,7 +40682,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.services.schedule_service.pagers.ListSchedulesPager", @@ -40763,7 +40763,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "shortName": "pause_schedule" @@ -40840,7 +40840,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "shortName": "pause_schedule" @@ -40922,7 +40922,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "shortName": "resume_schedule" @@ -41003,7 +41003,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "shortName": "resume_schedule" @@ -41085,7 +41085,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.Schedule", @@ -41169,7 +41169,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.Schedule", @@ -41254,7 +41254,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -41338,7 +41338,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -41419,7 +41419,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -41499,7 +41499,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -41580,7 +41580,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.SpecialistPool", @@ -41660,7 +41660,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.SpecialistPool", @@ -41741,7 +41741,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.services.specialist_pool_service.pagers.ListSpecialistPoolsAsyncPager", @@ -41821,7 +41821,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.services.specialist_pool_service.pagers.ListSpecialistPoolsPager", @@ -41906,7 +41906,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -41990,7 +41990,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -42075,7 +42075,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.BatchCreateTensorboardRunsResponse", @@ -42159,7 +42159,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.BatchCreateTensorboardRunsResponse", @@ -42244,7 +42244,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.BatchCreateTensorboardTimeSeriesResponse", @@ -42328,7 +42328,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.BatchCreateTensorboardTimeSeriesResponse", @@ -42409,7 +42409,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.BatchReadTensorboardTimeSeriesDataResponse", @@ -42489,7 +42489,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.BatchReadTensorboardTimeSeriesDataResponse", @@ -42578,7 +42578,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.TensorboardExperiment", @@ -42666,7 +42666,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.TensorboardExperiment", @@ -42755,7 +42755,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.TensorboardRun", @@ -42843,7 +42843,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.TensorboardRun", @@ -42928,7 +42928,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.TensorboardTimeSeries", @@ -43012,7 +43012,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.TensorboardTimeSeries", @@ -43097,7 +43097,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -43181,7 +43181,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -43262,7 +43262,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -43342,7 +43342,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -43423,7 +43423,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -43503,7 +43503,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -43584,7 +43584,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -43664,7 +43664,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -43745,7 +43745,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -43825,7 +43825,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -43906,7 +43906,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.services.tensorboard_service.pagers.ExportTensorboardTimeSeriesDataAsyncPager", @@ -43986,7 +43986,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.services.tensorboard_service.pagers.ExportTensorboardTimeSeriesDataPager", @@ -44067,7 +44067,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.TensorboardExperiment", @@ -44147,7 +44147,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.TensorboardExperiment", @@ -44228,7 +44228,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.TensorboardRun", @@ -44308,7 +44308,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.TensorboardRun", @@ -44389,7 +44389,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.TensorboardTimeSeries", @@ -44469,7 +44469,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.TensorboardTimeSeries", @@ -44550,7 +44550,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.Tensorboard", @@ -44630,7 +44630,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.Tensorboard", @@ -44711,7 +44711,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.services.tensorboard_service.pagers.ListTensorboardExperimentsAsyncPager", @@ -44791,7 +44791,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.services.tensorboard_service.pagers.ListTensorboardExperimentsPager", @@ -44872,7 +44872,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.services.tensorboard_service.pagers.ListTensorboardRunsAsyncPager", @@ -44952,7 +44952,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.services.tensorboard_service.pagers.ListTensorboardRunsPager", @@ -45033,7 +45033,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.services.tensorboard_service.pagers.ListTensorboardTimeSeriesAsyncPager", @@ -45113,7 +45113,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.services.tensorboard_service.pagers.ListTensorboardTimeSeriesPager", @@ -45194,7 +45194,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.services.tensorboard_service.pagers.ListTensorboardsAsyncPager", @@ -45274,7 +45274,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.services.tensorboard_service.pagers.ListTensorboardsPager", @@ -45355,7 +45355,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "Iterable[google.cloud.aiplatform_v1.types.ReadTensorboardBlobDataResponse]", @@ -45435,7 +45435,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "Iterable[google.cloud.aiplatform_v1.types.ReadTensorboardBlobDataResponse]", @@ -45516,7 +45516,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.ReadTensorboardSizeResponse", @@ -45596,7 +45596,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.ReadTensorboardSizeResponse", @@ -45677,7 +45677,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.ReadTensorboardTimeSeriesDataResponse", @@ -45757,7 +45757,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.ReadTensorboardTimeSeriesDataResponse", @@ -45838,7 +45838,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.ReadTensorboardUsageResponse", @@ -45918,7 +45918,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.ReadTensorboardUsageResponse", @@ -46003,7 +46003,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.TensorboardExperiment", @@ -46087,7 +46087,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.TensorboardExperiment", @@ -46172,7 +46172,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.TensorboardRun", @@ -46256,7 +46256,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.TensorboardRun", @@ -46341,7 +46341,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.TensorboardTimeSeries", @@ -46425,7 +46425,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.TensorboardTimeSeries", @@ -46510,7 +46510,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -46594,7 +46594,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -46679,7 +46679,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.WriteTensorboardExperimentDataResponse", @@ -46763,7 +46763,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.WriteTensorboardExperimentDataResponse", @@ -46848,7 +46848,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.WriteTensorboardRunDataResponse", @@ -46932,7 +46932,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.WriteTensorboardRunDataResponse", @@ -47017,7 +47017,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -47101,7 +47101,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -47182,7 +47182,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -47262,7 +47262,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -47343,7 +47343,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -47423,7 +47423,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -47504,7 +47504,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.RagCorpus", @@ -47584,7 +47584,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.RagCorpus", @@ -47665,7 +47665,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.RagFile", @@ -47745,7 +47745,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.RagFile", @@ -47830,7 +47830,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -47914,7 +47914,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -47995,7 +47995,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.services.vertex_rag_data_service.pagers.ListRagCorporaAsyncPager", @@ -48075,7 +48075,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.services.vertex_rag_data_service.pagers.ListRagCorporaPager", @@ -48156,7 +48156,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.services.vertex_rag_data_service.pagers.ListRagFilesAsyncPager", @@ -48236,7 +48236,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.services.vertex_rag_data_service.pagers.ListRagFilesPager", @@ -48317,7 +48317,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -48397,7 +48397,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -48486,7 +48486,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.UploadRagFileResponse", @@ -48574,7 +48574,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.UploadRagFileResponse", @@ -48663,7 +48663,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.AugmentPromptResponse", @@ -48751,7 +48751,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.AugmentPromptResponse", @@ -48840,7 +48840,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.CorroborateContentResponse", @@ -48928,7 +48928,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.CorroborateContentResponse", @@ -49013,7 +49013,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.RetrieveContextsResponse", @@ -49097,7 +49097,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.RetrieveContextsResponse", @@ -49174,7 +49174,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.Trial", @@ -49250,7 +49250,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.Trial", @@ -49327,7 +49327,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -49403,7 +49403,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -49480,7 +49480,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.Trial", @@ -49556,7 +49556,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.Trial", @@ -49641,7 +49641,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.Study", @@ -49725,7 +49725,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.Study", @@ -49810,7 +49810,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.Trial", @@ -49894,7 +49894,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.Trial", @@ -49975,7 +49975,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "shortName": "delete_study" @@ -50052,7 +50052,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "shortName": "delete_study" @@ -50130,7 +50130,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "shortName": "delete_trial" @@ -50207,7 +50207,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "shortName": "delete_trial" @@ -50285,7 +50285,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.Study", @@ -50365,7 +50365,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.Study", @@ -50446,7 +50446,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.Trial", @@ -50526,7 +50526,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.Trial", @@ -50607,7 +50607,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.ListOptimalTrialsResponse", @@ -50687,7 +50687,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.ListOptimalTrialsResponse", @@ -50768,7 +50768,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.services.vizier_service.pagers.ListStudiesAsyncPager", @@ -50848,7 +50848,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.services.vizier_service.pagers.ListStudiesPager", @@ -50929,7 +50929,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.services.vizier_service.pagers.ListTrialsAsyncPager", @@ -51009,7 +51009,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.services.vizier_service.pagers.ListTrialsPager", @@ -51090,7 +51090,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.Study", @@ -51170,7 +51170,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.Study", @@ -51247,7 +51247,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.Trial", @@ -51323,7 +51323,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1.types.Trial", @@ -51400,7 +51400,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -51476,7 +51476,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", diff --git a/samples/generated_samples/snippet_metadata_google.cloud.aiplatform.v1beta1.json b/samples/generated_samples/snippet_metadata_google.cloud.aiplatform.v1beta1.json index d214a58f55..ba00681c5e 100644 --- a/samples/generated_samples/snippet_metadata_google.cloud.aiplatform.v1beta1.json +++ b/samples/generated_samples/snippet_metadata_google.cloud.aiplatform.v1beta1.json @@ -8,7 +8,7 @@ ], "language": "PYTHON", "name": "google-cloud-aiplatform", - "version": "1.74.0" + "version": "0.1.0" }, "snippets": [ { @@ -51,7 +51,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -135,7 +135,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -220,7 +220,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -304,7 +304,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -385,7 +385,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -465,7 +465,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -546,7 +546,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -626,7 +626,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -707,7 +707,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -787,7 +787,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -872,7 +872,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -956,7 +956,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -1037,7 +1037,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.AnnotationSpec", @@ -1117,7 +1117,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.AnnotationSpec", @@ -1198,7 +1198,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.DatasetVersion", @@ -1278,7 +1278,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.DatasetVersion", @@ -1359,7 +1359,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.Dataset", @@ -1439,7 +1439,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.Dataset", @@ -1524,7 +1524,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -1608,7 +1608,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -1689,7 +1689,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.dataset_service.pagers.ListAnnotationsAsyncPager", @@ -1769,7 +1769,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.dataset_service.pagers.ListAnnotationsPager", @@ -1850,7 +1850,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.dataset_service.pagers.ListDataItemsAsyncPager", @@ -1930,7 +1930,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.dataset_service.pagers.ListDataItemsPager", @@ -2011,7 +2011,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.dataset_service.pagers.ListDatasetVersionsAsyncPager", @@ -2091,7 +2091,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.dataset_service.pagers.ListDatasetVersionsPager", @@ -2172,7 +2172,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.dataset_service.pagers.ListDatasetsAsyncPager", @@ -2252,7 +2252,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.dataset_service.pagers.ListDatasetsPager", @@ -2333,7 +2333,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.dataset_service.pagers.ListSavedQueriesAsyncPager", @@ -2413,7 +2413,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.dataset_service.pagers.ListSavedQueriesPager", @@ -2494,7 +2494,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -2574,7 +2574,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -2651,7 +2651,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.dataset_service.pagers.SearchDataItemsAsyncPager", @@ -2727,7 +2727,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.dataset_service.pagers.SearchDataItemsPager", @@ -2812,7 +2812,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.DatasetVersion", @@ -2896,7 +2896,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.DatasetVersion", @@ -2981,7 +2981,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.Dataset", @@ -3065,7 +3065,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.Dataset", @@ -3154,7 +3154,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -3242,7 +3242,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -3323,7 +3323,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -3403,7 +3403,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -3484,7 +3484,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.DeploymentResourcePool", @@ -3564,7 +3564,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.DeploymentResourcePool", @@ -3645,7 +3645,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.deployment_resource_pool_service.pagers.ListDeploymentResourcePoolsAsyncPager", @@ -3725,7 +3725,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.deployment_resource_pool_service.pagers.ListDeploymentResourcePoolsPager", @@ -3806,7 +3806,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.deployment_resource_pool_service.pagers.QueryDeployedModelsAsyncPager", @@ -3886,7 +3886,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.deployment_resource_pool_service.pagers.QueryDeployedModelsPager", @@ -3971,7 +3971,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -4055,7 +4055,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -4144,7 +4144,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -4232,7 +4232,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -4313,7 +4313,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -4393,7 +4393,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -4482,7 +4482,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -4570,7 +4570,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -4651,7 +4651,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.Endpoint", @@ -4731,7 +4731,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.Endpoint", @@ -4812,7 +4812,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.endpoint_service.pagers.ListEndpointsAsyncPager", @@ -4892,7 +4892,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.endpoint_service.pagers.ListEndpointsPager", @@ -4981,7 +4981,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -5069,7 +5069,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -5158,7 +5158,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -5246,7 +5246,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -5327,7 +5327,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -5407,7 +5407,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -5492,7 +5492,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.Endpoint", @@ -5576,7 +5576,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.Endpoint", @@ -5653,7 +5653,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.EvaluateInstancesResponse", @@ -5729,7 +5729,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.EvaluateInstancesResponse", @@ -5814,7 +5814,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.ExecuteExtensionResponse", @@ -5898,7 +5898,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.ExecuteExtensionResponse", @@ -5983,7 +5983,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.QueryExtensionResponse", @@ -6067,7 +6067,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.QueryExtensionResponse", @@ -6148,7 +6148,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -6228,7 +6228,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -6309,7 +6309,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.Extension", @@ -6389,7 +6389,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.Extension", @@ -6474,7 +6474,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -6558,7 +6558,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -6639,7 +6639,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.extension_registry_service.pagers.ListExtensionsAsyncPager", @@ -6719,7 +6719,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.extension_registry_service.pagers.ListExtensionsPager", @@ -6804,7 +6804,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.Extension", @@ -6888,7 +6888,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.Extension", @@ -6977,7 +6977,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -7065,7 +7065,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -7154,7 +7154,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -7242,7 +7242,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -7327,7 +7327,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -7411,7 +7411,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -7492,7 +7492,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -7572,7 +7572,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -7653,7 +7653,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.FeatureOnlineStore", @@ -7733,7 +7733,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.FeatureOnlineStore", @@ -7814,7 +7814,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.FeatureViewSync", @@ -7894,7 +7894,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.FeatureViewSync", @@ -7975,7 +7975,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.FeatureView", @@ -8055,7 +8055,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.FeatureView", @@ -8136,7 +8136,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.feature_online_store_admin_service.pagers.ListFeatureOnlineStoresAsyncPager", @@ -8216,7 +8216,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.feature_online_store_admin_service.pagers.ListFeatureOnlineStoresPager", @@ -8297,7 +8297,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.feature_online_store_admin_service.pagers.ListFeatureViewSyncsAsyncPager", @@ -8377,7 +8377,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.feature_online_store_admin_service.pagers.ListFeatureViewSyncsPager", @@ -8458,7 +8458,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.feature_online_store_admin_service.pagers.ListFeatureViewsAsyncPager", @@ -8538,7 +8538,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.feature_online_store_admin_service.pagers.ListFeatureViewsPager", @@ -8619,7 +8619,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.SyncFeatureViewResponse", @@ -8699,7 +8699,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.SyncFeatureViewResponse", @@ -8784,7 +8784,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -8868,7 +8868,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -8953,7 +8953,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -9037,7 +9037,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -9122,7 +9122,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.FetchFeatureValuesResponse", @@ -9206,7 +9206,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.FetchFeatureValuesResponse", @@ -9283,7 +9283,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.SearchNearestEntitiesResponse", @@ -9359,7 +9359,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.SearchNearestEntitiesResponse", @@ -9436,7 +9436,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "Iterable[google.cloud.aiplatform_v1beta1.types.StreamingFetchFeatureValuesResponse]", @@ -9512,7 +9512,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "Iterable[google.cloud.aiplatform_v1beta1.types.StreamingFetchFeatureValuesResponse]", @@ -9597,7 +9597,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -9681,7 +9681,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -9770,7 +9770,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -9858,7 +9858,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -9947,7 +9947,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.FeatureMonitorJob", @@ -10035,7 +10035,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.FeatureMonitorJob", @@ -10124,7 +10124,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -10212,7 +10212,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -10301,7 +10301,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -10389,7 +10389,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -10474,7 +10474,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -10558,7 +10558,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -10639,7 +10639,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -10719,7 +10719,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -10800,7 +10800,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -10880,7 +10880,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -10961,7 +10961,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.FeatureGroup", @@ -11041,7 +11041,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.FeatureGroup", @@ -11122,7 +11122,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.FeatureMonitorJob", @@ -11202,7 +11202,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.FeatureMonitorJob", @@ -11283,7 +11283,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.FeatureMonitor", @@ -11363,7 +11363,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.FeatureMonitor", @@ -11444,7 +11444,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.Feature", @@ -11524,7 +11524,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.Feature", @@ -11605,7 +11605,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.feature_registry_service.pagers.ListFeatureGroupsAsyncPager", @@ -11685,7 +11685,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.feature_registry_service.pagers.ListFeatureGroupsPager", @@ -11766,7 +11766,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.feature_registry_service.pagers.ListFeatureMonitorJobsAsyncPager", @@ -11846,7 +11846,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.feature_registry_service.pagers.ListFeatureMonitorJobsPager", @@ -11927,7 +11927,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.feature_registry_service.pagers.ListFeatureMonitorsAsyncPager", @@ -12007,7 +12007,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.feature_registry_service.pagers.ListFeatureMonitorsPager", @@ -12088,7 +12088,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.feature_registry_service.pagers.ListFeaturesAsyncPager", @@ -12168,7 +12168,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.feature_registry_service.pagers.ListFeaturesPager", @@ -12253,7 +12253,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -12337,7 +12337,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -12422,7 +12422,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -12506,7 +12506,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -12587,7 +12587,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.ReadFeatureValuesResponse", @@ -12667,7 +12667,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.ReadFeatureValuesResponse", @@ -12748,7 +12748,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "Iterable[google.cloud.aiplatform_v1beta1.types.ReadFeatureValuesResponse]", @@ -12828,7 +12828,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "Iterable[google.cloud.aiplatform_v1beta1.types.ReadFeatureValuesResponse]", @@ -12913,7 +12913,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.WriteFeatureValuesResponse", @@ -12997,7 +12997,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.WriteFeatureValuesResponse", @@ -13082,7 +13082,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -13166,7 +13166,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -13247,7 +13247,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -13327,7 +13327,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -13416,7 +13416,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -13504,7 +13504,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -13593,7 +13593,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -13681,7 +13681,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -13770,7 +13770,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -13858,7 +13858,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -13943,7 +13943,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -14027,7 +14027,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -14108,7 +14108,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -14188,7 +14188,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -14269,7 +14269,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -14349,7 +14349,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -14434,7 +14434,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -14518,7 +14518,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -14599,7 +14599,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -14679,7 +14679,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -14760,7 +14760,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.EntityType", @@ -14840,7 +14840,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.EntityType", @@ -14921,7 +14921,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.Feature", @@ -15001,7 +15001,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.Feature", @@ -15082,7 +15082,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.Featurestore", @@ -15162,7 +15162,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.Featurestore", @@ -15243,7 +15243,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -15323,7 +15323,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -15404,7 +15404,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.featurestore_service.pagers.ListEntityTypesAsyncPager", @@ -15484,7 +15484,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.featurestore_service.pagers.ListEntityTypesPager", @@ -15565,7 +15565,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.featurestore_service.pagers.ListFeaturesAsyncPager", @@ -15645,7 +15645,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.featurestore_service.pagers.ListFeaturesPager", @@ -15726,7 +15726,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.featurestore_service.pagers.ListFeaturestoresAsyncPager", @@ -15806,7 +15806,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.featurestore_service.pagers.ListFeaturestoresPager", @@ -15891,7 +15891,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.featurestore_service.pagers.SearchFeaturesAsyncPager", @@ -15975,7 +15975,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.featurestore_service.pagers.SearchFeaturesPager", @@ -16060,7 +16060,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.EntityType", @@ -16144,7 +16144,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.EntityType", @@ -16229,7 +16229,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.Feature", @@ -16313,7 +16313,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.Feature", @@ -16398,7 +16398,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -16482,7 +16482,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -16567,7 +16567,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.CachedContent", @@ -16651,7 +16651,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.CachedContent", @@ -16732,7 +16732,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "shortName": "delete_cached_content" @@ -16809,7 +16809,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "shortName": "delete_cached_content" @@ -16887,7 +16887,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.CachedContent", @@ -16967,7 +16967,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.CachedContent", @@ -17048,7 +17048,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.gen_ai_cache_service.pagers.ListCachedContentsAsyncPager", @@ -17128,7 +17128,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.gen_ai_cache_service.pagers.ListCachedContentsPager", @@ -17213,7 +17213,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.CachedContent", @@ -17297,7 +17297,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.CachedContent", @@ -17378,7 +17378,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "shortName": "cancel_tuning_job" @@ -17455,7 +17455,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "shortName": "cancel_tuning_job" @@ -17537,7 +17537,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.TuningJob", @@ -17621,7 +17621,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.TuningJob", @@ -17702,7 +17702,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.TuningJob", @@ -17782,7 +17782,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.TuningJob", @@ -17863,7 +17863,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.gen_ai_tuning_service.pagers.ListTuningJobsAsyncPager", @@ -17943,7 +17943,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.gen_ai_tuning_service.pagers.ListTuningJobsPager", @@ -18028,7 +18028,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -18112,7 +18112,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -18197,7 +18197,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -18281,7 +18281,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -18362,7 +18362,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -18442,7 +18442,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -18527,7 +18527,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -18611,7 +18611,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -18692,7 +18692,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.IndexEndpoint", @@ -18772,7 +18772,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.IndexEndpoint", @@ -18853,7 +18853,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.index_endpoint_service.pagers.ListIndexEndpointsAsyncPager", @@ -18933,7 +18933,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.index_endpoint_service.pagers.ListIndexEndpointsPager", @@ -19018,7 +19018,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -19102,7 +19102,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -19187,7 +19187,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -19271,7 +19271,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -19356,7 +19356,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.IndexEndpoint", @@ -19440,7 +19440,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.IndexEndpoint", @@ -19525,7 +19525,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -19609,7 +19609,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -19690,7 +19690,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -19770,7 +19770,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -19851,7 +19851,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.Index", @@ -19931,7 +19931,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.Index", @@ -20012,7 +20012,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.index_service.pagers.ListIndexesAsyncPager", @@ -20092,7 +20092,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.index_service.pagers.ListIndexesPager", @@ -20169,7 +20169,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.RemoveDatapointsResponse", @@ -20245,7 +20245,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.RemoveDatapointsResponse", @@ -20330,7 +20330,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -20414,7 +20414,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -20491,7 +20491,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.UpsertDatapointsResponse", @@ -20567,7 +20567,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.UpsertDatapointsResponse", @@ -20648,7 +20648,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "shortName": "cancel_batch_prediction_job" @@ -20725,7 +20725,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "shortName": "cancel_batch_prediction_job" @@ -20803,7 +20803,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "shortName": "cancel_custom_job" @@ -20880,7 +20880,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "shortName": "cancel_custom_job" @@ -20958,7 +20958,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "shortName": "cancel_data_labeling_job" @@ -21035,7 +21035,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "shortName": "cancel_data_labeling_job" @@ -21113,7 +21113,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "shortName": "cancel_hyperparameter_tuning_job" @@ -21190,7 +21190,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "shortName": "cancel_hyperparameter_tuning_job" @@ -21268,7 +21268,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "shortName": "cancel_nas_job" @@ -21345,7 +21345,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "shortName": "cancel_nas_job" @@ -21427,7 +21427,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.BatchPredictionJob", @@ -21511,7 +21511,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.BatchPredictionJob", @@ -21596,7 +21596,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.CustomJob", @@ -21680,7 +21680,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.CustomJob", @@ -21765,7 +21765,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.DataLabelingJob", @@ -21849,7 +21849,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.DataLabelingJob", @@ -21934,7 +21934,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.HyperparameterTuningJob", @@ -22018,7 +22018,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.HyperparameterTuningJob", @@ -22103,7 +22103,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.ModelDeploymentMonitoringJob", @@ -22187,7 +22187,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.ModelDeploymentMonitoringJob", @@ -22272,7 +22272,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.NasJob", @@ -22356,7 +22356,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.NasJob", @@ -22437,7 +22437,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -22517,7 +22517,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -22598,7 +22598,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -22678,7 +22678,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -22759,7 +22759,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -22839,7 +22839,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -22920,7 +22920,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -23000,7 +23000,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -23081,7 +23081,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -23161,7 +23161,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -23242,7 +23242,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -23322,7 +23322,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -23403,7 +23403,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.BatchPredictionJob", @@ -23483,7 +23483,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.BatchPredictionJob", @@ -23564,7 +23564,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.CustomJob", @@ -23644,7 +23644,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.CustomJob", @@ -23725,7 +23725,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.DataLabelingJob", @@ -23805,7 +23805,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.DataLabelingJob", @@ -23886,7 +23886,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.HyperparameterTuningJob", @@ -23966,7 +23966,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.HyperparameterTuningJob", @@ -24047,7 +24047,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.ModelDeploymentMonitoringJob", @@ -24127,7 +24127,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.ModelDeploymentMonitoringJob", @@ -24208,7 +24208,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.NasJob", @@ -24288,7 +24288,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.NasJob", @@ -24369,7 +24369,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.NasTrialDetail", @@ -24449,7 +24449,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.NasTrialDetail", @@ -24530,7 +24530,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.job_service.pagers.ListBatchPredictionJobsAsyncPager", @@ -24610,7 +24610,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.job_service.pagers.ListBatchPredictionJobsPager", @@ -24691,7 +24691,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.job_service.pagers.ListCustomJobsAsyncPager", @@ -24771,7 +24771,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.job_service.pagers.ListCustomJobsPager", @@ -24852,7 +24852,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.job_service.pagers.ListDataLabelingJobsAsyncPager", @@ -24932,7 +24932,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.job_service.pagers.ListDataLabelingJobsPager", @@ -25013,7 +25013,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.job_service.pagers.ListHyperparameterTuningJobsAsyncPager", @@ -25093,7 +25093,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.job_service.pagers.ListHyperparameterTuningJobsPager", @@ -25174,7 +25174,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.job_service.pagers.ListModelDeploymentMonitoringJobsAsyncPager", @@ -25254,7 +25254,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.job_service.pagers.ListModelDeploymentMonitoringJobsPager", @@ -25335,7 +25335,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.job_service.pagers.ListNasJobsAsyncPager", @@ -25415,7 +25415,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.job_service.pagers.ListNasJobsPager", @@ -25496,7 +25496,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.job_service.pagers.ListNasTrialDetailsAsyncPager", @@ -25576,7 +25576,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.job_service.pagers.ListNasTrialDetailsPager", @@ -25657,7 +25657,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "shortName": "pause_model_deployment_monitoring_job" @@ -25734,7 +25734,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "shortName": "pause_model_deployment_monitoring_job" @@ -25812,7 +25812,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "shortName": "resume_model_deployment_monitoring_job" @@ -25889,7 +25889,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "shortName": "resume_model_deployment_monitoring_job" @@ -25971,7 +25971,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.job_service.pagers.SearchModelDeploymentMonitoringStatsAnomaliesAsyncPager", @@ -26055,7 +26055,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.job_service.pagers.SearchModelDeploymentMonitoringStatsAnomaliesPager", @@ -26140,7 +26140,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -26224,7 +26224,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -26309,7 +26309,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.ComputeTokensResponse", @@ -26393,7 +26393,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.ComputeTokensResponse", @@ -26470,7 +26470,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.FindNeighborsResponse", @@ -26546,7 +26546,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.FindNeighborsResponse", @@ -26623,7 +26623,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.ReadIndexDatapointsResponse", @@ -26699,7 +26699,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.ReadIndexDatapointsResponse", @@ -26788,7 +26788,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.AddContextArtifactsAndExecutionsResponse", @@ -26876,7 +26876,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.AddContextArtifactsAndExecutionsResponse", @@ -26961,7 +26961,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.AddContextChildrenResponse", @@ -27045,7 +27045,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.AddContextChildrenResponse", @@ -27130,7 +27130,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.AddExecutionEventsResponse", @@ -27214,7 +27214,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.AddExecutionEventsResponse", @@ -27303,7 +27303,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.Artifact", @@ -27391,7 +27391,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.Artifact", @@ -27480,7 +27480,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.Context", @@ -27568,7 +27568,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.Context", @@ -27657,7 +27657,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.Execution", @@ -27745,7 +27745,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.Execution", @@ -27834,7 +27834,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.MetadataSchema", @@ -27922,7 +27922,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.MetadataSchema", @@ -28011,7 +28011,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -28099,7 +28099,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -28180,7 +28180,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -28260,7 +28260,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -28341,7 +28341,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -28421,7 +28421,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -28502,7 +28502,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -28582,7 +28582,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -28663,7 +28663,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -28743,7 +28743,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -28824,7 +28824,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.Artifact", @@ -28904,7 +28904,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.Artifact", @@ -28985,7 +28985,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.Context", @@ -29065,7 +29065,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.Context", @@ -29146,7 +29146,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.Execution", @@ -29226,7 +29226,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.Execution", @@ -29307,7 +29307,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.MetadataSchema", @@ -29387,7 +29387,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.MetadataSchema", @@ -29468,7 +29468,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.MetadataStore", @@ -29548,7 +29548,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.MetadataStore", @@ -29629,7 +29629,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.metadata_service.pagers.ListArtifactsAsyncPager", @@ -29709,7 +29709,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.metadata_service.pagers.ListArtifactsPager", @@ -29790,7 +29790,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.metadata_service.pagers.ListContextsAsyncPager", @@ -29870,7 +29870,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.metadata_service.pagers.ListContextsPager", @@ -29951,7 +29951,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.metadata_service.pagers.ListExecutionsAsyncPager", @@ -30031,7 +30031,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.metadata_service.pagers.ListExecutionsPager", @@ -30112,7 +30112,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.metadata_service.pagers.ListMetadataSchemasAsyncPager", @@ -30192,7 +30192,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.metadata_service.pagers.ListMetadataSchemasPager", @@ -30273,7 +30273,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.metadata_service.pagers.ListMetadataStoresAsyncPager", @@ -30353,7 +30353,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.metadata_service.pagers.ListMetadataStoresPager", @@ -30434,7 +30434,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -30514,7 +30514,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -30595,7 +30595,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -30675,7 +30675,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -30756,7 +30756,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -30836,7 +30836,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -30917,7 +30917,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.LineageSubgraph", @@ -30997,7 +30997,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.LineageSubgraph", @@ -31078,7 +31078,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.LineageSubgraph", @@ -31158,7 +31158,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.LineageSubgraph", @@ -31239,7 +31239,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.LineageSubgraph", @@ -31319,7 +31319,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.LineageSubgraph", @@ -31404,7 +31404,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.RemoveContextChildrenResponse", @@ -31488,7 +31488,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.RemoveContextChildrenResponse", @@ -31573,7 +31573,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.Artifact", @@ -31657,7 +31657,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.Artifact", @@ -31742,7 +31742,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.Context", @@ -31826,7 +31826,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.Context", @@ -31911,7 +31911,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.Execution", @@ -31995,7 +31995,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.Execution", @@ -32080,7 +32080,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -32164,7 +32164,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -32245,7 +32245,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.migration_service.pagers.SearchMigratableResourcesAsyncPager", @@ -32325,7 +32325,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.migration_service.pagers.SearchMigratableResourcesPager", @@ -32406,7 +32406,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.PublisherModel", @@ -32486,7 +32486,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.PublisherModel", @@ -32567,7 +32567,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.model_garden_service.pagers.ListPublisherModelsAsyncPager", @@ -32647,7 +32647,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.model_garden_service.pagers.ListPublisherModelsPager", @@ -32732,7 +32732,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -32816,7 +32816,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -32901,7 +32901,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.ModelMonitoringJob", @@ -32985,7 +32985,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.ModelMonitoringJob", @@ -33066,7 +33066,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -33146,7 +33146,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -33227,7 +33227,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -33307,7 +33307,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -33388,7 +33388,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.ModelMonitor", @@ -33468,7 +33468,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.ModelMonitor", @@ -33549,7 +33549,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.ModelMonitoringJob", @@ -33629,7 +33629,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.ModelMonitoringJob", @@ -33710,7 +33710,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.model_monitoring_service.pagers.ListModelMonitoringJobsAsyncPager", @@ -33790,7 +33790,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.model_monitoring_service.pagers.ListModelMonitoringJobsPager", @@ -33871,7 +33871,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.model_monitoring_service.pagers.ListModelMonitorsAsyncPager", @@ -33951,7 +33951,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.model_monitoring_service.pagers.ListModelMonitorsPager", @@ -34032,7 +34032,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.model_monitoring_service.pagers.SearchModelMonitoringAlertsAsyncPager", @@ -34112,7 +34112,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.model_monitoring_service.pagers.SearchModelMonitoringAlertsPager", @@ -34193,7 +34193,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.model_monitoring_service.pagers.SearchModelMonitoringStatsAsyncPager", @@ -34273,7 +34273,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.model_monitoring_service.pagers.SearchModelMonitoringStatsPager", @@ -34358,7 +34358,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -34442,7 +34442,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -34527,7 +34527,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.BatchImportEvaluatedAnnotationsResponse", @@ -34611,7 +34611,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.BatchImportEvaluatedAnnotationsResponse", @@ -34696,7 +34696,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.BatchImportModelEvaluationSlicesResponse", @@ -34780,7 +34780,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.BatchImportModelEvaluationSlicesResponse", @@ -34865,7 +34865,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -34949,7 +34949,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -35030,7 +35030,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -35110,7 +35110,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -35191,7 +35191,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -35271,7 +35271,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -35356,7 +35356,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -35440,7 +35440,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -35521,7 +35521,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.ModelEvaluationSlice", @@ -35601,7 +35601,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.ModelEvaluationSlice", @@ -35682,7 +35682,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.ModelEvaluation", @@ -35762,7 +35762,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.ModelEvaluation", @@ -35843,7 +35843,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.Model", @@ -35923,7 +35923,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.Model", @@ -36008,7 +36008,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.ModelEvaluation", @@ -36092,7 +36092,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.ModelEvaluation", @@ -36173,7 +36173,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.model_service.pagers.ListModelEvaluationSlicesAsyncPager", @@ -36253,7 +36253,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.model_service.pagers.ListModelEvaluationSlicesPager", @@ -36334,7 +36334,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.model_service.pagers.ListModelEvaluationsAsyncPager", @@ -36414,7 +36414,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.model_service.pagers.ListModelEvaluationsPager", @@ -36495,7 +36495,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.model_service.pagers.ListModelVersionsAsyncPager", @@ -36575,7 +36575,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.model_service.pagers.ListModelVersionsPager", @@ -36656,7 +36656,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.model_service.pagers.ListModelsAsyncPager", @@ -36736,7 +36736,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.model_service.pagers.ListModelsPager", @@ -36821,7 +36821,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.Model", @@ -36905,7 +36905,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.Model", @@ -36986,7 +36986,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -37066,7 +37066,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -37151,7 +37151,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.Model", @@ -37235,7 +37235,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.Model", @@ -37320,7 +37320,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -37404,7 +37404,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -37497,7 +37497,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -37589,7 +37589,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -37678,7 +37678,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -37766,7 +37766,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -37855,7 +37855,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -37943,7 +37943,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -38024,7 +38024,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -38104,7 +38104,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -38185,7 +38185,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -38265,7 +38265,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -38346,7 +38346,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -38426,7 +38426,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -38507,7 +38507,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.NotebookExecutionJob", @@ -38587,7 +38587,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.NotebookExecutionJob", @@ -38668,7 +38668,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.NotebookRuntimeTemplate", @@ -38748,7 +38748,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.NotebookRuntimeTemplate", @@ -38829,7 +38829,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.NotebookRuntime", @@ -38909,7 +38909,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.NotebookRuntime", @@ -38990,7 +38990,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.notebook_service.pagers.ListNotebookExecutionJobsAsyncPager", @@ -39070,7 +39070,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.notebook_service.pagers.ListNotebookExecutionJobsPager", @@ -39151,7 +39151,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.notebook_service.pagers.ListNotebookRuntimeTemplatesAsyncPager", @@ -39231,7 +39231,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.notebook_service.pagers.ListNotebookRuntimeTemplatesPager", @@ -39312,7 +39312,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.notebook_service.pagers.ListNotebookRuntimesAsyncPager", @@ -39392,7 +39392,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.notebook_service.pagers.ListNotebookRuntimesPager", @@ -39473,7 +39473,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -39553,7 +39553,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -39634,7 +39634,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -39714,7 +39714,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -39799,7 +39799,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.NotebookRuntimeTemplate", @@ -39883,7 +39883,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.NotebookRuntimeTemplate", @@ -39964,7 +39964,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -40044,7 +40044,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -40133,7 +40133,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -40221,7 +40221,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -40302,7 +40302,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -40382,7 +40382,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -40463,7 +40463,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.PersistentResource", @@ -40543,7 +40543,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.PersistentResource", @@ -40624,7 +40624,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.persistent_resource_service.pagers.ListPersistentResourcesAsyncPager", @@ -40704,7 +40704,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.persistent_resource_service.pagers.ListPersistentResourcesPager", @@ -40785,7 +40785,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -40865,7 +40865,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -40950,7 +40950,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -41034,7 +41034,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -41119,7 +41119,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -41203,7 +41203,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -41288,7 +41288,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -41372,7 +41372,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -41453,7 +41453,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "shortName": "cancel_pipeline_job" @@ -41530,7 +41530,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "shortName": "cancel_pipeline_job" @@ -41608,7 +41608,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "shortName": "cancel_training_pipeline" @@ -41685,7 +41685,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "shortName": "cancel_training_pipeline" @@ -41771,7 +41771,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.PipelineJob", @@ -41859,7 +41859,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.PipelineJob", @@ -41944,7 +41944,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.TrainingPipeline", @@ -42028,7 +42028,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.TrainingPipeline", @@ -42109,7 +42109,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -42189,7 +42189,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -42270,7 +42270,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -42350,7 +42350,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -42431,7 +42431,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.PipelineJob", @@ -42511,7 +42511,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.PipelineJob", @@ -42592,7 +42592,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.TrainingPipeline", @@ -42672,7 +42672,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.TrainingPipeline", @@ -42753,7 +42753,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.pipeline_service.pagers.ListPipelineJobsAsyncPager", @@ -42833,7 +42833,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.pipeline_service.pagers.ListPipelineJobsPager", @@ -42914,7 +42914,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.pipeline_service.pagers.ListTrainingPipelinesAsyncPager", @@ -42994,7 +42994,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.pipeline_service.pagers.ListTrainingPipelinesPager", @@ -43079,7 +43079,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "Iterable[google.api.httpbody_pb2.HttpBody]", @@ -43163,7 +43163,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "Iterable[google.api.httpbody_pb2.HttpBody]", @@ -43248,7 +43248,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.CountTokensResponse", @@ -43332,7 +43332,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.CountTokensResponse", @@ -43409,7 +43409,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.DirectPredictResponse", @@ -43485,7 +43485,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.DirectPredictResponse", @@ -43562,7 +43562,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.DirectRawPredictResponse", @@ -43638,7 +43638,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.DirectRawPredictResponse", @@ -43731,7 +43731,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.ExplainResponse", @@ -43823,7 +43823,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.ExplainResponse", @@ -43908,7 +43908,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.GenerateContentResponse", @@ -43992,7 +43992,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.GenerateContentResponse", @@ -44081,7 +44081,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.PredictResponse", @@ -44169,7 +44169,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.PredictResponse", @@ -44254,7 +44254,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api.httpbody_pb2.HttpBody", @@ -44338,7 +44338,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api.httpbody_pb2.HttpBody", @@ -44415,7 +44415,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "Iterable[google.cloud.aiplatform_v1beta1.types.StreamingPredictResponse]", @@ -44491,7 +44491,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "Iterable[google.cloud.aiplatform_v1beta1.types.StreamingPredictResponse]", @@ -44568,7 +44568,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "Iterable[google.cloud.aiplatform_v1beta1.types.StreamDirectPredictResponse]", @@ -44644,7 +44644,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "Iterable[google.cloud.aiplatform_v1beta1.types.StreamDirectPredictResponse]", @@ -44721,7 +44721,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "Iterable[google.cloud.aiplatform_v1beta1.types.StreamDirectRawPredictResponse]", @@ -44797,7 +44797,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "Iterable[google.cloud.aiplatform_v1beta1.types.StreamDirectRawPredictResponse]", @@ -44882,7 +44882,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "Iterable[google.cloud.aiplatform_v1beta1.types.GenerateContentResponse]", @@ -44966,7 +44966,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "Iterable[google.cloud.aiplatform_v1beta1.types.GenerateContentResponse]", @@ -45051,7 +45051,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "Iterable[google.api.httpbody_pb2.HttpBody]", @@ -45135,7 +45135,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "Iterable[google.api.httpbody_pb2.HttpBody]", @@ -45212,7 +45212,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "Iterable[google.cloud.aiplatform_v1beta1.types.StreamingPredictResponse]", @@ -45288,7 +45288,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "Iterable[google.cloud.aiplatform_v1beta1.types.StreamingPredictResponse]", @@ -45365,7 +45365,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "Iterable[google.cloud.aiplatform_v1beta1.types.StreamingRawPredictResponse]", @@ -45441,7 +45441,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "Iterable[google.cloud.aiplatform_v1beta1.types.StreamingRawPredictResponse]", @@ -45518,7 +45518,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.QueryReasoningEngineResponse", @@ -45594,7 +45594,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.QueryReasoningEngineResponse", @@ -45671,7 +45671,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "Iterable[google.api.httpbody_pb2.HttpBody]", @@ -45747,7 +45747,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "Iterable[google.api.httpbody_pb2.HttpBody]", @@ -45832,7 +45832,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -45916,7 +45916,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -45997,7 +45997,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -46077,7 +46077,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -46158,7 +46158,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.ReasoningEngine", @@ -46238,7 +46238,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.ReasoningEngine", @@ -46319,7 +46319,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.reasoning_engine_service.pagers.ListReasoningEnginesAsyncPager", @@ -46399,7 +46399,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.reasoning_engine_service.pagers.ListReasoningEnginesPager", @@ -46484,7 +46484,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -46568,7 +46568,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -46653,7 +46653,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.Schedule", @@ -46737,7 +46737,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.Schedule", @@ -46818,7 +46818,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -46898,7 +46898,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -46979,7 +46979,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.Schedule", @@ -47059,7 +47059,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.Schedule", @@ -47140,7 +47140,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.schedule_service.pagers.ListSchedulesAsyncPager", @@ -47220,7 +47220,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.schedule_service.pagers.ListSchedulesPager", @@ -47301,7 +47301,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "shortName": "pause_schedule" @@ -47378,7 +47378,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "shortName": "pause_schedule" @@ -47460,7 +47460,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "shortName": "resume_schedule" @@ -47541,7 +47541,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "shortName": "resume_schedule" @@ -47623,7 +47623,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.Schedule", @@ -47707,7 +47707,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.Schedule", @@ -47792,7 +47792,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -47876,7 +47876,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -47957,7 +47957,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -48037,7 +48037,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -48118,7 +48118,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.SpecialistPool", @@ -48198,7 +48198,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.SpecialistPool", @@ -48279,7 +48279,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.specialist_pool_service.pagers.ListSpecialistPoolsAsyncPager", @@ -48359,7 +48359,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.specialist_pool_service.pagers.ListSpecialistPoolsPager", @@ -48444,7 +48444,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -48528,7 +48528,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -48613,7 +48613,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.BatchCreateTensorboardRunsResponse", @@ -48697,7 +48697,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.BatchCreateTensorboardRunsResponse", @@ -48782,7 +48782,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.BatchCreateTensorboardTimeSeriesResponse", @@ -48866,7 +48866,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.BatchCreateTensorboardTimeSeriesResponse", @@ -48947,7 +48947,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.BatchReadTensorboardTimeSeriesDataResponse", @@ -49027,7 +49027,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.BatchReadTensorboardTimeSeriesDataResponse", @@ -49116,7 +49116,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.TensorboardExperiment", @@ -49204,7 +49204,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.TensorboardExperiment", @@ -49293,7 +49293,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.TensorboardRun", @@ -49381,7 +49381,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.TensorboardRun", @@ -49466,7 +49466,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.TensorboardTimeSeries", @@ -49550,7 +49550,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.TensorboardTimeSeries", @@ -49635,7 +49635,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -49719,7 +49719,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -49800,7 +49800,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -49880,7 +49880,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -49961,7 +49961,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -50041,7 +50041,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -50122,7 +50122,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -50202,7 +50202,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -50283,7 +50283,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -50363,7 +50363,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -50444,7 +50444,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.tensorboard_service.pagers.ExportTensorboardTimeSeriesDataAsyncPager", @@ -50524,7 +50524,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.tensorboard_service.pagers.ExportTensorboardTimeSeriesDataPager", @@ -50605,7 +50605,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.TensorboardExperiment", @@ -50685,7 +50685,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.TensorboardExperiment", @@ -50766,7 +50766,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.TensorboardRun", @@ -50846,7 +50846,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.TensorboardRun", @@ -50927,7 +50927,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.TensorboardTimeSeries", @@ -51007,7 +51007,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.TensorboardTimeSeries", @@ -51088,7 +51088,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.Tensorboard", @@ -51168,7 +51168,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.Tensorboard", @@ -51249,7 +51249,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.tensorboard_service.pagers.ListTensorboardExperimentsAsyncPager", @@ -51329,7 +51329,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.tensorboard_service.pagers.ListTensorboardExperimentsPager", @@ -51410,7 +51410,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.tensorboard_service.pagers.ListTensorboardRunsAsyncPager", @@ -51490,7 +51490,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.tensorboard_service.pagers.ListTensorboardRunsPager", @@ -51571,7 +51571,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.tensorboard_service.pagers.ListTensorboardTimeSeriesAsyncPager", @@ -51651,7 +51651,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.tensorboard_service.pagers.ListTensorboardTimeSeriesPager", @@ -51732,7 +51732,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.tensorboard_service.pagers.ListTensorboardsAsyncPager", @@ -51812,7 +51812,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.tensorboard_service.pagers.ListTensorboardsPager", @@ -51893,7 +51893,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "Iterable[google.cloud.aiplatform_v1beta1.types.ReadTensorboardBlobDataResponse]", @@ -51973,7 +51973,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "Iterable[google.cloud.aiplatform_v1beta1.types.ReadTensorboardBlobDataResponse]", @@ -52054,7 +52054,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.ReadTensorboardSizeResponse", @@ -52134,7 +52134,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.ReadTensorboardSizeResponse", @@ -52215,7 +52215,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.ReadTensorboardTimeSeriesDataResponse", @@ -52295,7 +52295,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.ReadTensorboardTimeSeriesDataResponse", @@ -52376,7 +52376,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.ReadTensorboardUsageResponse", @@ -52456,7 +52456,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.ReadTensorboardUsageResponse", @@ -52541,7 +52541,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.TensorboardExperiment", @@ -52625,7 +52625,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.TensorboardExperiment", @@ -52710,7 +52710,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.TensorboardRun", @@ -52794,7 +52794,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.TensorboardRun", @@ -52879,7 +52879,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.TensorboardTimeSeries", @@ -52963,7 +52963,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.TensorboardTimeSeries", @@ -53048,7 +53048,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -53132,7 +53132,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -53217,7 +53217,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.WriteTensorboardExperimentDataResponse", @@ -53301,7 +53301,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.WriteTensorboardExperimentDataResponse", @@ -53386,7 +53386,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.WriteTensorboardRunDataResponse", @@ -53470,7 +53470,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.WriteTensorboardRunDataResponse", @@ -53555,7 +53555,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -53639,7 +53639,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -53720,7 +53720,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -53800,7 +53800,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -53881,7 +53881,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -53961,7 +53961,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -54042,7 +54042,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.RagCorpus", @@ -54122,7 +54122,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.RagCorpus", @@ -54203,7 +54203,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.RagFile", @@ -54283,7 +54283,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.RagFile", @@ -54368,7 +54368,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -54452,7 +54452,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -54533,7 +54533,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.vertex_rag_data_service.pagers.ListRagCorporaAsyncPager", @@ -54613,7 +54613,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.vertex_rag_data_service.pagers.ListRagCorporaPager", @@ -54694,7 +54694,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.vertex_rag_data_service.pagers.ListRagFilesAsyncPager", @@ -54774,7 +54774,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.vertex_rag_data_service.pagers.ListRagFilesPager", @@ -54855,7 +54855,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -54935,7 +54935,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -55024,7 +55024,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.UploadRagFileResponse", @@ -55112,7 +55112,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.UploadRagFileResponse", @@ -55201,7 +55201,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.AugmentPromptResponse", @@ -55289,7 +55289,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.AugmentPromptResponse", @@ -55378,7 +55378,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.CorroborateContentResponse", @@ -55466,7 +55466,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.CorroborateContentResponse", @@ -55551,7 +55551,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.RetrieveContextsResponse", @@ -55635,7 +55635,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.RetrieveContextsResponse", @@ -55712,7 +55712,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.Trial", @@ -55788,7 +55788,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.Trial", @@ -55865,7 +55865,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -55941,7 +55941,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", @@ -56018,7 +56018,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.Trial", @@ -56094,7 +56094,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.Trial", @@ -56179,7 +56179,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.Study", @@ -56263,7 +56263,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.Study", @@ -56348,7 +56348,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.Trial", @@ -56432,7 +56432,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.Trial", @@ -56513,7 +56513,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "shortName": "delete_study" @@ -56590,7 +56590,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "shortName": "delete_study" @@ -56668,7 +56668,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "shortName": "delete_trial" @@ -56745,7 +56745,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "shortName": "delete_trial" @@ -56823,7 +56823,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.Study", @@ -56903,7 +56903,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.Study", @@ -56984,7 +56984,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.Trial", @@ -57064,7 +57064,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.Trial", @@ -57145,7 +57145,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.ListOptimalTrialsResponse", @@ -57225,7 +57225,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.ListOptimalTrialsResponse", @@ -57306,7 +57306,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.vizier_service.pagers.ListStudiesAsyncPager", @@ -57386,7 +57386,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.vizier_service.pagers.ListStudiesPager", @@ -57467,7 +57467,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.vizier_service.pagers.ListTrialsAsyncPager", @@ -57547,7 +57547,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.services.vizier_service.pagers.ListTrialsPager", @@ -57628,7 +57628,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.Study", @@ -57708,7 +57708,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.Study", @@ -57785,7 +57785,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.Trial", @@ -57861,7 +57861,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.cloud.aiplatform_v1beta1.types.Trial", @@ -57938,7 +57938,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation_async.AsyncOperation", @@ -58014,7 +58014,7 @@ }, { "name": "metadata", - "type": "Sequence[Tuple[str, str]" + "type": "Sequence[Tuple[str, Union[str, bytes]]]" } ], "resultType": "google.api_core.operation.Operation", diff --git a/tests/unit/gapic/aiplatform_v1/test_dataset_service.py b/tests/unit/gapic/aiplatform_v1/test_dataset_service.py index ebe9728322..4c65039b21 100644 --- a/tests/unit/gapic/aiplatform_v1/test_dataset_service.py +++ b/tests/unit/gapic/aiplatform_v1/test_dataset_service.py @@ -8917,6 +8917,7 @@ def test_create_dataset_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_dataset(request) @@ -8969,6 +8970,7 @@ def test_create_dataset_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_dataset(**mock_args) @@ -9102,6 +9104,7 @@ def test_get_dataset_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_dataset(request) @@ -9147,6 +9150,7 @@ def test_get_dataset_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_dataset(**mock_args) @@ -9275,6 +9279,7 @@ def test_update_dataset_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_dataset(request) @@ -9331,6 +9336,7 @@ def test_update_dataset_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_dataset(**mock_args) @@ -9473,6 +9479,7 @@ def test_list_datasets_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_datasets(request) @@ -9529,6 +9536,7 @@ def test_list_datasets_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_datasets(**mock_args) @@ -9723,6 +9731,7 @@ def test_delete_dataset_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_dataset(request) @@ -9766,6 +9775,7 @@ def test_delete_dataset_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_dataset(**mock_args) @@ -9898,6 +9908,7 @@ def test_import_data_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.import_data(request) @@ -9952,6 +9963,7 @@ def test_import_data_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.import_data(**mock_args) @@ -10088,6 +10100,7 @@ def test_export_data_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.export_data(request) @@ -10144,6 +10157,7 @@ def test_export_data_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.export_data(**mock_args) @@ -10287,6 +10301,7 @@ def test_create_dataset_version_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_dataset_version(request) @@ -10341,6 +10356,7 @@ def test_create_dataset_version_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_dataset_version(**mock_args) @@ -10476,6 +10492,7 @@ def test_update_dataset_version_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_dataset_version(request) @@ -10534,6 +10551,7 @@ def test_update_dataset_version_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_dataset_version(**mock_args) @@ -10672,6 +10690,7 @@ def test_delete_dataset_version_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_dataset_version(request) @@ -10717,6 +10736,7 @@ def test_delete_dataset_version_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_dataset_version(**mock_args) @@ -10854,6 +10874,7 @@ def test_get_dataset_version_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_dataset_version(request) @@ -10901,6 +10922,7 @@ def test_get_dataset_version_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_dataset_version(**mock_args) @@ -11047,6 +11069,7 @@ def test_list_dataset_versions_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_dataset_versions(request) @@ -11105,6 +11128,7 @@ def test_list_dataset_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_dataset_versions(**mock_args) @@ -11307,6 +11331,7 @@ def test_restore_dataset_version_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.restore_dataset_version(request) @@ -11352,6 +11377,7 @@ def test_restore_dataset_version_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.restore_dataset_version(**mock_args) @@ -11493,6 +11519,7 @@ def test_list_data_items_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_data_items(request) @@ -11551,6 +11578,7 @@ def test_list_data_items_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_data_items(**mock_args) @@ -11766,6 +11794,7 @@ def test_search_data_items_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.search_data_items(request) @@ -11982,6 +12011,7 @@ def test_list_saved_queries_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_saved_queries(request) @@ -12040,6 +12070,7 @@ def test_list_saved_queries_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_saved_queries(**mock_args) @@ -12241,6 +12272,7 @@ def test_delete_saved_query_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_saved_query(request) @@ -12286,6 +12318,7 @@ def test_delete_saved_query_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_saved_query(**mock_args) @@ -12423,6 +12456,7 @@ def test_get_annotation_spec_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_annotation_spec(request) @@ -12470,6 +12504,7 @@ def test_get_annotation_spec_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_annotation_spec(**mock_args) @@ -12613,6 +12648,7 @@ def test_list_annotations_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_annotations(request) @@ -12671,6 +12707,7 @@ def test_list_annotations_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_annotations(**mock_args) @@ -13881,6 +13918,7 @@ def test_create_dataset_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_dataset(request) @@ -14016,6 +14054,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_dataset(request) # Establish that the response is the type that we expect. @@ -14057,6 +14096,7 @@ def test_create_dataset_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 @@ -14099,6 +14139,7 @@ def test_get_dataset_rest_bad_request(request_type=dataset_service.GetDatasetReq 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_dataset(request) @@ -14143,6 +14184,7 @@ def test_get_dataset_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_dataset(request) # Establish that the response is the type that we expect. @@ -14192,6 +14234,7 @@ def test_get_dataset_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 = dataset.Dataset.to_json(dataset.Dataset()) req.return_value.content = return_value @@ -14238,6 +14281,7 @@ def test_update_dataset_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_dataset(request) @@ -14389,6 +14433,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_dataset(request) # Establish that the response is the type that we expect. @@ -14438,6 +14483,7 @@ def test_update_dataset_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 = gca_dataset.Dataset.to_json(gca_dataset.Dataset()) req.return_value.content = return_value @@ -14482,6 +14528,7 @@ def test_list_datasets_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_datasets(request) @@ -14517,6 +14564,7 @@ def test_list_datasets_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_datasets(request) # Establish that the response is the type that we expect. @@ -14557,6 +14605,7 @@ def test_list_datasets_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 = dataset_service.ListDatasetsResponse.to_json( dataset_service.ListDatasetsResponse() ) @@ -14603,6 +14652,7 @@ def test_delete_dataset_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_dataset(request) @@ -14633,6 +14683,7 @@ def test_delete_dataset_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_dataset(request) # Establish that the response is the type that we expect. @@ -14674,6 +14725,7 @@ def test_delete_dataset_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 @@ -14716,6 +14768,7 @@ def test_import_data_rest_bad_request(request_type=dataset_service.ImportDataReq 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.import_data(request) @@ -14746,6 +14799,7 @@ def test_import_data_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.import_data(request) # Establish that the response is the type that we expect. @@ -14787,6 +14841,7 @@ def test_import_data_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 @@ -14829,6 +14884,7 @@ def test_export_data_rest_bad_request(request_type=dataset_service.ExportDataReq 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.export_data(request) @@ -14859,6 +14915,7 @@ def test_export_data_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.export_data(request) # Establish that the response is the type that we expect. @@ -14900,6 +14957,7 @@ def test_export_data_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 @@ -14944,6 +15002,7 @@ def test_create_dataset_version_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_dataset_version(request) @@ -15062,6 +15121,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_dataset_version(request) # Establish that the response is the type that we expect. @@ -15103,6 +15163,7 @@ def test_create_dataset_version_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 @@ -15151,6 +15212,7 @@ def test_update_dataset_version_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_dataset_version(request) @@ -15284,6 +15346,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_dataset_version(request) # Establish that the response is the type that we expect. @@ -15330,6 +15393,7 @@ def test_update_dataset_version_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 = gca_dataset_version.DatasetVersion.to_json( gca_dataset_version.DatasetVersion() ) @@ -15378,6 +15442,7 @@ def test_delete_dataset_version_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_dataset_version(request) @@ -15410,6 +15475,7 @@ def test_delete_dataset_version_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_dataset_version(request) # Establish that the response is the type that we expect. @@ -15451,6 +15517,7 @@ def test_delete_dataset_version_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 @@ -15497,6 +15564,7 @@ def test_get_dataset_version_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_dataset_version(request) @@ -15540,6 +15608,7 @@ def test_get_dataset_version_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_dataset_version(request) # Establish that the response is the type that we expect. @@ -15586,6 +15655,7 @@ def test_get_dataset_version_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 = dataset_version.DatasetVersion.to_json( dataset_version.DatasetVersion() ) @@ -15632,6 +15702,7 @@ def test_list_dataset_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_dataset_versions(request) @@ -15667,6 +15738,7 @@ def test_list_dataset_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_dataset_versions(request) # Establish that the response is the type that we expect. @@ -15707,6 +15779,7 @@ def test_list_dataset_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 = dataset_service.ListDatasetVersionsResponse.to_json( dataset_service.ListDatasetVersionsResponse() ) @@ -15755,6 +15828,7 @@ def test_restore_dataset_version_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.restore_dataset_version(request) @@ -15787,6 +15861,7 @@ def test_restore_dataset_version_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.restore_dataset_version(request) # Establish that the response is the type that we expect. @@ -15828,6 +15903,7 @@ def test_restore_dataset_version_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 @@ -15872,6 +15948,7 @@ def test_list_data_items_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_data_items(request) @@ -15907,6 +15984,7 @@ def test_list_data_items_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_data_items(request) # Establish that the response is the type that we expect. @@ -15947,6 +16025,7 @@ def test_list_data_items_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 = dataset_service.ListDataItemsResponse.to_json( dataset_service.ListDataItemsResponse() ) @@ -15993,6 +16072,7 @@ def test_search_data_items_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.search_data_items(request) @@ -16028,6 +16108,7 @@ def test_search_data_items_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.search_data_items(request) # Establish that the response is the type that we expect. @@ -16068,6 +16149,7 @@ def test_search_data_items_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 = dataset_service.SearchDataItemsResponse.to_json( dataset_service.SearchDataItemsResponse() ) @@ -16114,6 +16196,7 @@ def test_list_saved_queries_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_saved_queries(request) @@ -16149,6 +16232,7 @@ def test_list_saved_queries_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_saved_queries(request) # Establish that the response is the type that we expect. @@ -16189,6 +16273,7 @@ def test_list_saved_queries_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 = dataset_service.ListSavedQueriesResponse.to_json( dataset_service.ListSavedQueriesResponse() ) @@ -16237,6 +16322,7 @@ def test_delete_saved_query_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_saved_query(request) @@ -16269,6 +16355,7 @@ def test_delete_saved_query_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_saved_query(request) # Establish that the response is the type that we expect. @@ -16310,6 +16397,7 @@ def test_delete_saved_query_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 @@ -16356,6 +16444,7 @@ def test_get_annotation_spec_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_annotation_spec(request) @@ -16395,6 +16484,7 @@ def test_get_annotation_spec_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_annotation_spec(request) # Establish that the response is the type that we expect. @@ -16437,6 +16527,7 @@ def test_get_annotation_spec_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 = annotation_spec.AnnotationSpec.to_json( annotation_spec.AnnotationSpec() ) @@ -16485,6 +16576,7 @@ def test_list_annotations_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_annotations(request) @@ -16522,6 +16614,7 @@ def test_list_annotations_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_annotations(request) # Establish that the response is the type that we expect. @@ -16562,6 +16655,7 @@ def test_list_annotations_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 = dataset_service.ListAnnotationsResponse.to_json( dataset_service.ListAnnotationsResponse() ) @@ -16608,6 +16702,7 @@ def test_get_location_rest_bad_request(request_type=locations_pb2.GetLocationReq 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_location(request) @@ -16638,6 +16733,7 @@ def test_get_location_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_location(request) @@ -16666,6 +16762,7 @@ def test_list_locations_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_locations(request) @@ -16696,6 +16793,7 @@ def test_list_locations_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_locations(request) @@ -16727,6 +16825,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -16759,6 +16858,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -16790,6 +16890,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -16822,6 +16923,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -16853,6 +16955,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -16885,6 +16988,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -16915,6 +17019,7 @@ def test_cancel_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.cancel_operation(request) @@ -16945,6 +17050,7 @@ def test_cancel_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.cancel_operation(request) @@ -16975,6 +17081,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) @@ -17005,6 +17112,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) @@ -17035,6 +17143,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) @@ -17065,6 +17174,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) @@ -17095,6 +17205,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) @@ -17125,6 +17236,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) @@ -17155,6 +17267,7 @@ def test_wait_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.wait_operation(request) @@ -17185,6 +17298,7 @@ def test_wait_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.wait_operation(request) @@ -17652,6 +17766,7 @@ async def test_create_dataset_rest_asyncio_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"} await client.create_dataset(request) @@ -17794,6 +17909,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.create_dataset(request) # Establish that the response is the type that we expect. @@ -17840,6 +17956,7 @@ async def test_create_dataset_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -17888,6 +18005,7 @@ async def test_get_dataset_rest_asyncio_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"} await client.get_dataset(request) @@ -17939,6 +18057,7 @@ async def test_get_dataset_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_dataset(request) # Establish that the response is the type that we expect. @@ -17993,6 +18112,7 @@ async def test_get_dataset_rest_asyncio_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 = dataset.Dataset.to_json(dataset.Dataset()) req.return_value.read = mock.AsyncMock(return_value=return_value) @@ -18043,6 +18163,7 @@ async def test_update_dataset_rest_asyncio_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"} await client.update_dataset(request) @@ -18201,6 +18322,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.update_dataset(request) # Establish that the response is the type that we expect. @@ -18255,6 +18377,7 @@ async def test_update_dataset_rest_asyncio_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 = gca_dataset.Dataset.to_json(gca_dataset.Dataset()) req.return_value.read = mock.AsyncMock(return_value=return_value) @@ -18303,6 +18426,7 @@ async def test_list_datasets_rest_asyncio_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"} await client.list_datasets(request) @@ -18345,6 +18469,7 @@ async def test_list_datasets_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_datasets(request) # Establish that the response is the type that we expect. @@ -18390,6 +18515,7 @@ async def test_list_datasets_rest_asyncio_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 = dataset_service.ListDatasetsResponse.to_json( dataset_service.ListDatasetsResponse() ) @@ -18440,6 +18566,7 @@ async def test_delete_dataset_rest_asyncio_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"} await client.delete_dataset(request) @@ -18477,6 +18604,7 @@ async def test_delete_dataset_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_dataset(request) # Establish that the response is the type that we expect. @@ -18523,6 +18651,7 @@ async def test_delete_dataset_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -18571,6 +18700,7 @@ async def test_import_data_rest_asyncio_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"} await client.import_data(request) @@ -18608,6 +18738,7 @@ async def test_import_data_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.import_data(request) # Establish that the response is the type that we expect. @@ -18654,6 +18785,7 @@ async def test_import_data_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -18702,6 +18834,7 @@ async def test_export_data_rest_asyncio_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"} await client.export_data(request) @@ -18739,6 +18872,7 @@ async def test_export_data_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.export_data(request) # Establish that the response is the type that we expect. @@ -18785,6 +18919,7 @@ async def test_export_data_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -18833,6 +18968,7 @@ async def test_create_dataset_version_rest_asyncio_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"} await client.create_dataset_version(request) @@ -18958,6 +19094,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.create_dataset_version(request) # Establish that the response is the type that we expect. @@ -19004,6 +19141,7 @@ async def test_create_dataset_version_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -19056,6 +19194,7 @@ async def test_update_dataset_version_rest_asyncio_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"} await client.update_dataset_version(request) @@ -19196,6 +19335,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.update_dataset_version(request) # Establish that the response is the type that we expect. @@ -19247,6 +19387,7 @@ async def test_update_dataset_version_rest_asyncio_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 = gca_dataset_version.DatasetVersion.to_json( gca_dataset_version.DatasetVersion() ) @@ -19299,6 +19440,7 @@ async def test_delete_dataset_version_rest_asyncio_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"} await client.delete_dataset_version(request) @@ -19338,6 +19480,7 @@ async def test_delete_dataset_version_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_dataset_version(request) # Establish that the response is the type that we expect. @@ -19384,6 +19527,7 @@ async def test_delete_dataset_version_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -19434,6 +19578,7 @@ async def test_get_dataset_version_rest_asyncio_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"} await client.get_dataset_version(request) @@ -19484,6 +19629,7 @@ async def test_get_dataset_version_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_dataset_version(request) # Establish that the response is the type that we expect. @@ -19535,6 +19681,7 @@ async def test_get_dataset_version_rest_asyncio_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 = dataset_version.DatasetVersion.to_json( dataset_version.DatasetVersion() ) @@ -19585,6 +19732,7 @@ async def test_list_dataset_versions_rest_asyncio_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"} await client.list_dataset_versions(request) @@ -19627,6 +19775,7 @@ async def test_list_dataset_versions_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_dataset_versions(request) # Establish that the response is the type that we expect. @@ -19672,6 +19821,7 @@ async def test_list_dataset_versions_rest_asyncio_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 = dataset_service.ListDatasetVersionsResponse.to_json( dataset_service.ListDatasetVersionsResponse() ) @@ -19724,6 +19874,7 @@ async def test_restore_dataset_version_rest_asyncio_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"} await client.restore_dataset_version(request) @@ -19763,6 +19914,7 @@ async def test_restore_dataset_version_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.restore_dataset_version(request) # Establish that the response is the type that we expect. @@ -19809,6 +19961,7 @@ async def test_restore_dataset_version_rest_asyncio_interceptors(null_intercepto 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.read = mock.AsyncMock(return_value=return_value) @@ -19857,6 +20010,7 @@ async def test_list_data_items_rest_asyncio_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"} await client.list_data_items(request) @@ -19899,6 +20053,7 @@ async def test_list_data_items_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_data_items(request) # Establish that the response is the type that we expect. @@ -19944,6 +20099,7 @@ async def test_list_data_items_rest_asyncio_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 = dataset_service.ListDataItemsResponse.to_json( dataset_service.ListDataItemsResponse() ) @@ -19994,6 +20150,7 @@ async def test_search_data_items_rest_asyncio_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"} await client.search_data_items(request) @@ -20036,6 +20193,7 @@ async def test_search_data_items_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.search_data_items(request) # Establish that the response is the type that we expect. @@ -20081,6 +20239,7 @@ async def test_search_data_items_rest_asyncio_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 = dataset_service.SearchDataItemsResponse.to_json( dataset_service.SearchDataItemsResponse() ) @@ -20131,6 +20290,7 @@ async def test_list_saved_queries_rest_asyncio_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"} await client.list_saved_queries(request) @@ -20173,6 +20333,7 @@ async def test_list_saved_queries_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_saved_queries(request) # Establish that the response is the type that we expect. @@ -20218,6 +20379,7 @@ async def test_list_saved_queries_rest_asyncio_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 = dataset_service.ListSavedQueriesResponse.to_json( dataset_service.ListSavedQueriesResponse() ) @@ -20270,6 +20432,7 @@ async def test_delete_saved_query_rest_asyncio_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"} await client.delete_saved_query(request) @@ -20309,6 +20472,7 @@ async def test_delete_saved_query_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_saved_query(request) # Establish that the response is the type that we expect. @@ -20355,6 +20519,7 @@ async def test_delete_saved_query_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -20405,6 +20570,7 @@ async def test_get_annotation_spec_rest_asyncio_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"} await client.get_annotation_spec(request) @@ -20451,6 +20617,7 @@ async def test_get_annotation_spec_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_annotation_spec(request) # Establish that the response is the type that we expect. @@ -20498,6 +20665,7 @@ async def test_get_annotation_spec_rest_asyncio_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 = annotation_spec.AnnotationSpec.to_json( annotation_spec.AnnotationSpec() ) @@ -20550,6 +20718,7 @@ async def test_list_annotations_rest_asyncio_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"} await client.list_annotations(request) @@ -20594,6 +20763,7 @@ async def test_list_annotations_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_annotations(request) # Establish that the response is the type that we expect. @@ -20639,6 +20809,7 @@ async def test_list_annotations_rest_asyncio_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 = dataset_service.ListAnnotationsResponse.to_json( dataset_service.ListAnnotationsResponse() ) @@ -20691,6 +20862,7 @@ async def test_get_location_rest_asyncio_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"} await client.get_location(request) @@ -20728,6 +20900,7 @@ async def test_get_location_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_location(request) @@ -20760,6 +20933,7 @@ async def test_list_locations_rest_asyncio_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"} await client.list_locations(request) @@ -20797,6 +20971,7 @@ async def test_list_locations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_locations(request) @@ -20832,6 +21007,7 @@ async def test_get_iam_policy_rest_asyncio_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"} await client.get_iam_policy(request) @@ -20871,6 +21047,7 @@ async def test_get_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_iam_policy(request) @@ -20906,6 +21083,7 @@ async def test_set_iam_policy_rest_asyncio_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"} await client.set_iam_policy(request) @@ -20945,6 +21123,7 @@ async def test_set_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.set_iam_policy(request) @@ -20980,6 +21159,7 @@ async def test_test_iam_permissions_rest_asyncio_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"} await client.test_iam_permissions(request) @@ -21019,6 +21199,7 @@ async def test_test_iam_permissions_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.test_iam_permissions(request) @@ -21053,6 +21234,7 @@ async def test_cancel_operation_rest_asyncio_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"} await client.cancel_operation(request) @@ -21090,6 +21272,7 @@ async def test_cancel_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.cancel_operation(request) @@ -21124,6 +21307,7 @@ async def test_delete_operation_rest_asyncio_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"} await client.delete_operation(request) @@ -21161,6 +21345,7 @@ async def test_delete_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_operation(request) @@ -21195,6 +21380,7 @@ async def test_get_operation_rest_asyncio_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"} await client.get_operation(request) @@ -21232,6 +21418,7 @@ async def test_get_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_operation(request) @@ -21266,6 +21453,7 @@ async def test_list_operations_rest_asyncio_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"} await client.list_operations(request) @@ -21303,6 +21491,7 @@ async def test_list_operations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_operations(request) @@ -21337,6 +21526,7 @@ async def test_wait_operation_rest_asyncio_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"} await client.wait_operation(request) @@ -21374,6 +21564,7 @@ async def test_wait_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.wait_operation(request) diff --git a/tests/unit/gapic/aiplatform_v1/test_deployment_resource_pool_service.py b/tests/unit/gapic/aiplatform_v1/test_deployment_resource_pool_service.py index 76318efc50..386e94fd76 100644 --- a/tests/unit/gapic/aiplatform_v1/test_deployment_resource_pool_service.py +++ b/tests/unit/gapic/aiplatform_v1/test_deployment_resource_pool_service.py @@ -3891,6 +3891,7 @@ def test_create_deployment_resource_pool_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_deployment_resource_pool(request) @@ -3949,6 +3950,7 @@ def test_create_deployment_resource_pool_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_deployment_resource_pool(**mock_args) @@ -4091,6 +4093,7 @@ def test_get_deployment_resource_pool_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_deployment_resource_pool(request) @@ -4138,6 +4141,7 @@ def test_get_deployment_resource_pool_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_deployment_resource_pool(**mock_args) @@ -4287,6 +4291,7 @@ def test_list_deployment_resource_pools_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_deployment_resource_pools(request) @@ -4348,6 +4353,7 @@ def test_list_deployment_resource_pools_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_deployment_resource_pools(**mock_args) @@ -4554,6 +4560,7 @@ def test_update_deployment_resource_pool_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_deployment_resource_pool(request) @@ -4614,6 +4621,7 @@ def test_update_deployment_resource_pool_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_deployment_resource_pool(**mock_args) @@ -4754,6 +4762,7 @@ def test_delete_deployment_resource_pool_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_deployment_resource_pool(request) @@ -4801,6 +4810,7 @@ def test_delete_deployment_resource_pool_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_deployment_resource_pool(**mock_args) @@ -4950,6 +4960,7 @@ def test_query_deployed_models_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.query_deployed_models(request) @@ -5007,6 +5018,7 @@ def test_query_deployed_models_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.query_deployed_models(**mock_args) @@ -5586,6 +5598,7 @@ def test_create_deployment_resource_pool_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_deployment_resource_pool(request) @@ -5616,6 +5629,7 @@ def test_create_deployment_resource_pool_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.create_deployment_resource_pool(request) # Establish that the response is the type that we expect. @@ -5661,6 +5675,7 @@ def test_create_deployment_resource_pool_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 @@ -5707,6 +5722,7 @@ def test_get_deployment_resource_pool_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_deployment_resource_pool(request) @@ -5748,6 +5764,7 @@ def test_get_deployment_resource_pool_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_deployment_resource_pool(request) # Establish that the response is the type that we expect. @@ -5796,6 +5813,7 @@ def test_get_deployment_resource_pool_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 = deployment_resource_pool.DeploymentResourcePool.to_json( deployment_resource_pool.DeploymentResourcePool() ) @@ -5842,6 +5860,7 @@ def test_list_deployment_resource_pools_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_deployment_resource_pools(request) @@ -5883,6 +5902,7 @@ def test_list_deployment_resource_pools_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_deployment_resource_pools(request) # Establish that the response is the type that we expect. @@ -5927,6 +5947,7 @@ def test_list_deployment_resource_pools_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 = deployment_resource_pool_service.ListDeploymentResourcePoolsResponse.to_json( deployment_resource_pool_service.ListDeploymentResourcePoolsResponse() ) @@ -5979,6 +6000,7 @@ def test_update_deployment_resource_pool_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_deployment_resource_pool(request) @@ -6016,6 +6038,7 @@ def test_update_deployment_resource_pool_rest_call_success(request_type): }, "min_replica_count": 1803, "max_replica_count": 1805, + "required_replica_count": 2344, "autoscaling_metric_specs": [ {"metric_name": "metric_name_value", "target": 647} ], @@ -6112,6 +6135,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_deployment_resource_pool(request) # Establish that the response is the type that we expect. @@ -6157,6 +6181,7 @@ def test_update_deployment_resource_pool_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 @@ -6203,6 +6228,7 @@ def test_delete_deployment_resource_pool_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_deployment_resource_pool(request) @@ -6235,6 +6261,7 @@ def test_delete_deployment_resource_pool_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_deployment_resource_pool(request) # Establish that the response is the type that we expect. @@ -6280,6 +6307,7 @@ def test_delete_deployment_resource_pool_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 @@ -6326,6 +6354,7 @@ def test_query_deployed_models_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.query_deployed_models(request) @@ -6367,6 +6396,7 @@ def test_query_deployed_models_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.query_deployed_models(request) # Establish that the response is the type that we expect. @@ -6411,6 +6441,7 @@ def test_query_deployed_models_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 = ( deployment_resource_pool_service.QueryDeployedModelsResponse.to_json( deployment_resource_pool_service.QueryDeployedModelsResponse() @@ -6461,6 +6492,7 @@ def test_get_location_rest_bad_request(request_type=locations_pb2.GetLocationReq 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_location(request) @@ -6491,6 +6523,7 @@ def test_get_location_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_location(request) @@ -6519,6 +6552,7 @@ def test_list_locations_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_locations(request) @@ -6549,6 +6583,7 @@ def test_list_locations_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_locations(request) @@ -6580,6 +6615,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -6612,6 +6648,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -6643,6 +6680,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -6675,6 +6713,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -6706,6 +6745,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -6738,6 +6778,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -6768,6 +6809,7 @@ def test_cancel_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.cancel_operation(request) @@ -6798,6 +6840,7 @@ def test_cancel_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.cancel_operation(request) @@ -6828,6 +6871,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) @@ -6858,6 +6902,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) @@ -6888,6 +6933,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) @@ -6918,6 +6964,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) @@ -6948,6 +6995,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) @@ -6978,6 +7026,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) @@ -7008,6 +7057,7 @@ def test_wait_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.wait_operation(request) @@ -7038,6 +7088,7 @@ def test_wait_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.wait_operation(request) @@ -7247,6 +7298,7 @@ async def test_create_deployment_resource_pool_rest_asyncio_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"} await client.create_deployment_resource_pool(request) @@ -7284,6 +7336,7 @@ async def test_create_deployment_resource_pool_rest_asyncio_call_success(request return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.create_deployment_resource_pool(request) # Establish that the response is the type that we expect. @@ -7336,6 +7389,7 @@ async def test_create_deployment_resource_pool_rest_asyncio_interceptors( 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.read = mock.AsyncMock(return_value=return_value) @@ -7386,6 +7440,7 @@ async def test_get_deployment_resource_pool_rest_asyncio_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"} await client.get_deployment_resource_pool(request) @@ -7434,6 +7489,7 @@ async def test_get_deployment_resource_pool_rest_asyncio_call_success(request_ty return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_deployment_resource_pool(request) # Establish that the response is the type that we expect. @@ -7487,6 +7543,7 @@ async def test_get_deployment_resource_pool_rest_asyncio_interceptors(null_inter 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 = deployment_resource_pool.DeploymentResourcePool.to_json( deployment_resource_pool.DeploymentResourcePool() ) @@ -7537,6 +7594,7 @@ async def test_list_deployment_resource_pools_rest_asyncio_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"} await client.list_deployment_resource_pools(request) @@ -7585,6 +7643,7 @@ async def test_list_deployment_resource_pools_rest_asyncio_call_success(request_ return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_deployment_resource_pools(request) # Establish that the response is the type that we expect. @@ -7636,6 +7695,7 @@ async def test_list_deployment_resource_pools_rest_asyncio_interceptors( 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 = deployment_resource_pool_service.ListDeploymentResourcePoolsResponse.to_json( deployment_resource_pool_service.ListDeploymentResourcePoolsResponse() ) @@ -7692,6 +7752,7 @@ async def test_update_deployment_resource_pool_rest_asyncio_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"} await client.update_deployment_resource_pool(request) @@ -7734,6 +7795,7 @@ async def test_update_deployment_resource_pool_rest_asyncio_call_success(request }, "min_replica_count": 1803, "max_replica_count": 1805, + "required_replica_count": 2344, "autoscaling_metric_specs": [ {"metric_name": "metric_name_value", "target": 647} ], @@ -7832,6 +7894,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.update_deployment_resource_pool(request) # Establish that the response is the type that we expect. @@ -7884,6 +7947,7 @@ async def test_update_deployment_resource_pool_rest_asyncio_interceptors( 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.read = mock.AsyncMock(return_value=return_value) @@ -7934,6 +7998,7 @@ async def test_delete_deployment_resource_pool_rest_asyncio_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"} await client.delete_deployment_resource_pool(request) @@ -7973,6 +8038,7 @@ async def test_delete_deployment_resource_pool_rest_asyncio_call_success(request return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_deployment_resource_pool(request) # Establish that the response is the type that we expect. @@ -8025,6 +8091,7 @@ async def test_delete_deployment_resource_pool_rest_asyncio_interceptors( 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.read = mock.AsyncMock(return_value=return_value) @@ -8075,6 +8142,7 @@ async def test_query_deployed_models_rest_asyncio_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"} await client.query_deployed_models(request) @@ -8123,6 +8191,7 @@ async def test_query_deployed_models_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.query_deployed_models(request) # Establish that the response is the type that we expect. @@ -8172,6 +8241,7 @@ async def test_query_deployed_models_rest_asyncio_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 = ( deployment_resource_pool_service.QueryDeployedModelsResponse.to_json( deployment_resource_pool_service.QueryDeployedModelsResponse() @@ -8228,6 +8298,7 @@ async def test_get_location_rest_asyncio_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"} await client.get_location(request) @@ -8265,6 +8336,7 @@ async def test_get_location_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_location(request) @@ -8297,6 +8369,7 @@ async def test_list_locations_rest_asyncio_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"} await client.list_locations(request) @@ -8334,6 +8407,7 @@ async def test_list_locations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_locations(request) @@ -8369,6 +8443,7 @@ async def test_get_iam_policy_rest_asyncio_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"} await client.get_iam_policy(request) @@ -8408,6 +8483,7 @@ async def test_get_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_iam_policy(request) @@ -8443,6 +8519,7 @@ async def test_set_iam_policy_rest_asyncio_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"} await client.set_iam_policy(request) @@ -8482,6 +8559,7 @@ async def test_set_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.set_iam_policy(request) @@ -8517,6 +8595,7 @@ async def test_test_iam_permissions_rest_asyncio_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"} await client.test_iam_permissions(request) @@ -8556,6 +8635,7 @@ async def test_test_iam_permissions_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.test_iam_permissions(request) @@ -8590,6 +8670,7 @@ async def test_cancel_operation_rest_asyncio_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"} await client.cancel_operation(request) @@ -8627,6 +8708,7 @@ async def test_cancel_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.cancel_operation(request) @@ -8661,6 +8743,7 @@ async def test_delete_operation_rest_asyncio_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"} await client.delete_operation(request) @@ -8698,6 +8781,7 @@ async def test_delete_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_operation(request) @@ -8732,6 +8816,7 @@ async def test_get_operation_rest_asyncio_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"} await client.get_operation(request) @@ -8769,6 +8854,7 @@ async def test_get_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_operation(request) @@ -8803,6 +8889,7 @@ async def test_list_operations_rest_asyncio_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"} await client.list_operations(request) @@ -8840,6 +8927,7 @@ async def test_list_operations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_operations(request) @@ -8874,6 +8962,7 @@ async def test_wait_operation_rest_asyncio_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"} await client.wait_operation(request) @@ -8911,6 +9000,7 @@ async def test_wait_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.wait_operation(request) diff --git a/tests/unit/gapic/aiplatform_v1/test_endpoint_service.py b/tests/unit/gapic/aiplatform_v1/test_endpoint_service.py index c894a38a21..da28e9edf6 100644 --- a/tests/unit/gapic/aiplatform_v1/test_endpoint_service.py +++ b/tests/unit/gapic/aiplatform_v1/test_endpoint_service.py @@ -4644,6 +4644,7 @@ def test_create_endpoint_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_endpoint(request) @@ -4697,6 +4698,7 @@ def test_create_endpoint_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_endpoint(**mock_args) @@ -4829,6 +4831,7 @@ def test_get_endpoint_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_endpoint(request) @@ -4876,6 +4879,7 @@ def test_get_endpoint_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_endpoint(**mock_args) @@ -5016,6 +5020,7 @@ def test_list_endpoints_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_endpoints(request) @@ -5072,6 +5077,7 @@ def test_list_endpoints_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_endpoints(**mock_args) @@ -5263,6 +5269,7 @@ def test_update_endpoint_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_endpoint(request) @@ -5319,6 +5326,7 @@ def test_update_endpoint_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_endpoint(**mock_args) @@ -5453,6 +5461,7 @@ def test_update_endpoint_long_running_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_endpoint_long_running(request) @@ -5498,6 +5507,7 @@ def test_update_endpoint_long_running_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_endpoint_long_running(**mock_args) @@ -5630,6 +5640,7 @@ def test_delete_endpoint_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_endpoint(request) @@ -5675,6 +5686,7 @@ def test_delete_endpoint_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_endpoint(**mock_args) @@ -5807,6 +5819,7 @@ def test_deploy_model_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.deploy_model(request) @@ -5868,6 +5881,7 @@ def test_deploy_model_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.deploy_model(**mock_args) @@ -6013,6 +6027,7 @@ def test_undeploy_model_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.undeploy_model(request) @@ -6068,6 +6083,7 @@ def test_undeploy_model_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.undeploy_model(**mock_args) @@ -6208,6 +6224,7 @@ def test_mutate_deployed_model_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.mutate_deployed_model(request) @@ -6270,6 +6287,7 @@ def test_mutate_deployed_model_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.mutate_deployed_model(**mock_args) @@ -6903,6 +6921,7 @@ def test_create_endpoint_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_endpoint(request) @@ -6940,6 +6959,7 @@ def test_create_endpoint_rest_call_success(request_type): }, "min_replica_count": 1803, "max_replica_count": 1805, + "required_replica_count": 2344, "autoscaling_metric_specs": [ {"metric_name": "metric_name_value", "target": 647} ], @@ -7013,6 +7033,11 @@ def test_create_endpoint_rest_call_success(request_type): "service_attachment": "service_attachment_value", }, "faster_deployment_config": {"fast_tryout_enabled": True}, + "status": { + "message": "message_value", + "last_update_time": {}, + "available_replica_count": 2408, + }, "system_labels": {}, } ], @@ -7126,6 +7151,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_endpoint(request) # Establish that the response is the type that we expect. @@ -7167,6 +7193,7 @@ def test_create_endpoint_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 @@ -7211,6 +7238,7 @@ def test_get_endpoint_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_endpoint(request) @@ -7256,6 +7284,7 @@ def test_get_endpoint_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_endpoint(request) # Establish that the response is the type that we expect. @@ -7309,6 +7338,7 @@ def test_get_endpoint_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 = endpoint.Endpoint.to_json(endpoint.Endpoint()) req.return_value.content = return_value @@ -7353,6 +7383,7 @@ def test_list_endpoints_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_endpoints(request) @@ -7388,6 +7419,7 @@ def test_list_endpoints_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_endpoints(request) # Establish that the response is the type that we expect. @@ -7428,6 +7460,7 @@ def test_list_endpoints_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 = endpoint_service.ListEndpointsResponse.to_json( endpoint_service.ListEndpointsResponse() ) @@ -7476,6 +7509,7 @@ def test_update_endpoint_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_endpoint(request) @@ -7515,6 +7549,7 @@ def test_update_endpoint_rest_call_success(request_type): }, "min_replica_count": 1803, "max_replica_count": 1805, + "required_replica_count": 2344, "autoscaling_metric_specs": [ {"metric_name": "metric_name_value", "target": 647} ], @@ -7588,6 +7623,11 @@ def test_update_endpoint_rest_call_success(request_type): "service_attachment": "service_attachment_value", }, "faster_deployment_config": {"fast_tryout_enabled": True}, + "status": { + "message": "message_value", + "last_update_time": {}, + "available_replica_count": 2408, + }, "system_labels": {}, } ], @@ -7716,6 +7756,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_endpoint(request) # Establish that the response is the type that we expect. @@ -7769,6 +7810,7 @@ def test_update_endpoint_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 = gca_endpoint.Endpoint.to_json(gca_endpoint.Endpoint()) req.return_value.content = return_value @@ -7815,6 +7857,7 @@ def test_update_endpoint_long_running_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_endpoint_long_running(request) @@ -7847,6 +7890,7 @@ def test_update_endpoint_long_running_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.update_endpoint_long_running(request) # Establish that the response is the type that we expect. @@ -7888,6 +7932,7 @@ def test_update_endpoint_long_running_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 @@ -7932,6 +7977,7 @@ def test_delete_endpoint_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_endpoint(request) @@ -7962,6 +8008,7 @@ def test_delete_endpoint_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_endpoint(request) # Establish that the response is the type that we expect. @@ -8003,6 +8050,7 @@ def test_delete_endpoint_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 @@ -8047,6 +8095,7 @@ def test_deploy_model_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.deploy_model(request) @@ -8077,6 +8126,7 @@ def test_deploy_model_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.deploy_model(request) # Establish that the response is the type that we expect. @@ -8118,6 +8168,7 @@ def test_deploy_model_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 @@ -8162,6 +8213,7 @@ def test_undeploy_model_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.undeploy_model(request) @@ -8192,6 +8244,7 @@ def test_undeploy_model_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.undeploy_model(request) # Establish that the response is the type that we expect. @@ -8233,6 +8286,7 @@ def test_undeploy_model_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 @@ -8277,6 +8331,7 @@ def test_mutate_deployed_model_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.mutate_deployed_model(request) @@ -8307,6 +8362,7 @@ def test_mutate_deployed_model_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.mutate_deployed_model(request) # Establish that the response is the type that we expect. @@ -8348,6 +8404,7 @@ def test_mutate_deployed_model_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 @@ -8392,6 +8449,7 @@ def test_get_location_rest_bad_request(request_type=locations_pb2.GetLocationReq 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_location(request) @@ -8422,6 +8480,7 @@ def test_get_location_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_location(request) @@ -8450,6 +8509,7 @@ def test_list_locations_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_locations(request) @@ -8480,6 +8540,7 @@ def test_list_locations_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_locations(request) @@ -8511,6 +8572,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -8543,6 +8605,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -8574,6 +8637,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -8606,6 +8670,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -8637,6 +8702,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -8669,6 +8735,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -8699,6 +8766,7 @@ def test_cancel_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.cancel_operation(request) @@ -8729,6 +8797,7 @@ def test_cancel_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.cancel_operation(request) @@ -8759,6 +8828,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) @@ -8789,6 +8859,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) @@ -8819,6 +8890,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) @@ -8849,6 +8921,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) @@ -8879,6 +8952,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) @@ -8909,6 +8983,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) @@ -8939,6 +9014,7 @@ def test_wait_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.wait_operation(request) @@ -8969,6 +9045,7 @@ def test_wait_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.wait_operation(request) @@ -9220,6 +9297,7 @@ async def test_create_endpoint_rest_asyncio_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"} await client.create_endpoint(request) @@ -9262,6 +9340,7 @@ async def test_create_endpoint_rest_asyncio_call_success(request_type): }, "min_replica_count": 1803, "max_replica_count": 1805, + "required_replica_count": 2344, "autoscaling_metric_specs": [ {"metric_name": "metric_name_value", "target": 647} ], @@ -9335,6 +9414,11 @@ async def test_create_endpoint_rest_asyncio_call_success(request_type): "service_attachment": "service_attachment_value", }, "faster_deployment_config": {"fast_tryout_enabled": True}, + "status": { + "message": "message_value", + "last_update_time": {}, + "available_replica_count": 2408, + }, "system_labels": {}, } ], @@ -9450,6 +9534,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.create_endpoint(request) # Establish that the response is the type that we expect. @@ -9496,6 +9581,7 @@ async def test_create_endpoint_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -9544,6 +9630,7 @@ async def test_get_endpoint_rest_asyncio_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"} await client.get_endpoint(request) @@ -9596,6 +9683,7 @@ async def test_get_endpoint_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_endpoint(request) # Establish that the response is the type that we expect. @@ -9654,6 +9742,7 @@ async def test_get_endpoint_rest_asyncio_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 = endpoint.Endpoint.to_json(endpoint.Endpoint()) req.return_value.read = mock.AsyncMock(return_value=return_value) @@ -9702,6 +9791,7 @@ async def test_list_endpoints_rest_asyncio_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"} await client.list_endpoints(request) @@ -9744,6 +9834,7 @@ async def test_list_endpoints_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_endpoints(request) # Establish that the response is the type that we expect. @@ -9789,6 +9880,7 @@ async def test_list_endpoints_rest_asyncio_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 = endpoint_service.ListEndpointsResponse.to_json( endpoint_service.ListEndpointsResponse() ) @@ -9841,6 +9933,7 @@ async def test_update_endpoint_rest_asyncio_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"} await client.update_endpoint(request) @@ -9885,6 +9978,7 @@ async def test_update_endpoint_rest_asyncio_call_success(request_type): }, "min_replica_count": 1803, "max_replica_count": 1805, + "required_replica_count": 2344, "autoscaling_metric_specs": [ {"metric_name": "metric_name_value", "target": 647} ], @@ -9958,6 +10052,11 @@ async def test_update_endpoint_rest_asyncio_call_success(request_type): "service_attachment": "service_attachment_value", }, "faster_deployment_config": {"fast_tryout_enabled": True}, + "status": { + "message": "message_value", + "last_update_time": {}, + "available_replica_count": 2408, + }, "system_labels": {}, } ], @@ -10088,6 +10187,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.update_endpoint(request) # Establish that the response is the type that we expect. @@ -10146,6 +10246,7 @@ async def test_update_endpoint_rest_asyncio_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 = gca_endpoint.Endpoint.to_json(gca_endpoint.Endpoint()) req.return_value.read = mock.AsyncMock(return_value=return_value) @@ -10196,6 +10297,7 @@ async def test_update_endpoint_long_running_rest_asyncio_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"} await client.update_endpoint_long_running(request) @@ -10235,6 +10337,7 @@ async def test_update_endpoint_long_running_rest_asyncio_call_success(request_ty return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.update_endpoint_long_running(request) # Establish that the response is the type that we expect. @@ -10283,6 +10386,7 @@ async def test_update_endpoint_long_running_rest_asyncio_interceptors(null_inter 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.read = mock.AsyncMock(return_value=return_value) @@ -10331,6 +10435,7 @@ async def test_delete_endpoint_rest_asyncio_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"} await client.delete_endpoint(request) @@ -10368,6 +10473,7 @@ async def test_delete_endpoint_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_endpoint(request) # Establish that the response is the type that we expect. @@ -10414,6 +10520,7 @@ async def test_delete_endpoint_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -10462,6 +10569,7 @@ async def test_deploy_model_rest_asyncio_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"} await client.deploy_model(request) @@ -10499,6 +10607,7 @@ async def test_deploy_model_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.deploy_model(request) # Establish that the response is the type that we expect. @@ -10545,6 +10654,7 @@ async def test_deploy_model_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -10593,6 +10703,7 @@ async def test_undeploy_model_rest_asyncio_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"} await client.undeploy_model(request) @@ -10630,6 +10741,7 @@ async def test_undeploy_model_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.undeploy_model(request) # Establish that the response is the type that we expect. @@ -10676,6 +10788,7 @@ async def test_undeploy_model_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -10724,6 +10837,7 @@ async def test_mutate_deployed_model_rest_asyncio_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"} await client.mutate_deployed_model(request) @@ -10761,6 +10875,7 @@ async def test_mutate_deployed_model_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.mutate_deployed_model(request) # Establish that the response is the type that we expect. @@ -10807,6 +10922,7 @@ async def test_mutate_deployed_model_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -10857,6 +10973,7 @@ async def test_get_location_rest_asyncio_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"} await client.get_location(request) @@ -10894,6 +11011,7 @@ async def test_get_location_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_location(request) @@ -10926,6 +11044,7 @@ async def test_list_locations_rest_asyncio_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"} await client.list_locations(request) @@ -10963,6 +11082,7 @@ async def test_list_locations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_locations(request) @@ -10998,6 +11118,7 @@ async def test_get_iam_policy_rest_asyncio_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"} await client.get_iam_policy(request) @@ -11037,6 +11158,7 @@ async def test_get_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_iam_policy(request) @@ -11072,6 +11194,7 @@ async def test_set_iam_policy_rest_asyncio_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"} await client.set_iam_policy(request) @@ -11111,6 +11234,7 @@ async def test_set_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.set_iam_policy(request) @@ -11146,6 +11270,7 @@ async def test_test_iam_permissions_rest_asyncio_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"} await client.test_iam_permissions(request) @@ -11185,6 +11310,7 @@ async def test_test_iam_permissions_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.test_iam_permissions(request) @@ -11219,6 +11345,7 @@ async def test_cancel_operation_rest_asyncio_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"} await client.cancel_operation(request) @@ -11256,6 +11383,7 @@ async def test_cancel_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.cancel_operation(request) @@ -11290,6 +11418,7 @@ async def test_delete_operation_rest_asyncio_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"} await client.delete_operation(request) @@ -11327,6 +11456,7 @@ async def test_delete_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_operation(request) @@ -11361,6 +11491,7 @@ async def test_get_operation_rest_asyncio_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"} await client.get_operation(request) @@ -11398,6 +11529,7 @@ async def test_get_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_operation(request) @@ -11432,6 +11564,7 @@ async def test_list_operations_rest_asyncio_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"} await client.list_operations(request) @@ -11469,6 +11602,7 @@ async def test_list_operations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_operations(request) @@ -11503,6 +11637,7 @@ async def test_wait_operation_rest_asyncio_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"} await client.wait_operation(request) @@ -11540,6 +11675,7 @@ async def test_wait_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.wait_operation(request) diff --git a/tests/unit/gapic/aiplatform_v1/test_evaluation_service.py b/tests/unit/gapic/aiplatform_v1/test_evaluation_service.py index 5fc4b59d10..a82fd0ce28 100644 --- a/tests/unit/gapic/aiplatform_v1/test_evaluation_service.py +++ b/tests/unit/gapic/aiplatform_v1/test_evaluation_service.py @@ -1473,6 +1473,7 @@ def test_evaluate_instances_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.evaluate_instances(request) @@ -1688,6 +1689,7 @@ def test_evaluate_instances_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.evaluate_instances(request) @@ -1721,6 +1723,7 @@ def test_evaluate_instances_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.evaluate_instances(request) # Establish that the response is the type that we expect. @@ -1760,6 +1763,7 @@ def test_evaluate_instances_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 = evaluation_service.EvaluateInstancesResponse.to_json( evaluation_service.EvaluateInstancesResponse() ) @@ -1806,6 +1810,7 @@ def test_get_location_rest_bad_request(request_type=locations_pb2.GetLocationReq 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_location(request) @@ -1836,6 +1841,7 @@ def test_get_location_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_location(request) @@ -1864,6 +1870,7 @@ def test_list_locations_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_locations(request) @@ -1894,6 +1901,7 @@ def test_list_locations_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_locations(request) @@ -1925,6 +1933,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -1957,6 +1966,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -1988,6 +1998,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -2020,6 +2031,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -2051,6 +2063,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -2083,6 +2096,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -2113,6 +2127,7 @@ def test_cancel_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.cancel_operation(request) @@ -2143,6 +2158,7 @@ def test_cancel_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.cancel_operation(request) @@ -2173,6 +2189,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) @@ -2203,6 +2220,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) @@ -2233,6 +2251,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) @@ -2263,6 +2282,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) @@ -2293,6 +2313,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) @@ -2323,6 +2344,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) @@ -2353,6 +2375,7 @@ def test_wait_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.wait_operation(request) @@ -2383,6 +2406,7 @@ def test_wait_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.wait_operation(request) @@ -2455,6 +2479,7 @@ async def test_evaluate_instances_rest_asyncio_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"} await client.evaluate_instances(request) @@ -2495,6 +2520,7 @@ async def test_evaluate_instances_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.evaluate_instances(request) # Establish that the response is the type that we expect. @@ -2539,6 +2565,7 @@ async def test_evaluate_instances_rest_asyncio_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 = evaluation_service.EvaluateInstancesResponse.to_json( evaluation_service.EvaluateInstancesResponse() ) @@ -2591,6 +2618,7 @@ async def test_get_location_rest_asyncio_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"} await client.get_location(request) @@ -2628,6 +2656,7 @@ async def test_get_location_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_location(request) @@ -2660,6 +2689,7 @@ async def test_list_locations_rest_asyncio_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"} await client.list_locations(request) @@ -2697,6 +2727,7 @@ async def test_list_locations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_locations(request) @@ -2732,6 +2763,7 @@ async def test_get_iam_policy_rest_asyncio_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"} await client.get_iam_policy(request) @@ -2771,6 +2803,7 @@ async def test_get_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_iam_policy(request) @@ -2806,6 +2839,7 @@ async def test_set_iam_policy_rest_asyncio_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"} await client.set_iam_policy(request) @@ -2845,6 +2879,7 @@ async def test_set_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.set_iam_policy(request) @@ -2880,6 +2915,7 @@ async def test_test_iam_permissions_rest_asyncio_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"} await client.test_iam_permissions(request) @@ -2919,6 +2955,7 @@ async def test_test_iam_permissions_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.test_iam_permissions(request) @@ -2953,6 +2990,7 @@ async def test_cancel_operation_rest_asyncio_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"} await client.cancel_operation(request) @@ -2990,6 +3028,7 @@ async def test_cancel_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.cancel_operation(request) @@ -3024,6 +3063,7 @@ async def test_delete_operation_rest_asyncio_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"} await client.delete_operation(request) @@ -3061,6 +3101,7 @@ async def test_delete_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_operation(request) @@ -3095,6 +3136,7 @@ async def test_get_operation_rest_asyncio_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"} await client.get_operation(request) @@ -3132,6 +3174,7 @@ async def test_get_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_operation(request) @@ -3166,6 +3209,7 @@ async def test_list_operations_rest_asyncio_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"} await client.list_operations(request) @@ -3203,6 +3247,7 @@ async def test_list_operations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_operations(request) @@ -3237,6 +3282,7 @@ async def test_wait_operation_rest_asyncio_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"} await client.wait_operation(request) @@ -3274,6 +3320,7 @@ async def test_wait_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.wait_operation(request) diff --git a/tests/unit/gapic/aiplatform_v1/test_feature_online_store_admin_service.py b/tests/unit/gapic/aiplatform_v1/test_feature_online_store_admin_service.py index 792d32d944..f0af64838f 100644 --- a/tests/unit/gapic/aiplatform_v1/test_feature_online_store_admin_service.py +++ b/tests/unit/gapic/aiplatform_v1/test_feature_online_store_admin_service.py @@ -6662,6 +6662,7 @@ def test_create_feature_online_store_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_feature_online_store(request) @@ -6728,6 +6729,7 @@ def test_create_feature_online_store_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_feature_online_store(**mock_args) @@ -6872,6 +6874,7 @@ def test_get_feature_online_store_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_feature_online_store(request) @@ -6919,6 +6922,7 @@ def test_get_feature_online_store_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_feature_online_store(**mock_args) @@ -7068,6 +7072,7 @@ def test_list_feature_online_stores_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_feature_online_stores(request) @@ -7129,6 +7134,7 @@ def test_list_feature_online_stores_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_feature_online_stores(**mock_args) @@ -7332,6 +7338,7 @@ def test_update_feature_online_store_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_feature_online_store(request) @@ -7386,6 +7393,7 @@ def test_update_feature_online_store_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_feature_online_store(**mock_args) @@ -7532,6 +7540,7 @@ def test_delete_feature_online_store_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_feature_online_store(request) @@ -7578,6 +7587,7 @@ def test_delete_feature_online_store_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_feature_online_store(**mock_args) @@ -7730,6 +7740,7 @@ def test_create_feature_view_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_feature_view(request) @@ -7801,6 +7812,7 @@ def test_create_feature_view_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_feature_view(**mock_args) @@ -7940,6 +7952,7 @@ def test_get_feature_view_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_feature_view(request) @@ -7987,6 +8000,7 @@ def test_get_feature_view_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_feature_view(**mock_args) @@ -8135,6 +8149,7 @@ def test_list_feature_views_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_feature_views(request) @@ -8194,6 +8209,7 @@ def test_list_feature_views_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_feature_views(**mock_args) @@ -8394,6 +8410,7 @@ def test_update_feature_view_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_feature_view(request) @@ -8446,6 +8463,7 @@ def test_update_feature_view_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_feature_view(**mock_args) @@ -8587,6 +8605,7 @@ def test_delete_feature_view_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_feature_view(request) @@ -8632,6 +8651,7 @@ def test_delete_feature_view_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_feature_view(**mock_args) @@ -8770,6 +8790,7 @@ def test_sync_feature_view_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.sync_feature_view(request) @@ -8819,6 +8840,7 @@ def test_sync_feature_view_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.sync_feature_view(**mock_args) @@ -8955,6 +8977,7 @@ def test_get_feature_view_sync_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_feature_view_sync(request) @@ -9002,6 +9025,7 @@ def test_get_feature_view_sync_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_feature_view_sync(**mock_args) @@ -9151,6 +9175,7 @@ def test_list_feature_view_syncs_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_feature_view_syncs(request) @@ -9212,6 +9237,7 @@ def test_list_feature_view_syncs_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_feature_view_syncs(**mock_args) @@ -10146,6 +10172,7 @@ def test_create_feature_online_store_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_feature_online_store(request) @@ -10280,6 +10307,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_feature_online_store(request) # Establish that the response is the type that we expect. @@ -10325,6 +10353,7 @@ def test_create_feature_online_store_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 @@ -10371,6 +10400,7 @@ def test_get_feature_online_store_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_feature_online_store(request) @@ -10412,6 +10442,7 @@ def test_get_feature_online_store_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_feature_online_store(request) # Establish that the response is the type that we expect. @@ -10458,6 +10489,7 @@ def test_get_feature_online_store_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 = feature_online_store.FeatureOnlineStore.to_json( feature_online_store.FeatureOnlineStore() ) @@ -10504,6 +10536,7 @@ def test_list_feature_online_stores_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_feature_online_stores(request) @@ -10545,6 +10578,7 @@ def test_list_feature_online_stores_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_feature_online_stores(request) # Establish that the response is the type that we expect. @@ -10589,6 +10623,7 @@ def test_list_feature_online_stores_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 = ( feature_online_store_admin_service.ListFeatureOnlineStoresResponse.to_json( feature_online_store_admin_service.ListFeatureOnlineStoresResponse() @@ -10643,6 +10678,7 @@ def test_update_feature_online_store_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_feature_online_store(request) @@ -10781,6 +10817,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_feature_online_store(request) # Establish that the response is the type that we expect. @@ -10826,6 +10863,7 @@ def test_update_feature_online_store_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 @@ -10872,6 +10910,7 @@ def test_delete_feature_online_store_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_feature_online_store(request) @@ -10904,6 +10943,7 @@ def test_delete_feature_online_store_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_feature_online_store(request) # Establish that the response is the type that we expect. @@ -10949,6 +10989,7 @@ def test_delete_feature_online_store_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 @@ -10995,6 +11036,7 @@ def test_create_feature_view_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_feature_view(request) @@ -11134,6 +11176,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_feature_view(request) # Establish that the response is the type that we expect. @@ -11177,6 +11220,7 @@ def test_create_feature_view_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 @@ -11223,6 +11267,7 @@ def test_get_feature_view_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_feature_view(request) @@ -11263,6 +11308,7 @@ def test_get_feature_view_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_feature_view(request) # Establish that the response is the type that we expect. @@ -11307,6 +11353,7 @@ def test_get_feature_view_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 = feature_view.FeatureView.to_json(feature_view.FeatureView()) req.return_value.content = return_value @@ -11353,6 +11400,7 @@ def test_list_feature_views_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_feature_views(request) @@ -11392,6 +11440,7 @@ def test_list_feature_views_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_feature_views(request) # Establish that the response is the type that we expect. @@ -11434,6 +11483,7 @@ def test_list_feature_views_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 = ( feature_online_store_admin_service.ListFeatureViewsResponse.to_json( feature_online_store_admin_service.ListFeatureViewsResponse() @@ -11488,6 +11538,7 @@ def test_update_feature_view_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_feature_view(request) @@ -11629,6 +11680,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_feature_view(request) # Establish that the response is the type that we expect. @@ -11672,6 +11724,7 @@ def test_update_feature_view_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 @@ -11718,6 +11771,7 @@ def test_delete_feature_view_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_feature_view(request) @@ -11750,6 +11804,7 @@ def test_delete_feature_view_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_feature_view(request) # Establish that the response is the type that we expect. @@ -11793,6 +11848,7 @@ def test_delete_feature_view_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 @@ -11839,6 +11895,7 @@ def test_sync_feature_view_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.sync_feature_view(request) @@ -11878,6 +11935,7 @@ def test_sync_feature_view_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.sync_feature_view(request) # Establish that the response is the type that we expect. @@ -11922,6 +11980,7 @@ def test_sync_feature_view_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 = ( feature_online_store_admin_service.SyncFeatureViewResponse.to_json( feature_online_store_admin_service.SyncFeatureViewResponse() @@ -11972,6 +12031,7 @@ def test_get_feature_view_sync_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_feature_view_sync(request) @@ -12011,6 +12071,7 @@ def test_get_feature_view_sync_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_feature_view_sync(request) # Establish that the response is the type that we expect. @@ -12055,6 +12116,7 @@ def test_get_feature_view_sync_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 = feature_view_sync.FeatureViewSync.to_json( feature_view_sync.FeatureViewSync() ) @@ -12103,6 +12165,7 @@ def test_list_feature_view_syncs_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_feature_view_syncs(request) @@ -12144,6 +12207,7 @@ def test_list_feature_view_syncs_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_feature_view_syncs(request) # Establish that the response is the type that we expect. @@ -12186,6 +12250,7 @@ def test_list_feature_view_syncs_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 = ( feature_online_store_admin_service.ListFeatureViewSyncsResponse.to_json( feature_online_store_admin_service.ListFeatureViewSyncsResponse() @@ -12236,6 +12301,7 @@ def test_get_location_rest_bad_request(request_type=locations_pb2.GetLocationReq 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_location(request) @@ -12266,6 +12332,7 @@ def test_get_location_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_location(request) @@ -12294,6 +12361,7 @@ def test_list_locations_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_locations(request) @@ -12324,6 +12392,7 @@ def test_list_locations_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_locations(request) @@ -12355,6 +12424,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -12387,6 +12457,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -12418,6 +12489,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -12450,6 +12522,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -12481,6 +12554,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -12513,6 +12587,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -12543,6 +12618,7 @@ def test_cancel_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.cancel_operation(request) @@ -12573,6 +12649,7 @@ def test_cancel_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.cancel_operation(request) @@ -12603,6 +12680,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) @@ -12633,6 +12711,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) @@ -12663,6 +12742,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) @@ -12693,6 +12773,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) @@ -12723,6 +12804,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) @@ -12753,6 +12835,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) @@ -12783,6 +12866,7 @@ def test_wait_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.wait_operation(request) @@ -12813,6 +12897,7 @@ def test_wait_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.wait_operation(request) @@ -13172,6 +13257,7 @@ async def test_create_feature_online_store_rest_asyncio_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"} await client.create_feature_online_store(request) @@ -13313,6 +13399,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.create_feature_online_store(request) # Establish that the response is the type that we expect. @@ -13363,6 +13450,7 @@ async def test_create_feature_online_store_rest_asyncio_interceptors(null_interc 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.read = mock.AsyncMock(return_value=return_value) @@ -13413,6 +13501,7 @@ async def test_get_feature_online_store_rest_asyncio_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"} await client.get_feature_online_store(request) @@ -13461,6 +13550,7 @@ async def test_get_feature_online_store_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_feature_online_store(request) # Establish that the response is the type that we expect. @@ -13512,6 +13602,7 @@ async def test_get_feature_online_store_rest_asyncio_interceptors(null_intercept 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 = feature_online_store.FeatureOnlineStore.to_json( feature_online_store.FeatureOnlineStore() ) @@ -13562,6 +13653,7 @@ async def test_list_feature_online_stores_rest_asyncio_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"} await client.list_feature_online_stores(request) @@ -13610,6 +13702,7 @@ async def test_list_feature_online_stores_rest_asyncio_call_success(request_type return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_feature_online_stores(request) # Establish that the response is the type that we expect. @@ -13659,6 +13752,7 @@ async def test_list_feature_online_stores_rest_asyncio_interceptors(null_interce 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 = ( feature_online_store_admin_service.ListFeatureOnlineStoresResponse.to_json( feature_online_store_admin_service.ListFeatureOnlineStoresResponse() @@ -13717,6 +13811,7 @@ async def test_update_feature_online_store_rest_asyncio_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"} await client.update_feature_online_store(request) @@ -13862,6 +13957,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.update_feature_online_store(request) # Establish that the response is the type that we expect. @@ -13912,6 +14008,7 @@ async def test_update_feature_online_store_rest_asyncio_interceptors(null_interc 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.read = mock.AsyncMock(return_value=return_value) @@ -13962,6 +14059,7 @@ async def test_delete_feature_online_store_rest_asyncio_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"} await client.delete_feature_online_store(request) @@ -14001,6 +14099,7 @@ async def test_delete_feature_online_store_rest_asyncio_call_success(request_typ return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_feature_online_store(request) # Establish that the response is the type that we expect. @@ -14051,6 +14150,7 @@ async def test_delete_feature_online_store_rest_asyncio_interceptors(null_interc 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.read = mock.AsyncMock(return_value=return_value) @@ -14101,6 +14201,7 @@ async def test_create_feature_view_rest_asyncio_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"} await client.create_feature_view(request) @@ -14247,6 +14348,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.create_feature_view(request) # Establish that the response is the type that we expect. @@ -14295,6 +14397,7 @@ async def test_create_feature_view_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -14345,6 +14448,7 @@ async def test_get_feature_view_rest_asyncio_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"} await client.get_feature_view(request) @@ -14392,6 +14496,7 @@ async def test_get_feature_view_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_feature_view(request) # Establish that the response is the type that we expect. @@ -14442,6 +14547,7 @@ async def test_get_feature_view_rest_asyncio_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 = feature_view.FeatureView.to_json(feature_view.FeatureView()) req.return_value.read = mock.AsyncMock(return_value=return_value) @@ -14492,6 +14598,7 @@ async def test_list_feature_views_rest_asyncio_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"} await client.list_feature_views(request) @@ -14538,6 +14645,7 @@ async def test_list_feature_views_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_feature_views(request) # Establish that the response is the type that we expect. @@ -14585,6 +14693,7 @@ async def test_list_feature_views_rest_asyncio_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 = ( feature_online_store_admin_service.ListFeatureViewsResponse.to_json( feature_online_store_admin_service.ListFeatureViewsResponse() @@ -14643,6 +14752,7 @@ async def test_update_feature_view_rest_asyncio_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"} await client.update_feature_view(request) @@ -14791,6 +14901,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.update_feature_view(request) # Establish that the response is the type that we expect. @@ -14839,6 +14950,7 @@ async def test_update_feature_view_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -14889,6 +15001,7 @@ async def test_delete_feature_view_rest_asyncio_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"} await client.delete_feature_view(request) @@ -14928,6 +15041,7 @@ async def test_delete_feature_view_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_feature_view(request) # Establish that the response is the type that we expect. @@ -14976,6 +15090,7 @@ async def test_delete_feature_view_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -15026,6 +15141,7 @@ async def test_sync_feature_view_rest_asyncio_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"} await client.sync_feature_view(request) @@ -15072,6 +15188,7 @@ async def test_sync_feature_view_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.sync_feature_view(request) # Establish that the response is the type that we expect. @@ -15121,6 +15238,7 @@ async def test_sync_feature_view_rest_asyncio_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 = ( feature_online_store_admin_service.SyncFeatureViewResponse.to_json( feature_online_store_admin_service.SyncFeatureViewResponse() @@ -15175,6 +15293,7 @@ async def test_get_feature_view_sync_rest_asyncio_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"} await client.get_feature_view_sync(request) @@ -15221,6 +15340,7 @@ async def test_get_feature_view_sync_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_feature_view_sync(request) # Establish that the response is the type that we expect. @@ -15270,6 +15390,7 @@ async def test_get_feature_view_sync_rest_asyncio_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 = feature_view_sync.FeatureViewSync.to_json( feature_view_sync.FeatureViewSync() ) @@ -15322,6 +15443,7 @@ async def test_list_feature_view_syncs_rest_asyncio_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"} await client.list_feature_view_syncs(request) @@ -15370,6 +15492,7 @@ async def test_list_feature_view_syncs_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_feature_view_syncs(request) # Establish that the response is the type that we expect. @@ -15417,6 +15540,7 @@ async def test_list_feature_view_syncs_rest_asyncio_interceptors(null_intercepto 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 = ( feature_online_store_admin_service.ListFeatureViewSyncsResponse.to_json( feature_online_store_admin_service.ListFeatureViewSyncsResponse() @@ -15473,6 +15597,7 @@ async def test_get_location_rest_asyncio_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"} await client.get_location(request) @@ -15510,6 +15635,7 @@ async def test_get_location_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_location(request) @@ -15542,6 +15668,7 @@ async def test_list_locations_rest_asyncio_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"} await client.list_locations(request) @@ -15579,6 +15706,7 @@ async def test_list_locations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_locations(request) @@ -15614,6 +15742,7 @@ async def test_get_iam_policy_rest_asyncio_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"} await client.get_iam_policy(request) @@ -15653,6 +15782,7 @@ async def test_get_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_iam_policy(request) @@ -15688,6 +15818,7 @@ async def test_set_iam_policy_rest_asyncio_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"} await client.set_iam_policy(request) @@ -15727,6 +15858,7 @@ async def test_set_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.set_iam_policy(request) @@ -15762,6 +15894,7 @@ async def test_test_iam_permissions_rest_asyncio_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"} await client.test_iam_permissions(request) @@ -15801,6 +15934,7 @@ async def test_test_iam_permissions_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.test_iam_permissions(request) @@ -15835,6 +15969,7 @@ async def test_cancel_operation_rest_asyncio_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"} await client.cancel_operation(request) @@ -15872,6 +16007,7 @@ async def test_cancel_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.cancel_operation(request) @@ -15906,6 +16042,7 @@ async def test_delete_operation_rest_asyncio_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"} await client.delete_operation(request) @@ -15943,6 +16080,7 @@ async def test_delete_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_operation(request) @@ -15977,6 +16115,7 @@ async def test_get_operation_rest_asyncio_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"} await client.get_operation(request) @@ -16014,6 +16153,7 @@ async def test_get_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_operation(request) @@ -16048,6 +16188,7 @@ async def test_list_operations_rest_asyncio_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"} await client.list_operations(request) @@ -16085,6 +16226,7 @@ async def test_list_operations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_operations(request) @@ -16119,6 +16261,7 @@ async def test_wait_operation_rest_asyncio_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"} await client.wait_operation(request) @@ -16156,6 +16299,7 @@ async def test_wait_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.wait_operation(request) diff --git a/tests/unit/gapic/aiplatform_v1/test_feature_online_store_service.py b/tests/unit/gapic/aiplatform_v1/test_feature_online_store_service.py index 0e1789b6aa..34324d87ab 100644 --- a/tests/unit/gapic/aiplatform_v1/test_feature_online_store_service.py +++ b/tests/unit/gapic/aiplatform_v1/test_feature_online_store_service.py @@ -1865,6 +1865,7 @@ def test_fetch_feature_values_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_feature_values(request) @@ -1915,6 +1916,7 @@ def test_fetch_feature_values_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.fetch_feature_values(**mock_args) @@ -2057,6 +2059,7 @@ def test_search_nearest_entities_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.search_nearest_entities(request) @@ -2332,6 +2335,7 @@ def test_fetch_feature_values_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_feature_values(request) @@ -2369,6 +2373,7 @@ def test_fetch_feature_values_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_feature_values(request) # Establish that the response is the type that we expect. @@ -2408,6 +2413,7 @@ def test_fetch_feature_values_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 = feature_online_store_service.FetchFeatureValuesResponse.to_json( feature_online_store_service.FetchFeatureValuesResponse() ) @@ -2456,6 +2462,7 @@ def test_search_nearest_entities_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.search_nearest_entities(request) @@ -2493,6 +2500,7 @@ def test_search_nearest_entities_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.search_nearest_entities(request) # Establish that the response is the type that we expect. @@ -2536,6 +2544,7 @@ def test_search_nearest_entities_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 = ( feature_online_store_service.SearchNearestEntitiesResponse.to_json( feature_online_store_service.SearchNearestEntitiesResponse() @@ -2584,6 +2593,7 @@ def test_get_location_rest_bad_request(request_type=locations_pb2.GetLocationReq 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_location(request) @@ -2614,6 +2624,7 @@ def test_get_location_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_location(request) @@ -2642,6 +2653,7 @@ def test_list_locations_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_locations(request) @@ -2672,6 +2684,7 @@ def test_list_locations_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_locations(request) @@ -2703,6 +2716,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -2735,6 +2749,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -2766,6 +2781,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -2798,6 +2814,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -2829,6 +2846,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -2861,6 +2879,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -2891,6 +2910,7 @@ def test_cancel_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.cancel_operation(request) @@ -2921,6 +2941,7 @@ def test_cancel_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.cancel_operation(request) @@ -2951,6 +2972,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) @@ -2981,6 +3003,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) @@ -3011,6 +3034,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) @@ -3041,6 +3065,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) @@ -3071,6 +3096,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) @@ -3101,6 +3127,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) @@ -3131,6 +3158,7 @@ def test_wait_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.wait_operation(request) @@ -3161,6 +3189,7 @@ def test_wait_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.wait_operation(request) @@ -3257,6 +3286,7 @@ async def test_fetch_feature_values_rest_asyncio_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"} await client.fetch_feature_values(request) @@ -3301,6 +3331,7 @@ async def test_fetch_feature_values_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.fetch_feature_values(request) # Establish that the response is the type that we expect. @@ -3347,6 +3378,7 @@ async def test_fetch_feature_values_rest_asyncio_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 = feature_online_store_service.FetchFeatureValuesResponse.to_json( feature_online_store_service.FetchFeatureValuesResponse() ) @@ -3399,6 +3431,7 @@ async def test_search_nearest_entities_rest_asyncio_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"} await client.search_nearest_entities(request) @@ -3443,6 +3476,7 @@ async def test_search_nearest_entities_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.search_nearest_entities(request) # Establish that the response is the type that we expect. @@ -3491,6 +3525,7 @@ async def test_search_nearest_entities_rest_asyncio_interceptors(null_intercepto 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 = ( feature_online_store_service.SearchNearestEntitiesResponse.to_json( feature_online_store_service.SearchNearestEntitiesResponse() @@ -3545,6 +3580,7 @@ async def test_get_location_rest_asyncio_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"} await client.get_location(request) @@ -3582,6 +3618,7 @@ async def test_get_location_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_location(request) @@ -3614,6 +3651,7 @@ async def test_list_locations_rest_asyncio_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"} await client.list_locations(request) @@ -3651,6 +3689,7 @@ async def test_list_locations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_locations(request) @@ -3686,6 +3725,7 @@ async def test_get_iam_policy_rest_asyncio_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"} await client.get_iam_policy(request) @@ -3725,6 +3765,7 @@ async def test_get_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_iam_policy(request) @@ -3760,6 +3801,7 @@ async def test_set_iam_policy_rest_asyncio_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"} await client.set_iam_policy(request) @@ -3799,6 +3841,7 @@ async def test_set_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.set_iam_policy(request) @@ -3834,6 +3877,7 @@ async def test_test_iam_permissions_rest_asyncio_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"} await client.test_iam_permissions(request) @@ -3873,6 +3917,7 @@ async def test_test_iam_permissions_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.test_iam_permissions(request) @@ -3907,6 +3952,7 @@ async def test_cancel_operation_rest_asyncio_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"} await client.cancel_operation(request) @@ -3944,6 +3990,7 @@ async def test_cancel_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.cancel_operation(request) @@ -3978,6 +4025,7 @@ async def test_delete_operation_rest_asyncio_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"} await client.delete_operation(request) @@ -4015,6 +4063,7 @@ async def test_delete_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_operation(request) @@ -4049,6 +4098,7 @@ async def test_get_operation_rest_asyncio_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"} await client.get_operation(request) @@ -4086,6 +4136,7 @@ async def test_get_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_operation(request) @@ -4120,6 +4171,7 @@ async def test_list_operations_rest_asyncio_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"} await client.list_operations(request) @@ -4157,6 +4209,7 @@ async def test_list_operations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_operations(request) @@ -4191,6 +4244,7 @@ async def test_wait_operation_rest_asyncio_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"} await client.wait_operation(request) @@ -4228,6 +4282,7 @@ async def test_wait_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.wait_operation(request) diff --git a/tests/unit/gapic/aiplatform_v1/test_feature_registry_service.py b/tests/unit/gapic/aiplatform_v1/test_feature_registry_service.py index b172feed29..8d09591d55 100644 --- a/tests/unit/gapic/aiplatform_v1/test_feature_registry_service.py +++ b/tests/unit/gapic/aiplatform_v1/test_feature_registry_service.py @@ -5533,6 +5533,7 @@ def test_create_feature_group_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_feature_group(request) @@ -5597,6 +5598,7 @@ def test_create_feature_group_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_feature_group(**mock_args) @@ -5736,6 +5738,7 @@ def test_get_feature_group_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_feature_group(request) @@ -5783,6 +5786,7 @@ def test_get_feature_group_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_feature_group(**mock_args) @@ -5929,6 +5933,7 @@ def test_list_feature_groups_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_feature_groups(request) @@ -5986,6 +5991,7 @@ def test_list_feature_groups_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_feature_groups(**mock_args) @@ -6184,6 +6190,7 @@ def test_update_feature_group_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_feature_group(request) @@ -6236,6 +6243,7 @@ def test_update_feature_group_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_feature_group(**mock_args) @@ -6379,6 +6387,7 @@ def test_delete_feature_group_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_feature_group(request) @@ -6425,6 +6434,7 @@ def test_delete_feature_group_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_feature_group(**mock_args) @@ -6568,6 +6578,7 @@ def test_create_feature_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_feature(request) @@ -6630,6 +6641,7 @@ def test_create_feature_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_feature(**mock_args) @@ -6770,6 +6782,7 @@ def test_batch_create_features_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.batch_create_features(request) @@ -6824,6 +6837,7 @@ def test_batch_create_features_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.batch_create_features(**mock_args) @@ -6956,6 +6970,7 @@ def test_get_feature_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_feature(request) @@ -7003,6 +7018,7 @@ def test_get_feature_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_feature(**mock_args) @@ -7145,6 +7161,7 @@ def test_list_features_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_features(request) @@ -7204,6 +7221,7 @@ def test_list_features_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_features(**mock_args) @@ -7399,6 +7417,7 @@ def test_update_feature_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_feature(request) @@ -7447,6 +7466,7 @@ def test_update_feature_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_feature(**mock_args) @@ -7580,6 +7600,7 @@ def test_delete_feature_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_feature(request) @@ -7625,6 +7646,7 @@ def test_delete_feature_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_feature(**mock_args) @@ -8348,6 +8370,7 @@ def test_create_feature_group_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_feature_group(request) @@ -8465,6 +8488,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_feature_group(request) # Establish that the response is the type that we expect. @@ -8506,6 +8530,7 @@ def test_create_feature_group_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 @@ -8550,6 +8575,7 @@ def test_get_feature_group_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_feature_group(request) @@ -8587,6 +8613,7 @@ def test_get_feature_group_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_feature_group(request) # Establish that the response is the type that we expect. @@ -8629,6 +8656,7 @@ def test_get_feature_group_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 = feature_group.FeatureGroup.to_json(feature_group.FeatureGroup()) req.return_value.content = return_value @@ -8673,6 +8701,7 @@ def test_list_feature_groups_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_feature_groups(request) @@ -8710,6 +8739,7 @@ def test_list_feature_groups_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_feature_groups(request) # Establish that the response is the type that we expect. @@ -8750,6 +8780,7 @@ def test_list_feature_groups_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 = feature_registry_service.ListFeatureGroupsResponse.to_json( feature_registry_service.ListFeatureGroupsResponse() ) @@ -8800,6 +8831,7 @@ def test_update_feature_group_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_feature_group(request) @@ -8921,6 +8953,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_feature_group(request) # Establish that the response is the type that we expect. @@ -8962,6 +8995,7 @@ def test_update_feature_group_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 @@ -9006,6 +9040,7 @@ def test_delete_feature_group_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_feature_group(request) @@ -9036,6 +9071,7 @@ def test_delete_feature_group_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_feature_group(request) # Establish that the response is the type that we expect. @@ -9077,6 +9113,7 @@ def test_delete_feature_group_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 @@ -9123,6 +9160,7 @@ def test_create_feature_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_feature(request) @@ -9248,6 +9286,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_feature(request) # Establish that the response is the type that we expect. @@ -9289,6 +9328,7 @@ def test_create_feature_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 @@ -9335,6 +9375,7 @@ def test_batch_create_features_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.batch_create_features(request) @@ -9367,6 +9408,7 @@ def test_batch_create_features_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.batch_create_features(request) # Establish that the response is the type that we expect. @@ -9408,6 +9450,7 @@ def test_batch_create_features_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 @@ -9454,6 +9497,7 @@ def test_get_feature_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_feature(request) @@ -9497,6 +9541,7 @@ def test_get_feature_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_feature(request) # Establish that the response is the type that we expect. @@ -9543,6 +9588,7 @@ def test_get_feature_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 = feature.Feature.to_json(feature.Feature()) req.return_value.content = return_value @@ -9589,6 +9635,7 @@ def test_list_features_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_features(request) @@ -9626,6 +9673,7 @@ def test_list_features_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_features(request) # Establish that the response is the type that we expect. @@ -9666,6 +9714,7 @@ def test_list_features_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 = featurestore_service.ListFeaturesResponse.to_json( featurestore_service.ListFeaturesResponse() ) @@ -9716,6 +9765,7 @@ def test_update_feature_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_feature(request) @@ -9843,6 +9893,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_feature(request) # Establish that the response is the type that we expect. @@ -9884,6 +9935,7 @@ def test_update_feature_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 @@ -9930,6 +9982,7 @@ def test_delete_feature_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_feature(request) @@ -9962,6 +10015,7 @@ def test_delete_feature_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_feature(request) # Establish that the response is the type that we expect. @@ -10003,6 +10057,7 @@ def test_delete_feature_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 @@ -10047,6 +10102,7 @@ def test_get_location_rest_bad_request(request_type=locations_pb2.GetLocationReq 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_location(request) @@ -10077,6 +10133,7 @@ def test_get_location_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_location(request) @@ -10105,6 +10162,7 @@ def test_list_locations_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_locations(request) @@ -10135,6 +10193,7 @@ def test_list_locations_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_locations(request) @@ -10166,6 +10225,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -10198,6 +10258,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -10229,6 +10290,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -10261,6 +10323,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -10292,6 +10355,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -10324,6 +10388,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -10354,6 +10419,7 @@ def test_cancel_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.cancel_operation(request) @@ -10384,6 +10450,7 @@ def test_cancel_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.cancel_operation(request) @@ -10414,6 +10481,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) @@ -10444,6 +10512,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) @@ -10474,6 +10543,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) @@ -10504,6 +10574,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) @@ -10534,6 +10605,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) @@ -10564,6 +10636,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) @@ -10594,6 +10667,7 @@ def test_wait_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.wait_operation(request) @@ -10624,6 +10698,7 @@ def test_wait_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.wait_operation(request) @@ -10923,6 +10998,7 @@ async def test_create_feature_group_rest_asyncio_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"} await client.create_feature_group(request) @@ -11047,6 +11123,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.create_feature_group(request) # Establish that the response is the type that we expect. @@ -11095,6 +11172,7 @@ async def test_create_feature_group_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -11143,6 +11221,7 @@ async def test_get_feature_group_rest_asyncio_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"} await client.get_feature_group(request) @@ -11187,6 +11266,7 @@ async def test_get_feature_group_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_feature_group(request) # Establish that the response is the type that we expect. @@ -11234,6 +11314,7 @@ async def test_get_feature_group_rest_asyncio_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 = feature_group.FeatureGroup.to_json(feature_group.FeatureGroup()) req.return_value.read = mock.AsyncMock(return_value=return_value) @@ -11282,6 +11363,7 @@ async def test_list_feature_groups_rest_asyncio_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"} await client.list_feature_groups(request) @@ -11326,6 +11408,7 @@ async def test_list_feature_groups_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_feature_groups(request) # Establish that the response is the type that we expect. @@ -11372,6 +11455,7 @@ async def test_list_feature_groups_rest_asyncio_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 = feature_registry_service.ListFeatureGroupsResponse.to_json( feature_registry_service.ListFeatureGroupsResponse() ) @@ -11426,6 +11510,7 @@ async def test_update_feature_group_rest_asyncio_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"} await client.update_feature_group(request) @@ -11554,6 +11639,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.update_feature_group(request) # Establish that the response is the type that we expect. @@ -11602,6 +11688,7 @@ async def test_update_feature_group_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -11650,6 +11737,7 @@ async def test_delete_feature_group_rest_asyncio_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"} await client.delete_feature_group(request) @@ -11687,6 +11775,7 @@ async def test_delete_feature_group_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_feature_group(request) # Establish that the response is the type that we expect. @@ -11735,6 +11824,7 @@ async def test_delete_feature_group_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -11785,6 +11875,7 @@ async def test_create_feature_rest_asyncio_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"} await client.create_feature(request) @@ -11917,6 +12008,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.create_feature(request) # Establish that the response is the type that we expect. @@ -11963,6 +12055,7 @@ async def test_create_feature_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -12013,6 +12106,7 @@ async def test_batch_create_features_rest_asyncio_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"} await client.batch_create_features(request) @@ -12052,6 +12146,7 @@ async def test_batch_create_features_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.batch_create_features(request) # Establish that the response is the type that we expect. @@ -12100,6 +12195,7 @@ async def test_batch_create_features_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -12150,6 +12246,7 @@ async def test_get_feature_rest_asyncio_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"} await client.get_feature(request) @@ -12200,6 +12297,7 @@ async def test_get_feature_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_feature(request) # Establish that the response is the type that we expect. @@ -12251,6 +12349,7 @@ async def test_get_feature_rest_asyncio_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 = feature.Feature.to_json(feature.Feature()) req.return_value.read = mock.AsyncMock(return_value=return_value) @@ -12301,6 +12400,7 @@ async def test_list_features_rest_asyncio_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"} await client.list_features(request) @@ -12345,6 +12445,7 @@ async def test_list_features_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_features(request) # Establish that the response is the type that we expect. @@ -12390,6 +12491,7 @@ async def test_list_features_rest_asyncio_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 = featurestore_service.ListFeaturesResponse.to_json( featurestore_service.ListFeaturesResponse() ) @@ -12444,6 +12546,7 @@ async def test_update_feature_rest_asyncio_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"} await client.update_feature(request) @@ -12578,6 +12681,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.update_feature(request) # Establish that the response is the type that we expect. @@ -12624,6 +12728,7 @@ async def test_update_feature_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -12674,6 +12779,7 @@ async def test_delete_feature_rest_asyncio_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"} await client.delete_feature(request) @@ -12713,6 +12819,7 @@ async def test_delete_feature_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_feature(request) # Establish that the response is the type that we expect. @@ -12759,6 +12866,7 @@ async def test_delete_feature_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -12809,6 +12917,7 @@ async def test_get_location_rest_asyncio_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"} await client.get_location(request) @@ -12846,6 +12955,7 @@ async def test_get_location_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_location(request) @@ -12878,6 +12988,7 @@ async def test_list_locations_rest_asyncio_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"} await client.list_locations(request) @@ -12915,6 +13026,7 @@ async def test_list_locations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_locations(request) @@ -12950,6 +13062,7 @@ async def test_get_iam_policy_rest_asyncio_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"} await client.get_iam_policy(request) @@ -12989,6 +13102,7 @@ async def test_get_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_iam_policy(request) @@ -13024,6 +13138,7 @@ async def test_set_iam_policy_rest_asyncio_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"} await client.set_iam_policy(request) @@ -13063,6 +13178,7 @@ async def test_set_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.set_iam_policy(request) @@ -13098,6 +13214,7 @@ async def test_test_iam_permissions_rest_asyncio_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"} await client.test_iam_permissions(request) @@ -13137,6 +13254,7 @@ async def test_test_iam_permissions_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.test_iam_permissions(request) @@ -13171,6 +13289,7 @@ async def test_cancel_operation_rest_asyncio_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"} await client.cancel_operation(request) @@ -13208,6 +13327,7 @@ async def test_cancel_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.cancel_operation(request) @@ -13242,6 +13362,7 @@ async def test_delete_operation_rest_asyncio_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"} await client.delete_operation(request) @@ -13279,6 +13400,7 @@ async def test_delete_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_operation(request) @@ -13313,6 +13435,7 @@ async def test_get_operation_rest_asyncio_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"} await client.get_operation(request) @@ -13350,6 +13473,7 @@ async def test_get_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_operation(request) @@ -13384,6 +13508,7 @@ async def test_list_operations_rest_asyncio_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"} await client.list_operations(request) @@ -13421,6 +13546,7 @@ async def test_list_operations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_operations(request) @@ -13455,6 +13581,7 @@ async def test_wait_operation_rest_asyncio_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"} await client.wait_operation(request) @@ -13492,6 +13619,7 @@ async def test_wait_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.wait_operation(request) diff --git a/tests/unit/gapic/aiplatform_v1/test_featurestore_online_serving_service.py b/tests/unit/gapic/aiplatform_v1/test_featurestore_online_serving_service.py index f584ecd623..678fde8481 100644 --- a/tests/unit/gapic/aiplatform_v1/test_featurestore_online_serving_service.py +++ b/tests/unit/gapic/aiplatform_v1/test_featurestore_online_serving_service.py @@ -2355,6 +2355,7 @@ def test_read_feature_values_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.read_feature_values(request) @@ -2413,6 +2414,7 @@ def test_read_feature_values_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.read_feature_values(**mock_args) @@ -2557,6 +2559,7 @@ def test_streaming_read_feature_values_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"} with mock.patch.object(response_value, "iter_content") as iter_content: iter_content.return_value = iter(json_return_value) @@ -2620,6 +2623,7 @@ def test_streaming_read_feature_values_rest_flattened(): json_return_value = "[{}]".format(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"} with mock.patch.object(response_value, "iter_content") as iter_content: iter_content.return_value = iter(json_return_value) @@ -2760,6 +2764,7 @@ def test_write_feature_values_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.write_feature_values(request) @@ -2822,6 +2827,7 @@ def test_write_feature_values_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.write_feature_values(**mock_args) @@ -3159,6 +3165,7 @@ def test_read_feature_values_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.read_feature_values(request) @@ -3196,6 +3203,7 @@ def test_read_feature_values_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.read_feature_values(request) # Establish that the response is the type that we expect. @@ -3237,6 +3245,7 @@ def test_read_feature_values_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 = featurestore_online_service.ReadFeatureValuesResponse.to_json( featurestore_online_service.ReadFeatureValuesResponse() ) @@ -3285,6 +3294,7 @@ def test_streaming_read_feature_values_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.streaming_read_feature_values(request) @@ -3323,6 +3333,7 @@ def test_streaming_read_feature_values_rest_call_success(request_type): json_return_value = "[{}]".format(json_return_value) response_value.iter_content = mock.Mock(return_value=iter(json_return_value)) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.streaming_read_feature_values(request) assert isinstance(response, Iterable) @@ -3367,6 +3378,7 @@ def test_streaming_read_feature_values_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 = featurestore_online_service.ReadFeatureValuesResponse.to_json( featurestore_online_service.ReadFeatureValuesResponse() ) @@ -3415,6 +3427,7 @@ def test_write_feature_values_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.write_feature_values(request) @@ -3452,6 +3465,7 @@ def test_write_feature_values_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.write_feature_values(request) # Establish that the response is the type that we expect. @@ -3493,6 +3507,7 @@ def test_write_feature_values_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 = featurestore_online_service.WriteFeatureValuesResponse.to_json( featurestore_online_service.WriteFeatureValuesResponse() ) @@ -3539,6 +3554,7 @@ def test_get_location_rest_bad_request(request_type=locations_pb2.GetLocationReq 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_location(request) @@ -3569,6 +3585,7 @@ def test_get_location_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_location(request) @@ -3597,6 +3614,7 @@ def test_list_locations_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_locations(request) @@ -3627,6 +3645,7 @@ def test_list_locations_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_locations(request) @@ -3658,6 +3677,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -3690,6 +3710,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -3721,6 +3742,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -3753,6 +3775,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -3784,6 +3807,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -3816,6 +3840,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -3846,6 +3871,7 @@ def test_cancel_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.cancel_operation(request) @@ -3876,6 +3902,7 @@ def test_cancel_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.cancel_operation(request) @@ -3906,6 +3933,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) @@ -3936,6 +3964,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) @@ -3966,6 +3995,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) @@ -3996,6 +4026,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) @@ -4026,6 +4057,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) @@ -4056,6 +4088,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) @@ -4086,6 +4119,7 @@ def test_wait_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.wait_operation(request) @@ -4116,6 +4150,7 @@ def test_wait_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.wait_operation(request) @@ -4234,6 +4269,7 @@ async def test_read_feature_values_rest_asyncio_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"} await client.read_feature_values(request) @@ -4278,6 +4314,7 @@ async def test_read_feature_values_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.read_feature_values(request) # Establish that the response is the type that we expect. @@ -4324,6 +4361,7 @@ async def test_read_feature_values_rest_asyncio_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 = featurestore_online_service.ReadFeatureValuesResponse.to_json( featurestore_online_service.ReadFeatureValuesResponse() ) @@ -4376,6 +4414,7 @@ async def test_streaming_read_feature_values_rest_asyncio_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"} await client.streaming_read_feature_values(request) @@ -4419,6 +4458,7 @@ async def test_streaming_read_feature_values_rest_asyncio_call_success(request_t json_return_value = "[{}]".format(json_return_value) response_value.content.return_value = mock_async_gen(json_return_value) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.streaming_read_feature_values(request) assert isinstance(response, AsyncIterable) @@ -4470,6 +4510,7 @@ async def test_streaming_read_feature_values_rest_asyncio_interceptors( 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 = featurestore_online_service.ReadFeatureValuesResponse.to_json( featurestore_online_service.ReadFeatureValuesResponse() ) @@ -4522,6 +4563,7 @@ async def test_write_feature_values_rest_asyncio_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"} await client.write_feature_values(request) @@ -4566,6 +4608,7 @@ async def test_write_feature_values_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.write_feature_values(request) # Establish that the response is the type that we expect. @@ -4612,6 +4655,7 @@ async def test_write_feature_values_rest_asyncio_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 = featurestore_online_service.WriteFeatureValuesResponse.to_json( featurestore_online_service.WriteFeatureValuesResponse() ) @@ -4664,6 +4708,7 @@ async def test_get_location_rest_asyncio_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"} await client.get_location(request) @@ -4701,6 +4746,7 @@ async def test_get_location_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_location(request) @@ -4733,6 +4779,7 @@ async def test_list_locations_rest_asyncio_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"} await client.list_locations(request) @@ -4770,6 +4817,7 @@ async def test_list_locations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_locations(request) @@ -4805,6 +4853,7 @@ async def test_get_iam_policy_rest_asyncio_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"} await client.get_iam_policy(request) @@ -4844,6 +4893,7 @@ async def test_get_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_iam_policy(request) @@ -4879,6 +4929,7 @@ async def test_set_iam_policy_rest_asyncio_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"} await client.set_iam_policy(request) @@ -4918,6 +4969,7 @@ async def test_set_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.set_iam_policy(request) @@ -4953,6 +5005,7 @@ async def test_test_iam_permissions_rest_asyncio_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"} await client.test_iam_permissions(request) @@ -4992,6 +5045,7 @@ async def test_test_iam_permissions_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.test_iam_permissions(request) @@ -5026,6 +5080,7 @@ async def test_cancel_operation_rest_asyncio_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"} await client.cancel_operation(request) @@ -5063,6 +5118,7 @@ async def test_cancel_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.cancel_operation(request) @@ -5097,6 +5153,7 @@ async def test_delete_operation_rest_asyncio_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"} await client.delete_operation(request) @@ -5134,6 +5191,7 @@ async def test_delete_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_operation(request) @@ -5168,6 +5226,7 @@ async def test_get_operation_rest_asyncio_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"} await client.get_operation(request) @@ -5205,6 +5264,7 @@ async def test_get_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_operation(request) @@ -5239,6 +5299,7 @@ async def test_list_operations_rest_asyncio_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"} await client.list_operations(request) @@ -5276,6 +5337,7 @@ async def test_list_operations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_operations(request) @@ -5310,6 +5372,7 @@ async def test_wait_operation_rest_asyncio_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"} await client.wait_operation(request) @@ -5347,6 +5410,7 @@ async def test_wait_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.wait_operation(request) diff --git a/tests/unit/gapic/aiplatform_v1/test_featurestore_service.py b/tests/unit/gapic/aiplatform_v1/test_featurestore_service.py index 9e49ceb23b..c805bfdcf3 100644 --- a/tests/unit/gapic/aiplatform_v1/test_featurestore_service.py +++ b/tests/unit/gapic/aiplatform_v1/test_featurestore_service.py @@ -9408,6 +9408,7 @@ def test_create_featurestore_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_featurestore(request) @@ -9468,6 +9469,7 @@ def test_create_featurestore_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_featurestore(**mock_args) @@ -9603,6 +9605,7 @@ def test_get_featurestore_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_featurestore(request) @@ -9650,6 +9653,7 @@ def test_get_featurestore_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_featurestore(**mock_args) @@ -9797,6 +9801,7 @@ def test_list_featurestores_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_featurestores(request) @@ -9853,6 +9858,7 @@ def test_list_featurestores_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_featurestores(**mock_args) @@ -10050,6 +10056,7 @@ def test_update_featurestore_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_featurestore(request) @@ -10098,6 +10105,7 @@ def test_update_featurestore_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_featurestore(**mock_args) @@ -10237,6 +10245,7 @@ def test_delete_featurestore_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_featurestore(request) @@ -10283,6 +10292,7 @@ def test_delete_featurestore_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_featurestore(**mock_args) @@ -10430,6 +10440,7 @@ def test_create_entity_type_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_entity_type(request) @@ -10491,6 +10502,7 @@ def test_create_entity_type_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_entity_type(**mock_args) @@ -10624,6 +10636,7 @@ def test_get_entity_type_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_entity_type(request) @@ -10671,6 +10684,7 @@ def test_get_entity_type_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_entity_type(**mock_args) @@ -10814,6 +10828,7 @@ def test_list_entity_types_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_entity_types(request) @@ -10872,6 +10887,7 @@ def test_list_entity_types_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_entity_types(**mock_args) @@ -11070,6 +11086,7 @@ def test_update_entity_type_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_entity_type(request) @@ -11120,6 +11137,7 @@ def test_update_entity_type_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_entity_type(**mock_args) @@ -11259,6 +11277,7 @@ def test_delete_entity_type_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_entity_type(request) @@ -11305,6 +11324,7 @@ def test_delete_entity_type_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_entity_type(**mock_args) @@ -11448,6 +11468,7 @@ def test_create_feature_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_feature(request) @@ -11510,6 +11531,7 @@ def test_create_feature_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_feature(**mock_args) @@ -11650,6 +11672,7 @@ def test_batch_create_features_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.batch_create_features(request) @@ -11704,6 +11727,7 @@ def test_batch_create_features_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.batch_create_features(**mock_args) @@ -11836,6 +11860,7 @@ def test_get_feature_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_feature(request) @@ -11883,6 +11908,7 @@ def test_get_feature_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_feature(**mock_args) @@ -12025,6 +12051,7 @@ def test_list_features_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_features(request) @@ -12084,6 +12111,7 @@ def test_list_features_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_features(**mock_args) @@ -12278,6 +12306,7 @@ def test_update_feature_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_feature(request) @@ -12328,6 +12357,7 @@ def test_update_feature_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_feature(**mock_args) @@ -12461,6 +12491,7 @@ def test_delete_feature_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_feature(request) @@ -12506,6 +12537,7 @@ def test_delete_feature_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_feature(**mock_args) @@ -12644,6 +12676,7 @@ def test_import_feature_values_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.import_feature_values(request) @@ -12697,6 +12730,7 @@ def test_import_feature_values_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.import_feature_values(**mock_args) @@ -12835,6 +12869,7 @@ def test_batch_read_feature_values_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.batch_read_feature_values(request) @@ -12889,6 +12924,7 @@ def test_batch_read_feature_values_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.batch_read_feature_values(**mock_args) @@ -13027,6 +13063,7 @@ def test_export_feature_values_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.export_feature_values(request) @@ -13081,6 +13118,7 @@ def test_export_feature_values_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.export_feature_values(**mock_args) @@ -13219,6 +13257,7 @@ def test_delete_feature_values_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_feature_values(request) @@ -13264,6 +13303,7 @@ def test_delete_feature_values_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_feature_values(**mock_args) @@ -13403,6 +13443,7 @@ def test_search_features_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.search_features(request) @@ -13458,6 +13499,7 @@ def test_search_features_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.search_features(**mock_args) @@ -14762,6 +14804,7 @@ def test_create_featurestore_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_featurestore(request) @@ -14881,6 +14924,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_featurestore(request) # Establish that the response is the type that we expect. @@ -14922,6 +14966,7 @@ def test_create_featurestore_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 @@ -14966,6 +15011,7 @@ def test_get_featurestore_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_featurestore(request) @@ -15006,6 +15052,7 @@ def test_get_featurestore_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_featurestore(request) # Establish that the response is the type that we expect. @@ -15051,6 +15098,7 @@ def test_get_featurestore_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 = featurestore.Featurestore.to_json(featurestore.Featurestore()) req.return_value.content = return_value @@ -15095,6 +15143,7 @@ def test_list_featurestores_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_featurestores(request) @@ -15130,6 +15179,7 @@ def test_list_featurestores_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_featurestores(request) # Establish that the response is the type that we expect. @@ -15170,6 +15220,7 @@ def test_list_featurestores_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 = featurestore_service.ListFeaturestoresResponse.to_json( featurestore_service.ListFeaturestoresResponse() ) @@ -15220,6 +15271,7 @@ def test_update_featurestore_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_featurestore(request) @@ -15343,6 +15395,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_featurestore(request) # Establish that the response is the type that we expect. @@ -15384,6 +15437,7 @@ def test_update_featurestore_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 @@ -15428,6 +15482,7 @@ def test_delete_featurestore_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_featurestore(request) @@ -15458,6 +15513,7 @@ def test_delete_featurestore_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_featurestore(request) # Establish that the response is the type that we expect. @@ -15499,6 +15555,7 @@ def test_delete_featurestore_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 @@ -15545,6 +15602,7 @@ def test_create_entity_type_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_entity_type(request) @@ -15665,6 +15723,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_entity_type(request) # Establish that the response is the type that we expect. @@ -15706,6 +15765,7 @@ def test_create_entity_type_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 @@ -15752,6 +15812,7 @@ def test_get_entity_type_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_entity_type(request) @@ -15794,6 +15855,7 @@ def test_get_entity_type_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_entity_type(request) # Establish that the response is the type that we expect. @@ -15839,6 +15901,7 @@ def test_get_entity_type_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 = entity_type.EntityType.to_json(entity_type.EntityType()) req.return_value.content = return_value @@ -15885,6 +15948,7 @@ def test_list_entity_types_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_entity_types(request) @@ -15922,6 +15986,7 @@ def test_list_entity_types_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_entity_types(request) # Establish that the response is the type that we expect. @@ -15962,6 +16027,7 @@ def test_list_entity_types_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 = featurestore_service.ListEntityTypesResponse.to_json( featurestore_service.ListEntityTypesResponse() ) @@ -16012,6 +16078,7 @@ def test_update_entity_type_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_entity_type(request) @@ -16144,6 +16211,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_entity_type(request) # Establish that the response is the type that we expect. @@ -16189,6 +16257,7 @@ def test_update_entity_type_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 = gca_entity_type.EntityType.to_json(gca_entity_type.EntityType()) req.return_value.content = return_value @@ -16235,6 +16304,7 @@ def test_delete_entity_type_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_entity_type(request) @@ -16267,6 +16337,7 @@ def test_delete_entity_type_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_entity_type(request) # Establish that the response is the type that we expect. @@ -16308,6 +16379,7 @@ def test_delete_entity_type_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 @@ -16354,6 +16426,7 @@ def test_create_feature_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_feature(request) @@ -16479,6 +16552,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_feature(request) # Establish that the response is the type that we expect. @@ -16520,6 +16594,7 @@ def test_create_feature_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 @@ -16566,6 +16641,7 @@ def test_batch_create_features_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.batch_create_features(request) @@ -16598,6 +16674,7 @@ def test_batch_create_features_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.batch_create_features(request) # Establish that the response is the type that we expect. @@ -16639,6 +16716,7 @@ def test_batch_create_features_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 @@ -16685,6 +16763,7 @@ def test_get_feature_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_feature(request) @@ -16728,6 +16807,7 @@ def test_get_feature_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_feature(request) # Establish that the response is the type that we expect. @@ -16774,6 +16854,7 @@ def test_get_feature_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 = feature.Feature.to_json(feature.Feature()) req.return_value.content = return_value @@ -16820,6 +16901,7 @@ def test_list_features_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_features(request) @@ -16857,6 +16939,7 @@ def test_list_features_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_features(request) # Establish that the response is the type that we expect. @@ -16897,6 +16980,7 @@ def test_list_features_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 = featurestore_service.ListFeaturesResponse.to_json( featurestore_service.ListFeaturesResponse() ) @@ -16947,6 +17031,7 @@ def test_update_feature_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_feature(request) @@ -17085,6 +17170,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_feature(request) # Establish that the response is the type that we expect. @@ -17131,6 +17217,7 @@ def test_update_feature_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 = gca_feature.Feature.to_json(gca_feature.Feature()) req.return_value.content = return_value @@ -17177,6 +17264,7 @@ def test_delete_feature_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_feature(request) @@ -17209,6 +17297,7 @@ def test_delete_feature_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_feature(request) # Establish that the response is the type that we expect. @@ -17250,6 +17339,7 @@ def test_delete_feature_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 @@ -17296,6 +17386,7 @@ def test_import_feature_values_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.import_feature_values(request) @@ -17328,6 +17419,7 @@ def test_import_feature_values_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.import_feature_values(request) # Establish that the response is the type that we expect. @@ -17369,6 +17461,7 @@ def test_import_feature_values_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 @@ -17415,6 +17508,7 @@ def test_batch_read_feature_values_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.batch_read_feature_values(request) @@ -17447,6 +17541,7 @@ def test_batch_read_feature_values_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.batch_read_feature_values(request) # Establish that the response is the type that we expect. @@ -17488,6 +17583,7 @@ def test_batch_read_feature_values_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 @@ -17534,6 +17630,7 @@ def test_export_feature_values_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.export_feature_values(request) @@ -17566,6 +17663,7 @@ def test_export_feature_values_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.export_feature_values(request) # Establish that the response is the type that we expect. @@ -17607,6 +17705,7 @@ def test_export_feature_values_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 @@ -17653,6 +17752,7 @@ def test_delete_feature_values_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_feature_values(request) @@ -17685,6 +17785,7 @@ def test_delete_feature_values_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_feature_values(request) # Establish that the response is the type that we expect. @@ -17726,6 +17827,7 @@ def test_delete_feature_values_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 @@ -17770,6 +17872,7 @@ def test_search_features_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.search_features(request) @@ -17805,6 +17908,7 @@ def test_search_features_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.search_features(request) # Establish that the response is the type that we expect. @@ -17845,6 +17949,7 @@ def test_search_features_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 = featurestore_service.SearchFeaturesResponse.to_json( featurestore_service.SearchFeaturesResponse() ) @@ -17891,6 +17996,7 @@ def test_get_location_rest_bad_request(request_type=locations_pb2.GetLocationReq 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_location(request) @@ -17921,6 +18027,7 @@ def test_get_location_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_location(request) @@ -17949,6 +18056,7 @@ def test_list_locations_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_locations(request) @@ -17979,6 +18087,7 @@ def test_list_locations_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_locations(request) @@ -18010,6 +18119,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -18042,6 +18152,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -18073,6 +18184,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -18105,6 +18217,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -18136,6 +18249,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -18168,6 +18282,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -18198,6 +18313,7 @@ def test_cancel_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.cancel_operation(request) @@ -18228,6 +18344,7 @@ def test_cancel_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.cancel_operation(request) @@ -18258,6 +18375,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) @@ -18288,6 +18406,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) @@ -18318,6 +18437,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) @@ -18348,6 +18468,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) @@ -18378,6 +18499,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) @@ -18408,6 +18530,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) @@ -18438,6 +18561,7 @@ def test_wait_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.wait_operation(request) @@ -18468,6 +18592,7 @@ def test_wait_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.wait_operation(request) @@ -18981,6 +19106,7 @@ async def test_create_featurestore_rest_asyncio_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"} await client.create_featurestore(request) @@ -19107,6 +19233,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.create_featurestore(request) # Establish that the response is the type that we expect. @@ -19153,6 +19280,7 @@ async def test_create_featurestore_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -19201,6 +19329,7 @@ async def test_get_featurestore_rest_asyncio_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"} await client.get_featurestore(request) @@ -19248,6 +19377,7 @@ async def test_get_featurestore_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_featurestore(request) # Establish that the response is the type that we expect. @@ -19298,6 +19428,7 @@ async def test_get_featurestore_rest_asyncio_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 = featurestore.Featurestore.to_json(featurestore.Featurestore()) req.return_value.read = mock.AsyncMock(return_value=return_value) @@ -19346,6 +19477,7 @@ async def test_list_featurestores_rest_asyncio_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"} await client.list_featurestores(request) @@ -19388,6 +19520,7 @@ async def test_list_featurestores_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_featurestores(request) # Establish that the response is the type that we expect. @@ -19433,6 +19566,7 @@ async def test_list_featurestores_rest_asyncio_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 = featurestore_service.ListFeaturestoresResponse.to_json( featurestore_service.ListFeaturestoresResponse() ) @@ -19487,6 +19621,7 @@ async def test_update_featurestore_rest_asyncio_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"} await client.update_featurestore(request) @@ -19617,6 +19752,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.update_featurestore(request) # Establish that the response is the type that we expect. @@ -19663,6 +19799,7 @@ async def test_update_featurestore_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -19711,6 +19848,7 @@ async def test_delete_featurestore_rest_asyncio_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"} await client.delete_featurestore(request) @@ -19748,6 +19886,7 @@ async def test_delete_featurestore_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_featurestore(request) # Establish that the response is the type that we expect. @@ -19794,6 +19933,7 @@ async def test_delete_featurestore_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -19844,6 +19984,7 @@ async def test_create_entity_type_rest_asyncio_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"} await client.create_entity_type(request) @@ -19971,6 +20112,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.create_entity_type(request) # Establish that the response is the type that we expect. @@ -20017,6 +20159,7 @@ async def test_create_entity_type_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -20067,6 +20210,7 @@ async def test_get_entity_type_rest_asyncio_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"} await client.get_entity_type(request) @@ -20116,6 +20260,7 @@ async def test_get_entity_type_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_entity_type(request) # Establish that the response is the type that we expect. @@ -20166,6 +20311,7 @@ async def test_get_entity_type_rest_asyncio_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 = entity_type.EntityType.to_json(entity_type.EntityType()) req.return_value.read = mock.AsyncMock(return_value=return_value) @@ -20216,6 +20362,7 @@ async def test_list_entity_types_rest_asyncio_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"} await client.list_entity_types(request) @@ -20260,6 +20407,7 @@ async def test_list_entity_types_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_entity_types(request) # Establish that the response is the type that we expect. @@ -20305,6 +20453,7 @@ async def test_list_entity_types_rest_asyncio_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 = featurestore_service.ListEntityTypesResponse.to_json( featurestore_service.ListEntityTypesResponse() ) @@ -20359,6 +20508,7 @@ async def test_update_entity_type_rest_asyncio_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"} await client.update_entity_type(request) @@ -20498,6 +20648,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.update_entity_type(request) # Establish that the response is the type that we expect. @@ -20548,6 +20699,7 @@ async def test_update_entity_type_rest_asyncio_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 = gca_entity_type.EntityType.to_json(gca_entity_type.EntityType()) req.return_value.read = mock.AsyncMock(return_value=return_value) @@ -20598,6 +20750,7 @@ async def test_delete_entity_type_rest_asyncio_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"} await client.delete_entity_type(request) @@ -20637,6 +20790,7 @@ async def test_delete_entity_type_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_entity_type(request) # Establish that the response is the type that we expect. @@ -20683,6 +20837,7 @@ async def test_delete_entity_type_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -20733,6 +20888,7 @@ async def test_create_feature_rest_asyncio_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"} await client.create_feature(request) @@ -20865,6 +21021,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.create_feature(request) # Establish that the response is the type that we expect. @@ -20911,6 +21068,7 @@ async def test_create_feature_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -20961,6 +21119,7 @@ async def test_batch_create_features_rest_asyncio_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"} await client.batch_create_features(request) @@ -21000,6 +21159,7 @@ async def test_batch_create_features_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.batch_create_features(request) # Establish that the response is the type that we expect. @@ -21046,6 +21206,7 @@ async def test_batch_create_features_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -21096,6 +21257,7 @@ async def test_get_feature_rest_asyncio_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"} await client.get_feature(request) @@ -21146,6 +21308,7 @@ async def test_get_feature_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_feature(request) # Establish that the response is the type that we expect. @@ -21197,6 +21360,7 @@ async def test_get_feature_rest_asyncio_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 = feature.Feature.to_json(feature.Feature()) req.return_value.read = mock.AsyncMock(return_value=return_value) @@ -21247,6 +21411,7 @@ async def test_list_features_rest_asyncio_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"} await client.list_features(request) @@ -21291,6 +21456,7 @@ async def test_list_features_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_features(request) # Establish that the response is the type that we expect. @@ -21336,6 +21502,7 @@ async def test_list_features_rest_asyncio_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 = featurestore_service.ListFeaturesResponse.to_json( featurestore_service.ListFeaturesResponse() ) @@ -21390,6 +21557,7 @@ async def test_update_feature_rest_asyncio_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"} await client.update_feature(request) @@ -21535,6 +21703,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.update_feature(request) # Establish that the response is the type that we expect. @@ -21586,6 +21755,7 @@ async def test_update_feature_rest_asyncio_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 = gca_feature.Feature.to_json(gca_feature.Feature()) req.return_value.read = mock.AsyncMock(return_value=return_value) @@ -21636,6 +21806,7 @@ async def test_delete_feature_rest_asyncio_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"} await client.delete_feature(request) @@ -21675,6 +21846,7 @@ async def test_delete_feature_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_feature(request) # Establish that the response is the type that we expect. @@ -21721,6 +21893,7 @@ async def test_delete_feature_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -21771,6 +21944,7 @@ async def test_import_feature_values_rest_asyncio_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"} await client.import_feature_values(request) @@ -21810,6 +21984,7 @@ async def test_import_feature_values_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.import_feature_values(request) # Establish that the response is the type that we expect. @@ -21856,6 +22031,7 @@ async def test_import_feature_values_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -21906,6 +22082,7 @@ async def test_batch_read_feature_values_rest_asyncio_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"} await client.batch_read_feature_values(request) @@ -21945,6 +22122,7 @@ async def test_batch_read_feature_values_rest_asyncio_call_success(request_type) return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.batch_read_feature_values(request) # Establish that the response is the type that we expect. @@ -21993,6 +22171,7 @@ async def test_batch_read_feature_values_rest_asyncio_interceptors(null_intercep 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.read = mock.AsyncMock(return_value=return_value) @@ -22043,6 +22222,7 @@ async def test_export_feature_values_rest_asyncio_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"} await client.export_feature_values(request) @@ -22082,6 +22262,7 @@ async def test_export_feature_values_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.export_feature_values(request) # Establish that the response is the type that we expect. @@ -22128,6 +22309,7 @@ async def test_export_feature_values_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -22178,6 +22360,7 @@ async def test_delete_feature_values_rest_asyncio_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"} await client.delete_feature_values(request) @@ -22217,6 +22400,7 @@ async def test_delete_feature_values_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_feature_values(request) # Establish that the response is the type that we expect. @@ -22263,6 +22447,7 @@ async def test_delete_feature_values_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -22311,6 +22496,7 @@ async def test_search_features_rest_asyncio_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"} await client.search_features(request) @@ -22353,6 +22539,7 @@ async def test_search_features_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.search_features(request) # Establish that the response is the type that we expect. @@ -22398,6 +22585,7 @@ async def test_search_features_rest_asyncio_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 = featurestore_service.SearchFeaturesResponse.to_json( featurestore_service.SearchFeaturesResponse() ) @@ -22450,6 +22638,7 @@ async def test_get_location_rest_asyncio_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"} await client.get_location(request) @@ -22487,6 +22676,7 @@ async def test_get_location_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_location(request) @@ -22519,6 +22709,7 @@ async def test_list_locations_rest_asyncio_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"} await client.list_locations(request) @@ -22556,6 +22747,7 @@ async def test_list_locations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_locations(request) @@ -22591,6 +22783,7 @@ async def test_get_iam_policy_rest_asyncio_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"} await client.get_iam_policy(request) @@ -22630,6 +22823,7 @@ async def test_get_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_iam_policy(request) @@ -22665,6 +22859,7 @@ async def test_set_iam_policy_rest_asyncio_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"} await client.set_iam_policy(request) @@ -22704,6 +22899,7 @@ async def test_set_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.set_iam_policy(request) @@ -22739,6 +22935,7 @@ async def test_test_iam_permissions_rest_asyncio_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"} await client.test_iam_permissions(request) @@ -22778,6 +22975,7 @@ async def test_test_iam_permissions_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.test_iam_permissions(request) @@ -22812,6 +23010,7 @@ async def test_cancel_operation_rest_asyncio_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"} await client.cancel_operation(request) @@ -22849,6 +23048,7 @@ async def test_cancel_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.cancel_operation(request) @@ -22883,6 +23083,7 @@ async def test_delete_operation_rest_asyncio_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"} await client.delete_operation(request) @@ -22920,6 +23121,7 @@ async def test_delete_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_operation(request) @@ -22954,6 +23156,7 @@ async def test_get_operation_rest_asyncio_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"} await client.get_operation(request) @@ -22991,6 +23194,7 @@ async def test_get_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_operation(request) @@ -23025,6 +23229,7 @@ async def test_list_operations_rest_asyncio_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"} await client.list_operations(request) @@ -23062,6 +23267,7 @@ async def test_list_operations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_operations(request) @@ -23096,6 +23302,7 @@ async def test_wait_operation_rest_asyncio_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"} await client.wait_operation(request) @@ -23133,6 +23340,7 @@ async def test_wait_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.wait_operation(request) diff --git a/tests/unit/gapic/aiplatform_v1/test_gen_ai_tuning_service.py b/tests/unit/gapic/aiplatform_v1/test_gen_ai_tuning_service.py index a2dddb83c2..5fce970d06 100644 --- a/tests/unit/gapic/aiplatform_v1/test_gen_ai_tuning_service.py +++ b/tests/unit/gapic/aiplatform_v1/test_gen_ai_tuning_service.py @@ -3166,6 +3166,7 @@ def test_create_tuning_job_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_tuning_job(request) @@ -3220,6 +3221,7 @@ def test_create_tuning_job_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_tuning_job(**mock_args) @@ -3351,6 +3353,7 @@ def test_get_tuning_job_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_tuning_job(request) @@ -3398,6 +3401,7 @@ def test_get_tuning_job_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_tuning_job(**mock_args) @@ -3538,6 +3542,7 @@ def test_list_tuning_jobs_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_tuning_jobs(request) @@ -3592,6 +3597,7 @@ def test_list_tuning_jobs_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_tuning_jobs(**mock_args) @@ -3785,6 +3791,7 @@ def test_cancel_tuning_job_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.cancel_tuning_job(request) @@ -3830,6 +3837,7 @@ def test_cancel_tuning_job_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.cancel_tuning_job(**mock_args) @@ -3967,6 +3975,7 @@ def test_rebase_tuned_model_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.rebase_tuned_model(request) @@ -4019,6 +4028,7 @@ def test_rebase_tuned_model_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.rebase_tuned_model(**mock_args) @@ -4453,6 +4463,7 @@ def test_create_tuning_job_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_tuning_job(request) @@ -4650,6 +4661,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_tuning_job(request) # Establish that the response is the type that we expect. @@ -4695,6 +4707,7 @@ def test_create_tuning_job_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 = gca_tuning_job.TuningJob.to_json(gca_tuning_job.TuningJob()) req.return_value.content = return_value @@ -4739,6 +4752,7 @@ def test_get_tuning_job_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_tuning_job(request) @@ -4780,6 +4794,7 @@ def test_get_tuning_job_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_tuning_job(request) # Establish that the response is the type that we expect. @@ -4825,6 +4840,7 @@ def test_get_tuning_job_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 = tuning_job.TuningJob.to_json(tuning_job.TuningJob()) req.return_value.content = return_value @@ -4869,6 +4885,7 @@ def test_list_tuning_jobs_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_tuning_jobs(request) @@ -4904,6 +4921,7 @@ def test_list_tuning_jobs_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_tuning_jobs(request) # Establish that the response is the type that we expect. @@ -4944,6 +4962,7 @@ def test_list_tuning_jobs_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 = genai_tuning_service.ListTuningJobsResponse.to_json( genai_tuning_service.ListTuningJobsResponse() ) @@ -4990,6 +5009,7 @@ def test_cancel_tuning_job_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.cancel_tuning_job(request) @@ -5020,6 +5040,7 @@ def test_cancel_tuning_job_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.cancel_tuning_job(request) # Establish that the response is the type that we expect. @@ -5056,6 +5077,7 @@ def test_cancel_tuning_job_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 = genai_tuning_service.CancelTuningJobRequest() metadata = [ @@ -5096,6 +5118,7 @@ def test_rebase_tuned_model_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.rebase_tuned_model(request) @@ -5126,6 +5149,7 @@ def test_rebase_tuned_model_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.rebase_tuned_model(request) # Establish that the response is the type that we expect. @@ -5167,6 +5191,7 @@ def test_rebase_tuned_model_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 @@ -5211,6 +5236,7 @@ def test_get_location_rest_bad_request(request_type=locations_pb2.GetLocationReq 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_location(request) @@ -5241,6 +5267,7 @@ def test_get_location_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_location(request) @@ -5269,6 +5296,7 @@ def test_list_locations_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_locations(request) @@ -5299,6 +5327,7 @@ def test_list_locations_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_locations(request) @@ -5330,6 +5359,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -5362,6 +5392,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -5393,6 +5424,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -5425,6 +5457,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -5456,6 +5489,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -5488,6 +5522,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -5518,6 +5553,7 @@ def test_cancel_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.cancel_operation(request) @@ -5548,6 +5584,7 @@ def test_cancel_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.cancel_operation(request) @@ -5578,6 +5615,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) @@ -5608,6 +5646,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) @@ -5638,6 +5677,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) @@ -5668,6 +5708,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) @@ -5698,6 +5739,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) @@ -5728,6 +5770,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) @@ -5758,6 +5801,7 @@ def test_wait_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.wait_operation(request) @@ -5788,6 +5832,7 @@ def test_wait_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.wait_operation(request) @@ -5961,6 +6006,7 @@ async def test_create_tuning_job_rest_asyncio_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"} await client.create_tuning_job(request) @@ -6165,6 +6211,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.create_tuning_job(request) # Establish that the response is the type that we expect. @@ -6215,6 +6262,7 @@ async def test_create_tuning_job_rest_asyncio_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 = gca_tuning_job.TuningJob.to_json(gca_tuning_job.TuningJob()) req.return_value.read = mock.AsyncMock(return_value=return_value) @@ -6263,6 +6311,7 @@ async def test_get_tuning_job_rest_asyncio_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"} await client.get_tuning_job(request) @@ -6311,6 +6360,7 @@ async def test_get_tuning_job_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_tuning_job(request) # Establish that the response is the type that we expect. @@ -6361,6 +6411,7 @@ async def test_get_tuning_job_rest_asyncio_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 = tuning_job.TuningJob.to_json(tuning_job.TuningJob()) req.return_value.read = mock.AsyncMock(return_value=return_value) @@ -6409,6 +6460,7 @@ async def test_list_tuning_jobs_rest_asyncio_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"} await client.list_tuning_jobs(request) @@ -6451,6 +6503,7 @@ async def test_list_tuning_jobs_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_tuning_jobs(request) # Establish that the response is the type that we expect. @@ -6496,6 +6549,7 @@ async def test_list_tuning_jobs_rest_asyncio_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 = genai_tuning_service.ListTuningJobsResponse.to_json( genai_tuning_service.ListTuningJobsResponse() ) @@ -6546,6 +6600,7 @@ async def test_cancel_tuning_job_rest_asyncio_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"} await client.cancel_tuning_job(request) @@ -6583,6 +6638,7 @@ async def test_cancel_tuning_job_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.cancel_tuning_job(request) # Establish that the response is the type that we expect. @@ -6624,6 +6680,7 @@ async def test_cancel_tuning_job_rest_asyncio_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 = genai_tuning_service.CancelTuningJobRequest() metadata = [ @@ -6668,6 +6725,7 @@ async def test_rebase_tuned_model_rest_asyncio_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"} await client.rebase_tuned_model(request) @@ -6705,6 +6763,7 @@ async def test_rebase_tuned_model_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.rebase_tuned_model(request) # Establish that the response is the type that we expect. @@ -6751,6 +6810,7 @@ async def test_rebase_tuned_model_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -6801,6 +6861,7 @@ async def test_get_location_rest_asyncio_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"} await client.get_location(request) @@ -6838,6 +6899,7 @@ async def test_get_location_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_location(request) @@ -6870,6 +6932,7 @@ async def test_list_locations_rest_asyncio_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"} await client.list_locations(request) @@ -6907,6 +6970,7 @@ async def test_list_locations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_locations(request) @@ -6942,6 +7006,7 @@ async def test_get_iam_policy_rest_asyncio_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"} await client.get_iam_policy(request) @@ -6981,6 +7046,7 @@ async def test_get_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_iam_policy(request) @@ -7016,6 +7082,7 @@ async def test_set_iam_policy_rest_asyncio_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"} await client.set_iam_policy(request) @@ -7055,6 +7122,7 @@ async def test_set_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.set_iam_policy(request) @@ -7090,6 +7158,7 @@ async def test_test_iam_permissions_rest_asyncio_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"} await client.test_iam_permissions(request) @@ -7129,6 +7198,7 @@ async def test_test_iam_permissions_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.test_iam_permissions(request) @@ -7163,6 +7233,7 @@ async def test_cancel_operation_rest_asyncio_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"} await client.cancel_operation(request) @@ -7200,6 +7271,7 @@ async def test_cancel_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.cancel_operation(request) @@ -7234,6 +7306,7 @@ async def test_delete_operation_rest_asyncio_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"} await client.delete_operation(request) @@ -7271,6 +7344,7 @@ async def test_delete_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_operation(request) @@ -7305,6 +7379,7 @@ async def test_get_operation_rest_asyncio_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"} await client.get_operation(request) @@ -7342,6 +7417,7 @@ async def test_get_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_operation(request) @@ -7376,6 +7452,7 @@ async def test_list_operations_rest_asyncio_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"} await client.list_operations(request) @@ -7413,6 +7490,7 @@ async def test_list_operations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_operations(request) @@ -7447,6 +7525,7 @@ async def test_wait_operation_rest_asyncio_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"} await client.wait_operation(request) @@ -7484,6 +7563,7 @@ async def test_wait_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.wait_operation(request) diff --git a/tests/unit/gapic/aiplatform_v1/test_index_endpoint_service.py b/tests/unit/gapic/aiplatform_v1/test_index_endpoint_service.py index a0711246a6..7375afc246 100644 --- a/tests/unit/gapic/aiplatform_v1/test_index_endpoint_service.py +++ b/tests/unit/gapic/aiplatform_v1/test_index_endpoint_service.py @@ -4313,6 +4313,7 @@ def test_create_index_endpoint_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_index_endpoint(request) @@ -4365,6 +4366,7 @@ def test_create_index_endpoint_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_index_endpoint(**mock_args) @@ -4501,6 +4503,7 @@ def test_get_index_endpoint_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_index_endpoint(request) @@ -4548,6 +4551,7 @@ def test_get_index_endpoint_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_index_endpoint(**mock_args) @@ -4694,6 +4698,7 @@ def test_list_index_endpoints_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_index_endpoints(request) @@ -4751,6 +4756,7 @@ def test_list_index_endpoints_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_index_endpoints(**mock_args) @@ -4949,6 +4955,7 @@ def test_update_index_endpoint_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_index_endpoint(request) @@ -5007,6 +5014,7 @@ def test_update_index_endpoint_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_index_endpoint(**mock_args) @@ -5145,6 +5153,7 @@ def test_delete_index_endpoint_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_index_endpoint(request) @@ -5190,6 +5199,7 @@ def test_delete_index_endpoint_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_index_endpoint(**mock_args) @@ -5323,6 +5333,7 @@ def test_deploy_index_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.deploy_index(request) @@ -5377,6 +5388,7 @@ def test_deploy_index_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.deploy_index(**mock_args) @@ -5515,6 +5527,7 @@ def test_undeploy_index_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.undeploy_index(request) @@ -5569,6 +5582,7 @@ def test_undeploy_index_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.undeploy_index(**mock_args) @@ -5708,6 +5722,7 @@ def test_mutate_deployed_index_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.mutate_deployed_index(request) @@ -5762,6 +5777,7 @@ def test_mutate_deployed_index_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.mutate_deployed_index(**mock_args) @@ -6356,6 +6372,7 @@ def test_create_index_endpoint_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_index_endpoint(request) @@ -6413,6 +6430,7 @@ def test_create_index_endpoint_rest_call_success(request_type): }, "min_replica_count": 1803, "max_replica_count": 1805, + "required_replica_count": 2344, "autoscaling_metric_specs": [ {"metric_name": "metric_name_value", "target": 647} ], @@ -6540,6 +6558,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_index_endpoint(request) # Establish that the response is the type that we expect. @@ -6581,6 +6600,7 @@ def test_create_index_endpoint_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 @@ -6625,6 +6645,7 @@ def test_get_index_endpoint_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_index_endpoint(request) @@ -6669,6 +6690,7 @@ def test_get_index_endpoint_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_index_endpoint(request) # Establish that the response is the type that we expect. @@ -6718,6 +6740,7 @@ def test_get_index_endpoint_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 = index_endpoint.IndexEndpoint.to_json( index_endpoint.IndexEndpoint() ) @@ -6764,6 +6787,7 @@ def test_list_index_endpoints_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_index_endpoints(request) @@ -6801,6 +6825,7 @@ def test_list_index_endpoints_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_index_endpoints(request) # Establish that the response is the type that we expect. @@ -6841,6 +6866,7 @@ def test_list_index_endpoints_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 = index_endpoint_service.ListIndexEndpointsResponse.to_json( index_endpoint_service.ListIndexEndpointsResponse() ) @@ -6891,6 +6917,7 @@ def test_update_index_endpoint_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_index_endpoint(request) @@ -6952,6 +6979,7 @@ def test_update_index_endpoint_rest_call_success(request_type): }, "min_replica_count": 1803, "max_replica_count": 1805, + "required_replica_count": 2344, "autoscaling_metric_specs": [ {"metric_name": "metric_name_value", "target": 647} ], @@ -7093,6 +7121,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_index_endpoint(request) # Establish that the response is the type that we expect. @@ -7142,6 +7171,7 @@ def test_update_index_endpoint_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 = gca_index_endpoint.IndexEndpoint.to_json( gca_index_endpoint.IndexEndpoint() ) @@ -7188,6 +7218,7 @@ def test_delete_index_endpoint_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_index_endpoint(request) @@ -7218,6 +7249,7 @@ def test_delete_index_endpoint_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_index_endpoint(request) # Establish that the response is the type that we expect. @@ -7259,6 +7291,7 @@ def test_delete_index_endpoint_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 @@ -7305,6 +7338,7 @@ def test_deploy_index_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.deploy_index(request) @@ -7337,6 +7371,7 @@ def test_deploy_index_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.deploy_index(request) # Establish that the response is the type that we expect. @@ -7378,6 +7413,7 @@ def test_deploy_index_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 @@ -7424,6 +7460,7 @@ def test_undeploy_index_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.undeploy_index(request) @@ -7456,6 +7493,7 @@ def test_undeploy_index_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.undeploy_index(request) # Establish that the response is the type that we expect. @@ -7497,6 +7535,7 @@ def test_undeploy_index_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 @@ -7543,6 +7582,7 @@ def test_mutate_deployed_index_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.mutate_deployed_index(request) @@ -7594,6 +7634,7 @@ def test_mutate_deployed_index_rest_call_success(request_type): }, "min_replica_count": 1803, "max_replica_count": 1805, + "required_replica_count": 2344, "autoscaling_metric_specs": [ {"metric_name": "metric_name_value", "target": 647} ], @@ -7697,6 +7738,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.mutate_deployed_index(request) # Establish that the response is the type that we expect. @@ -7738,6 +7780,7 @@ def test_mutate_deployed_index_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 @@ -7782,6 +7825,7 @@ def test_get_location_rest_bad_request(request_type=locations_pb2.GetLocationReq 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_location(request) @@ -7812,6 +7856,7 @@ def test_get_location_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_location(request) @@ -7840,6 +7885,7 @@ def test_list_locations_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_locations(request) @@ -7870,6 +7916,7 @@ def test_list_locations_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_locations(request) @@ -7901,6 +7948,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -7933,6 +7981,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -7964,6 +8013,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -7996,6 +8046,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -8027,6 +8078,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -8059,6 +8111,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -8089,6 +8142,7 @@ def test_cancel_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.cancel_operation(request) @@ -8119,6 +8173,7 @@ def test_cancel_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.cancel_operation(request) @@ -8149,6 +8204,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) @@ -8179,6 +8235,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) @@ -8209,6 +8266,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) @@ -8239,6 +8297,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) @@ -8269,6 +8328,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) @@ -8299,6 +8359,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) @@ -8329,6 +8390,7 @@ def test_wait_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.wait_operation(request) @@ -8359,6 +8421,7 @@ def test_wait_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.wait_operation(request) @@ -8598,6 +8661,7 @@ async def test_create_index_endpoint_rest_asyncio_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"} await client.create_index_endpoint(request) @@ -8660,6 +8724,7 @@ async def test_create_index_endpoint_rest_asyncio_call_success(request_type): }, "min_replica_count": 1803, "max_replica_count": 1805, + "required_replica_count": 2344, "autoscaling_metric_specs": [ {"metric_name": "metric_name_value", "target": 647} ], @@ -8789,6 +8854,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.create_index_endpoint(request) # Establish that the response is the type that we expect. @@ -8836,6 +8902,7 @@ async def test_create_index_endpoint_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -8884,6 +8951,7 @@ async def test_get_index_endpoint_rest_asyncio_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"} await client.get_index_endpoint(request) @@ -8935,6 +9003,7 @@ async def test_get_index_endpoint_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_index_endpoint(request) # Establish that the response is the type that we expect. @@ -8989,6 +9058,7 @@ async def test_get_index_endpoint_rest_asyncio_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 = index_endpoint.IndexEndpoint.to_json( index_endpoint.IndexEndpoint() ) @@ -9039,6 +9109,7 @@ async def test_list_index_endpoints_rest_asyncio_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"} await client.list_index_endpoints(request) @@ -9083,6 +9154,7 @@ async def test_list_index_endpoints_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_index_endpoints(request) # Establish that the response is the type that we expect. @@ -9128,6 +9200,7 @@ async def test_list_index_endpoints_rest_asyncio_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 = index_endpoint_service.ListIndexEndpointsResponse.to_json( index_endpoint_service.ListIndexEndpointsResponse() ) @@ -9182,6 +9255,7 @@ async def test_update_index_endpoint_rest_asyncio_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"} await client.update_index_endpoint(request) @@ -9248,6 +9322,7 @@ async def test_update_index_endpoint_rest_asyncio_call_success(request_type): }, "min_replica_count": 1803, "max_replica_count": 1805, + "required_replica_count": 2344, "autoscaling_metric_specs": [ {"metric_name": "metric_name_value", "target": 647} ], @@ -9391,6 +9466,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.update_index_endpoint(request) # Establish that the response is the type that we expect. @@ -9446,6 +9522,7 @@ async def test_update_index_endpoint_rest_asyncio_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 = gca_index_endpoint.IndexEndpoint.to_json( gca_index_endpoint.IndexEndpoint() ) @@ -9496,6 +9573,7 @@ async def test_delete_index_endpoint_rest_asyncio_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"} await client.delete_index_endpoint(request) @@ -9533,6 +9611,7 @@ async def test_delete_index_endpoint_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_index_endpoint(request) # Establish that the response is the type that we expect. @@ -9580,6 +9659,7 @@ async def test_delete_index_endpoint_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -9630,6 +9710,7 @@ async def test_deploy_index_rest_asyncio_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"} await client.deploy_index(request) @@ -9669,6 +9750,7 @@ async def test_deploy_index_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.deploy_index(request) # Establish that the response is the type that we expect. @@ -9715,6 +9797,7 @@ async def test_deploy_index_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -9765,6 +9848,7 @@ async def test_undeploy_index_rest_asyncio_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"} await client.undeploy_index(request) @@ -9804,6 +9888,7 @@ async def test_undeploy_index_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.undeploy_index(request) # Establish that the response is the type that we expect. @@ -9850,6 +9935,7 @@ async def test_undeploy_index_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -9900,6 +9986,7 @@ async def test_mutate_deployed_index_rest_asyncio_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"} await client.mutate_deployed_index(request) @@ -9956,6 +10043,7 @@ async def test_mutate_deployed_index_rest_asyncio_call_success(request_type): }, "min_replica_count": 1803, "max_replica_count": 1805, + "required_replica_count": 2344, "autoscaling_metric_specs": [ {"metric_name": "metric_name_value", "target": 647} ], @@ -10061,6 +10149,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.mutate_deployed_index(request) # Establish that the response is the type that we expect. @@ -10108,6 +10197,7 @@ async def test_mutate_deployed_index_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -10158,6 +10248,7 @@ async def test_get_location_rest_asyncio_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"} await client.get_location(request) @@ -10195,6 +10286,7 @@ async def test_get_location_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_location(request) @@ -10227,6 +10319,7 @@ async def test_list_locations_rest_asyncio_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"} await client.list_locations(request) @@ -10264,6 +10357,7 @@ async def test_list_locations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_locations(request) @@ -10299,6 +10393,7 @@ async def test_get_iam_policy_rest_asyncio_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"} await client.get_iam_policy(request) @@ -10338,6 +10433,7 @@ async def test_get_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_iam_policy(request) @@ -10373,6 +10469,7 @@ async def test_set_iam_policy_rest_asyncio_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"} await client.set_iam_policy(request) @@ -10412,6 +10509,7 @@ async def test_set_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.set_iam_policy(request) @@ -10447,6 +10545,7 @@ async def test_test_iam_permissions_rest_asyncio_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"} await client.test_iam_permissions(request) @@ -10486,6 +10585,7 @@ async def test_test_iam_permissions_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.test_iam_permissions(request) @@ -10520,6 +10620,7 @@ async def test_cancel_operation_rest_asyncio_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"} await client.cancel_operation(request) @@ -10557,6 +10658,7 @@ async def test_cancel_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.cancel_operation(request) @@ -10591,6 +10693,7 @@ async def test_delete_operation_rest_asyncio_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"} await client.delete_operation(request) @@ -10628,6 +10731,7 @@ async def test_delete_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_operation(request) @@ -10662,6 +10766,7 @@ async def test_get_operation_rest_asyncio_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"} await client.get_operation(request) @@ -10699,6 +10804,7 @@ async def test_get_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_operation(request) @@ -10733,6 +10839,7 @@ async def test_list_operations_rest_asyncio_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"} await client.list_operations(request) @@ -10770,6 +10877,7 @@ async def test_list_operations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_operations(request) @@ -10804,6 +10912,7 @@ async def test_wait_operation_rest_asyncio_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"} await client.wait_operation(request) @@ -10841,6 +10950,7 @@ async def test_wait_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.wait_operation(request) diff --git a/tests/unit/gapic/aiplatform_v1/test_index_service.py b/tests/unit/gapic/aiplatform_v1/test_index_service.py index e70914c0ab..7235f715ed 100644 --- a/tests/unit/gapic/aiplatform_v1/test_index_service.py +++ b/tests/unit/gapic/aiplatform_v1/test_index_service.py @@ -3526,6 +3526,7 @@ def test_create_index_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_index(request) @@ -3578,6 +3579,7 @@ def test_create_index_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_index(**mock_args) @@ -3707,6 +3709,7 @@ def test_get_index_rest_required_fields(request_type=index_service.GetIndexReque 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_index(request) @@ -3752,6 +3755,7 @@ def test_get_index_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_index(**mock_args) @@ -3891,6 +3895,7 @@ def test_list_indexes_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_indexes(request) @@ -3946,6 +3951,7 @@ def test_list_indexes_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_indexes(**mock_args) @@ -4136,6 +4142,7 @@ def test_update_index_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_index(request) @@ -4182,6 +4189,7 @@ def test_update_index_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_index(**mock_args) @@ -4315,6 +4323,7 @@ def test_delete_index_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_index(request) @@ -4358,6 +4367,7 @@ def test_delete_index_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_index(**mock_args) @@ -4491,6 +4501,7 @@ def test_upsert_datapoints_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.upsert_datapoints(request) @@ -4613,6 +4624,7 @@ def test_remove_datapoints_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.remove_datapoints(request) @@ -5117,6 +5129,7 @@ def test_create_index_rest_bad_request(request_type=index_service.CreateIndexReq 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_index(request) @@ -5248,6 +5261,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_index(request) # Establish that the response is the type that we expect. @@ -5289,6 +5303,7 @@ def test_create_index_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 @@ -5331,6 +5346,7 @@ def test_get_index_rest_bad_request(request_type=index_service.GetIndexRequest): 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_index(request) @@ -5373,6 +5389,7 @@ def test_get_index_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_index(request) # Establish that the response is the type that we expect. @@ -5418,6 +5435,7 @@ def test_get_index_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 = index.Index.to_json(index.Index()) req.return_value.content = return_value @@ -5460,6 +5478,7 @@ def test_list_indexes_rest_bad_request(request_type=index_service.ListIndexesReq 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_indexes(request) @@ -5495,6 +5514,7 @@ def test_list_indexes_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_indexes(request) # Establish that the response is the type that we expect. @@ -5535,6 +5555,7 @@ def test_list_indexes_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 = index_service.ListIndexesResponse.to_json( index_service.ListIndexesResponse() ) @@ -5581,6 +5602,7 @@ def test_update_index_rest_bad_request(request_type=index_service.UpdateIndexReq 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_index(request) @@ -5714,6 +5736,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_index(request) # Establish that the response is the type that we expect. @@ -5755,6 +5778,7 @@ def test_update_index_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 @@ -5797,6 +5821,7 @@ def test_delete_index_rest_bad_request(request_type=index_service.DeleteIndexReq 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_index(request) @@ -5827,6 +5852,7 @@ def test_delete_index_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_index(request) # Establish that the response is the type that we expect. @@ -5868,6 +5894,7 @@ def test_delete_index_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 @@ -5912,6 +5939,7 @@ def test_upsert_datapoints_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.upsert_datapoints(request) @@ -5945,6 +5973,7 @@ def test_upsert_datapoints_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.upsert_datapoints(request) # Establish that the response is the type that we expect. @@ -5984,6 +6013,7 @@ def test_upsert_datapoints_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 = index_service.UpsertDatapointsResponse.to_json( index_service.UpsertDatapointsResponse() ) @@ -6030,6 +6060,7 @@ def test_remove_datapoints_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.remove_datapoints(request) @@ -6063,6 +6094,7 @@ def test_remove_datapoints_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.remove_datapoints(request) # Establish that the response is the type that we expect. @@ -6102,6 +6134,7 @@ def test_remove_datapoints_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 = index_service.RemoveDatapointsResponse.to_json( index_service.RemoveDatapointsResponse() ) @@ -6148,6 +6181,7 @@ def test_get_location_rest_bad_request(request_type=locations_pb2.GetLocationReq 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_location(request) @@ -6178,6 +6212,7 @@ def test_get_location_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_location(request) @@ -6206,6 +6241,7 @@ def test_list_locations_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_locations(request) @@ -6236,6 +6272,7 @@ def test_list_locations_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_locations(request) @@ -6267,6 +6304,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -6299,6 +6337,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -6330,6 +6369,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -6362,6 +6402,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -6393,6 +6434,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -6425,6 +6467,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -6455,6 +6498,7 @@ def test_cancel_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.cancel_operation(request) @@ -6485,6 +6529,7 @@ def test_cancel_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.cancel_operation(request) @@ -6515,6 +6560,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) @@ -6545,6 +6591,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) @@ -6575,6 +6622,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) @@ -6605,6 +6653,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) @@ -6635,6 +6684,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) @@ -6665,6 +6715,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) @@ -6695,6 +6746,7 @@ def test_wait_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.wait_operation(request) @@ -6725,6 +6777,7 @@ def test_wait_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.wait_operation(request) @@ -6936,6 +6989,7 @@ async def test_create_index_rest_asyncio_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"} await client.create_index(request) @@ -7074,6 +7128,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.create_index(request) # Establish that the response is the type that we expect. @@ -7120,6 +7175,7 @@ async def test_create_index_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -7168,6 +7224,7 @@ async def test_get_index_rest_asyncio_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"} await client.get_index(request) @@ -7217,6 +7274,7 @@ async def test_get_index_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_index(request) # Establish that the response is the type that we expect. @@ -7267,6 +7325,7 @@ async def test_get_index_rest_asyncio_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 = index.Index.to_json(index.Index()) req.return_value.read = mock.AsyncMock(return_value=return_value) @@ -7315,6 +7374,7 @@ async def test_list_indexes_rest_asyncio_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"} await client.list_indexes(request) @@ -7357,6 +7417,7 @@ async def test_list_indexes_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_indexes(request) # Establish that the response is the type that we expect. @@ -7402,6 +7463,7 @@ async def test_list_indexes_rest_asyncio_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 = index_service.ListIndexesResponse.to_json( index_service.ListIndexesResponse() ) @@ -7454,6 +7516,7 @@ async def test_update_index_rest_asyncio_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"} await client.update_index(request) @@ -7594,6 +7657,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.update_index(request) # Establish that the response is the type that we expect. @@ -7640,6 +7704,7 @@ async def test_update_index_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -7688,6 +7753,7 @@ async def test_delete_index_rest_asyncio_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"} await client.delete_index(request) @@ -7725,6 +7791,7 @@ async def test_delete_index_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_index(request) # Establish that the response is the type that we expect. @@ -7771,6 +7838,7 @@ async def test_delete_index_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -7819,6 +7887,7 @@ async def test_upsert_datapoints_rest_asyncio_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"} await client.upsert_datapoints(request) @@ -7859,6 +7928,7 @@ async def test_upsert_datapoints_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.upsert_datapoints(request) # Establish that the response is the type that we expect. @@ -7903,6 +7973,7 @@ async def test_upsert_datapoints_rest_asyncio_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 = index_service.UpsertDatapointsResponse.to_json( index_service.UpsertDatapointsResponse() ) @@ -7953,6 +8024,7 @@ async def test_remove_datapoints_rest_asyncio_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"} await client.remove_datapoints(request) @@ -7993,6 +8065,7 @@ async def test_remove_datapoints_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.remove_datapoints(request) # Establish that the response is the type that we expect. @@ -8037,6 +8110,7 @@ async def test_remove_datapoints_rest_asyncio_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 = index_service.RemoveDatapointsResponse.to_json( index_service.RemoveDatapointsResponse() ) @@ -8089,6 +8163,7 @@ async def test_get_location_rest_asyncio_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"} await client.get_location(request) @@ -8126,6 +8201,7 @@ async def test_get_location_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_location(request) @@ -8158,6 +8234,7 @@ async def test_list_locations_rest_asyncio_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"} await client.list_locations(request) @@ -8195,6 +8272,7 @@ async def test_list_locations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_locations(request) @@ -8230,6 +8308,7 @@ async def test_get_iam_policy_rest_asyncio_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"} await client.get_iam_policy(request) @@ -8269,6 +8348,7 @@ async def test_get_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_iam_policy(request) @@ -8304,6 +8384,7 @@ async def test_set_iam_policy_rest_asyncio_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"} await client.set_iam_policy(request) @@ -8343,6 +8424,7 @@ async def test_set_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.set_iam_policy(request) @@ -8378,6 +8460,7 @@ async def test_test_iam_permissions_rest_asyncio_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"} await client.test_iam_permissions(request) @@ -8417,6 +8500,7 @@ async def test_test_iam_permissions_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.test_iam_permissions(request) @@ -8451,6 +8535,7 @@ async def test_cancel_operation_rest_asyncio_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"} await client.cancel_operation(request) @@ -8488,6 +8573,7 @@ async def test_cancel_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.cancel_operation(request) @@ -8522,6 +8608,7 @@ async def test_delete_operation_rest_asyncio_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"} await client.delete_operation(request) @@ -8559,6 +8646,7 @@ async def test_delete_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_operation(request) @@ -8593,6 +8681,7 @@ async def test_get_operation_rest_asyncio_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"} await client.get_operation(request) @@ -8630,6 +8719,7 @@ async def test_get_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_operation(request) @@ -8664,6 +8754,7 @@ async def test_list_operations_rest_asyncio_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"} await client.list_operations(request) @@ -8701,6 +8792,7 @@ async def test_list_operations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_operations(request) @@ -8735,6 +8827,7 @@ async def test_wait_operation_rest_asyncio_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"} await client.wait_operation(request) @@ -8772,6 +8865,7 @@ async def test_wait_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.wait_operation(request) diff --git a/tests/unit/gapic/aiplatform_v1/test_job_service.py b/tests/unit/gapic/aiplatform_v1/test_job_service.py index 2fc8c1755f..cb9526aaaa 100644 --- a/tests/unit/gapic/aiplatform_v1/test_job_service.py +++ b/tests/unit/gapic/aiplatform_v1/test_job_service.py @@ -15173,6 +15173,7 @@ def test_create_custom_job_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_custom_job(request) @@ -15227,6 +15228,7 @@ def test_create_custom_job_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_custom_job(**mock_args) @@ -15358,6 +15360,7 @@ def test_get_custom_job_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_custom_job(request) @@ -15405,6 +15408,7 @@ def test_get_custom_job_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_custom_job(**mock_args) @@ -15546,6 +15550,7 @@ def test_list_custom_jobs_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_custom_jobs(request) @@ -15601,6 +15606,7 @@ def test_list_custom_jobs_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_custom_jobs(**mock_args) @@ -15797,6 +15803,7 @@ def test_delete_custom_job_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_custom_job(request) @@ -15842,6 +15849,7 @@ def test_delete_custom_job_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_custom_job(**mock_args) @@ -15972,6 +15980,7 @@ def test_cancel_custom_job_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.cancel_custom_job(request) @@ -16017,6 +16026,7 @@ def test_cancel_custom_job_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.cancel_custom_job(**mock_args) @@ -16154,6 +16164,7 @@ def test_create_data_labeling_job_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_data_labeling_job(request) @@ -16208,6 +16219,7 @@ def test_create_data_labeling_job_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_data_labeling_job(**mock_args) @@ -16345,6 +16357,7 @@ def test_get_data_labeling_job_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_data_labeling_job(request) @@ -16392,6 +16405,7 @@ def test_get_data_labeling_job_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_data_labeling_job(**mock_args) @@ -16538,6 +16552,7 @@ def test_list_data_labeling_jobs_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_data_labeling_jobs(request) @@ -16594,6 +16609,7 @@ def test_list_data_labeling_jobs_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_data_labeling_jobs(**mock_args) @@ -16794,6 +16810,7 @@ def test_delete_data_labeling_job_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_data_labeling_job(request) @@ -16839,6 +16856,7 @@ def test_delete_data_labeling_job_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_data_labeling_job(**mock_args) @@ -16973,6 +16991,7 @@ def test_cancel_data_labeling_job_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.cancel_data_labeling_job(request) @@ -17018,6 +17037,7 @@ def test_cancel_data_labeling_job_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.cancel_data_labeling_job(**mock_args) @@ -17157,6 +17177,7 @@ def test_create_hyperparameter_tuning_job_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_hyperparameter_tuning_job(request) @@ -17217,6 +17238,7 @@ def test_create_hyperparameter_tuning_job_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_hyperparameter_tuning_job(**mock_args) @@ -17358,6 +17380,7 @@ def test_get_hyperparameter_tuning_job_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_hyperparameter_tuning_job(request) @@ -17409,6 +17432,7 @@ def test_get_hyperparameter_tuning_job_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_hyperparameter_tuning_job(**mock_args) @@ -17556,6 +17580,7 @@ def test_list_hyperparameter_tuning_jobs_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_hyperparameter_tuning_jobs(request) @@ -17613,6 +17638,7 @@ def test_list_hyperparameter_tuning_jobs_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_hyperparameter_tuning_jobs(**mock_args) @@ -17819,6 +17845,7 @@ def test_delete_hyperparameter_tuning_job_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_hyperparameter_tuning_job(request) @@ -17866,6 +17893,7 @@ def test_delete_hyperparameter_tuning_job_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_hyperparameter_tuning_job(**mock_args) @@ -18000,6 +18028,7 @@ def test_cancel_hyperparameter_tuning_job_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.cancel_hyperparameter_tuning_job(request) @@ -18047,6 +18076,7 @@ def test_cancel_hyperparameter_tuning_job_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.cancel_hyperparameter_tuning_job(**mock_args) @@ -18179,6 +18209,7 @@ def test_create_nas_job_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_nas_job(request) @@ -18233,6 +18264,7 @@ def test_create_nas_job_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_nas_job(**mock_args) @@ -18362,6 +18394,7 @@ def test_get_nas_job_rest_required_fields(request_type=job_service.GetNasJobRequ 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_nas_job(request) @@ -18407,6 +18440,7 @@ def test_get_nas_job_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_nas_job(**mock_args) @@ -18546,6 +18580,7 @@ def test_list_nas_jobs_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_nas_jobs(request) @@ -18601,6 +18636,7 @@ def test_list_nas_jobs_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_nas_jobs(**mock_args) @@ -18793,6 +18829,7 @@ def test_delete_nas_job_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_nas_job(request) @@ -18836,6 +18873,7 @@ def test_delete_nas_job_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_nas_job(**mock_args) @@ -18964,6 +19002,7 @@ def test_cancel_nas_job_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.cancel_nas_job(request) @@ -19007,6 +19046,7 @@ def test_cancel_nas_job_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.cancel_nas_job(**mock_args) @@ -19142,6 +19182,7 @@ def test_get_nas_trial_detail_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_nas_trial_detail(request) @@ -19189,6 +19230,7 @@ def test_get_nas_trial_detail_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_nas_trial_detail(**mock_args) @@ -19332,6 +19374,7 @@ def test_list_nas_trial_details_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_nas_trial_details(request) @@ -19387,6 +19430,7 @@ def test_list_nas_trial_details_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_nas_trial_details(**mock_args) @@ -19589,6 +19633,7 @@ def test_create_batch_prediction_job_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_batch_prediction_job(request) @@ -19645,6 +19690,7 @@ def test_create_batch_prediction_job_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_batch_prediction_job(**mock_args) @@ -19784,6 +19830,7 @@ def test_get_batch_prediction_job_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_batch_prediction_job(request) @@ -19831,6 +19878,7 @@ def test_get_batch_prediction_job_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_batch_prediction_job(**mock_args) @@ -19976,6 +20024,7 @@ def test_list_batch_prediction_jobs_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_batch_prediction_jobs(request) @@ -20031,6 +20080,7 @@ def test_list_batch_prediction_jobs_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_batch_prediction_jobs(**mock_args) @@ -20233,6 +20283,7 @@ def test_delete_batch_prediction_job_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_batch_prediction_job(request) @@ -20278,6 +20329,7 @@ def test_delete_batch_prediction_job_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_batch_prediction_job(**mock_args) @@ -20412,6 +20464,7 @@ def test_cancel_batch_prediction_job_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.cancel_batch_prediction_job(request) @@ -20457,6 +20510,7 @@ def test_cancel_batch_prediction_job_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.cancel_batch_prediction_job(**mock_args) @@ -20602,6 +20656,7 @@ def test_create_model_deployment_monitoring_job_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_model_deployment_monitoring_job(request) @@ -20666,6 +20721,7 @@ def test_create_model_deployment_monitoring_job_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_model_deployment_monitoring_job(**mock_args) @@ -20825,6 +20881,7 @@ def test_search_model_deployment_monitoring_stats_anomalies_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.search_model_deployment_monitoring_stats_anomalies( request @@ -20892,6 +20949,7 @@ def test_search_model_deployment_monitoring_stats_anomalies_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.search_model_deployment_monitoring_stats_anomalies(**mock_args) @@ -21114,6 +21172,7 @@ def test_get_model_deployment_monitoring_job_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_model_deployment_monitoring_job(request) @@ -21165,6 +21224,7 @@ def test_get_model_deployment_monitoring_job_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_model_deployment_monitoring_job(**mock_args) @@ -21318,6 +21378,7 @@ def test_list_model_deployment_monitoring_jobs_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_model_deployment_monitoring_jobs(request) @@ -21377,6 +21438,7 @@ def test_list_model_deployment_monitoring_jobs_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_model_deployment_monitoring_jobs(**mock_args) @@ -21587,6 +21649,7 @@ def test_update_model_deployment_monitoring_job_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_model_deployment_monitoring_job(request) @@ -21647,6 +21710,7 @@ def test_update_model_deployment_monitoring_job_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_model_deployment_monitoring_job(**mock_args) @@ -21793,6 +21857,7 @@ def test_delete_model_deployment_monitoring_job_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_model_deployment_monitoring_job(request) @@ -21840,6 +21905,7 @@ def test_delete_model_deployment_monitoring_job_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_model_deployment_monitoring_job(**mock_args) @@ -21980,6 +22046,7 @@ def test_pause_model_deployment_monitoring_job_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.pause_model_deployment_monitoring_job(request) @@ -22027,6 +22094,7 @@ def test_pause_model_deployment_monitoring_job_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.pause_model_deployment_monitoring_job(**mock_args) @@ -22167,6 +22235,7 @@ def test_resume_model_deployment_monitoring_job_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.resume_model_deployment_monitoring_job(request) @@ -22214,6 +22283,7 @@ def test_resume_model_deployment_monitoring_job_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.resume_model_deployment_monitoring_job(**mock_args) @@ -24236,6 +24306,7 @@ def test_create_custom_job_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_custom_job(request) @@ -24430,6 +24501,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_custom_job(request) # Establish that the response is the type that we expect. @@ -24474,6 +24546,7 @@ def test_create_custom_job_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 = gca_custom_job.CustomJob.to_json(gca_custom_job.CustomJob()) req.return_value.content = return_value @@ -24516,6 +24589,7 @@ def test_get_custom_job_rest_bad_request(request_type=job_service.GetCustomJobRe 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_custom_job(request) @@ -24555,6 +24629,7 @@ def test_get_custom_job_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_custom_job(request) # Establish that the response is the type that we expect. @@ -24599,6 +24674,7 @@ def test_get_custom_job_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 = custom_job.CustomJob.to_json(custom_job.CustomJob()) req.return_value.content = return_value @@ -24643,6 +24719,7 @@ def test_list_custom_jobs_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_custom_jobs(request) @@ -24678,6 +24755,7 @@ def test_list_custom_jobs_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_custom_jobs(request) # Establish that the response is the type that we expect. @@ -24718,6 +24796,7 @@ def test_list_custom_jobs_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 = job_service.ListCustomJobsResponse.to_json( job_service.ListCustomJobsResponse() ) @@ -24764,6 +24843,7 @@ def test_delete_custom_job_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_custom_job(request) @@ -24794,6 +24874,7 @@ def test_delete_custom_job_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_custom_job(request) # Establish that the response is the type that we expect. @@ -24835,6 +24916,7 @@ def test_delete_custom_job_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 @@ -24879,6 +24961,7 @@ def test_cancel_custom_job_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.cancel_custom_job(request) @@ -24909,6 +24992,7 @@ def test_cancel_custom_job_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.cancel_custom_job(request) # Establish that the response is the type that we expect. @@ -24945,6 +25029,7 @@ def test_cancel_custom_job_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 = job_service.CancelCustomJobRequest() metadata = [ @@ -24985,6 +25070,7 @@ def test_create_data_labeling_job_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_data_labeling_job(request) @@ -25146,6 +25232,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_data_labeling_job(request) # Establish that the response is the type that we expect. @@ -25194,6 +25281,7 @@ def test_create_data_labeling_job_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 = gca_data_labeling_job.DataLabelingJob.to_json( gca_data_labeling_job.DataLabelingJob() ) @@ -25242,6 +25330,7 @@ def test_get_data_labeling_job_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_data_labeling_job(request) @@ -25287,6 +25376,7 @@ def test_get_data_labeling_job_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_data_labeling_job(request) # Establish that the response is the type that we expect. @@ -25335,6 +25425,7 @@ def test_get_data_labeling_job_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 = data_labeling_job.DataLabelingJob.to_json( data_labeling_job.DataLabelingJob() ) @@ -25381,6 +25472,7 @@ def test_list_data_labeling_jobs_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_data_labeling_jobs(request) @@ -25416,6 +25508,7 @@ def test_list_data_labeling_jobs_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_data_labeling_jobs(request) # Establish that the response is the type that we expect. @@ -25456,6 +25549,7 @@ def test_list_data_labeling_jobs_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 = job_service.ListDataLabelingJobsResponse.to_json( job_service.ListDataLabelingJobsResponse() ) @@ -25504,6 +25598,7 @@ def test_delete_data_labeling_job_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_data_labeling_job(request) @@ -25536,6 +25631,7 @@ def test_delete_data_labeling_job_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_data_labeling_job(request) # Establish that the response is the type that we expect. @@ -25577,6 +25673,7 @@ def test_delete_data_labeling_job_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 @@ -25623,6 +25720,7 @@ def test_cancel_data_labeling_job_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.cancel_data_labeling_job(request) @@ -25655,6 +25753,7 @@ def test_cancel_data_labeling_job_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.cancel_data_labeling_job(request) # Establish that the response is the type that we expect. @@ -25691,6 +25790,7 @@ def test_cancel_data_labeling_job_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 = job_service.CancelDataLabelingJobRequest() metadata = [ @@ -25731,6 +25831,7 @@ def test_create_hyperparameter_tuning_job_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_hyperparameter_tuning_job(request) @@ -26041,6 +26142,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_hyperparameter_tuning_job(request) # Establish that the response is the type that we expect. @@ -26088,6 +26190,7 @@ def test_create_hyperparameter_tuning_job_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 = gca_hyperparameter_tuning_job.HyperparameterTuningJob.to_json( gca_hyperparameter_tuning_job.HyperparameterTuningJob() ) @@ -26136,6 +26239,7 @@ def test_get_hyperparameter_tuning_job_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_hyperparameter_tuning_job(request) @@ -26182,6 +26286,7 @@ def test_get_hyperparameter_tuning_job_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_hyperparameter_tuning_job(request) # Establish that the response is the type that we expect. @@ -26229,6 +26334,7 @@ def test_get_hyperparameter_tuning_job_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 = hyperparameter_tuning_job.HyperparameterTuningJob.to_json( hyperparameter_tuning_job.HyperparameterTuningJob() ) @@ -26275,6 +26381,7 @@ def test_list_hyperparameter_tuning_jobs_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_hyperparameter_tuning_jobs(request) @@ -26310,6 +26417,7 @@ def test_list_hyperparameter_tuning_jobs_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_hyperparameter_tuning_jobs(request) # Establish that the response is the type that we expect. @@ -26350,6 +26458,7 @@ def test_list_hyperparameter_tuning_jobs_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 = job_service.ListHyperparameterTuningJobsResponse.to_json( job_service.ListHyperparameterTuningJobsResponse() ) @@ -26398,6 +26507,7 @@ def test_delete_hyperparameter_tuning_job_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_hyperparameter_tuning_job(request) @@ -26430,6 +26540,7 @@ def test_delete_hyperparameter_tuning_job_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_hyperparameter_tuning_job(request) # Establish that the response is the type that we expect. @@ -26471,6 +26582,7 @@ def test_delete_hyperparameter_tuning_job_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 @@ -26517,6 +26629,7 @@ def test_cancel_hyperparameter_tuning_job_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.cancel_hyperparameter_tuning_job(request) @@ -26549,6 +26662,7 @@ def test_cancel_hyperparameter_tuning_job_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.cancel_hyperparameter_tuning_job(request) # Establish that the response is the type that we expect. @@ -26585,6 +26699,7 @@ def test_cancel_hyperparameter_tuning_job_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 = job_service.CancelHyperparameterTuningJobRequest() metadata = [ @@ -26623,6 +26738,7 @@ def test_create_nas_job_rest_bad_request(request_type=job_service.CreateNasJobRe 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_nas_job(request) @@ -26863,6 +26979,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_nas_job(request) # Establish that the response is the type that we expect. @@ -26908,6 +27025,7 @@ def test_create_nas_job_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 = gca_nas_job.NasJob.to_json(gca_nas_job.NasJob()) req.return_value.content = return_value @@ -26950,6 +27068,7 @@ def test_get_nas_job_rest_bad_request(request_type=job_service.GetNasJobRequest) 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_nas_job(request) @@ -26990,6 +27109,7 @@ def test_get_nas_job_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_nas_job(request) # Establish that the response is the type that we expect. @@ -27033,6 +27153,7 @@ def test_get_nas_job_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 = nas_job.NasJob.to_json(nas_job.NasJob()) req.return_value.content = return_value @@ -27075,6 +27196,7 @@ def test_list_nas_jobs_rest_bad_request(request_type=job_service.ListNasJobsRequ 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_nas_jobs(request) @@ -27110,6 +27232,7 @@ def test_list_nas_jobs_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_nas_jobs(request) # Establish that the response is the type that we expect. @@ -27148,6 +27271,7 @@ def test_list_nas_jobs_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 = job_service.ListNasJobsResponse.to_json( job_service.ListNasJobsResponse() ) @@ -27192,6 +27316,7 @@ def test_delete_nas_job_rest_bad_request(request_type=job_service.DeleteNasJobRe 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_nas_job(request) @@ -27222,6 +27347,7 @@ def test_delete_nas_job_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_nas_job(request) # Establish that the response is the type that we expect. @@ -27263,6 +27389,7 @@ def test_delete_nas_job_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 @@ -27305,6 +27432,7 @@ def test_cancel_nas_job_rest_bad_request(request_type=job_service.CancelNasJobRe 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.cancel_nas_job(request) @@ -27335,6 +27463,7 @@ def test_cancel_nas_job_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.cancel_nas_job(request) # Establish that the response is the type that we expect. @@ -27371,6 +27500,7 @@ def test_cancel_nas_job_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 = job_service.CancelNasJobRequest() metadata = [ @@ -27413,6 +27543,7 @@ def test_get_nas_trial_detail_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_nas_trial_detail(request) @@ -27451,6 +27582,7 @@ def test_get_nas_trial_detail_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_nas_trial_detail(request) # Establish that the response is the type that we expect. @@ -27492,6 +27624,7 @@ def test_get_nas_trial_detail_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 = nas_job.NasTrialDetail.to_json(nas_job.NasTrialDetail()) req.return_value.content = return_value @@ -27536,6 +27669,7 @@ def test_list_nas_trial_details_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_nas_trial_details(request) @@ -27571,6 +27705,7 @@ def test_list_nas_trial_details_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_nas_trial_details(request) # Establish that the response is the type that we expect. @@ -27611,6 +27746,7 @@ def test_list_nas_trial_details_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 = job_service.ListNasTrialDetailsResponse.to_json( job_service.ListNasTrialDetailsResponse() ) @@ -27657,6 +27793,7 @@ def test_create_batch_prediction_job_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_batch_prediction_job(request) @@ -27914,6 +28051,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_batch_prediction_job(request) # Establish that the response is the type that we expect. @@ -27963,6 +28101,7 @@ def test_create_batch_prediction_job_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 = gca_batch_prediction_job.BatchPredictionJob.to_json( gca_batch_prediction_job.BatchPredictionJob() ) @@ -28011,6 +28150,7 @@ def test_get_batch_prediction_job_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_batch_prediction_job(request) @@ -28057,6 +28197,7 @@ def test_get_batch_prediction_job_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_batch_prediction_job(request) # Establish that the response is the type that we expect. @@ -28106,6 +28247,7 @@ def test_get_batch_prediction_job_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 = batch_prediction_job.BatchPredictionJob.to_json( batch_prediction_job.BatchPredictionJob() ) @@ -28152,6 +28294,7 @@ def test_list_batch_prediction_jobs_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_batch_prediction_jobs(request) @@ -28187,6 +28330,7 @@ def test_list_batch_prediction_jobs_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_batch_prediction_jobs(request) # Establish that the response is the type that we expect. @@ -28227,6 +28371,7 @@ def test_list_batch_prediction_jobs_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 = job_service.ListBatchPredictionJobsResponse.to_json( job_service.ListBatchPredictionJobsResponse() ) @@ -28275,6 +28420,7 @@ def test_delete_batch_prediction_job_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_batch_prediction_job(request) @@ -28307,6 +28453,7 @@ def test_delete_batch_prediction_job_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_batch_prediction_job(request) # Establish that the response is the type that we expect. @@ -28348,6 +28495,7 @@ def test_delete_batch_prediction_job_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 @@ -28394,6 +28542,7 @@ def test_cancel_batch_prediction_job_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.cancel_batch_prediction_job(request) @@ -28426,6 +28575,7 @@ def test_cancel_batch_prediction_job_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.cancel_batch_prediction_job(request) # Establish that the response is the type that we expect. @@ -28462,6 +28612,7 @@ def test_cancel_batch_prediction_job_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 = job_service.CancelBatchPredictionJobRequest() metadata = [ @@ -28502,6 +28653,7 @@ def test_create_model_deployment_monitoring_job_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_model_deployment_monitoring_job(request) @@ -28724,6 +28876,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_model_deployment_monitoring_job(request) # Establish that the response is the type that we expect. @@ -28780,6 +28933,7 @@ def test_create_model_deployment_monitoring_job_rest_interceptors(null_intercept 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 = ( gca_model_deployment_monitoring_job.ModelDeploymentMonitoringJob.to_json( gca_model_deployment_monitoring_job.ModelDeploymentMonitoringJob() @@ -28832,6 +28986,7 @@ def test_search_model_deployment_monitoring_stats_anomalies_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.search_model_deployment_monitoring_stats_anomalies(request) @@ -28877,6 +29032,7 @@ def test_search_model_deployment_monitoring_stats_anomalies_rest_call_success( 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.search_model_deployment_monitoring_stats_anomalies(request) # Establish that the response is the type that we expect. @@ -28925,6 +29081,7 @@ def test_search_model_deployment_monitoring_stats_anomalies_rest_interceptors( 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 = ( job_service.SearchModelDeploymentMonitoringStatsAnomaliesResponse.to_json( job_service.SearchModelDeploymentMonitoringStatsAnomaliesResponse() @@ -28977,6 +29134,7 @@ def test_get_model_deployment_monitoring_job_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_model_deployment_monitoring_job(request) @@ -29025,6 +29183,7 @@ def test_get_model_deployment_monitoring_job_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_model_deployment_monitoring_job(request) # Establish that the response is the type that we expect. @@ -29079,6 +29238,7 @@ def test_get_model_deployment_monitoring_job_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 = ( model_deployment_monitoring_job.ModelDeploymentMonitoringJob.to_json( model_deployment_monitoring_job.ModelDeploymentMonitoringJob() @@ -29129,6 +29289,7 @@ def test_list_model_deployment_monitoring_jobs_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_model_deployment_monitoring_jobs(request) @@ -29166,6 +29327,7 @@ def test_list_model_deployment_monitoring_jobs_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_model_deployment_monitoring_jobs(request) # Establish that the response is the type that we expect. @@ -29208,6 +29370,7 @@ def test_list_model_deployment_monitoring_jobs_rest_interceptors(null_intercepto 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 = job_service.ListModelDeploymentMonitoringJobsResponse.to_json( job_service.ListModelDeploymentMonitoringJobsResponse() ) @@ -29258,6 +29421,7 @@ def test_update_model_deployment_monitoring_job_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_model_deployment_monitoring_job(request) @@ -29466,6 +29630,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_model_deployment_monitoring_job(request) # Establish that the response is the type that we expect. @@ -29509,6 +29674,7 @@ def test_update_model_deployment_monitoring_job_rest_interceptors(null_intercept 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 @@ -29555,6 +29721,7 @@ def test_delete_model_deployment_monitoring_job_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_model_deployment_monitoring_job(request) @@ -29587,6 +29754,7 @@ def test_delete_model_deployment_monitoring_job_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_model_deployment_monitoring_job(request) # Establish that the response is the type that we expect. @@ -29630,6 +29798,7 @@ def test_delete_model_deployment_monitoring_job_rest_interceptors(null_intercept 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 @@ -29676,6 +29845,7 @@ def test_pause_model_deployment_monitoring_job_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.pause_model_deployment_monitoring_job(request) @@ -29708,6 +29878,7 @@ def test_pause_model_deployment_monitoring_job_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.pause_model_deployment_monitoring_job(request) # Establish that the response is the type that we expect. @@ -29745,6 +29916,7 @@ def test_pause_model_deployment_monitoring_job_rest_interceptors(null_intercepto req.return_value = mock.Mock() req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} request = job_service.PauseModelDeploymentMonitoringJobRequest() metadata = [ @@ -29787,6 +29959,7 @@ def test_resume_model_deployment_monitoring_job_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.resume_model_deployment_monitoring_job(request) @@ -29819,6 +29992,7 @@ def test_resume_model_deployment_monitoring_job_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.resume_model_deployment_monitoring_job(request) # Establish that the response is the type that we expect. @@ -29856,6 +30030,7 @@ def test_resume_model_deployment_monitoring_job_rest_interceptors(null_intercept req.return_value = mock.Mock() req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} request = job_service.ResumeModelDeploymentMonitoringJobRequest() metadata = [ @@ -29896,6 +30071,7 @@ def test_get_location_rest_bad_request(request_type=locations_pb2.GetLocationReq 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_location(request) @@ -29926,6 +30102,7 @@ def test_get_location_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_location(request) @@ -29954,6 +30131,7 @@ def test_list_locations_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_locations(request) @@ -29984,6 +30162,7 @@ def test_list_locations_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_locations(request) @@ -30015,6 +30194,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -30047,6 +30227,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -30078,6 +30259,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -30110,6 +30292,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -30141,6 +30324,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -30173,6 +30357,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -30203,6 +30388,7 @@ def test_cancel_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.cancel_operation(request) @@ -30233,6 +30419,7 @@ def test_cancel_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.cancel_operation(request) @@ -30263,6 +30450,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) @@ -30293,6 +30481,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) @@ -30323,6 +30512,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) @@ -30353,6 +30543,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) @@ -30383,6 +30574,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) @@ -30413,6 +30605,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) @@ -30443,6 +30636,7 @@ def test_wait_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.wait_operation(request) @@ -30473,6 +30667,7 @@ def test_wait_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.wait_operation(request) @@ -31297,6 +31492,7 @@ async def test_create_custom_job_rest_asyncio_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"} await client.create_custom_job(request) @@ -31498,6 +31694,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.create_custom_job(request) # Establish that the response is the type that we expect. @@ -31547,6 +31744,7 @@ async def test_create_custom_job_rest_asyncio_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 = gca_custom_job.CustomJob.to_json(gca_custom_job.CustomJob()) req.return_value.read = mock.AsyncMock(return_value=return_value) @@ -31595,6 +31793,7 @@ async def test_get_custom_job_rest_asyncio_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"} await client.get_custom_job(request) @@ -31641,6 +31840,7 @@ async def test_get_custom_job_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_custom_job(request) # Establish that the response is the type that we expect. @@ -31690,6 +31890,7 @@ async def test_get_custom_job_rest_asyncio_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 = custom_job.CustomJob.to_json(custom_job.CustomJob()) req.return_value.read = mock.AsyncMock(return_value=return_value) @@ -31738,6 +31939,7 @@ async def test_list_custom_jobs_rest_asyncio_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"} await client.list_custom_jobs(request) @@ -31780,6 +31982,7 @@ async def test_list_custom_jobs_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_custom_jobs(request) # Establish that the response is the type that we expect. @@ -31825,6 +32028,7 @@ async def test_list_custom_jobs_rest_asyncio_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 = job_service.ListCustomJobsResponse.to_json( job_service.ListCustomJobsResponse() ) @@ -31875,6 +32079,7 @@ async def test_delete_custom_job_rest_asyncio_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"} await client.delete_custom_job(request) @@ -31912,6 +32117,7 @@ async def test_delete_custom_job_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_custom_job(request) # Establish that the response is the type that we expect. @@ -31958,6 +32164,7 @@ async def test_delete_custom_job_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -32006,6 +32213,7 @@ async def test_cancel_custom_job_rest_asyncio_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"} await client.cancel_custom_job(request) @@ -32043,6 +32251,7 @@ async def test_cancel_custom_job_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.cancel_custom_job(request) # Establish that the response is the type that we expect. @@ -32084,6 +32293,7 @@ async def test_cancel_custom_job_rest_asyncio_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 = job_service.CancelCustomJobRequest() metadata = [ @@ -32128,6 +32338,7 @@ async def test_create_data_labeling_job_rest_asyncio_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"} await client.create_data_labeling_job(request) @@ -32296,6 +32507,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.create_data_labeling_job(request) # Establish that the response is the type that we expect. @@ -32349,6 +32561,7 @@ async def test_create_data_labeling_job_rest_asyncio_interceptors(null_intercept 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 = gca_data_labeling_job.DataLabelingJob.to_json( gca_data_labeling_job.DataLabelingJob() ) @@ -32401,6 +32614,7 @@ async def test_get_data_labeling_job_rest_asyncio_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"} await client.get_data_labeling_job(request) @@ -32453,6 +32667,7 @@ async def test_get_data_labeling_job_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_data_labeling_job(request) # Establish that the response is the type that we expect. @@ -32506,6 +32721,7 @@ async def test_get_data_labeling_job_rest_asyncio_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 = data_labeling_job.DataLabelingJob.to_json( data_labeling_job.DataLabelingJob() ) @@ -32556,6 +32772,7 @@ async def test_list_data_labeling_jobs_rest_asyncio_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"} await client.list_data_labeling_jobs(request) @@ -32598,6 +32815,7 @@ async def test_list_data_labeling_jobs_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_data_labeling_jobs(request) # Establish that the response is the type that we expect. @@ -32643,6 +32861,7 @@ async def test_list_data_labeling_jobs_rest_asyncio_interceptors(null_intercepto 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 = job_service.ListDataLabelingJobsResponse.to_json( job_service.ListDataLabelingJobsResponse() ) @@ -32695,6 +32914,7 @@ async def test_delete_data_labeling_job_rest_asyncio_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"} await client.delete_data_labeling_job(request) @@ -32734,6 +32954,7 @@ async def test_delete_data_labeling_job_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_data_labeling_job(request) # Establish that the response is the type that we expect. @@ -32780,6 +33001,7 @@ async def test_delete_data_labeling_job_rest_asyncio_interceptors(null_intercept 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.read = mock.AsyncMock(return_value=return_value) @@ -32830,6 +33052,7 @@ async def test_cancel_data_labeling_job_rest_asyncio_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"} await client.cancel_data_labeling_job(request) @@ -32869,6 +33092,7 @@ async def test_cancel_data_labeling_job_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.cancel_data_labeling_job(request) # Establish that the response is the type that we expect. @@ -32910,6 +33134,7 @@ async def test_cancel_data_labeling_job_rest_asyncio_interceptors(null_intercept req.return_value = mock.Mock() req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} request = job_service.CancelDataLabelingJobRequest() metadata = [ @@ -32954,6 +33179,7 @@ async def test_create_hyperparameter_tuning_job_rest_asyncio_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"} await client.create_hyperparameter_tuning_job(request) @@ -33271,6 +33497,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.create_hyperparameter_tuning_job(request) # Establish that the response is the type that we expect. @@ -33327,6 +33554,7 @@ async def test_create_hyperparameter_tuning_job_rest_asyncio_interceptors( 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 = gca_hyperparameter_tuning_job.HyperparameterTuningJob.to_json( gca_hyperparameter_tuning_job.HyperparameterTuningJob() ) @@ -33379,6 +33607,7 @@ async def test_get_hyperparameter_tuning_job_rest_asyncio_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"} await client.get_hyperparameter_tuning_job(request) @@ -33432,6 +33661,7 @@ async def test_get_hyperparameter_tuning_job_rest_asyncio_call_success(request_t return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_hyperparameter_tuning_job(request) # Establish that the response is the type that we expect. @@ -33486,6 +33716,7 @@ async def test_get_hyperparameter_tuning_job_rest_asyncio_interceptors( 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 = hyperparameter_tuning_job.HyperparameterTuningJob.to_json( hyperparameter_tuning_job.HyperparameterTuningJob() ) @@ -33536,6 +33767,7 @@ async def test_list_hyperparameter_tuning_jobs_rest_asyncio_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"} await client.list_hyperparameter_tuning_jobs(request) @@ -33578,6 +33810,7 @@ async def test_list_hyperparameter_tuning_jobs_rest_asyncio_call_success(request return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_hyperparameter_tuning_jobs(request) # Establish that the response is the type that we expect. @@ -33626,6 +33859,7 @@ async def test_list_hyperparameter_tuning_jobs_rest_asyncio_interceptors( 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 = job_service.ListHyperparameterTuningJobsResponse.to_json( job_service.ListHyperparameterTuningJobsResponse() ) @@ -33678,6 +33912,7 @@ async def test_delete_hyperparameter_tuning_job_rest_asyncio_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"} await client.delete_hyperparameter_tuning_job(request) @@ -33717,6 +33952,7 @@ async def test_delete_hyperparameter_tuning_job_rest_asyncio_call_success(reques return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_hyperparameter_tuning_job(request) # Establish that the response is the type that we expect. @@ -33767,6 +34003,7 @@ async def test_delete_hyperparameter_tuning_job_rest_asyncio_interceptors( 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.read = mock.AsyncMock(return_value=return_value) @@ -33817,6 +34054,7 @@ async def test_cancel_hyperparameter_tuning_job_rest_asyncio_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"} await client.cancel_hyperparameter_tuning_job(request) @@ -33856,6 +34094,7 @@ async def test_cancel_hyperparameter_tuning_job_rest_asyncio_call_success(reques return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.cancel_hyperparameter_tuning_job(request) # Establish that the response is the type that we expect. @@ -33900,6 +34139,7 @@ async def test_cancel_hyperparameter_tuning_job_rest_asyncio_interceptors( req.return_value = mock.Mock() req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} request = job_service.CancelHyperparameterTuningJobRequest() metadata = [ @@ -33944,6 +34184,7 @@ async def test_create_nas_job_rest_asyncio_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"} await client.create_nas_job(request) @@ -34191,6 +34432,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.create_nas_job(request) # Establish that the response is the type that we expect. @@ -34241,6 +34483,7 @@ async def test_create_nas_job_rest_asyncio_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 = gca_nas_job.NasJob.to_json(gca_nas_job.NasJob()) req.return_value.read = mock.AsyncMock(return_value=return_value) @@ -34289,6 +34532,7 @@ async def test_get_nas_job_rest_asyncio_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"} await client.get_nas_job(request) @@ -34336,6 +34580,7 @@ async def test_get_nas_job_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_nas_job(request) # Establish that the response is the type that we expect. @@ -34384,6 +34629,7 @@ async def test_get_nas_job_rest_asyncio_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 = nas_job.NasJob.to_json(nas_job.NasJob()) req.return_value.read = mock.AsyncMock(return_value=return_value) @@ -34432,6 +34678,7 @@ async def test_list_nas_jobs_rest_asyncio_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"} await client.list_nas_jobs(request) @@ -34474,6 +34721,7 @@ async def test_list_nas_jobs_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_nas_jobs(request) # Establish that the response is the type that we expect. @@ -34517,6 +34765,7 @@ async def test_list_nas_jobs_rest_asyncio_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 = job_service.ListNasJobsResponse.to_json( job_service.ListNasJobsResponse() ) @@ -34567,6 +34816,7 @@ async def test_delete_nas_job_rest_asyncio_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"} await client.delete_nas_job(request) @@ -34604,6 +34854,7 @@ async def test_delete_nas_job_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_nas_job(request) # Establish that the response is the type that we expect. @@ -34650,6 +34901,7 @@ async def test_delete_nas_job_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -34698,6 +34950,7 @@ async def test_cancel_nas_job_rest_asyncio_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"} await client.cancel_nas_job(request) @@ -34735,6 +34988,7 @@ async def test_cancel_nas_job_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.cancel_nas_job(request) # Establish that the response is the type that we expect. @@ -34776,6 +35030,7 @@ async def test_cancel_nas_job_rest_asyncio_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 = job_service.CancelNasJobRequest() metadata = [ @@ -34822,6 +35077,7 @@ async def test_get_nas_trial_detail_rest_asyncio_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"} await client.get_nas_trial_detail(request) @@ -34867,6 +35123,7 @@ async def test_get_nas_trial_detail_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_nas_trial_detail(request) # Establish that the response is the type that we expect. @@ -34913,6 +35170,7 @@ async def test_get_nas_trial_detail_rest_asyncio_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 = nas_job.NasTrialDetail.to_json(nas_job.NasTrialDetail()) req.return_value.read = mock.AsyncMock(return_value=return_value) @@ -34961,6 +35219,7 @@ async def test_list_nas_trial_details_rest_asyncio_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"} await client.list_nas_trial_details(request) @@ -35003,6 +35262,7 @@ async def test_list_nas_trial_details_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_nas_trial_details(request) # Establish that the response is the type that we expect. @@ -35048,6 +35308,7 @@ async def test_list_nas_trial_details_rest_asyncio_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 = job_service.ListNasTrialDetailsResponse.to_json( job_service.ListNasTrialDetailsResponse() ) @@ -35098,6 +35359,7 @@ async def test_create_batch_prediction_job_rest_asyncio_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"} await client.create_batch_prediction_job(request) @@ -35362,6 +35624,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.create_batch_prediction_job(request) # Establish that the response is the type that we expect. @@ -35416,6 +35679,7 @@ async def test_create_batch_prediction_job_rest_asyncio_interceptors(null_interc 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 = gca_batch_prediction_job.BatchPredictionJob.to_json( gca_batch_prediction_job.BatchPredictionJob() ) @@ -35468,6 +35732,7 @@ async def test_get_batch_prediction_job_rest_asyncio_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"} await client.get_batch_prediction_job(request) @@ -35521,6 +35786,7 @@ async def test_get_batch_prediction_job_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_batch_prediction_job(request) # Establish that the response is the type that we expect. @@ -35575,6 +35841,7 @@ async def test_get_batch_prediction_job_rest_asyncio_interceptors(null_intercept 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 = batch_prediction_job.BatchPredictionJob.to_json( batch_prediction_job.BatchPredictionJob() ) @@ -35625,6 +35892,7 @@ async def test_list_batch_prediction_jobs_rest_asyncio_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"} await client.list_batch_prediction_jobs(request) @@ -35667,6 +35935,7 @@ async def test_list_batch_prediction_jobs_rest_asyncio_call_success(request_type return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_batch_prediction_jobs(request) # Establish that the response is the type that we expect. @@ -35712,6 +35981,7 @@ async def test_list_batch_prediction_jobs_rest_asyncio_interceptors(null_interce 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 = job_service.ListBatchPredictionJobsResponse.to_json( job_service.ListBatchPredictionJobsResponse() ) @@ -35764,6 +36034,7 @@ async def test_delete_batch_prediction_job_rest_asyncio_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"} await client.delete_batch_prediction_job(request) @@ -35803,6 +36074,7 @@ async def test_delete_batch_prediction_job_rest_asyncio_call_success(request_typ return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_batch_prediction_job(request) # Establish that the response is the type that we expect. @@ -35849,6 +36121,7 @@ async def test_delete_batch_prediction_job_rest_asyncio_interceptors(null_interc 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.read = mock.AsyncMock(return_value=return_value) @@ -35899,6 +36172,7 @@ async def test_cancel_batch_prediction_job_rest_asyncio_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"} await client.cancel_batch_prediction_job(request) @@ -35938,6 +36212,7 @@ async def test_cancel_batch_prediction_job_rest_asyncio_call_success(request_typ return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.cancel_batch_prediction_job(request) # Establish that the response is the type that we expect. @@ -35979,6 +36254,7 @@ async def test_cancel_batch_prediction_job_rest_asyncio_interceptors(null_interc req.return_value = mock.Mock() req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} request = job_service.CancelBatchPredictionJobRequest() metadata = [ @@ -36023,6 +36299,7 @@ async def test_create_model_deployment_monitoring_job_rest_asyncio_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"} await client.create_model_deployment_monitoring_job(request) @@ -36254,6 +36531,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.create_model_deployment_monitoring_job(request) # Establish that the response is the type that we expect. @@ -36317,6 +36595,7 @@ async def test_create_model_deployment_monitoring_job_rest_asyncio_interceptors( 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 = ( gca_model_deployment_monitoring_job.ModelDeploymentMonitoringJob.to_json( gca_model_deployment_monitoring_job.ModelDeploymentMonitoringJob() @@ -36373,6 +36652,7 @@ async def test_search_model_deployment_monitoring_stats_anomalies_rest_asyncio_b 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"} await client.search_model_deployment_monitoring_stats_anomalies(request) @@ -36425,6 +36705,7 @@ async def test_search_model_deployment_monitoring_stats_anomalies_rest_asyncio_c return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.search_model_deployment_monitoring_stats_anomalies( request ) @@ -36480,6 +36761,7 @@ async def test_search_model_deployment_monitoring_stats_anomalies_rest_asyncio_i 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 = ( job_service.SearchModelDeploymentMonitoringStatsAnomaliesResponse.to_json( job_service.SearchModelDeploymentMonitoringStatsAnomaliesResponse() @@ -36536,6 +36818,7 @@ async def test_get_model_deployment_monitoring_job_rest_asyncio_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"} await client.get_model_deployment_monitoring_job(request) @@ -36593,6 +36876,7 @@ async def test_get_model_deployment_monitoring_job_rest_asyncio_call_success( return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_model_deployment_monitoring_job(request) # Establish that the response is the type that we expect. @@ -36656,6 +36940,7 @@ async def test_get_model_deployment_monitoring_job_rest_asyncio_interceptors( 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 = ( model_deployment_monitoring_job.ModelDeploymentMonitoringJob.to_json( model_deployment_monitoring_job.ModelDeploymentMonitoringJob() @@ -36710,6 +36995,7 @@ async def test_list_model_deployment_monitoring_jobs_rest_asyncio_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"} await client.list_model_deployment_monitoring_jobs(request) @@ -36756,6 +37042,7 @@ async def test_list_model_deployment_monitoring_jobs_rest_asyncio_call_success( return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_model_deployment_monitoring_jobs(request) # Establish that the response is the type that we expect. @@ -36805,6 +37092,7 @@ async def test_list_model_deployment_monitoring_jobs_rest_asyncio_interceptors( 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 = job_service.ListModelDeploymentMonitoringJobsResponse.to_json( job_service.ListModelDeploymentMonitoringJobsResponse() ) @@ -36859,6 +37147,7 @@ async def test_update_model_deployment_monitoring_job_rest_asyncio_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"} await client.update_model_deployment_monitoring_job(request) @@ -37076,6 +37365,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.update_model_deployment_monitoring_job(request) # Establish that the response is the type that we expect. @@ -37126,6 +37416,7 @@ async def test_update_model_deployment_monitoring_job_rest_asyncio_interceptors( 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.read = mock.AsyncMock(return_value=return_value) @@ -37176,6 +37467,7 @@ async def test_delete_model_deployment_monitoring_job_rest_asyncio_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"} await client.delete_model_deployment_monitoring_job(request) @@ -37217,6 +37509,7 @@ async def test_delete_model_deployment_monitoring_job_rest_asyncio_call_success( return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_model_deployment_monitoring_job(request) # Establish that the response is the type that we expect. @@ -37267,6 +37560,7 @@ async def test_delete_model_deployment_monitoring_job_rest_asyncio_interceptors( 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.read = mock.AsyncMock(return_value=return_value) @@ -37317,6 +37611,7 @@ async def test_pause_model_deployment_monitoring_job_rest_asyncio_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"} await client.pause_model_deployment_monitoring_job(request) @@ -37358,6 +37653,7 @@ async def test_pause_model_deployment_monitoring_job_rest_asyncio_call_success( return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.pause_model_deployment_monitoring_job(request) # Establish that the response is the type that we expect. @@ -37402,6 +37698,7 @@ async def test_pause_model_deployment_monitoring_job_rest_asyncio_interceptors( req.return_value = mock.Mock() req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} request = job_service.PauseModelDeploymentMonitoringJobRequest() metadata = [ @@ -37448,6 +37745,7 @@ async def test_resume_model_deployment_monitoring_job_rest_asyncio_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"} await client.resume_model_deployment_monitoring_job(request) @@ -37489,6 +37787,7 @@ async def test_resume_model_deployment_monitoring_job_rest_asyncio_call_success( return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.resume_model_deployment_monitoring_job(request) # Establish that the response is the type that we expect. @@ -37533,6 +37832,7 @@ async def test_resume_model_deployment_monitoring_job_rest_asyncio_interceptors( req.return_value = mock.Mock() req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} request = job_service.ResumeModelDeploymentMonitoringJobRequest() metadata = [ @@ -37579,6 +37879,7 @@ async def test_get_location_rest_asyncio_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"} await client.get_location(request) @@ -37616,6 +37917,7 @@ async def test_get_location_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_location(request) @@ -37648,6 +37950,7 @@ async def test_list_locations_rest_asyncio_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"} await client.list_locations(request) @@ -37685,6 +37988,7 @@ async def test_list_locations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_locations(request) @@ -37720,6 +38024,7 @@ async def test_get_iam_policy_rest_asyncio_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"} await client.get_iam_policy(request) @@ -37759,6 +38064,7 @@ async def test_get_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_iam_policy(request) @@ -37794,6 +38100,7 @@ async def test_set_iam_policy_rest_asyncio_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"} await client.set_iam_policy(request) @@ -37833,6 +38140,7 @@ async def test_set_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.set_iam_policy(request) @@ -37868,6 +38176,7 @@ async def test_test_iam_permissions_rest_asyncio_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"} await client.test_iam_permissions(request) @@ -37907,6 +38216,7 @@ async def test_test_iam_permissions_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.test_iam_permissions(request) @@ -37941,6 +38251,7 @@ async def test_cancel_operation_rest_asyncio_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"} await client.cancel_operation(request) @@ -37978,6 +38289,7 @@ async def test_cancel_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.cancel_operation(request) @@ -38012,6 +38324,7 @@ async def test_delete_operation_rest_asyncio_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"} await client.delete_operation(request) @@ -38049,6 +38362,7 @@ async def test_delete_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_operation(request) @@ -38083,6 +38397,7 @@ async def test_get_operation_rest_asyncio_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"} await client.get_operation(request) @@ -38120,6 +38435,7 @@ async def test_get_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_operation(request) @@ -38154,6 +38470,7 @@ async def test_list_operations_rest_asyncio_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"} await client.list_operations(request) @@ -38191,6 +38508,7 @@ async def test_list_operations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_operations(request) @@ -38225,6 +38543,7 @@ async def test_wait_operation_rest_asyncio_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"} await client.wait_operation(request) @@ -38262,6 +38581,7 @@ async def test_wait_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.wait_operation(request) diff --git a/tests/unit/gapic/aiplatform_v1/test_llm_utility_service.py b/tests/unit/gapic/aiplatform_v1/test_llm_utility_service.py index d8752f15c5..176edc7ead 100644 --- a/tests/unit/gapic/aiplatform_v1/test_llm_utility_service.py +++ b/tests/unit/gapic/aiplatform_v1/test_llm_utility_service.py @@ -1894,6 +1894,7 @@ def test_count_tokens_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.count_tokens(request) @@ -1942,6 +1943,7 @@ def test_count_tokens_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.count_tokens(**mock_args) @@ -2075,6 +2077,7 @@ def test_compute_tokens_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.compute_tokens(request) @@ -2123,6 +2126,7 @@ def test_compute_tokens_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.compute_tokens(**mock_args) @@ -2396,6 +2400,7 @@ def test_count_tokens_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.count_tokens(request) @@ -2432,6 +2437,7 @@ def test_count_tokens_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.count_tokens(request) # Establish that the response is the type that we expect. @@ -2473,6 +2479,7 @@ def test_count_tokens_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 = prediction_service.CountTokensResponse.to_json( prediction_service.CountTokensResponse() ) @@ -2519,6 +2526,7 @@ def test_compute_tokens_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.compute_tokens(request) @@ -2552,6 +2560,7 @@ def test_compute_tokens_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.compute_tokens(request) # Establish that the response is the type that we expect. @@ -2591,6 +2600,7 @@ def test_compute_tokens_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 = llm_utility_service.ComputeTokensResponse.to_json( llm_utility_service.ComputeTokensResponse() ) @@ -2637,6 +2647,7 @@ def test_get_location_rest_bad_request(request_type=locations_pb2.GetLocationReq 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_location(request) @@ -2667,6 +2678,7 @@ def test_get_location_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_location(request) @@ -2695,6 +2707,7 @@ def test_list_locations_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_locations(request) @@ -2725,6 +2738,7 @@ def test_list_locations_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_locations(request) @@ -2756,6 +2770,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -2788,6 +2803,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -2819,6 +2835,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -2851,6 +2868,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -2882,6 +2900,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -2914,6 +2933,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -2944,6 +2964,7 @@ def test_cancel_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.cancel_operation(request) @@ -2974,6 +2995,7 @@ def test_cancel_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.cancel_operation(request) @@ -3004,6 +3026,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) @@ -3034,6 +3057,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) @@ -3064,6 +3088,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) @@ -3094,6 +3119,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) @@ -3124,6 +3150,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) @@ -3154,6 +3181,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) @@ -3184,6 +3212,7 @@ def test_wait_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.wait_operation(request) @@ -3214,6 +3243,7 @@ def test_wait_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.wait_operation(request) @@ -3304,6 +3334,7 @@ async def test_count_tokens_rest_asyncio_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"} await client.count_tokens(request) @@ -3347,6 +3378,7 @@ async def test_count_tokens_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.count_tokens(request) # Establish that the response is the type that we expect. @@ -3393,6 +3425,7 @@ async def test_count_tokens_rest_asyncio_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 = prediction_service.CountTokensResponse.to_json( prediction_service.CountTokensResponse() ) @@ -3443,6 +3476,7 @@ async def test_compute_tokens_rest_asyncio_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"} await client.compute_tokens(request) @@ -3483,6 +3517,7 @@ async def test_compute_tokens_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.compute_tokens(request) # Establish that the response is the type that we expect. @@ -3527,6 +3562,7 @@ async def test_compute_tokens_rest_asyncio_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 = llm_utility_service.ComputeTokensResponse.to_json( llm_utility_service.ComputeTokensResponse() ) @@ -3579,6 +3615,7 @@ async def test_get_location_rest_asyncio_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"} await client.get_location(request) @@ -3616,6 +3653,7 @@ async def test_get_location_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_location(request) @@ -3648,6 +3686,7 @@ async def test_list_locations_rest_asyncio_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"} await client.list_locations(request) @@ -3685,6 +3724,7 @@ async def test_list_locations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_locations(request) @@ -3720,6 +3760,7 @@ async def test_get_iam_policy_rest_asyncio_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"} await client.get_iam_policy(request) @@ -3759,6 +3800,7 @@ async def test_get_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_iam_policy(request) @@ -3794,6 +3836,7 @@ async def test_set_iam_policy_rest_asyncio_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"} await client.set_iam_policy(request) @@ -3833,6 +3876,7 @@ async def test_set_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.set_iam_policy(request) @@ -3868,6 +3912,7 @@ async def test_test_iam_permissions_rest_asyncio_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"} await client.test_iam_permissions(request) @@ -3907,6 +3952,7 @@ async def test_test_iam_permissions_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.test_iam_permissions(request) @@ -3941,6 +3987,7 @@ async def test_cancel_operation_rest_asyncio_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"} await client.cancel_operation(request) @@ -3978,6 +4025,7 @@ async def test_cancel_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.cancel_operation(request) @@ -4012,6 +4060,7 @@ async def test_delete_operation_rest_asyncio_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"} await client.delete_operation(request) @@ -4049,6 +4098,7 @@ async def test_delete_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_operation(request) @@ -4083,6 +4133,7 @@ async def test_get_operation_rest_asyncio_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"} await client.get_operation(request) @@ -4120,6 +4171,7 @@ async def test_get_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_operation(request) @@ -4154,6 +4206,7 @@ async def test_list_operations_rest_asyncio_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"} await client.list_operations(request) @@ -4191,6 +4244,7 @@ async def test_list_operations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_operations(request) @@ -4225,6 +4279,7 @@ async def test_wait_operation_rest_asyncio_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"} await client.wait_operation(request) @@ -4262,6 +4317,7 @@ async def test_wait_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.wait_operation(request) diff --git a/tests/unit/gapic/aiplatform_v1/test_match_service.py b/tests/unit/gapic/aiplatform_v1/test_match_service.py index 60fd94e88b..7e5c7159db 100644 --- a/tests/unit/gapic/aiplatform_v1/test_match_service.py +++ b/tests/unit/gapic/aiplatform_v1/test_match_service.py @@ -1645,6 +1645,7 @@ def test_find_neighbors_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.find_neighbors(request) @@ -1770,6 +1771,7 @@ def test_read_index_datapoints_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.read_index_datapoints(request) @@ -2033,6 +2035,7 @@ def test_find_neighbors_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.find_neighbors(request) @@ -2068,6 +2071,7 @@ def test_find_neighbors_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.find_neighbors(request) # Establish that the response is the type that we expect. @@ -2107,6 +2111,7 @@ def test_find_neighbors_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 = match_service.FindNeighborsResponse.to_json( match_service.FindNeighborsResponse() ) @@ -2155,6 +2160,7 @@ def test_read_index_datapoints_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.read_index_datapoints(request) @@ -2190,6 +2196,7 @@ def test_read_index_datapoints_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.read_index_datapoints(request) # Establish that the response is the type that we expect. @@ -2229,6 +2236,7 @@ def test_read_index_datapoints_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 = match_service.ReadIndexDatapointsResponse.to_json( match_service.ReadIndexDatapointsResponse() ) @@ -2275,6 +2283,7 @@ def test_get_location_rest_bad_request(request_type=locations_pb2.GetLocationReq 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_location(request) @@ -2305,6 +2314,7 @@ def test_get_location_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_location(request) @@ -2333,6 +2343,7 @@ def test_list_locations_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_locations(request) @@ -2363,6 +2374,7 @@ def test_list_locations_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_locations(request) @@ -2394,6 +2406,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -2426,6 +2439,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -2457,6 +2471,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -2489,6 +2504,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -2520,6 +2536,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -2552,6 +2569,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -2582,6 +2600,7 @@ def test_cancel_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.cancel_operation(request) @@ -2612,6 +2631,7 @@ def test_cancel_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.cancel_operation(request) @@ -2642,6 +2662,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) @@ -2672,6 +2693,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) @@ -2702,6 +2724,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) @@ -2732,6 +2755,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) @@ -2762,6 +2786,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) @@ -2792,6 +2817,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) @@ -2822,6 +2848,7 @@ def test_wait_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.wait_operation(request) @@ -2852,6 +2879,7 @@ def test_wait_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.wait_operation(request) @@ -2946,6 +2974,7 @@ async def test_find_neighbors_rest_asyncio_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"} await client.find_neighbors(request) @@ -2988,6 +3017,7 @@ async def test_find_neighbors_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.find_neighbors(request) # Establish that the response is the type that we expect. @@ -3032,6 +3062,7 @@ async def test_find_neighbors_rest_asyncio_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 = match_service.FindNeighborsResponse.to_json( match_service.FindNeighborsResponse() ) @@ -3084,6 +3115,7 @@ async def test_read_index_datapoints_rest_asyncio_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"} await client.read_index_datapoints(request) @@ -3126,6 +3158,7 @@ async def test_read_index_datapoints_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.read_index_datapoints(request) # Establish that the response is the type that we expect. @@ -3170,6 +3203,7 @@ async def test_read_index_datapoints_rest_asyncio_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 = match_service.ReadIndexDatapointsResponse.to_json( match_service.ReadIndexDatapointsResponse() ) @@ -3222,6 +3256,7 @@ async def test_get_location_rest_asyncio_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"} await client.get_location(request) @@ -3259,6 +3294,7 @@ async def test_get_location_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_location(request) @@ -3291,6 +3327,7 @@ async def test_list_locations_rest_asyncio_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"} await client.list_locations(request) @@ -3328,6 +3365,7 @@ async def test_list_locations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_locations(request) @@ -3363,6 +3401,7 @@ async def test_get_iam_policy_rest_asyncio_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"} await client.get_iam_policy(request) @@ -3402,6 +3441,7 @@ async def test_get_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_iam_policy(request) @@ -3437,6 +3477,7 @@ async def test_set_iam_policy_rest_asyncio_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"} await client.set_iam_policy(request) @@ -3476,6 +3517,7 @@ async def test_set_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.set_iam_policy(request) @@ -3511,6 +3553,7 @@ async def test_test_iam_permissions_rest_asyncio_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"} await client.test_iam_permissions(request) @@ -3550,6 +3593,7 @@ async def test_test_iam_permissions_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.test_iam_permissions(request) @@ -3584,6 +3628,7 @@ async def test_cancel_operation_rest_asyncio_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"} await client.cancel_operation(request) @@ -3621,6 +3666,7 @@ async def test_cancel_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.cancel_operation(request) @@ -3655,6 +3701,7 @@ async def test_delete_operation_rest_asyncio_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"} await client.delete_operation(request) @@ -3692,6 +3739,7 @@ async def test_delete_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_operation(request) @@ -3726,6 +3774,7 @@ async def test_get_operation_rest_asyncio_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"} await client.get_operation(request) @@ -3763,6 +3812,7 @@ async def test_get_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_operation(request) @@ -3797,6 +3847,7 @@ async def test_list_operations_rest_asyncio_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"} await client.list_operations(request) @@ -3834,6 +3885,7 @@ async def test_list_operations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_operations(request) @@ -3868,6 +3920,7 @@ async def test_wait_operation_rest_asyncio_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"} await client.wait_operation(request) @@ -3905,6 +3958,7 @@ async def test_wait_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.wait_operation(request) diff --git a/tests/unit/gapic/aiplatform_v1/test_metadata_service.py b/tests/unit/gapic/aiplatform_v1/test_metadata_service.py index 3bf48dfe8b..982f2581f2 100644 --- a/tests/unit/gapic/aiplatform_v1/test_metadata_service.py +++ b/tests/unit/gapic/aiplatform_v1/test_metadata_service.py @@ -13309,6 +13309,7 @@ def test_create_metadata_store_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_metadata_store(request) @@ -13362,6 +13363,7 @@ def test_create_metadata_store_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_metadata_store(**mock_args) @@ -13499,6 +13501,7 @@ def test_get_metadata_store_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_metadata_store(request) @@ -13546,6 +13549,7 @@ def test_get_metadata_store_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_metadata_store(**mock_args) @@ -13688,6 +13692,7 @@ def test_list_metadata_stores_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_metadata_stores(request) @@ -13741,6 +13746,7 @@ def test_list_metadata_stores_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_metadata_stores(**mock_args) @@ -13943,6 +13949,7 @@ def test_delete_metadata_store_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_metadata_store(request) @@ -13988,6 +13995,7 @@ def test_delete_metadata_store_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_metadata_store(**mock_args) @@ -14122,6 +14130,7 @@ def test_create_artifact_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_artifact(request) @@ -14179,6 +14188,7 @@ def test_create_artifact_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_artifact(**mock_args) @@ -14312,6 +14322,7 @@ def test_get_artifact_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_artifact(request) @@ -14359,6 +14370,7 @@ def test_get_artifact_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_artifact(**mock_args) @@ -14499,6 +14511,7 @@ def test_list_artifacts_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_artifacts(request) @@ -14556,6 +14569,7 @@ def test_list_artifacts_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_artifacts(**mock_args) @@ -14755,6 +14769,7 @@ def test_update_artifact_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_artifact(request) @@ -14813,6 +14828,7 @@ def test_update_artifact_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_artifact(**mock_args) @@ -14948,6 +14964,7 @@ def test_delete_artifact_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_artifact(request) @@ -14993,6 +15010,7 @@ def test_delete_artifact_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_artifact(**mock_args) @@ -15130,6 +15148,7 @@ def test_purge_artifacts_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.purge_artifacts(request) @@ -15183,6 +15202,7 @@ def test_purge_artifacts_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.purge_artifacts(**mock_args) @@ -15317,6 +15337,7 @@ def test_create_context_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_context(request) @@ -15374,6 +15395,7 @@ def test_create_context_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_context(**mock_args) @@ -15507,6 +15529,7 @@ def test_get_context_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_context(request) @@ -15554,6 +15577,7 @@ def test_get_context_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_context(**mock_args) @@ -15694,6 +15718,7 @@ def test_list_contexts_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_contexts(request) @@ -15751,6 +15776,7 @@ def test_list_contexts_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_contexts(**mock_args) @@ -15950,6 +15976,7 @@ def test_update_context_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_context(request) @@ -16008,6 +16035,7 @@ def test_update_context_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_context(**mock_args) @@ -16148,6 +16176,7 @@ def test_delete_context_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_context(request) @@ -16201,6 +16230,7 @@ def test_delete_context_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_context(**mock_args) @@ -16338,6 +16368,7 @@ def test_purge_contexts_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.purge_contexts(request) @@ -16391,6 +16422,7 @@ def test_purge_contexts_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.purge_contexts(**mock_args) @@ -16530,6 +16562,7 @@ def test_add_context_artifacts_and_executions_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.add_context_artifacts_and_executions(request) @@ -16583,6 +16616,7 @@ def test_add_context_artifacts_and_executions_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.add_context_artifacts_and_executions(**mock_args) @@ -16723,6 +16757,7 @@ def test_add_context_children_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.add_context_children(request) @@ -16771,6 +16806,7 @@ def test_add_context_children_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.add_context_children(**mock_args) @@ -16911,6 +16947,7 @@ def test_remove_context_children_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.remove_context_children(request) @@ -16959,6 +16996,7 @@ def test_remove_context_children_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.remove_context_children(**mock_args) @@ -17096,6 +17134,7 @@ def test_query_context_lineage_subgraph_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.query_context_lineage_subgraph(request) @@ -17145,6 +17184,7 @@ def test_query_context_lineage_subgraph_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.query_context_lineage_subgraph(**mock_args) @@ -17281,6 +17321,7 @@ def test_create_execution_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_execution(request) @@ -17338,6 +17379,7 @@ def test_create_execution_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_execution(**mock_args) @@ -17471,6 +17513,7 @@ def test_get_execution_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_execution(request) @@ -17518,6 +17561,7 @@ def test_get_execution_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_execution(**mock_args) @@ -17658,6 +17702,7 @@ def test_list_executions_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_executions(request) @@ -17715,6 +17760,7 @@ def test_list_executions_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_executions(**mock_args) @@ -17916,6 +17962,7 @@ def test_update_execution_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_execution(request) @@ -17974,6 +18021,7 @@ def test_update_execution_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_execution(**mock_args) @@ -18111,6 +18159,7 @@ def test_delete_execution_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_execution(request) @@ -18156,6 +18205,7 @@ def test_delete_execution_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_execution(**mock_args) @@ -18295,6 +18345,7 @@ def test_purge_executions_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.purge_executions(request) @@ -18348,6 +18399,7 @@ def test_purge_executions_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.purge_executions(**mock_args) @@ -18484,6 +18536,7 @@ def test_add_execution_events_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.add_execution_events(request) @@ -18532,6 +18585,7 @@ def test_add_execution_events_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.add_execution_events(**mock_args) @@ -18669,6 +18723,7 @@ def test_query_execution_inputs_and_outputs_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.query_execution_inputs_and_outputs(request) @@ -18718,6 +18773,7 @@ def test_query_execution_inputs_and_outputs_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.query_execution_inputs_and_outputs(**mock_args) @@ -18859,6 +18915,7 @@ def test_create_metadata_schema_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_metadata_schema(request) @@ -18916,6 +18973,7 @@ def test_create_metadata_schema_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_metadata_schema(**mock_args) @@ -19053,6 +19111,7 @@ def test_get_metadata_schema_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_metadata_schema(request) @@ -19100,6 +19159,7 @@ def test_get_metadata_schema_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_metadata_schema(**mock_args) @@ -19244,6 +19304,7 @@ def test_list_metadata_schemas_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_metadata_schemas(request) @@ -19300,6 +19361,7 @@ def test_list_metadata_schemas_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_metadata_schemas(**mock_args) @@ -19508,6 +19570,7 @@ def test_query_artifact_lineage_subgraph_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.query_artifact_lineage_subgraph(request) @@ -19565,6 +19628,7 @@ def test_query_artifact_lineage_subgraph_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.query_artifact_lineage_subgraph(**mock_args) @@ -21370,6 +21434,7 @@ def test_create_metadata_store_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_metadata_store(request) @@ -21478,6 +21543,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_metadata_store(request) # Establish that the response is the type that we expect. @@ -21519,6 +21585,7 @@ def test_create_metadata_store_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 @@ -21563,6 +21630,7 @@ def test_get_metadata_store_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_metadata_store(request) @@ -21599,6 +21667,7 @@ def test_get_metadata_store_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_metadata_store(request) # Establish that the response is the type that we expect. @@ -21640,6 +21709,7 @@ def test_get_metadata_store_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 = metadata_store.MetadataStore.to_json( metadata_store.MetadataStore() ) @@ -21686,6 +21756,7 @@ def test_list_metadata_stores_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_metadata_stores(request) @@ -21721,6 +21792,7 @@ def test_list_metadata_stores_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_metadata_stores(request) # Establish that the response is the type that we expect. @@ -21761,6 +21833,7 @@ def test_list_metadata_stores_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 = metadata_service.ListMetadataStoresResponse.to_json( metadata_service.ListMetadataStoresResponse() ) @@ -21807,6 +21880,7 @@ def test_delete_metadata_store_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_metadata_store(request) @@ -21837,6 +21911,7 @@ def test_delete_metadata_store_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_metadata_store(request) # Establish that the response is the type that we expect. @@ -21878,6 +21953,7 @@ def test_delete_metadata_store_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 @@ -21924,6 +22000,7 @@ def test_create_artifact_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_artifact(request) @@ -22049,6 +22126,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_artifact(request) # Establish that the response is the type that we expect. @@ -22096,6 +22174,7 @@ def test_create_artifact_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 = gca_artifact.Artifact.to_json(gca_artifact.Artifact()) req.return_value.content = return_value @@ -22142,6 +22221,7 @@ def test_get_artifact_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_artifact(request) @@ -22186,6 +22266,7 @@ def test_get_artifact_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_artifact(request) # Establish that the response is the type that we expect. @@ -22233,6 +22314,7 @@ def test_get_artifact_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 = artifact.Artifact.to_json(artifact.Artifact()) req.return_value.content = return_value @@ -22279,6 +22361,7 @@ def test_list_artifacts_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_artifacts(request) @@ -22316,6 +22399,7 @@ def test_list_artifacts_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_artifacts(request) # Establish that the response is the type that we expect. @@ -22356,6 +22440,7 @@ def test_list_artifacts_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 = metadata_service.ListArtifactsResponse.to_json( metadata_service.ListArtifactsResponse() ) @@ -22406,6 +22491,7 @@ def test_update_artifact_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_artifact(request) @@ -22533,6 +22619,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_artifact(request) # Establish that the response is the type that we expect. @@ -22580,6 +22667,7 @@ def test_update_artifact_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 = gca_artifact.Artifact.to_json(gca_artifact.Artifact()) req.return_value.content = return_value @@ -22626,6 +22714,7 @@ def test_delete_artifact_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_artifact(request) @@ -22658,6 +22747,7 @@ def test_delete_artifact_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_artifact(request) # Establish that the response is the type that we expect. @@ -22699,6 +22789,7 @@ def test_delete_artifact_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 @@ -22745,6 +22836,7 @@ def test_purge_artifacts_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.purge_artifacts(request) @@ -22777,6 +22869,7 @@ def test_purge_artifacts_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.purge_artifacts(request) # Establish that the response is the type that we expect. @@ -22818,6 +22911,7 @@ def test_purge_artifacts_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 @@ -22864,6 +22958,7 @@ def test_create_context_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_context(request) @@ -22987,6 +23082,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_context(request) # Establish that the response is the type that we expect. @@ -23033,6 +23129,7 @@ def test_create_context_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 = gca_context.Context.to_json(gca_context.Context()) req.return_value.content = return_value @@ -23077,6 +23174,7 @@ def test_get_context_rest_bad_request(request_type=metadata_service.GetContextRe 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_context(request) @@ -23120,6 +23218,7 @@ def test_get_context_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_context(request) # Establish that the response is the type that we expect. @@ -23166,6 +23265,7 @@ def test_get_context_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 = context.Context.to_json(context.Context()) req.return_value.content = return_value @@ -23212,6 +23312,7 @@ def test_list_contexts_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_contexts(request) @@ -23249,6 +23350,7 @@ def test_list_contexts_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_contexts(request) # Establish that the response is the type that we expect. @@ -23289,6 +23391,7 @@ def test_list_contexts_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 = metadata_service.ListContextsResponse.to_json( metadata_service.ListContextsResponse() ) @@ -23339,6 +23442,7 @@ def test_update_context_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_context(request) @@ -23464,6 +23568,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_context(request) # Establish that the response is the type that we expect. @@ -23510,6 +23615,7 @@ def test_update_context_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 = gca_context.Context.to_json(gca_context.Context()) req.return_value.content = return_value @@ -23556,6 +23662,7 @@ def test_delete_context_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_context(request) @@ -23588,6 +23695,7 @@ def test_delete_context_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_context(request) # Establish that the response is the type that we expect. @@ -23629,6 +23737,7 @@ def test_delete_context_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 @@ -23675,6 +23784,7 @@ def test_purge_contexts_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.purge_contexts(request) @@ -23707,6 +23817,7 @@ def test_purge_contexts_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.purge_contexts(request) # Establish that the response is the type that we expect. @@ -23748,6 +23859,7 @@ def test_purge_contexts_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 @@ -23794,6 +23906,7 @@ def test_add_context_artifacts_and_executions_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.add_context_artifacts_and_executions(request) @@ -23831,6 +23944,7 @@ def test_add_context_artifacts_and_executions_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.add_context_artifacts_and_executions(request) # Establish that the response is the type that we expect. @@ -23874,6 +23988,7 @@ def test_add_context_artifacts_and_executions_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 = ( metadata_service.AddContextArtifactsAndExecutionsResponse.to_json( metadata_service.AddContextArtifactsAndExecutionsResponse() @@ -23924,6 +24039,7 @@ def test_add_context_children_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.add_context_children(request) @@ -23959,6 +24075,7 @@ def test_add_context_children_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.add_context_children(request) # Establish that the response is the type that we expect. @@ -23998,6 +24115,7 @@ def test_add_context_children_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 = metadata_service.AddContextChildrenResponse.to_json( metadata_service.AddContextChildrenResponse() ) @@ -24046,6 +24164,7 @@ def test_remove_context_children_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.remove_context_children(request) @@ -24081,6 +24200,7 @@ def test_remove_context_children_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.remove_context_children(request) # Establish that the response is the type that we expect. @@ -24120,6 +24240,7 @@ def test_remove_context_children_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 = metadata_service.RemoveContextChildrenResponse.to_json( metadata_service.RemoveContextChildrenResponse() ) @@ -24168,6 +24289,7 @@ def test_query_context_lineage_subgraph_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.query_context_lineage_subgraph(request) @@ -24203,6 +24325,7 @@ def test_query_context_lineage_subgraph_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.query_context_lineage_subgraph(request) # Establish that the response is the type that we expect. @@ -24242,6 +24365,7 @@ def test_query_context_lineage_subgraph_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 = lineage_subgraph.LineageSubgraph.to_json( lineage_subgraph.LineageSubgraph() ) @@ -24290,6 +24414,7 @@ def test_create_execution_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_execution(request) @@ -24413,6 +24538,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_execution(request) # Establish that the response is the type that we expect. @@ -24459,6 +24585,7 @@ def test_create_execution_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 = gca_execution.Execution.to_json(gca_execution.Execution()) req.return_value.content = return_value @@ -24505,6 +24632,7 @@ def test_get_execution_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_execution(request) @@ -24548,6 +24676,7 @@ def test_get_execution_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_execution(request) # Establish that the response is the type that we expect. @@ -24594,6 +24723,7 @@ def test_get_execution_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 = execution.Execution.to_json(execution.Execution()) req.return_value.content = return_value @@ -24640,6 +24770,7 @@ def test_list_executions_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_executions(request) @@ -24677,6 +24808,7 @@ def test_list_executions_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_executions(request) # Establish that the response is the type that we expect. @@ -24717,6 +24849,7 @@ def test_list_executions_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 = metadata_service.ListExecutionsResponse.to_json( metadata_service.ListExecutionsResponse() ) @@ -24767,6 +24900,7 @@ def test_update_execution_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_execution(request) @@ -24892,6 +25026,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_execution(request) # Establish that the response is the type that we expect. @@ -24938,6 +25073,7 @@ def test_update_execution_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 = gca_execution.Execution.to_json(gca_execution.Execution()) req.return_value.content = return_value @@ -24984,6 +25120,7 @@ def test_delete_execution_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_execution(request) @@ -25016,6 +25153,7 @@ def test_delete_execution_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_execution(request) # Establish that the response is the type that we expect. @@ -25057,6 +25195,7 @@ def test_delete_execution_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 @@ -25103,6 +25242,7 @@ def test_purge_executions_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.purge_executions(request) @@ -25135,6 +25275,7 @@ def test_purge_executions_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.purge_executions(request) # Establish that the response is the type that we expect. @@ -25176,6 +25317,7 @@ def test_purge_executions_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 @@ -25222,6 +25364,7 @@ def test_add_execution_events_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.add_execution_events(request) @@ -25257,6 +25400,7 @@ def test_add_execution_events_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.add_execution_events(request) # Establish that the response is the type that we expect. @@ -25296,6 +25440,7 @@ def test_add_execution_events_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 = metadata_service.AddExecutionEventsResponse.to_json( metadata_service.AddExecutionEventsResponse() ) @@ -25344,6 +25489,7 @@ def test_query_execution_inputs_and_outputs_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.query_execution_inputs_and_outputs(request) @@ -25379,6 +25525,7 @@ def test_query_execution_inputs_and_outputs_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.query_execution_inputs_and_outputs(request) # Establish that the response is the type that we expect. @@ -25420,6 +25567,7 @@ def test_query_execution_inputs_and_outputs_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 = lineage_subgraph.LineageSubgraph.to_json( lineage_subgraph.LineageSubgraph() ) @@ -25468,6 +25616,7 @@ def test_create_metadata_schema_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_metadata_schema(request) @@ -25586,6 +25735,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_metadata_schema(request) # Establish that the response is the type that we expect. @@ -25633,6 +25783,7 @@ def test_create_metadata_schema_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 = gca_metadata_schema.MetadataSchema.to_json( gca_metadata_schema.MetadataSchema() ) @@ -25681,6 +25832,7 @@ def test_get_metadata_schema_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_metadata_schema(request) @@ -25722,6 +25874,7 @@ def test_get_metadata_schema_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_metadata_schema(request) # Establish that the response is the type that we expect. @@ -25769,6 +25922,7 @@ def test_get_metadata_schema_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 = metadata_schema.MetadataSchema.to_json( metadata_schema.MetadataSchema() ) @@ -25817,6 +25971,7 @@ def test_list_metadata_schemas_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_metadata_schemas(request) @@ -25854,6 +26009,7 @@ def test_list_metadata_schemas_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_metadata_schemas(request) # Establish that the response is the type that we expect. @@ -25894,6 +26050,7 @@ def test_list_metadata_schemas_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 = metadata_service.ListMetadataSchemasResponse.to_json( metadata_service.ListMetadataSchemasResponse() ) @@ -25942,6 +26099,7 @@ def test_query_artifact_lineage_subgraph_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.query_artifact_lineage_subgraph(request) @@ -25977,6 +26135,7 @@ def test_query_artifact_lineage_subgraph_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.query_artifact_lineage_subgraph(request) # Establish that the response is the type that we expect. @@ -26017,6 +26176,7 @@ def test_query_artifact_lineage_subgraph_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 = lineage_subgraph.LineageSubgraph.to_json( lineage_subgraph.LineageSubgraph() ) @@ -26063,6 +26223,7 @@ def test_get_location_rest_bad_request(request_type=locations_pb2.GetLocationReq 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_location(request) @@ -26093,6 +26254,7 @@ def test_get_location_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_location(request) @@ -26121,6 +26283,7 @@ def test_list_locations_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_locations(request) @@ -26151,6 +26314,7 @@ def test_list_locations_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_locations(request) @@ -26182,6 +26346,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -26214,6 +26379,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -26245,6 +26411,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -26277,6 +26444,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -26308,6 +26476,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -26340,6 +26509,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -26370,6 +26540,7 @@ def test_cancel_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.cancel_operation(request) @@ -26400,6 +26571,7 @@ def test_cancel_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.cancel_operation(request) @@ -26430,6 +26602,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) @@ -26460,6 +26633,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) @@ -26490,6 +26664,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) @@ -26520,6 +26695,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) @@ -26550,6 +26726,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) @@ -26580,6 +26757,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) @@ -26610,6 +26788,7 @@ def test_wait_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.wait_operation(request) @@ -26640,6 +26819,7 @@ def test_wait_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.wait_operation(request) @@ -27375,6 +27555,7 @@ async def test_create_metadata_store_rest_asyncio_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"} await client.create_metadata_store(request) @@ -27490,6 +27671,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.create_metadata_store(request) # Establish that the response is the type that we expect. @@ -27536,6 +27718,7 @@ async def test_create_metadata_store_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -27584,6 +27767,7 @@ async def test_get_metadata_store_rest_asyncio_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"} await client.get_metadata_store(request) @@ -27627,6 +27811,7 @@ async def test_get_metadata_store_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_metadata_store(request) # Establish that the response is the type that we expect. @@ -27673,6 +27858,7 @@ async def test_get_metadata_store_rest_asyncio_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 = metadata_store.MetadataStore.to_json( metadata_store.MetadataStore() ) @@ -27723,6 +27909,7 @@ async def test_list_metadata_stores_rest_asyncio_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"} await client.list_metadata_stores(request) @@ -27765,6 +27952,7 @@ async def test_list_metadata_stores_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_metadata_stores(request) # Establish that the response is the type that we expect. @@ -27810,6 +27998,7 @@ async def test_list_metadata_stores_rest_asyncio_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 = metadata_service.ListMetadataStoresResponse.to_json( metadata_service.ListMetadataStoresResponse() ) @@ -27860,6 +28049,7 @@ async def test_delete_metadata_store_rest_asyncio_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"} await client.delete_metadata_store(request) @@ -27897,6 +28087,7 @@ async def test_delete_metadata_store_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_metadata_store(request) # Establish that the response is the type that we expect. @@ -27943,6 +28134,7 @@ async def test_delete_metadata_store_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -27993,6 +28185,7 @@ async def test_create_artifact_rest_asyncio_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"} await client.create_artifact(request) @@ -28125,6 +28318,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.create_artifact(request) # Establish that the response is the type that we expect. @@ -28177,6 +28371,7 @@ async def test_create_artifact_rest_asyncio_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 = gca_artifact.Artifact.to_json(gca_artifact.Artifact()) req.return_value.read = mock.AsyncMock(return_value=return_value) @@ -28227,6 +28422,7 @@ async def test_get_artifact_rest_asyncio_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"} await client.get_artifact(request) @@ -28278,6 +28474,7 @@ async def test_get_artifact_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_artifact(request) # Establish that the response is the type that we expect. @@ -28330,6 +28527,7 @@ async def test_get_artifact_rest_asyncio_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 = artifact.Artifact.to_json(artifact.Artifact()) req.return_value.read = mock.AsyncMock(return_value=return_value) @@ -28380,6 +28578,7 @@ async def test_list_artifacts_rest_asyncio_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"} await client.list_artifacts(request) @@ -28424,6 +28623,7 @@ async def test_list_artifacts_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_artifacts(request) # Establish that the response is the type that we expect. @@ -28469,6 +28669,7 @@ async def test_list_artifacts_rest_asyncio_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 = metadata_service.ListArtifactsResponse.to_json( metadata_service.ListArtifactsResponse() ) @@ -28523,6 +28724,7 @@ async def test_update_artifact_rest_asyncio_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"} await client.update_artifact(request) @@ -28657,6 +28859,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.update_artifact(request) # Establish that the response is the type that we expect. @@ -28709,6 +28912,7 @@ async def test_update_artifact_rest_asyncio_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 = gca_artifact.Artifact.to_json(gca_artifact.Artifact()) req.return_value.read = mock.AsyncMock(return_value=return_value) @@ -28759,6 +28963,7 @@ async def test_delete_artifact_rest_asyncio_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"} await client.delete_artifact(request) @@ -28798,6 +29003,7 @@ async def test_delete_artifact_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_artifact(request) # Establish that the response is the type that we expect. @@ -28844,6 +29050,7 @@ async def test_delete_artifact_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -28894,6 +29101,7 @@ async def test_purge_artifacts_rest_asyncio_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"} await client.purge_artifacts(request) @@ -28933,6 +29141,7 @@ async def test_purge_artifacts_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.purge_artifacts(request) # Establish that the response is the type that we expect. @@ -28979,6 +29188,7 @@ async def test_purge_artifacts_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -29029,6 +29239,7 @@ async def test_create_context_rest_asyncio_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"} await client.create_context(request) @@ -29159,6 +29370,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.create_context(request) # Establish that the response is the type that we expect. @@ -29210,6 +29422,7 @@ async def test_create_context_rest_asyncio_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 = gca_context.Context.to_json(gca_context.Context()) req.return_value.read = mock.AsyncMock(return_value=return_value) @@ -29260,6 +29473,7 @@ async def test_get_context_rest_asyncio_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"} await client.get_context(request) @@ -29310,6 +29524,7 @@ async def test_get_context_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_context(request) # Establish that the response is the type that we expect. @@ -29361,6 +29576,7 @@ async def test_get_context_rest_asyncio_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 = context.Context.to_json(context.Context()) req.return_value.read = mock.AsyncMock(return_value=return_value) @@ -29411,6 +29627,7 @@ async def test_list_contexts_rest_asyncio_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"} await client.list_contexts(request) @@ -29455,6 +29672,7 @@ async def test_list_contexts_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_contexts(request) # Establish that the response is the type that we expect. @@ -29500,6 +29718,7 @@ async def test_list_contexts_rest_asyncio_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 = metadata_service.ListContextsResponse.to_json( metadata_service.ListContextsResponse() ) @@ -29554,6 +29773,7 @@ async def test_update_context_rest_asyncio_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"} await client.update_context(request) @@ -29686,6 +29906,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.update_context(request) # Establish that the response is the type that we expect. @@ -29737,6 +29958,7 @@ async def test_update_context_rest_asyncio_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 = gca_context.Context.to_json(gca_context.Context()) req.return_value.read = mock.AsyncMock(return_value=return_value) @@ -29787,6 +30009,7 @@ async def test_delete_context_rest_asyncio_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"} await client.delete_context(request) @@ -29826,6 +30049,7 @@ async def test_delete_context_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_context(request) # Establish that the response is the type that we expect. @@ -29872,6 +30096,7 @@ async def test_delete_context_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -29922,6 +30147,7 @@ async def test_purge_contexts_rest_asyncio_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"} await client.purge_contexts(request) @@ -29961,6 +30187,7 @@ async def test_purge_contexts_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.purge_contexts(request) # Establish that the response is the type that we expect. @@ -30007,6 +30234,7 @@ async def test_purge_contexts_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -30057,6 +30285,7 @@ async def test_add_context_artifacts_and_executions_rest_asyncio_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"} await client.add_context_artifacts_and_executions(request) @@ -30103,6 +30332,7 @@ async def test_add_context_artifacts_and_executions_rest_asyncio_call_success( return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.add_context_artifacts_and_executions(request) # Establish that the response is the type that we expect. @@ -30153,6 +30383,7 @@ async def test_add_context_artifacts_and_executions_rest_asyncio_interceptors( 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 = ( metadata_service.AddContextArtifactsAndExecutionsResponse.to_json( metadata_service.AddContextArtifactsAndExecutionsResponse() @@ -30207,6 +30438,7 @@ async def test_add_context_children_rest_asyncio_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"} await client.add_context_children(request) @@ -30249,6 +30481,7 @@ async def test_add_context_children_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.add_context_children(request) # Establish that the response is the type that we expect. @@ -30293,6 +30526,7 @@ async def test_add_context_children_rest_asyncio_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 = metadata_service.AddContextChildrenResponse.to_json( metadata_service.AddContextChildrenResponse() ) @@ -30345,6 +30579,7 @@ async def test_remove_context_children_rest_asyncio_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"} await client.remove_context_children(request) @@ -30387,6 +30622,7 @@ async def test_remove_context_children_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.remove_context_children(request) # Establish that the response is the type that we expect. @@ -30431,6 +30667,7 @@ async def test_remove_context_children_rest_asyncio_interceptors(null_intercepto 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 = metadata_service.RemoveContextChildrenResponse.to_json( metadata_service.RemoveContextChildrenResponse() ) @@ -30483,6 +30720,7 @@ async def test_query_context_lineage_subgraph_rest_asyncio_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"} await client.query_context_lineage_subgraph(request) @@ -30525,6 +30763,7 @@ async def test_query_context_lineage_subgraph_rest_asyncio_call_success(request_ return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.query_context_lineage_subgraph(request) # Establish that the response is the type that we expect. @@ -30573,6 +30812,7 @@ async def test_query_context_lineage_subgraph_rest_asyncio_interceptors( 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 = lineage_subgraph.LineageSubgraph.to_json( lineage_subgraph.LineageSubgraph() ) @@ -30625,6 +30865,7 @@ async def test_create_execution_rest_asyncio_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"} await client.create_execution(request) @@ -30755,6 +30996,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.create_execution(request) # Establish that the response is the type that we expect. @@ -30806,6 +31048,7 @@ async def test_create_execution_rest_asyncio_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 = gca_execution.Execution.to_json(gca_execution.Execution()) req.return_value.read = mock.AsyncMock(return_value=return_value) @@ -30856,6 +31099,7 @@ async def test_get_execution_rest_asyncio_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"} await client.get_execution(request) @@ -30906,6 +31150,7 @@ async def test_get_execution_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_execution(request) # Establish that the response is the type that we expect. @@ -30957,6 +31202,7 @@ async def test_get_execution_rest_asyncio_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 = execution.Execution.to_json(execution.Execution()) req.return_value.read = mock.AsyncMock(return_value=return_value) @@ -31007,6 +31253,7 @@ async def test_list_executions_rest_asyncio_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"} await client.list_executions(request) @@ -31051,6 +31298,7 @@ async def test_list_executions_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_executions(request) # Establish that the response is the type that we expect. @@ -31096,6 +31344,7 @@ async def test_list_executions_rest_asyncio_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 = metadata_service.ListExecutionsResponse.to_json( metadata_service.ListExecutionsResponse() ) @@ -31150,6 +31399,7 @@ async def test_update_execution_rest_asyncio_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"} await client.update_execution(request) @@ -31282,6 +31532,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.update_execution(request) # Establish that the response is the type that we expect. @@ -31333,6 +31584,7 @@ async def test_update_execution_rest_asyncio_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 = gca_execution.Execution.to_json(gca_execution.Execution()) req.return_value.read = mock.AsyncMock(return_value=return_value) @@ -31383,6 +31635,7 @@ async def test_delete_execution_rest_asyncio_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"} await client.delete_execution(request) @@ -31422,6 +31675,7 @@ async def test_delete_execution_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_execution(request) # Establish that the response is the type that we expect. @@ -31468,6 +31722,7 @@ async def test_delete_execution_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -31518,6 +31773,7 @@ async def test_purge_executions_rest_asyncio_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"} await client.purge_executions(request) @@ -31557,6 +31813,7 @@ async def test_purge_executions_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.purge_executions(request) # Establish that the response is the type that we expect. @@ -31603,6 +31860,7 @@ async def test_purge_executions_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -31653,6 +31911,7 @@ async def test_add_execution_events_rest_asyncio_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"} await client.add_execution_events(request) @@ -31695,6 +31954,7 @@ async def test_add_execution_events_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.add_execution_events(request) # Establish that the response is the type that we expect. @@ -31739,6 +31999,7 @@ async def test_add_execution_events_rest_asyncio_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 = metadata_service.AddExecutionEventsResponse.to_json( metadata_service.AddExecutionEventsResponse() ) @@ -31791,6 +32052,7 @@ async def test_query_execution_inputs_and_outputs_rest_asyncio_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"} await client.query_execution_inputs_and_outputs(request) @@ -31835,6 +32097,7 @@ async def test_query_execution_inputs_and_outputs_rest_asyncio_call_success( return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.query_execution_inputs_and_outputs(request) # Establish that the response is the type that we expect. @@ -31883,6 +32146,7 @@ async def test_query_execution_inputs_and_outputs_rest_asyncio_interceptors( 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 = lineage_subgraph.LineageSubgraph.to_json( lineage_subgraph.LineageSubgraph() ) @@ -31935,6 +32199,7 @@ async def test_create_metadata_schema_rest_asyncio_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"} await client.create_metadata_schema(request) @@ -32060,6 +32325,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.create_metadata_schema(request) # Establish that the response is the type that we expect. @@ -32112,6 +32378,7 @@ async def test_create_metadata_schema_rest_asyncio_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 = gca_metadata_schema.MetadataSchema.to_json( gca_metadata_schema.MetadataSchema() ) @@ -32164,6 +32431,7 @@ async def test_get_metadata_schema_rest_asyncio_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"} await client.get_metadata_schema(request) @@ -32212,6 +32480,7 @@ async def test_get_metadata_schema_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_metadata_schema(request) # Establish that the response is the type that we expect. @@ -32264,6 +32533,7 @@ async def test_get_metadata_schema_rest_asyncio_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 = metadata_schema.MetadataSchema.to_json( metadata_schema.MetadataSchema() ) @@ -32316,6 +32586,7 @@ async def test_list_metadata_schemas_rest_asyncio_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"} await client.list_metadata_schemas(request) @@ -32360,6 +32631,7 @@ async def test_list_metadata_schemas_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_metadata_schemas(request) # Establish that the response is the type that we expect. @@ -32405,6 +32677,7 @@ async def test_list_metadata_schemas_rest_asyncio_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 = metadata_service.ListMetadataSchemasResponse.to_json( metadata_service.ListMetadataSchemasResponse() ) @@ -32457,6 +32730,7 @@ async def test_query_artifact_lineage_subgraph_rest_asyncio_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"} await client.query_artifact_lineage_subgraph(request) @@ -32499,6 +32773,7 @@ async def test_query_artifact_lineage_subgraph_rest_asyncio_call_success(request return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.query_artifact_lineage_subgraph(request) # Establish that the response is the type that we expect. @@ -32547,6 +32822,7 @@ async def test_query_artifact_lineage_subgraph_rest_asyncio_interceptors( 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 = lineage_subgraph.LineageSubgraph.to_json( lineage_subgraph.LineageSubgraph() ) @@ -32599,6 +32875,7 @@ async def test_get_location_rest_asyncio_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"} await client.get_location(request) @@ -32636,6 +32913,7 @@ async def test_get_location_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_location(request) @@ -32668,6 +32946,7 @@ async def test_list_locations_rest_asyncio_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"} await client.list_locations(request) @@ -32705,6 +32984,7 @@ async def test_list_locations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_locations(request) @@ -32740,6 +33020,7 @@ async def test_get_iam_policy_rest_asyncio_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"} await client.get_iam_policy(request) @@ -32779,6 +33060,7 @@ async def test_get_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_iam_policy(request) @@ -32814,6 +33096,7 @@ async def test_set_iam_policy_rest_asyncio_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"} await client.set_iam_policy(request) @@ -32853,6 +33136,7 @@ async def test_set_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.set_iam_policy(request) @@ -32888,6 +33172,7 @@ async def test_test_iam_permissions_rest_asyncio_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"} await client.test_iam_permissions(request) @@ -32927,6 +33212,7 @@ async def test_test_iam_permissions_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.test_iam_permissions(request) @@ -32961,6 +33247,7 @@ async def test_cancel_operation_rest_asyncio_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"} await client.cancel_operation(request) @@ -32998,6 +33285,7 @@ async def test_cancel_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.cancel_operation(request) @@ -33032,6 +33320,7 @@ async def test_delete_operation_rest_asyncio_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"} await client.delete_operation(request) @@ -33069,6 +33358,7 @@ async def test_delete_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_operation(request) @@ -33103,6 +33393,7 @@ async def test_get_operation_rest_asyncio_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"} await client.get_operation(request) @@ -33140,6 +33431,7 @@ async def test_get_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_operation(request) @@ -33174,6 +33466,7 @@ async def test_list_operations_rest_asyncio_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"} await client.list_operations(request) @@ -33211,6 +33504,7 @@ async def test_list_operations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_operations(request) @@ -33245,6 +33539,7 @@ async def test_wait_operation_rest_asyncio_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"} await client.wait_operation(request) @@ -33282,6 +33577,7 @@ async def test_wait_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.wait_operation(request) diff --git a/tests/unit/gapic/aiplatform_v1/test_migration_service.py b/tests/unit/gapic/aiplatform_v1/test_migration_service.py index 3800a89a6c..05a47d20e5 100644 --- a/tests/unit/gapic/aiplatform_v1/test_migration_service.py +++ b/tests/unit/gapic/aiplatform_v1/test_migration_service.py @@ -2170,6 +2170,7 @@ def test_search_migratable_resources_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.search_migratable_resources(request) @@ -2217,6 +2218,7 @@ def test_search_migratable_resources_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.search_migratable_resources(**mock_args) @@ -2421,6 +2423,7 @@ def test_batch_migrate_resources_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.batch_migrate_resources(request) @@ -2479,6 +2482,7 @@ def test_batch_migrate_resources_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.batch_migrate_resources(**mock_args) @@ -2765,6 +2769,7 @@ def test_search_migratable_resources_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.search_migratable_resources(request) @@ -2802,6 +2807,7 @@ def test_search_migratable_resources_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.search_migratable_resources(request) # Establish that the response is the type that we expect. @@ -2842,6 +2848,7 @@ def test_search_migratable_resources_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 = migration_service.SearchMigratableResourcesResponse.to_json( migration_service.SearchMigratableResourcesResponse() ) @@ -2888,6 +2895,7 @@ def test_batch_migrate_resources_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.batch_migrate_resources(request) @@ -2918,6 +2926,7 @@ def test_batch_migrate_resources_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.batch_migrate_resources(request) # Establish that the response is the type that we expect. @@ -2959,6 +2968,7 @@ def test_batch_migrate_resources_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 @@ -3003,6 +3013,7 @@ def test_get_location_rest_bad_request(request_type=locations_pb2.GetLocationReq 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_location(request) @@ -3033,6 +3044,7 @@ def test_get_location_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_location(request) @@ -3061,6 +3073,7 @@ def test_list_locations_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_locations(request) @@ -3091,6 +3104,7 @@ def test_list_locations_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_locations(request) @@ -3122,6 +3136,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -3154,6 +3169,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -3185,6 +3201,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -3217,6 +3234,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -3248,6 +3266,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -3280,6 +3299,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -3310,6 +3330,7 @@ def test_cancel_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.cancel_operation(request) @@ -3340,6 +3361,7 @@ def test_cancel_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.cancel_operation(request) @@ -3370,6 +3392,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) @@ -3400,6 +3423,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) @@ -3430,6 +3454,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) @@ -3460,6 +3485,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) @@ -3490,6 +3516,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) @@ -3520,6 +3547,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) @@ -3550,6 +3578,7 @@ def test_wait_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.wait_operation(request) @@ -3580,6 +3609,7 @@ def test_wait_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.wait_operation(request) @@ -3691,6 +3721,7 @@ async def test_search_migratable_resources_rest_asyncio_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"} await client.search_migratable_resources(request) @@ -3735,6 +3766,7 @@ async def test_search_migratable_resources_rest_asyncio_call_success(request_typ return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.search_migratable_resources(request) # Establish that the response is the type that we expect. @@ -3782,6 +3814,7 @@ async def test_search_migratable_resources_rest_asyncio_interceptors(null_interc 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 = migration_service.SearchMigratableResourcesResponse.to_json( migration_service.SearchMigratableResourcesResponse() ) @@ -3832,6 +3865,7 @@ async def test_batch_migrate_resources_rest_asyncio_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"} await client.batch_migrate_resources(request) @@ -3869,6 +3903,7 @@ async def test_batch_migrate_resources_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.batch_migrate_resources(request) # Establish that the response is the type that we expect. @@ -3915,6 +3950,7 @@ async def test_batch_migrate_resources_rest_asyncio_interceptors(null_intercepto 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.read = mock.AsyncMock(return_value=return_value) @@ -3965,6 +4001,7 @@ async def test_get_location_rest_asyncio_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"} await client.get_location(request) @@ -4002,6 +4039,7 @@ async def test_get_location_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_location(request) @@ -4034,6 +4072,7 @@ async def test_list_locations_rest_asyncio_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"} await client.list_locations(request) @@ -4071,6 +4110,7 @@ async def test_list_locations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_locations(request) @@ -4106,6 +4146,7 @@ async def test_get_iam_policy_rest_asyncio_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"} await client.get_iam_policy(request) @@ -4145,6 +4186,7 @@ async def test_get_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_iam_policy(request) @@ -4180,6 +4222,7 @@ async def test_set_iam_policy_rest_asyncio_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"} await client.set_iam_policy(request) @@ -4219,6 +4262,7 @@ async def test_set_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.set_iam_policy(request) @@ -4254,6 +4298,7 @@ async def test_test_iam_permissions_rest_asyncio_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"} await client.test_iam_permissions(request) @@ -4293,6 +4338,7 @@ async def test_test_iam_permissions_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.test_iam_permissions(request) @@ -4327,6 +4373,7 @@ async def test_cancel_operation_rest_asyncio_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"} await client.cancel_operation(request) @@ -4364,6 +4411,7 @@ async def test_cancel_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.cancel_operation(request) @@ -4398,6 +4446,7 @@ async def test_delete_operation_rest_asyncio_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"} await client.delete_operation(request) @@ -4435,6 +4484,7 @@ async def test_delete_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_operation(request) @@ -4469,6 +4519,7 @@ async def test_get_operation_rest_asyncio_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"} await client.get_operation(request) @@ -4506,6 +4557,7 @@ async def test_get_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_operation(request) @@ -4540,6 +4592,7 @@ async def test_list_operations_rest_asyncio_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"} await client.list_operations(request) @@ -4577,6 +4630,7 @@ async def test_list_operations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_operations(request) @@ -4611,6 +4665,7 @@ async def test_wait_operation_rest_asyncio_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"} await client.wait_operation(request) @@ -4648,6 +4703,7 @@ async def test_wait_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.wait_operation(request) @@ -5261,22 +5317,19 @@ def test_parse_annotated_dataset_path(): def test_dataset_path(): project = "cuttlefish" - location = "mussel" - dataset = "winkle" - expected = "projects/{project}/locations/{location}/datasets/{dataset}".format( + dataset = "mussel" + expected = "projects/{project}/datasets/{dataset}".format( project=project, - location=location, dataset=dataset, ) - actual = MigrationServiceClient.dataset_path(project, location, dataset) + actual = MigrationServiceClient.dataset_path(project, dataset) assert expected == actual def test_parse_dataset_path(): expected = { - "project": "nautilus", - "location": "scallop", - "dataset": "abalone", + "project": "winkle", + "dataset": "nautilus", } path = MigrationServiceClient.dataset_path(**expected) @@ -5286,9 +5339,9 @@ def test_parse_dataset_path(): def test_dataset_path(): - project = "squid" - location = "clam" - dataset = "whelk" + project = "scallop" + location = "abalone" + dataset = "squid" expected = "projects/{project}/locations/{location}/datasets/{dataset}".format( project=project, location=location, @@ -5300,9 +5353,9 @@ def test_dataset_path(): def test_parse_dataset_path(): expected = { - "project": "octopus", - "location": "oyster", - "dataset": "nudibranch", + "project": "clam", + "location": "whelk", + "dataset": "octopus", } path = MigrationServiceClient.dataset_path(**expected) @@ -5312,19 +5365,22 @@ def test_parse_dataset_path(): def test_dataset_path(): - project = "cuttlefish" - dataset = "mussel" - expected = "projects/{project}/datasets/{dataset}".format( + project = "oyster" + location = "nudibranch" + dataset = "cuttlefish" + expected = "projects/{project}/locations/{location}/datasets/{dataset}".format( project=project, + location=location, dataset=dataset, ) - actual = MigrationServiceClient.dataset_path(project, dataset) + actual = MigrationServiceClient.dataset_path(project, location, dataset) assert expected == actual def test_parse_dataset_path(): expected = { - "project": "winkle", + "project": "mussel", + "location": "winkle", "dataset": "nautilus", } path = MigrationServiceClient.dataset_path(**expected) diff --git a/tests/unit/gapic/aiplatform_v1/test_model_garden_service.py b/tests/unit/gapic/aiplatform_v1/test_model_garden_service.py index b4f6acee6b..3bf3db409b 100644 --- a/tests/unit/gapic/aiplatform_v1/test_model_garden_service.py +++ b/tests/unit/gapic/aiplatform_v1/test_model_garden_service.py @@ -1623,6 +1623,7 @@ def test_get_publisher_model_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_publisher_model(request) @@ -1678,6 +1679,7 @@ def test_get_publisher_model_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_publisher_model(**mock_args) @@ -1911,6 +1913,7 @@ def test_get_publisher_model_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_publisher_model(request) @@ -1952,6 +1955,7 @@ def test_get_publisher_model_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_publisher_model(request) # Establish that the response is the type that we expect. @@ -2006,6 +2010,7 @@ def test_get_publisher_model_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 = publisher_model.PublisherModel.to_json( publisher_model.PublisherModel() ) @@ -2052,6 +2057,7 @@ def test_get_location_rest_bad_request(request_type=locations_pb2.GetLocationReq 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_location(request) @@ -2082,6 +2088,7 @@ def test_get_location_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_location(request) @@ -2110,6 +2117,7 @@ def test_list_locations_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_locations(request) @@ -2140,6 +2148,7 @@ def test_list_locations_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_locations(request) @@ -2171,6 +2180,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -2203,6 +2213,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -2234,6 +2245,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -2266,6 +2278,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -2297,6 +2310,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -2329,6 +2343,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -2359,6 +2374,7 @@ def test_cancel_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.cancel_operation(request) @@ -2389,6 +2405,7 @@ def test_cancel_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.cancel_operation(request) @@ -2419,6 +2436,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) @@ -2449,6 +2467,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) @@ -2479,6 +2498,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) @@ -2509,6 +2529,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) @@ -2539,6 +2560,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) @@ -2569,6 +2591,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) @@ -2599,6 +2622,7 @@ def test_wait_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.wait_operation(request) @@ -2629,6 +2653,7 @@ def test_wait_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.wait_operation(request) @@ -2701,6 +2726,7 @@ async def test_get_publisher_model_rest_asyncio_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"} await client.get_publisher_model(request) @@ -2749,6 +2775,7 @@ async def test_get_publisher_model_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_publisher_model(request) # Establish that the response is the type that we expect. @@ -2808,6 +2835,7 @@ async def test_get_publisher_model_rest_asyncio_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 = publisher_model.PublisherModel.to_json( publisher_model.PublisherModel() ) @@ -2860,6 +2888,7 @@ async def test_get_location_rest_asyncio_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"} await client.get_location(request) @@ -2897,6 +2926,7 @@ async def test_get_location_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_location(request) @@ -2929,6 +2959,7 @@ async def test_list_locations_rest_asyncio_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"} await client.list_locations(request) @@ -2966,6 +2997,7 @@ async def test_list_locations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_locations(request) @@ -3001,6 +3033,7 @@ async def test_get_iam_policy_rest_asyncio_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"} await client.get_iam_policy(request) @@ -3040,6 +3073,7 @@ async def test_get_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_iam_policy(request) @@ -3075,6 +3109,7 @@ async def test_set_iam_policy_rest_asyncio_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"} await client.set_iam_policy(request) @@ -3114,6 +3149,7 @@ async def test_set_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.set_iam_policy(request) @@ -3149,6 +3185,7 @@ async def test_test_iam_permissions_rest_asyncio_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"} await client.test_iam_permissions(request) @@ -3188,6 +3225,7 @@ async def test_test_iam_permissions_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.test_iam_permissions(request) @@ -3222,6 +3260,7 @@ async def test_cancel_operation_rest_asyncio_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"} await client.cancel_operation(request) @@ -3259,6 +3298,7 @@ async def test_cancel_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.cancel_operation(request) @@ -3293,6 +3333,7 @@ async def test_delete_operation_rest_asyncio_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"} await client.delete_operation(request) @@ -3330,6 +3371,7 @@ async def test_delete_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_operation(request) @@ -3364,6 +3406,7 @@ async def test_get_operation_rest_asyncio_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"} await client.get_operation(request) @@ -3401,6 +3444,7 @@ async def test_get_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_operation(request) @@ -3435,6 +3479,7 @@ async def test_list_operations_rest_asyncio_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"} await client.list_operations(request) @@ -3472,6 +3517,7 @@ async def test_list_operations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_operations(request) @@ -3506,6 +3552,7 @@ async def test_wait_operation_rest_asyncio_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"} await client.wait_operation(request) @@ -3543,6 +3590,7 @@ async def test_wait_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.wait_operation(request) diff --git a/tests/unit/gapic/aiplatform_v1/test_model_service.py b/tests/unit/gapic/aiplatform_v1/test_model_service.py index 0a7756dc9e..fbf212a5f5 100644 --- a/tests/unit/gapic/aiplatform_v1/test_model_service.py +++ b/tests/unit/gapic/aiplatform_v1/test_model_service.py @@ -8478,6 +8478,7 @@ def test_upload_model_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.upload_model(request) @@ -8530,6 +8531,7 @@ def test_upload_model_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.upload_model(**mock_args) @@ -8660,6 +8662,7 @@ def test_get_model_rest_required_fields(request_type=model_service.GetModelReque 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_model(request) @@ -8705,6 +8708,7 @@ def test_get_model_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_model(**mock_args) @@ -8843,6 +8847,7 @@ def test_list_models_rest_required_fields(request_type=model_service.ListModelsR 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_models(request) @@ -8899,6 +8904,7 @@ def test_list_models_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_models(**mock_args) @@ -9104,6 +9110,7 @@ def test_list_model_versions_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_model_versions(request) @@ -9160,6 +9167,7 @@ def test_list_model_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_model_versions(**mock_args) @@ -9352,6 +9360,7 @@ def test_update_model_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_model(request) @@ -9408,6 +9417,7 @@ def test_update_model_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_model(**mock_args) @@ -9547,6 +9557,7 @@ def test_update_explanation_dataset_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_explanation_dataset(request) @@ -9590,6 +9601,7 @@ def test_update_explanation_dataset_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_explanation_dataset(**mock_args) @@ -9722,6 +9734,7 @@ def test_delete_model_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_model(request) @@ -9765,6 +9778,7 @@ def test_delete_model_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_model(**mock_args) @@ -9900,6 +9914,7 @@ def test_delete_model_version_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_model_version(request) @@ -9943,6 +9958,7 @@ def test_delete_model_version_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_model_version(**mock_args) @@ -10084,6 +10100,7 @@ def test_merge_version_aliases_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.merge_version_aliases(request) @@ -10138,6 +10155,7 @@ def test_merge_version_aliases_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.merge_version_aliases(**mock_args) @@ -10272,6 +10290,7 @@ def test_export_model_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.export_model(request) @@ -10326,6 +10345,7 @@ def test_export_model_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.export_model(**mock_args) @@ -10464,6 +10484,7 @@ def test_copy_model_rest_required_fields(request_type=model_service.CopyModelReq 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.copy_model(request) @@ -10516,6 +10537,7 @@ def test_copy_model_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.copy_model(**mock_args) @@ -10654,6 +10676,7 @@ def test_import_model_evaluation_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.import_model_evaluation(request) @@ -10708,6 +10731,7 @@ def test_import_model_evaluation_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.import_model_evaluation(**mock_args) @@ -10848,6 +10872,7 @@ def test_batch_import_model_evaluation_slices_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.batch_import_model_evaluation_slices(request) @@ -10910,6 +10935,7 @@ def test_batch_import_model_evaluation_slices_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.batch_import_model_evaluation_slices(**mock_args) @@ -11054,6 +11080,7 @@ def test_batch_import_evaluated_annotations_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.batch_import_evaluated_annotations(request) @@ -11118,6 +11145,7 @@ def test_batch_import_evaluated_annotations_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.batch_import_evaluated_annotations(**mock_args) @@ -11260,6 +11288,7 @@ def test_get_model_evaluation_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_model_evaluation(request) @@ -11307,6 +11336,7 @@ def test_get_model_evaluation_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_model_evaluation(**mock_args) @@ -11452,6 +11482,7 @@ def test_list_model_evaluations_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_model_evaluations(request) @@ -11507,6 +11538,7 @@ def test_list_model_evaluations_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_model_evaluations(**mock_args) @@ -11706,6 +11738,7 @@ def test_get_model_evaluation_slice_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_model_evaluation_slice(request) @@ -11753,6 +11786,7 @@ def test_get_model_evaluation_slice_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_model_evaluation_slice(**mock_args) @@ -11900,6 +11934,7 @@ def test_list_model_evaluation_slices_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_model_evaluation_slices(request) @@ -11957,6 +11992,7 @@ def test_list_model_evaluation_slices_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_model_evaluation_slices(**mock_args) @@ -13174,6 +13210,7 @@ def test_upload_model_rest_bad_request(request_type=model_service.UploadModelReq 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.upload_model(request) @@ -13204,6 +13241,7 @@ def test_upload_model_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.upload_model(request) # Establish that the response is the type that we expect. @@ -13245,6 +13283,7 @@ def test_upload_model_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 @@ -13287,6 +13326,7 @@ def test_get_model_rest_bad_request(request_type=model_service.GetModelRequest): 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_model(request) @@ -13340,6 +13380,7 @@ def test_get_model_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_model(request) # Establish that the response is the type that we expect. @@ -13400,6 +13441,7 @@ def test_get_model_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 = model.Model.to_json(model.Model()) req.return_value.content = return_value @@ -13442,6 +13484,7 @@ def test_list_models_rest_bad_request(request_type=model_service.ListModelsReque 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_models(request) @@ -13477,6 +13520,7 @@ def test_list_models_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_models(request) # Establish that the response is the type that we expect. @@ -13517,6 +13561,7 @@ def test_list_models_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 = model_service.ListModelsResponse.to_json( model_service.ListModelsResponse() ) @@ -13563,6 +13608,7 @@ def test_list_model_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_model_versions(request) @@ -13598,6 +13644,7 @@ def test_list_model_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_model_versions(request) # Establish that the response is the type that we expect. @@ -13638,6 +13685,7 @@ def test_list_model_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 = model_service.ListModelVersionsResponse.to_json( model_service.ListModelVersionsResponse() ) @@ -13684,6 +13732,7 @@ def test_update_model_rest_bad_request(request_type=model_service.UpdateModelReq 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_model(request) @@ -13927,6 +13976,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_model(request) # Establish that the response is the type that we expect. @@ -13989,6 +14039,7 @@ def test_update_model_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 = gca_model.Model.to_json(gca_model.Model()) req.return_value.content = return_value @@ -14033,6 +14084,7 @@ def test_update_explanation_dataset_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_explanation_dataset(request) @@ -14063,6 +14115,7 @@ def test_update_explanation_dataset_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.update_explanation_dataset(request) # Establish that the response is the type that we expect. @@ -14104,6 +14157,7 @@ def test_update_explanation_dataset_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 @@ -14146,6 +14200,7 @@ def test_delete_model_rest_bad_request(request_type=model_service.DeleteModelReq 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_model(request) @@ -14176,6 +14231,7 @@ def test_delete_model_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_model(request) # Establish that the response is the type that we expect. @@ -14217,6 +14273,7 @@ def test_delete_model_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 @@ -14261,6 +14318,7 @@ def test_delete_model_version_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_model_version(request) @@ -14291,6 +14349,7 @@ def test_delete_model_version_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_model_version(request) # Establish that the response is the type that we expect. @@ -14332,6 +14391,7 @@ def test_delete_model_version_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 @@ -14376,6 +14436,7 @@ def test_merge_version_aliases_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.merge_version_aliases(request) @@ -14429,6 +14490,7 @@ def test_merge_version_aliases_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.merge_version_aliases(request) # Establish that the response is the type that we expect. @@ -14491,6 +14553,7 @@ def test_merge_version_aliases_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 = model.Model.to_json(model.Model()) req.return_value.content = return_value @@ -14533,6 +14596,7 @@ def test_export_model_rest_bad_request(request_type=model_service.ExportModelReq 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.export_model(request) @@ -14563,6 +14627,7 @@ def test_export_model_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.export_model(request) # Establish that the response is the type that we expect. @@ -14604,6 +14669,7 @@ def test_export_model_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 @@ -14646,6 +14712,7 @@ def test_copy_model_rest_bad_request(request_type=model_service.CopyModelRequest 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.copy_model(request) @@ -14676,6 +14743,7 @@ def test_copy_model_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.copy_model(request) # Establish that the response is the type that we expect. @@ -14715,6 +14783,7 @@ def test_copy_model_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 @@ -14759,6 +14828,7 @@ def test_import_model_evaluation_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.import_model_evaluation(request) @@ -14799,6 +14869,7 @@ def test_import_model_evaluation_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.import_model_evaluation(request) # Establish that the response is the type that we expect. @@ -14844,6 +14915,7 @@ def test_import_model_evaluation_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 = gca_model_evaluation.ModelEvaluation.to_json( gca_model_evaluation.ModelEvaluation() ) @@ -14892,6 +14964,7 @@ def test_batch_import_model_evaluation_slices_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.batch_import_model_evaluation_slices(request) @@ -14931,6 +15004,7 @@ def test_batch_import_model_evaluation_slices_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.batch_import_model_evaluation_slices(request) # Establish that the response is the type that we expect. @@ -14975,6 +15049,7 @@ def test_batch_import_model_evaluation_slices_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 = model_service.BatchImportModelEvaluationSlicesResponse.to_json( model_service.BatchImportModelEvaluationSlicesResponse() ) @@ -15023,6 +15098,7 @@ def test_batch_import_evaluated_annotations_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.batch_import_evaluated_annotations(request) @@ -15062,6 +15138,7 @@ def test_batch_import_evaluated_annotations_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.batch_import_evaluated_annotations(request) # Establish that the response is the type that we expect. @@ -15103,6 +15180,7 @@ def test_batch_import_evaluated_annotations_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 = model_service.BatchImportEvaluatedAnnotationsResponse.to_json( model_service.BatchImportEvaluatedAnnotationsResponse() ) @@ -15151,6 +15229,7 @@ def test_get_model_evaluation_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_model_evaluation(request) @@ -15193,6 +15272,7 @@ def test_get_model_evaluation_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_model_evaluation(request) # Establish that the response is the type that we expect. @@ -15238,6 +15318,7 @@ def test_get_model_evaluation_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 = model_evaluation.ModelEvaluation.to_json( model_evaluation.ModelEvaluation() ) @@ -15284,6 +15365,7 @@ def test_list_model_evaluations_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_model_evaluations(request) @@ -15319,6 +15401,7 @@ def test_list_model_evaluations_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_model_evaluations(request) # Establish that the response is the type that we expect. @@ -15359,6 +15442,7 @@ def test_list_model_evaluations_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 = model_service.ListModelEvaluationsResponse.to_json( model_service.ListModelEvaluationsResponse() ) @@ -15407,6 +15491,7 @@ def test_get_model_evaluation_slice_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_model_evaluation_slice(request) @@ -15445,6 +15530,7 @@ def test_get_model_evaluation_slice_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_model_evaluation_slice(request) # Establish that the response is the type that we expect. @@ -15486,6 +15572,7 @@ def test_get_model_evaluation_slice_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 = model_evaluation_slice.ModelEvaluationSlice.to_json( model_evaluation_slice.ModelEvaluationSlice() ) @@ -15534,6 +15621,7 @@ def test_list_model_evaluation_slices_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_model_evaluation_slices(request) @@ -15571,6 +15659,7 @@ def test_list_model_evaluation_slices_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_model_evaluation_slices(request) # Establish that the response is the type that we expect. @@ -15611,6 +15700,7 @@ def test_list_model_evaluation_slices_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 = model_service.ListModelEvaluationSlicesResponse.to_json( model_service.ListModelEvaluationSlicesResponse() ) @@ -15657,6 +15747,7 @@ def test_get_location_rest_bad_request(request_type=locations_pb2.GetLocationReq 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_location(request) @@ -15687,6 +15778,7 @@ def test_get_location_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_location(request) @@ -15715,6 +15807,7 @@ def test_list_locations_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_locations(request) @@ -15745,6 +15838,7 @@ def test_list_locations_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_locations(request) @@ -15776,6 +15870,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -15808,6 +15903,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -15839,6 +15935,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -15871,6 +15968,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -15902,6 +16000,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -15934,6 +16033,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -15964,6 +16064,7 @@ def test_cancel_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.cancel_operation(request) @@ -15994,6 +16095,7 @@ def test_cancel_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.cancel_operation(request) @@ -16024,6 +16126,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) @@ -16054,6 +16157,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) @@ -16084,6 +16188,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) @@ -16114,6 +16219,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) @@ -16144,6 +16250,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) @@ -16174,6 +16281,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) @@ -16204,6 +16312,7 @@ def test_wait_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.wait_operation(request) @@ -16234,6 +16343,7 @@ def test_wait_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.wait_operation(request) @@ -16683,6 +16793,7 @@ async def test_upload_model_rest_asyncio_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"} await client.upload_model(request) @@ -16720,6 +16831,7 @@ async def test_upload_model_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.upload_model(request) # Establish that the response is the type that we expect. @@ -16766,6 +16878,7 @@ async def test_upload_model_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -16814,6 +16927,7 @@ async def test_get_model_rest_asyncio_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"} await client.get_model(request) @@ -16874,6 +16988,7 @@ async def test_get_model_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_model(request) # Establish that the response is the type that we expect. @@ -16939,6 +17054,7 @@ async def test_get_model_rest_asyncio_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 = model.Model.to_json(model.Model()) req.return_value.read = mock.AsyncMock(return_value=return_value) @@ -16987,6 +17103,7 @@ async def test_list_models_rest_asyncio_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"} await client.list_models(request) @@ -17029,6 +17146,7 @@ async def test_list_models_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_models(request) # Establish that the response is the type that we expect. @@ -17074,6 +17192,7 @@ async def test_list_models_rest_asyncio_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 = model_service.ListModelsResponse.to_json( model_service.ListModelsResponse() ) @@ -17124,6 +17243,7 @@ async def test_list_model_versions_rest_asyncio_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"} await client.list_model_versions(request) @@ -17166,6 +17286,7 @@ async def test_list_model_versions_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_model_versions(request) # Establish that the response is the type that we expect. @@ -17211,6 +17332,7 @@ async def test_list_model_versions_rest_asyncio_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 = model_service.ListModelVersionsResponse.to_json( model_service.ListModelVersionsResponse() ) @@ -17263,6 +17385,7 @@ async def test_update_model_rest_asyncio_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"} await client.update_model(request) @@ -17513,6 +17636,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.update_model(request) # Establish that the response is the type that we expect. @@ -17580,6 +17704,7 @@ async def test_update_model_rest_asyncio_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 = gca_model.Model.to_json(gca_model.Model()) req.return_value.read = mock.AsyncMock(return_value=return_value) @@ -17628,6 +17753,7 @@ async def test_update_explanation_dataset_rest_asyncio_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"} await client.update_explanation_dataset(request) @@ -17665,6 +17791,7 @@ async def test_update_explanation_dataset_rest_asyncio_call_success(request_type return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.update_explanation_dataset(request) # Establish that the response is the type that we expect. @@ -17711,6 +17838,7 @@ async def test_update_explanation_dataset_rest_asyncio_interceptors(null_interce 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.read = mock.AsyncMock(return_value=return_value) @@ -17759,6 +17887,7 @@ async def test_delete_model_rest_asyncio_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"} await client.delete_model(request) @@ -17796,6 +17925,7 @@ async def test_delete_model_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_model(request) # Establish that the response is the type that we expect. @@ -17842,6 +17972,7 @@ async def test_delete_model_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -17890,6 +18021,7 @@ async def test_delete_model_version_rest_asyncio_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"} await client.delete_model_version(request) @@ -17927,6 +18059,7 @@ async def test_delete_model_version_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_model_version(request) # Establish that the response is the type that we expect. @@ -17973,6 +18106,7 @@ async def test_delete_model_version_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -18021,6 +18155,7 @@ async def test_merge_version_aliases_rest_asyncio_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"} await client.merge_version_aliases(request) @@ -18081,6 +18216,7 @@ async def test_merge_version_aliases_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.merge_version_aliases(request) # Establish that the response is the type that we expect. @@ -18148,6 +18284,7 @@ async def test_merge_version_aliases_rest_asyncio_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 = model.Model.to_json(model.Model()) req.return_value.read = mock.AsyncMock(return_value=return_value) @@ -18196,6 +18333,7 @@ async def test_export_model_rest_asyncio_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"} await client.export_model(request) @@ -18233,6 +18371,7 @@ async def test_export_model_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.export_model(request) # Establish that the response is the type that we expect. @@ -18279,6 +18418,7 @@ async def test_export_model_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -18327,6 +18467,7 @@ async def test_copy_model_rest_asyncio_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"} await client.copy_model(request) @@ -18364,6 +18505,7 @@ async def test_copy_model_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.copy_model(request) # Establish that the response is the type that we expect. @@ -18408,6 +18550,7 @@ async def test_copy_model_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -18456,6 +18599,7 @@ async def test_import_model_evaluation_rest_asyncio_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"} await client.import_model_evaluation(request) @@ -18503,6 +18647,7 @@ async def test_import_model_evaluation_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.import_model_evaluation(request) # Establish that the response is the type that we expect. @@ -18553,6 +18698,7 @@ async def test_import_model_evaluation_rest_asyncio_interceptors(null_intercepto 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 = gca_model_evaluation.ModelEvaluation.to_json( gca_model_evaluation.ModelEvaluation() ) @@ -18605,6 +18751,7 @@ async def test_batch_import_model_evaluation_slices_rest_asyncio_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"} await client.batch_import_model_evaluation_slices(request) @@ -18653,6 +18800,7 @@ async def test_batch_import_model_evaluation_slices_rest_asyncio_call_success( return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.batch_import_model_evaluation_slices(request) # Establish that the response is the type that we expect. @@ -18704,6 +18852,7 @@ async def test_batch_import_model_evaluation_slices_rest_asyncio_interceptors( 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 = model_service.BatchImportModelEvaluationSlicesResponse.to_json( model_service.BatchImportModelEvaluationSlicesResponse() ) @@ -18756,6 +18905,7 @@ async def test_batch_import_evaluated_annotations_rest_asyncio_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"} await client.batch_import_evaluated_annotations(request) @@ -18804,6 +18954,7 @@ async def test_batch_import_evaluated_annotations_rest_asyncio_call_success( return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.batch_import_evaluated_annotations(request) # Establish that the response is the type that we expect. @@ -18853,6 +19004,7 @@ async def test_batch_import_evaluated_annotations_rest_asyncio_interceptors( 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 = model_service.BatchImportEvaluatedAnnotationsResponse.to_json( model_service.BatchImportEvaluatedAnnotationsResponse() ) @@ -18905,6 +19057,7 @@ async def test_get_model_evaluation_rest_asyncio_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"} await client.get_model_evaluation(request) @@ -18954,6 +19107,7 @@ async def test_get_model_evaluation_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_model_evaluation(request) # Establish that the response is the type that we expect. @@ -19004,6 +19158,7 @@ async def test_get_model_evaluation_rest_asyncio_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 = model_evaluation.ModelEvaluation.to_json( model_evaluation.ModelEvaluation() ) @@ -19054,6 +19209,7 @@ async def test_list_model_evaluations_rest_asyncio_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"} await client.list_model_evaluations(request) @@ -19096,6 +19252,7 @@ async def test_list_model_evaluations_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_model_evaluations(request) # Establish that the response is the type that we expect. @@ -19141,6 +19298,7 @@ async def test_list_model_evaluations_rest_asyncio_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 = model_service.ListModelEvaluationsResponse.to_json( model_service.ListModelEvaluationsResponse() ) @@ -19193,6 +19351,7 @@ async def test_get_model_evaluation_slice_rest_asyncio_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"} await client.get_model_evaluation_slice(request) @@ -19238,6 +19397,7 @@ async def test_get_model_evaluation_slice_rest_asyncio_call_success(request_type return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_model_evaluation_slice(request) # Establish that the response is the type that we expect. @@ -19284,6 +19444,7 @@ async def test_get_model_evaluation_slice_rest_asyncio_interceptors(null_interce 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 = model_evaluation_slice.ModelEvaluationSlice.to_json( model_evaluation_slice.ModelEvaluationSlice() ) @@ -19336,6 +19497,7 @@ async def test_list_model_evaluation_slices_rest_asyncio_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"} await client.list_model_evaluation_slices(request) @@ -19380,6 +19542,7 @@ async def test_list_model_evaluation_slices_rest_asyncio_call_success(request_ty return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_model_evaluation_slices(request) # Establish that the response is the type that we expect. @@ -19425,6 +19588,7 @@ async def test_list_model_evaluation_slices_rest_asyncio_interceptors(null_inter 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 = model_service.ListModelEvaluationSlicesResponse.to_json( model_service.ListModelEvaluationSlicesResponse() ) @@ -19477,6 +19641,7 @@ async def test_get_location_rest_asyncio_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"} await client.get_location(request) @@ -19514,6 +19679,7 @@ async def test_get_location_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_location(request) @@ -19546,6 +19712,7 @@ async def test_list_locations_rest_asyncio_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"} await client.list_locations(request) @@ -19583,6 +19750,7 @@ async def test_list_locations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_locations(request) @@ -19618,6 +19786,7 @@ async def test_get_iam_policy_rest_asyncio_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"} await client.get_iam_policy(request) @@ -19657,6 +19826,7 @@ async def test_get_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_iam_policy(request) @@ -19692,6 +19862,7 @@ async def test_set_iam_policy_rest_asyncio_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"} await client.set_iam_policy(request) @@ -19731,6 +19902,7 @@ async def test_set_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.set_iam_policy(request) @@ -19766,6 +19938,7 @@ async def test_test_iam_permissions_rest_asyncio_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"} await client.test_iam_permissions(request) @@ -19805,6 +19978,7 @@ async def test_test_iam_permissions_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.test_iam_permissions(request) @@ -19839,6 +20013,7 @@ async def test_cancel_operation_rest_asyncio_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"} await client.cancel_operation(request) @@ -19876,6 +20051,7 @@ async def test_cancel_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.cancel_operation(request) @@ -19910,6 +20086,7 @@ async def test_delete_operation_rest_asyncio_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"} await client.delete_operation(request) @@ -19947,6 +20124,7 @@ async def test_delete_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_operation(request) @@ -19981,6 +20159,7 @@ async def test_get_operation_rest_asyncio_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"} await client.get_operation(request) @@ -20018,6 +20197,7 @@ async def test_get_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_operation(request) @@ -20052,6 +20232,7 @@ async def test_list_operations_rest_asyncio_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"} await client.list_operations(request) @@ -20089,6 +20270,7 @@ async def test_list_operations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_operations(request) @@ -20123,6 +20305,7 @@ async def test_wait_operation_rest_asyncio_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"} await client.wait_operation(request) @@ -20160,6 +20343,7 @@ async def test_wait_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.wait_operation(request) diff --git a/tests/unit/gapic/aiplatform_v1/test_notebook_service.py b/tests/unit/gapic/aiplatform_v1/test_notebook_service.py index a05c886e9b..27ad674bbe 100644 --- a/tests/unit/gapic/aiplatform_v1/test_notebook_service.py +++ b/tests/unit/gapic/aiplatform_v1/test_notebook_service.py @@ -6320,6 +6320,7 @@ def test_get_notebook_execution_job(request_type, transport: str = "grpc"): display_name="display_name_value", schedule_resource_name="schedule_resource_name_value", job_state=job_state.JobState.JOB_STATE_QUEUED, + kernel_name="kernel_name_value", notebook_runtime_template_resource_name="notebook_runtime_template_resource_name_value", gcs_output_uri="gcs_output_uri_value", execution_user="execution_user_value", @@ -6338,6 +6339,7 @@ def test_get_notebook_execution_job(request_type, transport: str = "grpc"): assert response.display_name == "display_name_value" assert response.schedule_resource_name == "schedule_resource_name_value" assert response.job_state == job_state.JobState.JOB_STATE_QUEUED + assert response.kernel_name == "kernel_name_value" def test_get_notebook_execution_job_non_empty_request_with_auto_populated_field(): @@ -6477,6 +6479,7 @@ async def test_get_notebook_execution_job_async( display_name="display_name_value", schedule_resource_name="schedule_resource_name_value", job_state=job_state.JobState.JOB_STATE_QUEUED, + kernel_name="kernel_name_value", ) ) response = await client.get_notebook_execution_job(request) @@ -6493,6 +6496,7 @@ async def test_get_notebook_execution_job_async( assert response.display_name == "display_name_value" assert response.schedule_resource_name == "schedule_resource_name_value" assert response.job_state == job_state.JobState.JOB_STATE_QUEUED + assert response.kernel_name == "kernel_name_value" @pytest.mark.asyncio @@ -7667,6 +7671,7 @@ def test_create_notebook_runtime_template_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_notebook_runtime_template(request) @@ -7724,6 +7729,7 @@ def test_create_notebook_runtime_template_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_notebook_runtime_template(**mock_args) @@ -7864,6 +7870,7 @@ def test_get_notebook_runtime_template_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_notebook_runtime_template(request) @@ -7913,6 +7920,7 @@ def test_get_notebook_runtime_template_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_notebook_runtime_template(**mock_args) @@ -8061,6 +8069,7 @@ def test_list_notebook_runtime_templates_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_notebook_runtime_templates(request) @@ -8121,6 +8130,7 @@ def test_list_notebook_runtime_templates_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_notebook_runtime_templates(**mock_args) @@ -8326,6 +8336,7 @@ def test_delete_notebook_runtime_template_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_notebook_runtime_template(request) @@ -8373,6 +8384,7 @@ def test_delete_notebook_runtime_template_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_notebook_runtime_template(**mock_args) @@ -8507,6 +8519,7 @@ def test_update_notebook_runtime_template_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_notebook_runtime_template(request) @@ -8569,6 +8582,7 @@ def test_update_notebook_runtime_template_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_notebook_runtime_template(**mock_args) @@ -8717,6 +8731,7 @@ def test_assign_notebook_runtime_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.assign_notebook_runtime(request) @@ -8772,6 +8787,7 @@ def test_assign_notebook_runtime_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.assign_notebook_runtime(**mock_args) @@ -8910,6 +8926,7 @@ def test_get_notebook_runtime_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_notebook_runtime(request) @@ -8957,6 +8974,7 @@ def test_get_notebook_runtime_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_notebook_runtime(**mock_args) @@ -9105,6 +9123,7 @@ def test_list_notebook_runtimes_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_notebook_runtimes(request) @@ -9161,6 +9180,7 @@ def test_list_notebook_runtimes_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_notebook_runtimes(**mock_args) @@ -9361,6 +9381,7 @@ def test_delete_notebook_runtime_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_notebook_runtime(request) @@ -9406,6 +9427,7 @@ def test_delete_notebook_runtime_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_notebook_runtime(**mock_args) @@ -9544,6 +9566,7 @@ def test_upgrade_notebook_runtime_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.upgrade_notebook_runtime(request) @@ -9589,6 +9612,7 @@ def test_upgrade_notebook_runtime_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.upgrade_notebook_runtime(**mock_args) @@ -9727,6 +9751,7 @@ def test_start_notebook_runtime_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.start_notebook_runtime(request) @@ -9772,6 +9797,7 @@ def test_start_notebook_runtime_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.start_notebook_runtime(**mock_args) @@ -9910,6 +9936,7 @@ def test_stop_notebook_runtime_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.stop_notebook_runtime(request) @@ -9955,6 +9982,7 @@ def test_stop_notebook_runtime_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.stop_notebook_runtime(**mock_args) @@ -10095,6 +10123,7 @@ def test_create_notebook_execution_job_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_notebook_execution_job(request) @@ -10154,6 +10183,7 @@ def test_create_notebook_execution_job_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_notebook_execution_job(**mock_args) @@ -10298,6 +10328,7 @@ def test_get_notebook_execution_job_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_notebook_execution_job(request) @@ -10345,6 +10376,7 @@ def test_get_notebook_execution_job_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_notebook_execution_job(**mock_args) @@ -10493,6 +10525,7 @@ def test_list_notebook_execution_jobs_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_notebook_execution_jobs(request) @@ -10551,6 +10584,7 @@ def test_list_notebook_execution_jobs_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_notebook_execution_jobs(**mock_args) @@ -10754,6 +10788,7 @@ def test_delete_notebook_execution_job_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_notebook_execution_job(request) @@ -10801,6 +10836,7 @@ def test_delete_notebook_execution_job_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_notebook_execution_job(**mock_args) @@ -11726,6 +11762,7 @@ async def test_get_notebook_execution_job_empty_call_grpc_asyncio(): display_name="display_name_value", schedule_resource_name="schedule_resource_name_value", job_state=job_state.JobState.JOB_STATE_QUEUED, + kernel_name="kernel_name_value", ) ) await client.get_notebook_execution_job(request=None) @@ -11822,6 +11859,7 @@ def test_create_notebook_runtime_template_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_notebook_runtime_template(request) @@ -11965,6 +12003,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_notebook_runtime_template(request) # Establish that the response is the type that we expect. @@ -12008,6 +12047,7 @@ def test_create_notebook_runtime_template_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 @@ -12054,6 +12094,7 @@ def test_get_notebook_runtime_template_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_notebook_runtime_template(request) @@ -12098,6 +12139,7 @@ def test_get_notebook_runtime_template_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_notebook_runtime_template(request) # Establish that the response is the type that we expect. @@ -12148,6 +12190,7 @@ def test_get_notebook_runtime_template_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 = notebook_runtime.NotebookRuntimeTemplate.to_json( notebook_runtime.NotebookRuntimeTemplate() ) @@ -12194,6 +12237,7 @@ def test_list_notebook_runtime_templates_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_notebook_runtime_templates(request) @@ -12231,6 +12275,7 @@ def test_list_notebook_runtime_templates_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_notebook_runtime_templates(request) # Establish that the response is the type that we expect. @@ -12272,6 +12317,7 @@ def test_list_notebook_runtime_templates_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 = notebook_service.ListNotebookRuntimeTemplatesResponse.to_json( notebook_service.ListNotebookRuntimeTemplatesResponse() ) @@ -12320,6 +12366,7 @@ def test_delete_notebook_runtime_template_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_notebook_runtime_template(request) @@ -12352,6 +12399,7 @@ def test_delete_notebook_runtime_template_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_notebook_runtime_template(request) # Establish that the response is the type that we expect. @@ -12395,6 +12443,7 @@ def test_delete_notebook_runtime_template_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 @@ -12443,6 +12492,7 @@ def test_update_notebook_runtime_template_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_notebook_runtime_template(request) @@ -12602,6 +12652,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_notebook_runtime_template(request) # Establish that the response is the type that we expect. @@ -12654,6 +12705,7 @@ def test_update_notebook_runtime_template_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 = notebook_runtime.NotebookRuntimeTemplate.to_json( notebook_runtime.NotebookRuntimeTemplate() ) @@ -12700,6 +12752,7 @@ def test_assign_notebook_runtime_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.assign_notebook_runtime(request) @@ -12730,6 +12783,7 @@ def test_assign_notebook_runtime_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.assign_notebook_runtime(request) # Establish that the response is the type that we expect. @@ -12771,6 +12825,7 @@ def test_assign_notebook_runtime_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 @@ -12817,6 +12872,7 @@ def test_get_notebook_runtime_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_notebook_runtime(request) @@ -12867,6 +12923,7 @@ def test_get_notebook_runtime_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_notebook_runtime(request) # Establish that the response is the type that we expect. @@ -12925,6 +12982,7 @@ def test_get_notebook_runtime_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 = notebook_runtime.NotebookRuntime.to_json( notebook_runtime.NotebookRuntime() ) @@ -12971,6 +13029,7 @@ def test_list_notebook_runtimes_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_notebook_runtimes(request) @@ -13006,6 +13065,7 @@ def test_list_notebook_runtimes_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_notebook_runtimes(request) # Establish that the response is the type that we expect. @@ -13046,6 +13106,7 @@ def test_list_notebook_runtimes_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 = notebook_service.ListNotebookRuntimesResponse.to_json( notebook_service.ListNotebookRuntimesResponse() ) @@ -13094,6 +13155,7 @@ def test_delete_notebook_runtime_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_notebook_runtime(request) @@ -13126,6 +13188,7 @@ def test_delete_notebook_runtime_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_notebook_runtime(request) # Establish that the response is the type that we expect. @@ -13167,6 +13230,7 @@ def test_delete_notebook_runtime_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 @@ -13213,6 +13277,7 @@ def test_upgrade_notebook_runtime_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.upgrade_notebook_runtime(request) @@ -13245,6 +13310,7 @@ def test_upgrade_notebook_runtime_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.upgrade_notebook_runtime(request) # Establish that the response is the type that we expect. @@ -13286,6 +13352,7 @@ def test_upgrade_notebook_runtime_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 @@ -13332,6 +13399,7 @@ def test_start_notebook_runtime_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.start_notebook_runtime(request) @@ -13364,6 +13432,7 @@ def test_start_notebook_runtime_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.start_notebook_runtime(request) # Establish that the response is the type that we expect. @@ -13405,6 +13474,7 @@ def test_start_notebook_runtime_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 @@ -13451,6 +13521,7 @@ def test_stop_notebook_runtime_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_notebook_runtime(request) @@ -13483,6 +13554,7 @@ def test_stop_notebook_runtime_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_notebook_runtime(request) # Establish that the response is the type that we expect. @@ -13524,6 +13596,7 @@ def test_stop_notebook_runtime_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 @@ -13568,6 +13641,7 @@ def test_create_notebook_execution_job_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_notebook_execution_job(request) @@ -13618,6 +13692,7 @@ def test_create_notebook_execution_job_rest_call_success(request_type): "gcs_output_uri": "gcs_output_uri_value", "execution_user": "execution_user_value", "service_account": "service_account_value", + "workbench_runtime": {}, "name": "name_value", "display_name": "display_name_value", "execution_timeout": {"seconds": 751, "nanos": 543}, @@ -13636,6 +13711,7 @@ def test_create_notebook_execution_job_rest_call_success(request_type): "create_time": {"seconds": 751, "nanos": 543}, "update_time": {}, "labels": {}, + "kernel_name": "kernel_name_value", "encryption_spec": {"kms_key_name": "kms_key_name_value"}, } # The version of a generated dependency at test runtime may differ from the version used during generation. @@ -13722,6 +13798,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_notebook_execution_job(request) # Establish that the response is the type that we expect. @@ -13763,6 +13840,7 @@ def test_create_notebook_execution_job_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 @@ -13809,6 +13887,7 @@ def test_get_notebook_execution_job_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_notebook_execution_job(request) @@ -13838,6 +13917,7 @@ def test_get_notebook_execution_job_rest_call_success(request_type): display_name="display_name_value", schedule_resource_name="schedule_resource_name_value", job_state=job_state.JobState.JOB_STATE_QUEUED, + kernel_name="kernel_name_value", notebook_runtime_template_resource_name="notebook_runtime_template_resource_name_value", gcs_output_uri="gcs_output_uri_value", execution_user="execution_user_value", @@ -13852,6 +13932,7 @@ def test_get_notebook_execution_job_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_notebook_execution_job(request) # Establish that the response is the type that we expect. @@ -13860,6 +13941,7 @@ def test_get_notebook_execution_job_rest_call_success(request_type): assert response.display_name == "display_name_value" assert response.schedule_resource_name == "schedule_resource_name_value" assert response.job_state == job_state.JobState.JOB_STATE_QUEUED + assert response.kernel_name == "kernel_name_value" @pytest.mark.parametrize("null_interceptor", [True, False]) @@ -13895,6 +13977,7 @@ def test_get_notebook_execution_job_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 = notebook_execution_job.NotebookExecutionJob.to_json( notebook_execution_job.NotebookExecutionJob() ) @@ -13941,6 +14024,7 @@ def test_list_notebook_execution_jobs_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_notebook_execution_jobs(request) @@ -13978,6 +14062,7 @@ def test_list_notebook_execution_jobs_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_notebook_execution_jobs(request) # Establish that the response is the type that we expect. @@ -14018,6 +14103,7 @@ def test_list_notebook_execution_jobs_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 = notebook_service.ListNotebookExecutionJobsResponse.to_json( notebook_service.ListNotebookExecutionJobsResponse() ) @@ -14066,6 +14152,7 @@ def test_delete_notebook_execution_job_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_notebook_execution_job(request) @@ -14098,6 +14185,7 @@ def test_delete_notebook_execution_job_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_notebook_execution_job(request) # Establish that the response is the type that we expect. @@ -14139,6 +14227,7 @@ def test_delete_notebook_execution_job_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 @@ -14183,6 +14272,7 @@ def test_get_location_rest_bad_request(request_type=locations_pb2.GetLocationReq 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_location(request) @@ -14213,6 +14303,7 @@ def test_get_location_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_location(request) @@ -14241,6 +14332,7 @@ def test_list_locations_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_locations(request) @@ -14271,6 +14363,7 @@ def test_list_locations_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_locations(request) @@ -14302,6 +14395,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -14334,6 +14428,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -14365,6 +14460,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -14397,6 +14493,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -14428,6 +14525,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -14460,6 +14558,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -14490,6 +14589,7 @@ def test_cancel_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.cancel_operation(request) @@ -14520,6 +14620,7 @@ def test_cancel_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.cancel_operation(request) @@ -14550,6 +14651,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) @@ -14580,6 +14682,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) @@ -14610,6 +14713,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) @@ -14640,6 +14744,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) @@ -14670,6 +14775,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) @@ -14700,6 +14806,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) @@ -14730,6 +14837,7 @@ def test_wait_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.wait_operation(request) @@ -14760,6 +14868,7 @@ def test_wait_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.wait_operation(request) @@ -15179,6 +15288,7 @@ async def test_create_notebook_runtime_template_rest_asyncio_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"} await client.create_notebook_runtime_template(request) @@ -15329,6 +15439,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.create_notebook_runtime_template(request) # Establish that the response is the type that we expect. @@ -15379,6 +15490,7 @@ async def test_create_notebook_runtime_template_rest_asyncio_interceptors( 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.read = mock.AsyncMock(return_value=return_value) @@ -15429,6 +15541,7 @@ async def test_get_notebook_runtime_template_rest_asyncio_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"} await client.get_notebook_runtime_template(request) @@ -15480,6 +15593,7 @@ async def test_get_notebook_runtime_template_rest_asyncio_call_success(request_t return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_notebook_runtime_template(request) # Establish that the response is the type that we expect. @@ -15539,6 +15653,7 @@ async def test_get_notebook_runtime_template_rest_asyncio_interceptors( 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 = notebook_runtime.NotebookRuntimeTemplate.to_json( notebook_runtime.NotebookRuntimeTemplate() ) @@ -15589,6 +15704,7 @@ async def test_list_notebook_runtime_templates_rest_asyncio_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"} await client.list_notebook_runtime_templates(request) @@ -15633,6 +15749,7 @@ async def test_list_notebook_runtime_templates_rest_asyncio_call_success(request return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_notebook_runtime_templates(request) # Establish that the response is the type that we expect. @@ -15682,6 +15799,7 @@ async def test_list_notebook_runtime_templates_rest_asyncio_interceptors( 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 = notebook_service.ListNotebookRuntimeTemplatesResponse.to_json( notebook_service.ListNotebookRuntimeTemplatesResponse() ) @@ -15734,6 +15852,7 @@ async def test_delete_notebook_runtime_template_rest_asyncio_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"} await client.delete_notebook_runtime_template(request) @@ -15773,6 +15892,7 @@ async def test_delete_notebook_runtime_template_rest_asyncio_call_success(reques return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_notebook_runtime_template(request) # Establish that the response is the type that we expect. @@ -15823,6 +15943,7 @@ async def test_delete_notebook_runtime_template_rest_asyncio_interceptors( 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.read = mock.AsyncMock(return_value=return_value) @@ -15875,6 +15996,7 @@ async def test_update_notebook_runtime_template_rest_asyncio_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"} await client.update_notebook_runtime_template(request) @@ -16041,6 +16163,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.update_notebook_runtime_template(request) # Establish that the response is the type that we expect. @@ -16100,6 +16223,7 @@ async def test_update_notebook_runtime_template_rest_asyncio_interceptors( 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 = notebook_runtime.NotebookRuntimeTemplate.to_json( notebook_runtime.NotebookRuntimeTemplate() ) @@ -16150,6 +16274,7 @@ async def test_assign_notebook_runtime_rest_asyncio_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"} await client.assign_notebook_runtime(request) @@ -16187,6 +16312,7 @@ async def test_assign_notebook_runtime_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.assign_notebook_runtime(request) # Establish that the response is the type that we expect. @@ -16233,6 +16359,7 @@ async def test_assign_notebook_runtime_rest_asyncio_interceptors(null_intercepto 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.read = mock.AsyncMock(return_value=return_value) @@ -16283,6 +16410,7 @@ async def test_get_notebook_runtime_rest_asyncio_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"} await client.get_notebook_runtime(request) @@ -16340,6 +16468,7 @@ async def test_get_notebook_runtime_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_notebook_runtime(request) # Establish that the response is the type that we expect. @@ -16403,6 +16532,7 @@ async def test_get_notebook_runtime_rest_asyncio_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 = notebook_runtime.NotebookRuntime.to_json( notebook_runtime.NotebookRuntime() ) @@ -16453,6 +16583,7 @@ async def test_list_notebook_runtimes_rest_asyncio_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"} await client.list_notebook_runtimes(request) @@ -16495,6 +16626,7 @@ async def test_list_notebook_runtimes_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_notebook_runtimes(request) # Establish that the response is the type that we expect. @@ -16540,6 +16672,7 @@ async def test_list_notebook_runtimes_rest_asyncio_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 = notebook_service.ListNotebookRuntimesResponse.to_json( notebook_service.ListNotebookRuntimesResponse() ) @@ -16592,6 +16725,7 @@ async def test_delete_notebook_runtime_rest_asyncio_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"} await client.delete_notebook_runtime(request) @@ -16631,6 +16765,7 @@ async def test_delete_notebook_runtime_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_notebook_runtime(request) # Establish that the response is the type that we expect. @@ -16677,6 +16812,7 @@ async def test_delete_notebook_runtime_rest_asyncio_interceptors(null_intercepto 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.read = mock.AsyncMock(return_value=return_value) @@ -16727,6 +16863,7 @@ async def test_upgrade_notebook_runtime_rest_asyncio_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"} await client.upgrade_notebook_runtime(request) @@ -16766,6 +16903,7 @@ async def test_upgrade_notebook_runtime_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.upgrade_notebook_runtime(request) # Establish that the response is the type that we expect. @@ -16812,6 +16950,7 @@ async def test_upgrade_notebook_runtime_rest_asyncio_interceptors(null_intercept 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.read = mock.AsyncMock(return_value=return_value) @@ -16862,6 +17001,7 @@ async def test_start_notebook_runtime_rest_asyncio_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"} await client.start_notebook_runtime(request) @@ -16901,6 +17041,7 @@ async def test_start_notebook_runtime_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.start_notebook_runtime(request) # Establish that the response is the type that we expect. @@ -16947,6 +17088,7 @@ async def test_start_notebook_runtime_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -16997,6 +17139,7 @@ async def test_stop_notebook_runtime_rest_asyncio_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"} await client.stop_notebook_runtime(request) @@ -17036,6 +17179,7 @@ async def test_stop_notebook_runtime_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.stop_notebook_runtime(request) # Establish that the response is the type that we expect. @@ -17082,6 +17226,7 @@ async def test_stop_notebook_runtime_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -17130,6 +17275,7 @@ async def test_create_notebook_execution_job_rest_asyncio_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"} await client.create_notebook_execution_job(request) @@ -17185,6 +17331,7 @@ async def test_create_notebook_execution_job_rest_asyncio_call_success(request_t "gcs_output_uri": "gcs_output_uri_value", "execution_user": "execution_user_value", "service_account": "service_account_value", + "workbench_runtime": {}, "name": "name_value", "display_name": "display_name_value", "execution_timeout": {"seconds": 751, "nanos": 543}, @@ -17203,6 +17350,7 @@ async def test_create_notebook_execution_job_rest_asyncio_call_success(request_t "create_time": {"seconds": 751, "nanos": 543}, "update_time": {}, "labels": {}, + "kernel_name": "kernel_name_value", "encryption_spec": {"kms_key_name": "kms_key_name_value"}, } # The version of a generated dependency at test runtime may differ from the version used during generation. @@ -17291,6 +17439,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.create_notebook_execution_job(request) # Establish that the response is the type that we expect. @@ -17341,6 +17490,7 @@ async def test_create_notebook_execution_job_rest_asyncio_interceptors( 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.read = mock.AsyncMock(return_value=return_value) @@ -17391,6 +17541,7 @@ async def test_get_notebook_execution_job_rest_asyncio_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"} await client.get_notebook_execution_job(request) @@ -17425,6 +17576,7 @@ async def test_get_notebook_execution_job_rest_asyncio_call_success(request_type display_name="display_name_value", schedule_resource_name="schedule_resource_name_value", job_state=job_state.JobState.JOB_STATE_QUEUED, + kernel_name="kernel_name_value", notebook_runtime_template_resource_name="notebook_runtime_template_resource_name_value", gcs_output_uri="gcs_output_uri_value", execution_user="execution_user_value", @@ -17441,6 +17593,7 @@ async def test_get_notebook_execution_job_rest_asyncio_call_success(request_type return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_notebook_execution_job(request) # Establish that the response is the type that we expect. @@ -17449,6 +17602,7 @@ async def test_get_notebook_execution_job_rest_asyncio_call_success(request_type assert response.display_name == "display_name_value" assert response.schedule_resource_name == "schedule_resource_name_value" assert response.job_state == job_state.JobState.JOB_STATE_QUEUED + assert response.kernel_name == "kernel_name_value" @pytest.mark.asyncio @@ -17490,6 +17644,7 @@ async def test_get_notebook_execution_job_rest_asyncio_interceptors(null_interce 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 = notebook_execution_job.NotebookExecutionJob.to_json( notebook_execution_job.NotebookExecutionJob() ) @@ -17540,6 +17695,7 @@ async def test_list_notebook_execution_jobs_rest_asyncio_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"} await client.list_notebook_execution_jobs(request) @@ -17584,6 +17740,7 @@ async def test_list_notebook_execution_jobs_rest_asyncio_call_success(request_ty return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_notebook_execution_jobs(request) # Establish that the response is the type that we expect. @@ -17631,6 +17788,7 @@ async def test_list_notebook_execution_jobs_rest_asyncio_interceptors(null_inter 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 = notebook_service.ListNotebookExecutionJobsResponse.to_json( notebook_service.ListNotebookExecutionJobsResponse() ) @@ -17683,6 +17841,7 @@ async def test_delete_notebook_execution_job_rest_asyncio_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"} await client.delete_notebook_execution_job(request) @@ -17722,6 +17881,7 @@ async def test_delete_notebook_execution_job_rest_asyncio_call_success(request_t return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_notebook_execution_job(request) # Establish that the response is the type that we expect. @@ -17772,6 +17932,7 @@ async def test_delete_notebook_execution_job_rest_asyncio_interceptors( 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.read = mock.AsyncMock(return_value=return_value) @@ -17822,6 +17983,7 @@ async def test_get_location_rest_asyncio_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"} await client.get_location(request) @@ -17859,6 +18021,7 @@ async def test_get_location_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_location(request) @@ -17891,6 +18054,7 @@ async def test_list_locations_rest_asyncio_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"} await client.list_locations(request) @@ -17928,6 +18092,7 @@ async def test_list_locations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_locations(request) @@ -17963,6 +18128,7 @@ async def test_get_iam_policy_rest_asyncio_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"} await client.get_iam_policy(request) @@ -18002,6 +18168,7 @@ async def test_get_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_iam_policy(request) @@ -18037,6 +18204,7 @@ async def test_set_iam_policy_rest_asyncio_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"} await client.set_iam_policy(request) @@ -18076,6 +18244,7 @@ async def test_set_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.set_iam_policy(request) @@ -18111,6 +18280,7 @@ async def test_test_iam_permissions_rest_asyncio_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"} await client.test_iam_permissions(request) @@ -18150,6 +18320,7 @@ async def test_test_iam_permissions_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.test_iam_permissions(request) @@ -18184,6 +18355,7 @@ async def test_cancel_operation_rest_asyncio_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"} await client.cancel_operation(request) @@ -18221,6 +18393,7 @@ async def test_cancel_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.cancel_operation(request) @@ -18255,6 +18428,7 @@ async def test_delete_operation_rest_asyncio_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"} await client.delete_operation(request) @@ -18292,6 +18466,7 @@ async def test_delete_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_operation(request) @@ -18326,6 +18501,7 @@ async def test_get_operation_rest_asyncio_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"} await client.get_operation(request) @@ -18363,6 +18539,7 @@ async def test_get_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_operation(request) @@ -18397,6 +18574,7 @@ async def test_list_operations_rest_asyncio_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"} await client.list_operations(request) @@ -18434,6 +18612,7 @@ async def test_list_operations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_operations(request) @@ -18468,6 +18647,7 @@ async def test_wait_operation_rest_asyncio_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"} await client.wait_operation(request) @@ -18505,6 +18685,7 @@ async def test_wait_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.wait_operation(request) diff --git a/tests/unit/gapic/aiplatform_v1/test_persistent_resource_service.py b/tests/unit/gapic/aiplatform_v1/test_persistent_resource_service.py index b07c2625f7..9ddb342010 100644 --- a/tests/unit/gapic/aiplatform_v1/test_persistent_resource_service.py +++ b/tests/unit/gapic/aiplatform_v1/test_persistent_resource_service.py @@ -3644,6 +3644,7 @@ def test_create_persistent_resource_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_persistent_resource(request) @@ -3706,6 +3707,7 @@ def test_create_persistent_resource_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_persistent_resource(**mock_args) @@ -3846,6 +3848,7 @@ def test_get_persistent_resource_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_persistent_resource(request) @@ -3893,6 +3896,7 @@ def test_get_persistent_resource_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_persistent_resource(**mock_args) @@ -4040,6 +4044,7 @@ def test_list_persistent_resources_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_persistent_resources(request) @@ -4095,6 +4100,7 @@ def test_list_persistent_resources_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_persistent_resources(**mock_args) @@ -4298,6 +4304,7 @@ def test_delete_persistent_resource_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_persistent_resource(request) @@ -4343,6 +4350,7 @@ def test_delete_persistent_resource_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_persistent_resource(**mock_args) @@ -4478,6 +4486,7 @@ def test_update_persistent_resource_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_persistent_resource(request) @@ -4536,6 +4545,7 @@ def test_update_persistent_resource_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_persistent_resource(**mock_args) @@ -4677,6 +4687,7 @@ def test_reboot_persistent_resource_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.reboot_persistent_resource(request) @@ -4722,6 +4733,7 @@ def test_reboot_persistent_resource_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.reboot_persistent_resource(**mock_args) @@ -5209,6 +5221,7 @@ def test_create_persistent_resource_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_persistent_resource(request) @@ -5375,6 +5388,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_persistent_resource(request) # Establish that the response is the type that we expect. @@ -5418,6 +5432,7 @@ def test_create_persistent_resource_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 @@ -5464,6 +5479,7 @@ def test_get_persistent_resource_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_persistent_resource(request) @@ -5505,6 +5521,7 @@ def test_get_persistent_resource_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_persistent_resource(request) # Establish that the response is the type that we expect. @@ -5551,6 +5568,7 @@ def test_get_persistent_resource_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 = persistent_resource.PersistentResource.to_json( persistent_resource.PersistentResource() ) @@ -5597,6 +5615,7 @@ def test_list_persistent_resources_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_persistent_resources(request) @@ -5634,6 +5653,7 @@ def test_list_persistent_resources_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_persistent_resources(request) # Establish that the response is the type that we expect. @@ -5676,6 +5696,7 @@ def test_list_persistent_resources_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 = ( persistent_resource_service.ListPersistentResourcesResponse.to_json( persistent_resource_service.ListPersistentResourcesResponse() @@ -5728,6 +5749,7 @@ def test_delete_persistent_resource_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_persistent_resource(request) @@ -5760,6 +5782,7 @@ def test_delete_persistent_resource_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_persistent_resource(request) # Establish that the response is the type that we expect. @@ -5803,6 +5826,7 @@ def test_delete_persistent_resource_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 @@ -5851,6 +5875,7 @@ def test_update_persistent_resource_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_persistent_resource(request) @@ -6021,6 +6046,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_persistent_resource(request) # Establish that the response is the type that we expect. @@ -6064,6 +6090,7 @@ def test_update_persistent_resource_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 @@ -6110,6 +6137,7 @@ def test_reboot_persistent_resource_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.reboot_persistent_resource(request) @@ -6142,6 +6170,7 @@ def test_reboot_persistent_resource_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.reboot_persistent_resource(request) # Establish that the response is the type that we expect. @@ -6185,6 +6214,7 @@ def test_reboot_persistent_resource_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 @@ -6229,6 +6259,7 @@ def test_get_location_rest_bad_request(request_type=locations_pb2.GetLocationReq 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_location(request) @@ -6259,6 +6290,7 @@ def test_get_location_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_location(request) @@ -6287,6 +6319,7 @@ def test_list_locations_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_locations(request) @@ -6317,6 +6350,7 @@ def test_list_locations_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_locations(request) @@ -6348,6 +6382,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -6380,6 +6415,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -6411,6 +6447,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -6443,6 +6480,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -6474,6 +6512,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -6506,6 +6545,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -6536,6 +6576,7 @@ def test_cancel_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.cancel_operation(request) @@ -6566,6 +6607,7 @@ def test_cancel_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.cancel_operation(request) @@ -6596,6 +6638,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) @@ -6626,6 +6669,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) @@ -6656,6 +6700,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) @@ -6686,6 +6731,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) @@ -6716,6 +6762,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) @@ -6746,6 +6793,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) @@ -6776,6 +6824,7 @@ def test_wait_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.wait_operation(request) @@ -6806,6 +6855,7 @@ def test_wait_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.wait_operation(request) @@ -7005,6 +7055,7 @@ async def test_create_persistent_resource_rest_asyncio_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"} await client.create_persistent_resource(request) @@ -7178,6 +7229,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.create_persistent_resource(request) # Establish that the response is the type that we expect. @@ -7226,6 +7278,7 @@ async def test_create_persistent_resource_rest_asyncio_interceptors(null_interce 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.read = mock.AsyncMock(return_value=return_value) @@ -7276,6 +7329,7 @@ async def test_get_persistent_resource_rest_asyncio_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"} await client.get_persistent_resource(request) @@ -7324,6 +7378,7 @@ async def test_get_persistent_resource_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_persistent_resource(request) # Establish that the response is the type that we expect. @@ -7375,6 +7430,7 @@ async def test_get_persistent_resource_rest_asyncio_interceptors(null_intercepto 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 = persistent_resource.PersistentResource.to_json( persistent_resource.PersistentResource() ) @@ -7425,6 +7481,7 @@ async def test_list_persistent_resources_rest_asyncio_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"} await client.list_persistent_resources(request) @@ -7469,6 +7526,7 @@ async def test_list_persistent_resources_rest_asyncio_call_success(request_type) return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_persistent_resources(request) # Establish that the response is the type that we expect. @@ -7516,6 +7574,7 @@ async def test_list_persistent_resources_rest_asyncio_interceptors(null_intercep 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 = ( persistent_resource_service.ListPersistentResourcesResponse.to_json( persistent_resource_service.ListPersistentResourcesResponse() @@ -7572,6 +7631,7 @@ async def test_delete_persistent_resource_rest_asyncio_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"} await client.delete_persistent_resource(request) @@ -7611,6 +7671,7 @@ async def test_delete_persistent_resource_rest_asyncio_call_success(request_type return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_persistent_resource(request) # Establish that the response is the type that we expect. @@ -7659,6 +7720,7 @@ async def test_delete_persistent_resource_rest_asyncio_interceptors(null_interce 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.read = mock.AsyncMock(return_value=return_value) @@ -7711,6 +7773,7 @@ async def test_update_persistent_resource_rest_asyncio_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"} await client.update_persistent_resource(request) @@ -7888,6 +7951,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.update_persistent_resource(request) # Establish that the response is the type that we expect. @@ -7936,6 +8000,7 @@ async def test_update_persistent_resource_rest_asyncio_interceptors(null_interce 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.read = mock.AsyncMock(return_value=return_value) @@ -7986,6 +8051,7 @@ async def test_reboot_persistent_resource_rest_asyncio_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"} await client.reboot_persistent_resource(request) @@ -8025,6 +8091,7 @@ async def test_reboot_persistent_resource_rest_asyncio_call_success(request_type return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.reboot_persistent_resource(request) # Establish that the response is the type that we expect. @@ -8073,6 +8140,7 @@ async def test_reboot_persistent_resource_rest_asyncio_interceptors(null_interce 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.read = mock.AsyncMock(return_value=return_value) @@ -8123,6 +8191,7 @@ async def test_get_location_rest_asyncio_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"} await client.get_location(request) @@ -8160,6 +8229,7 @@ async def test_get_location_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_location(request) @@ -8192,6 +8262,7 @@ async def test_list_locations_rest_asyncio_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"} await client.list_locations(request) @@ -8229,6 +8300,7 @@ async def test_list_locations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_locations(request) @@ -8264,6 +8336,7 @@ async def test_get_iam_policy_rest_asyncio_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"} await client.get_iam_policy(request) @@ -8303,6 +8376,7 @@ async def test_get_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_iam_policy(request) @@ -8338,6 +8412,7 @@ async def test_set_iam_policy_rest_asyncio_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"} await client.set_iam_policy(request) @@ -8377,6 +8452,7 @@ async def test_set_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.set_iam_policy(request) @@ -8412,6 +8488,7 @@ async def test_test_iam_permissions_rest_asyncio_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"} await client.test_iam_permissions(request) @@ -8451,6 +8528,7 @@ async def test_test_iam_permissions_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.test_iam_permissions(request) @@ -8485,6 +8563,7 @@ async def test_cancel_operation_rest_asyncio_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"} await client.cancel_operation(request) @@ -8522,6 +8601,7 @@ async def test_cancel_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.cancel_operation(request) @@ -8556,6 +8636,7 @@ async def test_delete_operation_rest_asyncio_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"} await client.delete_operation(request) @@ -8593,6 +8674,7 @@ async def test_delete_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_operation(request) @@ -8627,6 +8709,7 @@ async def test_get_operation_rest_asyncio_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"} await client.get_operation(request) @@ -8664,6 +8747,7 @@ async def test_get_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_operation(request) @@ -8698,6 +8782,7 @@ async def test_list_operations_rest_asyncio_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"} await client.list_operations(request) @@ -8735,6 +8820,7 @@ async def test_list_operations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_operations(request) @@ -8769,6 +8855,7 @@ async def test_wait_operation_rest_asyncio_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"} await client.wait_operation(request) @@ -8806,6 +8893,7 @@ async def test_wait_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.wait_operation(request) diff --git a/tests/unit/gapic/aiplatform_v1/test_pipeline_service.py b/tests/unit/gapic/aiplatform_v1/test_pipeline_service.py index 5b86ce8da5..eca386f2df 100644 --- a/tests/unit/gapic/aiplatform_v1/test_pipeline_service.py +++ b/tests/unit/gapic/aiplatform_v1/test_pipeline_service.py @@ -5894,6 +5894,7 @@ def test_create_training_pipeline_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_training_pipeline(request) @@ -5948,6 +5949,7 @@ def test_create_training_pipeline_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_training_pipeline(**mock_args) @@ -6085,6 +6087,7 @@ def test_get_training_pipeline_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_training_pipeline(request) @@ -6132,6 +6135,7 @@ def test_get_training_pipeline_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_training_pipeline(**mock_args) @@ -6279,6 +6283,7 @@ def test_list_training_pipelines_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_training_pipelines(request) @@ -6334,6 +6339,7 @@ def test_list_training_pipelines_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_training_pipelines(**mock_args) @@ -6534,6 +6540,7 @@ def test_delete_training_pipeline_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_training_pipeline(request) @@ -6579,6 +6586,7 @@ def test_delete_training_pipeline_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_training_pipeline(**mock_args) @@ -6713,6 +6721,7 @@ def test_cancel_training_pipeline_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.cancel_training_pipeline(request) @@ -6758,6 +6767,7 @@ def test_cancel_training_pipeline_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.cancel_training_pipeline(**mock_args) @@ -6896,6 +6906,7 @@ def test_create_pipeline_job_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_pipeline_job(request) @@ -6951,6 +6962,7 @@ def test_create_pipeline_job_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_pipeline_job(**mock_args) @@ -7086,6 +7098,7 @@ def test_get_pipeline_job_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_pipeline_job(request) @@ -7133,6 +7146,7 @@ def test_get_pipeline_job_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_pipeline_job(**mock_args) @@ -7278,6 +7292,7 @@ def test_list_pipeline_jobs_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_pipeline_jobs(request) @@ -7334,6 +7349,7 @@ def test_list_pipeline_jobs_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_pipeline_jobs(**mock_args) @@ -7533,6 +7549,7 @@ def test_delete_pipeline_job_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_pipeline_job(request) @@ -7578,6 +7595,7 @@ def test_delete_pipeline_job_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_pipeline_job(**mock_args) @@ -7720,6 +7738,7 @@ def test_batch_delete_pipeline_jobs_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.batch_delete_pipeline_jobs(request) @@ -7772,6 +7791,7 @@ def test_batch_delete_pipeline_jobs_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.batch_delete_pipeline_jobs(**mock_args) @@ -7906,6 +7926,7 @@ def test_cancel_pipeline_job_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.cancel_pipeline_job(request) @@ -7951,6 +7972,7 @@ def test_cancel_pipeline_job_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.cancel_pipeline_job(**mock_args) @@ -8093,6 +8115,7 @@ def test_batch_cancel_pipeline_jobs_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.batch_cancel_pipeline_jobs(request) @@ -8145,6 +8168,7 @@ def test_batch_cancel_pipeline_jobs_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.batch_cancel_pipeline_jobs(**mock_args) @@ -8953,6 +8977,7 @@ def test_create_training_pipeline_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_training_pipeline(request) @@ -9243,6 +9268,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_training_pipeline(request) # Establish that the response is the type that we expect. @@ -9288,6 +9314,7 @@ def test_create_training_pipeline_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 = gca_training_pipeline.TrainingPipeline.to_json( gca_training_pipeline.TrainingPipeline() ) @@ -9336,6 +9363,7 @@ def test_get_training_pipeline_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_training_pipeline(request) @@ -9378,6 +9406,7 @@ def test_get_training_pipeline_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_training_pipeline(request) # Establish that the response is the type that we expect. @@ -9423,6 +9452,7 @@ def test_get_training_pipeline_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 = training_pipeline.TrainingPipeline.to_json( training_pipeline.TrainingPipeline() ) @@ -9469,6 +9499,7 @@ def test_list_training_pipelines_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_training_pipelines(request) @@ -9504,6 +9535,7 @@ def test_list_training_pipelines_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_training_pipelines(request) # Establish that the response is the type that we expect. @@ -9544,6 +9576,7 @@ def test_list_training_pipelines_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 = pipeline_service.ListTrainingPipelinesResponse.to_json( pipeline_service.ListTrainingPipelinesResponse() ) @@ -9592,6 +9625,7 @@ def test_delete_training_pipeline_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_training_pipeline(request) @@ -9624,6 +9658,7 @@ def test_delete_training_pipeline_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_training_pipeline(request) # Establish that the response is the type that we expect. @@ -9665,6 +9700,7 @@ def test_delete_training_pipeline_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 @@ -9711,6 +9747,7 @@ def test_cancel_training_pipeline_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.cancel_training_pipeline(request) @@ -9743,6 +9780,7 @@ def test_cancel_training_pipeline_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.cancel_training_pipeline(request) # Establish that the response is the type that we expect. @@ -9779,6 +9817,7 @@ def test_cancel_training_pipeline_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 = pipeline_service.CancelTrainingPipelineRequest() metadata = [ @@ -9819,6 +9858,7 @@ def test_create_pipeline_job_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_pipeline_job(request) @@ -10032,6 +10072,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_pipeline_job(request) # Establish that the response is the type that we expect. @@ -10080,6 +10121,7 @@ def test_create_pipeline_job_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 = gca_pipeline_job.PipelineJob.to_json( gca_pipeline_job.PipelineJob() ) @@ -10126,6 +10168,7 @@ def test_get_pipeline_job_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_pipeline_job(request) @@ -10169,6 +10212,7 @@ def test_get_pipeline_job_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_pipeline_job(request) # Establish that the response is the type that we expect. @@ -10217,6 +10261,7 @@ def test_get_pipeline_job_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 = pipeline_job.PipelineJob.to_json(pipeline_job.PipelineJob()) req.return_value.content = return_value @@ -10261,6 +10306,7 @@ def test_list_pipeline_jobs_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_pipeline_jobs(request) @@ -10296,6 +10342,7 @@ def test_list_pipeline_jobs_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_pipeline_jobs(request) # Establish that the response is the type that we expect. @@ -10336,6 +10383,7 @@ def test_list_pipeline_jobs_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 = pipeline_service.ListPipelineJobsResponse.to_json( pipeline_service.ListPipelineJobsResponse() ) @@ -10382,6 +10430,7 @@ def test_delete_pipeline_job_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_pipeline_job(request) @@ -10412,6 +10461,7 @@ def test_delete_pipeline_job_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_pipeline_job(request) # Establish that the response is the type that we expect. @@ -10453,6 +10503,7 @@ def test_delete_pipeline_job_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 @@ -10497,6 +10548,7 @@ def test_batch_delete_pipeline_jobs_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.batch_delete_pipeline_jobs(request) @@ -10527,6 +10579,7 @@ def test_batch_delete_pipeline_jobs_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.batch_delete_pipeline_jobs(request) # Establish that the response is the type that we expect. @@ -10568,6 +10621,7 @@ def test_batch_delete_pipeline_jobs_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 @@ -10612,6 +10666,7 @@ def test_cancel_pipeline_job_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.cancel_pipeline_job(request) @@ -10642,6 +10697,7 @@ def test_cancel_pipeline_job_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.cancel_pipeline_job(request) # Establish that the response is the type that we expect. @@ -10678,6 +10734,7 @@ def test_cancel_pipeline_job_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 = pipeline_service.CancelPipelineJobRequest() metadata = [ @@ -10718,6 +10775,7 @@ def test_batch_cancel_pipeline_jobs_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.batch_cancel_pipeline_jobs(request) @@ -10748,6 +10806,7 @@ def test_batch_cancel_pipeline_jobs_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.batch_cancel_pipeline_jobs(request) # Establish that the response is the type that we expect. @@ -10789,6 +10848,7 @@ def test_batch_cancel_pipeline_jobs_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 @@ -10833,6 +10893,7 @@ def test_get_location_rest_bad_request(request_type=locations_pb2.GetLocationReq 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_location(request) @@ -10863,6 +10924,7 @@ def test_get_location_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_location(request) @@ -10891,6 +10953,7 @@ def test_list_locations_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_locations(request) @@ -10921,6 +10984,7 @@ def test_list_locations_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_locations(request) @@ -10952,6 +11016,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -10984,6 +11049,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -11015,6 +11081,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -11047,6 +11114,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -11078,6 +11146,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -11110,6 +11179,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -11140,6 +11210,7 @@ def test_cancel_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.cancel_operation(request) @@ -11170,6 +11241,7 @@ def test_cancel_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.cancel_operation(request) @@ -11200,6 +11272,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) @@ -11230,6 +11303,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) @@ -11260,6 +11334,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) @@ -11290,6 +11365,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) @@ -11320,6 +11396,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) @@ -11350,6 +11427,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) @@ -11380,6 +11458,7 @@ def test_wait_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.wait_operation(request) @@ -11410,6 +11489,7 @@ def test_wait_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.wait_operation(request) @@ -11739,6 +11819,7 @@ async def test_create_training_pipeline_rest_asyncio_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"} await client.create_training_pipeline(request) @@ -12036,6 +12117,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.create_training_pipeline(request) # Establish that the response is the type that we expect. @@ -12086,6 +12168,7 @@ async def test_create_training_pipeline_rest_asyncio_interceptors(null_intercept 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 = gca_training_pipeline.TrainingPipeline.to_json( gca_training_pipeline.TrainingPipeline() ) @@ -12138,6 +12221,7 @@ async def test_get_training_pipeline_rest_asyncio_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"} await client.get_training_pipeline(request) @@ -12187,6 +12271,7 @@ async def test_get_training_pipeline_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_training_pipeline(request) # Establish that the response is the type that we expect. @@ -12237,6 +12322,7 @@ async def test_get_training_pipeline_rest_asyncio_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 = training_pipeline.TrainingPipeline.to_json( training_pipeline.TrainingPipeline() ) @@ -12287,6 +12373,7 @@ async def test_list_training_pipelines_rest_asyncio_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"} await client.list_training_pipelines(request) @@ -12329,6 +12416,7 @@ async def test_list_training_pipelines_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_training_pipelines(request) # Establish that the response is the type that we expect. @@ -12374,6 +12462,7 @@ async def test_list_training_pipelines_rest_asyncio_interceptors(null_intercepto 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 = pipeline_service.ListTrainingPipelinesResponse.to_json( pipeline_service.ListTrainingPipelinesResponse() ) @@ -12426,6 +12515,7 @@ async def test_delete_training_pipeline_rest_asyncio_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"} await client.delete_training_pipeline(request) @@ -12465,6 +12555,7 @@ async def test_delete_training_pipeline_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_training_pipeline(request) # Establish that the response is the type that we expect. @@ -12511,6 +12602,7 @@ async def test_delete_training_pipeline_rest_asyncio_interceptors(null_intercept 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.read = mock.AsyncMock(return_value=return_value) @@ -12561,6 +12653,7 @@ async def test_cancel_training_pipeline_rest_asyncio_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"} await client.cancel_training_pipeline(request) @@ -12600,6 +12693,7 @@ async def test_cancel_training_pipeline_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.cancel_training_pipeline(request) # Establish that the response is the type that we expect. @@ -12641,6 +12735,7 @@ async def test_cancel_training_pipeline_rest_asyncio_interceptors(null_intercept req.return_value = mock.Mock() req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} request = pipeline_service.CancelTrainingPipelineRequest() metadata = [ @@ -12685,6 +12780,7 @@ async def test_create_pipeline_job_rest_asyncio_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"} await client.create_pipeline_job(request) @@ -12905,6 +13001,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.create_pipeline_job(request) # Establish that the response is the type that we expect. @@ -12958,6 +13055,7 @@ async def test_create_pipeline_job_rest_asyncio_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 = gca_pipeline_job.PipelineJob.to_json( gca_pipeline_job.PipelineJob() ) @@ -13008,6 +13106,7 @@ async def test_get_pipeline_job_rest_asyncio_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"} await client.get_pipeline_job(request) @@ -13058,6 +13157,7 @@ async def test_get_pipeline_job_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_pipeline_job(request) # Establish that the response is the type that we expect. @@ -13111,6 +13211,7 @@ async def test_get_pipeline_job_rest_asyncio_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 = pipeline_job.PipelineJob.to_json(pipeline_job.PipelineJob()) req.return_value.read = mock.AsyncMock(return_value=return_value) @@ -13159,6 +13260,7 @@ async def test_list_pipeline_jobs_rest_asyncio_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"} await client.list_pipeline_jobs(request) @@ -13201,6 +13303,7 @@ async def test_list_pipeline_jobs_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_pipeline_jobs(request) # Establish that the response is the type that we expect. @@ -13246,6 +13349,7 @@ async def test_list_pipeline_jobs_rest_asyncio_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 = pipeline_service.ListPipelineJobsResponse.to_json( pipeline_service.ListPipelineJobsResponse() ) @@ -13296,6 +13400,7 @@ async def test_delete_pipeline_job_rest_asyncio_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"} await client.delete_pipeline_job(request) @@ -13333,6 +13438,7 @@ async def test_delete_pipeline_job_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_pipeline_job(request) # Establish that the response is the type that we expect. @@ -13379,6 +13485,7 @@ async def test_delete_pipeline_job_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -13427,6 +13534,7 @@ async def test_batch_delete_pipeline_jobs_rest_asyncio_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"} await client.batch_delete_pipeline_jobs(request) @@ -13464,6 +13572,7 @@ async def test_batch_delete_pipeline_jobs_rest_asyncio_call_success(request_type return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.batch_delete_pipeline_jobs(request) # Establish that the response is the type that we expect. @@ -13511,6 +13620,7 @@ async def test_batch_delete_pipeline_jobs_rest_asyncio_interceptors(null_interce 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.read = mock.AsyncMock(return_value=return_value) @@ -13559,6 +13669,7 @@ async def test_cancel_pipeline_job_rest_asyncio_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"} await client.cancel_pipeline_job(request) @@ -13596,6 +13707,7 @@ async def test_cancel_pipeline_job_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.cancel_pipeline_job(request) # Establish that the response is the type that we expect. @@ -13637,6 +13749,7 @@ async def test_cancel_pipeline_job_rest_asyncio_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 = pipeline_service.CancelPipelineJobRequest() metadata = [ @@ -13681,6 +13794,7 @@ async def test_batch_cancel_pipeline_jobs_rest_asyncio_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"} await client.batch_cancel_pipeline_jobs(request) @@ -13718,6 +13832,7 @@ async def test_batch_cancel_pipeline_jobs_rest_asyncio_call_success(request_type return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.batch_cancel_pipeline_jobs(request) # Establish that the response is the type that we expect. @@ -13765,6 +13880,7 @@ async def test_batch_cancel_pipeline_jobs_rest_asyncio_interceptors(null_interce 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.read = mock.AsyncMock(return_value=return_value) @@ -13815,6 +13931,7 @@ async def test_get_location_rest_asyncio_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"} await client.get_location(request) @@ -13852,6 +13969,7 @@ async def test_get_location_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_location(request) @@ -13884,6 +14002,7 @@ async def test_list_locations_rest_asyncio_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"} await client.list_locations(request) @@ -13921,6 +14040,7 @@ async def test_list_locations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_locations(request) @@ -13956,6 +14076,7 @@ async def test_get_iam_policy_rest_asyncio_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"} await client.get_iam_policy(request) @@ -13995,6 +14116,7 @@ async def test_get_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_iam_policy(request) @@ -14030,6 +14152,7 @@ async def test_set_iam_policy_rest_asyncio_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"} await client.set_iam_policy(request) @@ -14069,6 +14192,7 @@ async def test_set_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.set_iam_policy(request) @@ -14104,6 +14228,7 @@ async def test_test_iam_permissions_rest_asyncio_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"} await client.test_iam_permissions(request) @@ -14143,6 +14268,7 @@ async def test_test_iam_permissions_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.test_iam_permissions(request) @@ -14177,6 +14303,7 @@ async def test_cancel_operation_rest_asyncio_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"} await client.cancel_operation(request) @@ -14214,6 +14341,7 @@ async def test_cancel_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.cancel_operation(request) @@ -14248,6 +14376,7 @@ async def test_delete_operation_rest_asyncio_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"} await client.delete_operation(request) @@ -14285,6 +14414,7 @@ async def test_delete_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_operation(request) @@ -14319,6 +14449,7 @@ async def test_get_operation_rest_asyncio_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"} await client.get_operation(request) @@ -14356,6 +14487,7 @@ async def test_get_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_operation(request) @@ -14390,6 +14522,7 @@ async def test_list_operations_rest_asyncio_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"} await client.list_operations(request) @@ -14427,6 +14560,7 @@ async def test_list_operations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_operations(request) @@ -14461,6 +14595,7 @@ async def test_wait_operation_rest_asyncio_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"} await client.wait_operation(request) @@ -14498,6 +14633,7 @@ async def test_wait_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.wait_operation(request) diff --git a/tests/unit/gapic/aiplatform_v1/test_prediction_service.py b/tests/unit/gapic/aiplatform_v1/test_prediction_service.py index 2ad0e8ed34..9344a46601 100644 --- a/tests/unit/gapic/aiplatform_v1/test_prediction_service.py +++ b/tests/unit/gapic/aiplatform_v1/test_prediction_service.py @@ -4538,6 +4538,7 @@ def test_predict_rest_required_fields(request_type=prediction_service.PredictReq 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.predict(request) @@ -4595,6 +4596,7 @@ def test_predict_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.predict(**mock_args) @@ -4727,6 +4729,7 @@ def test_raw_predict_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.raw_predict(request) @@ -4773,6 +4776,7 @@ def test_raw_predict_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.raw_predict(**mock_args) @@ -4909,6 +4913,7 @@ def test_stream_raw_predict_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"} with mock.patch.object(response_value, "iter_content") as iter_content: iter_content.return_value = iter(json_return_value) @@ -4958,6 +4963,7 @@ def test_stream_raw_predict_rest_flattened(): json_return_value = "[{}]".format(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"} with mock.patch.object(response_value, "iter_content") as iter_content: iter_content.return_value = iter(json_return_value) @@ -5093,6 +5099,7 @@ def test_direct_predict_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.direct_predict(request) @@ -5217,6 +5224,7 @@ def test_direct_raw_predict_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.direct_raw_predict(request) @@ -5376,6 +5384,7 @@ def test_server_streaming_predict_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"} with mock.patch.object(response_value, "iter_content") as iter_content: iter_content.return_value = iter(json_return_value) @@ -5507,6 +5516,7 @@ def test_explain_rest_required_fields(request_type=prediction_service.ExplainReq 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.explain(request) @@ -5565,6 +5575,7 @@ def test_explain_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.explain(**mock_args) @@ -5702,6 +5713,7 @@ def test_generate_content_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.generate_content(request) @@ -5758,6 +5770,7 @@ def test_generate_content_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.generate_content(**mock_args) @@ -5897,6 +5910,7 @@ def test_stream_generate_content_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"} with mock.patch.object(response_value, "iter_content") as iter_content: iter_content.return_value = iter(json_return_value) @@ -5956,6 +5970,7 @@ def test_stream_generate_content_rest_flattened(): json_return_value = "[{}]".format(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"} with mock.patch.object(response_value, "iter_content") as iter_content: iter_content.return_value = iter(json_return_value) @@ -6631,6 +6646,7 @@ def test_predict_rest_bad_request(request_type=prediction_service.PredictRequest 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.predict(request) @@ -6669,6 +6685,7 @@ def test_predict_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.predict(request) # Establish that the response is the type that we expect. @@ -6712,6 +6729,7 @@ def test_predict_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 = prediction_service.PredictResponse.to_json( prediction_service.PredictResponse() ) @@ -6758,6 +6776,7 @@ def test_raw_predict_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.raw_predict(request) @@ -6791,6 +6810,7 @@ def test_raw_predict_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.raw_predict(request) # Establish that the response is the type that we expect. @@ -6832,6 +6852,7 @@ def test_raw_predict_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(httpbody_pb2.HttpBody()) req.return_value.content = return_value @@ -6876,6 +6897,7 @@ def test_stream_raw_predict_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.stream_raw_predict(request) @@ -6910,6 +6932,7 @@ def test_stream_raw_predict_rest_call_success(request_type): json_return_value = "[{}]".format(json_return_value) response_value.iter_content = mock.Mock(return_value=iter(json_return_value)) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.stream_raw_predict(request) assert isinstance(response, Iterable) @@ -6954,6 +6977,7 @@ def test_stream_raw_predict_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(httpbody_pb2.HttpBody()) req.return_value.iter_content = mock.Mock(return_value=iter(return_value)) @@ -6998,6 +7022,7 @@ def test_direct_predict_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.direct_predict(request) @@ -7031,6 +7056,7 @@ def test_direct_predict_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.direct_predict(request) # Establish that the response is the type that we expect. @@ -7070,6 +7096,7 @@ def test_direct_predict_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 = prediction_service.DirectPredictResponse.to_json( prediction_service.DirectPredictResponse() ) @@ -7116,6 +7143,7 @@ def test_direct_raw_predict_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.direct_raw_predict(request) @@ -7151,6 +7179,7 @@ def test_direct_raw_predict_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.direct_raw_predict(request) # Establish that the response is the type that we expect. @@ -7191,6 +7220,7 @@ def test_direct_raw_predict_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 = prediction_service.DirectRawPredictResponse.to_json( prediction_service.DirectRawPredictResponse() ) @@ -7276,6 +7306,7 @@ def test_server_streaming_predict_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.server_streaming_predict(request) @@ -7310,6 +7341,7 @@ def test_server_streaming_predict_rest_call_success(request_type): json_return_value = "[{}]".format(json_return_value) response_value.iter_content = mock.Mock(return_value=iter(json_return_value)) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.server_streaming_predict(request) assert isinstance(response, Iterable) @@ -7352,6 +7384,7 @@ def test_server_streaming_predict_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 = prediction_service.StreamingPredictResponse.to_json( prediction_service.StreamingPredictResponse() ) @@ -7409,6 +7442,7 @@ def test_explain_rest_bad_request(request_type=prediction_service.ExplainRequest 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.explain(request) @@ -7444,6 +7478,7 @@ def test_explain_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.explain(request) # Establish that the response is the type that we expect. @@ -7484,6 +7519,7 @@ def test_explain_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 = prediction_service.ExplainResponse.to_json( prediction_service.ExplainResponse() ) @@ -7530,6 +7566,7 @@ def test_generate_content_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.generate_content(request) @@ -7565,6 +7602,7 @@ def test_generate_content_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.generate_content(request) # Establish that the response is the type that we expect. @@ -7605,6 +7643,7 @@ def test_generate_content_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 = prediction_service.GenerateContentResponse.to_json( prediction_service.GenerateContentResponse() ) @@ -7651,6 +7690,7 @@ def test_stream_generate_content_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.stream_generate_content(request) @@ -7687,6 +7727,7 @@ def test_stream_generate_content_rest_call_success(request_type): json_return_value = "[{}]".format(json_return_value) response_value.iter_content = mock.Mock(return_value=iter(json_return_value)) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.stream_generate_content(request) assert isinstance(response, Iterable) @@ -7730,6 +7771,7 @@ def test_stream_generate_content_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 = prediction_service.GenerateContentResponse.to_json( prediction_service.GenerateContentResponse() ) @@ -7776,6 +7818,7 @@ def test_get_location_rest_bad_request(request_type=locations_pb2.GetLocationReq 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_location(request) @@ -7806,6 +7849,7 @@ def test_get_location_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_location(request) @@ -7834,6 +7878,7 @@ def test_list_locations_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_locations(request) @@ -7864,6 +7909,7 @@ def test_list_locations_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_locations(request) @@ -7895,6 +7941,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -7927,6 +7974,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -7958,6 +8006,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -7990,6 +8039,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -8021,6 +8071,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -8053,6 +8104,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -8083,6 +8135,7 @@ def test_cancel_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.cancel_operation(request) @@ -8113,6 +8166,7 @@ def test_cancel_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.cancel_operation(request) @@ -8143,6 +8197,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) @@ -8173,6 +8228,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) @@ -8203,6 +8259,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) @@ -8233,6 +8290,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) @@ -8263,6 +8321,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) @@ -8293,6 +8352,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) @@ -8323,6 +8383,7 @@ def test_wait_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.wait_operation(request) @@ -8353,6 +8414,7 @@ def test_wait_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.wait_operation(request) @@ -8591,6 +8653,7 @@ async def test_predict_rest_asyncio_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"} await client.predict(request) @@ -8636,6 +8699,7 @@ async def test_predict_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.predict(request) # Establish that the response is the type that we expect. @@ -8684,6 +8748,7 @@ async def test_predict_rest_asyncio_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 = prediction_service.PredictResponse.to_json( prediction_service.PredictResponse() ) @@ -8734,6 +8799,7 @@ async def test_raw_predict_rest_asyncio_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"} await client.raw_predict(request) @@ -8774,6 +8840,7 @@ async def test_raw_predict_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.raw_predict(request) # Establish that the response is the type that we expect. @@ -8820,6 +8887,7 @@ async def test_raw_predict_rest_asyncio_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(httpbody_pb2.HttpBody()) req.return_value.read = mock.AsyncMock(return_value=return_value) @@ -8868,6 +8936,7 @@ async def test_stream_raw_predict_rest_asyncio_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"} await client.stream_raw_predict(request) @@ -8907,6 +8976,7 @@ async def test_stream_raw_predict_rest_asyncio_call_success(request_type): json_return_value = "[{}]".format(json_return_value) response_value.content.return_value = mock_async_gen(json_return_value) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.stream_raw_predict(request) assert isinstance(response, AsyncIterable) @@ -8956,6 +9026,7 @@ async def test_stream_raw_predict_rest_asyncio_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(httpbody_pb2.HttpBody()) req.return_value.content.return_value = mock_async_gen(return_value) @@ -9004,6 +9075,7 @@ async def test_direct_predict_rest_asyncio_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"} await client.direct_predict(request) @@ -9044,6 +9116,7 @@ async def test_direct_predict_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.direct_predict(request) # Establish that the response is the type that we expect. @@ -9088,6 +9161,7 @@ async def test_direct_predict_rest_asyncio_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 = prediction_service.DirectPredictResponse.to_json( prediction_service.DirectPredictResponse() ) @@ -9138,6 +9212,7 @@ async def test_direct_raw_predict_rest_asyncio_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"} await client.direct_raw_predict(request) @@ -9180,6 +9255,7 @@ async def test_direct_raw_predict_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.direct_raw_predict(request) # Establish that the response is the type that we expect. @@ -9225,6 +9301,7 @@ async def test_direct_raw_predict_rest_asyncio_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 = prediction_service.DirectRawPredictResponse.to_json( prediction_service.DirectRawPredictResponse() ) @@ -9329,6 +9406,7 @@ async def test_server_streaming_predict_rest_asyncio_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"} await client.server_streaming_predict(request) @@ -9368,6 +9446,7 @@ async def test_server_streaming_predict_rest_asyncio_call_success(request_type): json_return_value = "[{}]".format(json_return_value) response_value.content.return_value = mock_async_gen(json_return_value) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.server_streaming_predict(request) assert isinstance(response, AsyncIterable) @@ -9416,6 +9495,7 @@ async def test_server_streaming_predict_rest_asyncio_interceptors(null_intercept 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 = prediction_service.StreamingPredictResponse.to_json( prediction_service.StreamingPredictResponse() ) @@ -9484,6 +9564,7 @@ async def test_explain_rest_asyncio_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"} await client.explain(request) @@ -9526,6 +9607,7 @@ async def test_explain_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.explain(request) # Establish that the response is the type that we expect. @@ -9571,6 +9653,7 @@ async def test_explain_rest_asyncio_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 = prediction_service.ExplainResponse.to_json( prediction_service.ExplainResponse() ) @@ -9621,6 +9704,7 @@ async def test_generate_content_rest_asyncio_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"} await client.generate_content(request) @@ -9663,6 +9747,7 @@ async def test_generate_content_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.generate_content(request) # Establish that the response is the type that we expect. @@ -9708,6 +9793,7 @@ async def test_generate_content_rest_asyncio_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 = prediction_service.GenerateContentResponse.to_json( prediction_service.GenerateContentResponse() ) @@ -9758,6 +9844,7 @@ async def test_stream_generate_content_rest_asyncio_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"} await client.stream_generate_content(request) @@ -9799,6 +9886,7 @@ async def test_stream_generate_content_rest_asyncio_call_success(request_type): json_return_value = "[{}]".format(json_return_value) response_value.content.return_value = mock_async_gen(json_return_value) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.stream_generate_content(request) assert isinstance(response, AsyncIterable) @@ -9847,6 +9935,7 @@ async def test_stream_generate_content_rest_asyncio_interceptors(null_intercepto 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 = prediction_service.GenerateContentResponse.to_json( prediction_service.GenerateContentResponse() ) @@ -9899,6 +9988,7 @@ async def test_get_location_rest_asyncio_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"} await client.get_location(request) @@ -9936,6 +10026,7 @@ async def test_get_location_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_location(request) @@ -9968,6 +10059,7 @@ async def test_list_locations_rest_asyncio_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"} await client.list_locations(request) @@ -10005,6 +10097,7 @@ async def test_list_locations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_locations(request) @@ -10040,6 +10133,7 @@ async def test_get_iam_policy_rest_asyncio_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"} await client.get_iam_policy(request) @@ -10079,6 +10173,7 @@ async def test_get_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_iam_policy(request) @@ -10114,6 +10209,7 @@ async def test_set_iam_policy_rest_asyncio_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"} await client.set_iam_policy(request) @@ -10153,6 +10249,7 @@ async def test_set_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.set_iam_policy(request) @@ -10188,6 +10285,7 @@ async def test_test_iam_permissions_rest_asyncio_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"} await client.test_iam_permissions(request) @@ -10227,6 +10325,7 @@ async def test_test_iam_permissions_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.test_iam_permissions(request) @@ -10261,6 +10360,7 @@ async def test_cancel_operation_rest_asyncio_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"} await client.cancel_operation(request) @@ -10298,6 +10398,7 @@ async def test_cancel_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.cancel_operation(request) @@ -10332,6 +10433,7 @@ async def test_delete_operation_rest_asyncio_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"} await client.delete_operation(request) @@ -10369,6 +10471,7 @@ async def test_delete_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_operation(request) @@ -10403,6 +10506,7 @@ async def test_get_operation_rest_asyncio_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"} await client.get_operation(request) @@ -10440,6 +10544,7 @@ async def test_get_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_operation(request) @@ -10474,6 +10579,7 @@ async def test_list_operations_rest_asyncio_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"} await client.list_operations(request) @@ -10511,6 +10617,7 @@ async def test_list_operations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_operations(request) @@ -10545,6 +10652,7 @@ async def test_wait_operation_rest_asyncio_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"} await client.wait_operation(request) @@ -10582,6 +10690,7 @@ async def test_wait_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.wait_operation(request) diff --git a/tests/unit/gapic/aiplatform_v1/test_schedule_service.py b/tests/unit/gapic/aiplatform_v1/test_schedule_service.py index 3d39158d90..9929732b08 100644 --- a/tests/unit/gapic/aiplatform_v1/test_schedule_service.py +++ b/tests/unit/gapic/aiplatform_v1/test_schedule_service.py @@ -3784,6 +3784,7 @@ def test_create_schedule_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_schedule(request) @@ -3838,6 +3839,7 @@ def test_create_schedule_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_schedule(**mock_args) @@ -3970,6 +3972,7 @@ def test_delete_schedule_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_schedule(request) @@ -4015,6 +4018,7 @@ def test_delete_schedule_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_schedule(**mock_args) @@ -4145,6 +4149,7 @@ def test_get_schedule_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_schedule(request) @@ -4192,6 +4197,7 @@ def test_get_schedule_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_schedule(**mock_args) @@ -4331,6 +4337,7 @@ def test_list_schedules_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_schedules(request) @@ -4386,6 +4393,7 @@ def test_list_schedules_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_schedules(**mock_args) @@ -4577,6 +4585,7 @@ def test_pause_schedule_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.pause_schedule(request) @@ -4622,6 +4631,7 @@ def test_pause_schedule_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.pause_schedule(**mock_args) @@ -4751,6 +4761,7 @@ def test_resume_schedule_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.resume_schedule(request) @@ -4797,6 +4808,7 @@ def test_resume_schedule_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.resume_schedule(**mock_args) @@ -4927,6 +4939,7 @@ def test_update_schedule_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_schedule(request) @@ -4983,6 +4996,7 @@ def test_update_schedule_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_schedule(**mock_args) @@ -5508,6 +5522,7 @@ def test_create_schedule_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_schedule(request) @@ -5678,6 +5693,7 @@ def test_create_schedule_rest_call_success(request_type): "gcs_output_uri": "gcs_output_uri_value", "execution_user": "execution_user_value", "service_account": "service_account_value", + "workbench_runtime": {}, "name": "name_value", "display_name": "display_name_value", "execution_timeout": {"seconds": 751, "nanos": 543}, @@ -5687,6 +5703,7 @@ def test_create_schedule_rest_call_success(request_type): "create_time": {}, "update_time": {}, "labels": {}, + "kernel_name": "kernel_name_value", "encryption_spec": {}, }, "notebook_execution_job_id": "notebook_execution_job_id_value", @@ -5804,6 +5821,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_schedule(request) # Establish that the response is the type that we expect. @@ -5851,6 +5869,7 @@ def test_create_schedule_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 = gca_schedule.Schedule.to_json(gca_schedule.Schedule()) req.return_value.content = return_value @@ -5895,6 +5914,7 @@ def test_delete_schedule_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_schedule(request) @@ -5925,6 +5945,7 @@ def test_delete_schedule_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_schedule(request) # Establish that the response is the type that we expect. @@ -5966,6 +5987,7 @@ def test_delete_schedule_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 @@ -6010,6 +6032,7 @@ def test_get_schedule_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_schedule(request) @@ -6053,6 +6076,7 @@ def test_get_schedule_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_schedule(request) # Establish that the response is the type that we expect. @@ -6100,6 +6124,7 @@ def test_get_schedule_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 = schedule.Schedule.to_json(schedule.Schedule()) req.return_value.content = return_value @@ -6144,6 +6169,7 @@ def test_list_schedules_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_schedules(request) @@ -6179,6 +6205,7 @@ def test_list_schedules_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_schedules(request) # Establish that the response is the type that we expect. @@ -6219,6 +6246,7 @@ def test_list_schedules_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 = schedule_service.ListSchedulesResponse.to_json( schedule_service.ListSchedulesResponse() ) @@ -6265,6 +6293,7 @@ def test_pause_schedule_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.pause_schedule(request) @@ -6295,6 +6324,7 @@ def test_pause_schedule_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.pause_schedule(request) # Establish that the response is the type that we expect. @@ -6331,6 +6361,7 @@ def test_pause_schedule_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 = schedule_service.PauseScheduleRequest() metadata = [ @@ -6371,6 +6402,7 @@ def test_resume_schedule_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.resume_schedule(request) @@ -6401,6 +6433,7 @@ def test_resume_schedule_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.resume_schedule(request) # Establish that the response is the type that we expect. @@ -6437,6 +6470,7 @@ def test_resume_schedule_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 = schedule_service.ResumeScheduleRequest() metadata = [ @@ -6479,6 +6513,7 @@ def test_update_schedule_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_schedule(request) @@ -6651,6 +6686,7 @@ def test_update_schedule_rest_call_success(request_type): "gcs_output_uri": "gcs_output_uri_value", "execution_user": "execution_user_value", "service_account": "service_account_value", + "workbench_runtime": {}, "name": "name_value", "display_name": "display_name_value", "execution_timeout": {"seconds": 751, "nanos": 543}, @@ -6660,6 +6696,7 @@ def test_update_schedule_rest_call_success(request_type): "create_time": {}, "update_time": {}, "labels": {}, + "kernel_name": "kernel_name_value", "encryption_spec": {}, }, "notebook_execution_job_id": "notebook_execution_job_id_value", @@ -6777,6 +6814,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_schedule(request) # Establish that the response is the type that we expect. @@ -6824,6 +6862,7 @@ def test_update_schedule_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 = gca_schedule.Schedule.to_json(gca_schedule.Schedule()) req.return_value.content = return_value @@ -6868,6 +6907,7 @@ def test_get_location_rest_bad_request(request_type=locations_pb2.GetLocationReq 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_location(request) @@ -6898,6 +6938,7 @@ def test_get_location_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_location(request) @@ -6926,6 +6967,7 @@ def test_list_locations_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_locations(request) @@ -6956,6 +6998,7 @@ def test_list_locations_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_locations(request) @@ -6987,6 +7030,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -7019,6 +7063,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -7050,6 +7095,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -7082,6 +7128,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -7113,6 +7160,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -7145,6 +7193,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -7175,6 +7224,7 @@ def test_cancel_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.cancel_operation(request) @@ -7205,6 +7255,7 @@ def test_cancel_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.cancel_operation(request) @@ -7235,6 +7286,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) @@ -7265,6 +7317,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) @@ -7295,6 +7348,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) @@ -7325,6 +7379,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) @@ -7355,6 +7410,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) @@ -7385,6 +7441,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) @@ -7415,6 +7472,7 @@ def test_wait_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.wait_operation(request) @@ -7445,6 +7503,7 @@ def test_wait_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.wait_operation(request) @@ -7652,6 +7711,7 @@ async def test_create_schedule_rest_asyncio_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"} await client.create_schedule(request) @@ -7827,6 +7887,7 @@ async def test_create_schedule_rest_asyncio_call_success(request_type): "gcs_output_uri": "gcs_output_uri_value", "execution_user": "execution_user_value", "service_account": "service_account_value", + "workbench_runtime": {}, "name": "name_value", "display_name": "display_name_value", "execution_timeout": {"seconds": 751, "nanos": 543}, @@ -7836,6 +7897,7 @@ async def test_create_schedule_rest_asyncio_call_success(request_type): "create_time": {}, "update_time": {}, "labels": {}, + "kernel_name": "kernel_name_value", "encryption_spec": {}, }, "notebook_execution_job_id": "notebook_execution_job_id_value", @@ -7955,6 +8017,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.create_schedule(request) # Establish that the response is the type that we expect. @@ -8007,6 +8070,7 @@ async def test_create_schedule_rest_asyncio_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 = gca_schedule.Schedule.to_json(gca_schedule.Schedule()) req.return_value.read = mock.AsyncMock(return_value=return_value) @@ -8055,6 +8119,7 @@ async def test_delete_schedule_rest_asyncio_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"} await client.delete_schedule(request) @@ -8092,6 +8157,7 @@ async def test_delete_schedule_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_schedule(request) # Establish that the response is the type that we expect. @@ -8138,6 +8204,7 @@ async def test_delete_schedule_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -8186,6 +8253,7 @@ async def test_get_schedule_rest_asyncio_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"} await client.get_schedule(request) @@ -8236,6 +8304,7 @@ async def test_get_schedule_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_schedule(request) # Establish that the response is the type that we expect. @@ -8288,6 +8357,7 @@ async def test_get_schedule_rest_asyncio_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 = schedule.Schedule.to_json(schedule.Schedule()) req.return_value.read = mock.AsyncMock(return_value=return_value) @@ -8336,6 +8406,7 @@ async def test_list_schedules_rest_asyncio_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"} await client.list_schedules(request) @@ -8378,6 +8449,7 @@ async def test_list_schedules_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_schedules(request) # Establish that the response is the type that we expect. @@ -8423,6 +8495,7 @@ async def test_list_schedules_rest_asyncio_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 = schedule_service.ListSchedulesResponse.to_json( schedule_service.ListSchedulesResponse() ) @@ -8473,6 +8546,7 @@ async def test_pause_schedule_rest_asyncio_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"} await client.pause_schedule(request) @@ -8510,6 +8584,7 @@ async def test_pause_schedule_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.pause_schedule(request) # Establish that the response is the type that we expect. @@ -8551,6 +8626,7 @@ async def test_pause_schedule_rest_asyncio_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 = schedule_service.PauseScheduleRequest() metadata = [ @@ -8595,6 +8671,7 @@ async def test_resume_schedule_rest_asyncio_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"} await client.resume_schedule(request) @@ -8632,6 +8709,7 @@ async def test_resume_schedule_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.resume_schedule(request) # Establish that the response is the type that we expect. @@ -8673,6 +8751,7 @@ async def test_resume_schedule_rest_asyncio_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 = schedule_service.ResumeScheduleRequest() metadata = [ @@ -8719,6 +8798,7 @@ async def test_update_schedule_rest_asyncio_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"} await client.update_schedule(request) @@ -8896,6 +8976,7 @@ async def test_update_schedule_rest_asyncio_call_success(request_type): "gcs_output_uri": "gcs_output_uri_value", "execution_user": "execution_user_value", "service_account": "service_account_value", + "workbench_runtime": {}, "name": "name_value", "display_name": "display_name_value", "execution_timeout": {"seconds": 751, "nanos": 543}, @@ -8905,6 +8986,7 @@ async def test_update_schedule_rest_asyncio_call_success(request_type): "create_time": {}, "update_time": {}, "labels": {}, + "kernel_name": "kernel_name_value", "encryption_spec": {}, }, "notebook_execution_job_id": "notebook_execution_job_id_value", @@ -9024,6 +9106,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.update_schedule(request) # Establish that the response is the type that we expect. @@ -9076,6 +9159,7 @@ async def test_update_schedule_rest_asyncio_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 = gca_schedule.Schedule.to_json(gca_schedule.Schedule()) req.return_value.read = mock.AsyncMock(return_value=return_value) @@ -9126,6 +9210,7 @@ async def test_get_location_rest_asyncio_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"} await client.get_location(request) @@ -9163,6 +9248,7 @@ async def test_get_location_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_location(request) @@ -9195,6 +9281,7 @@ async def test_list_locations_rest_asyncio_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"} await client.list_locations(request) @@ -9232,6 +9319,7 @@ async def test_list_locations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_locations(request) @@ -9267,6 +9355,7 @@ async def test_get_iam_policy_rest_asyncio_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"} await client.get_iam_policy(request) @@ -9306,6 +9395,7 @@ async def test_get_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_iam_policy(request) @@ -9341,6 +9431,7 @@ async def test_set_iam_policy_rest_asyncio_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"} await client.set_iam_policy(request) @@ -9380,6 +9471,7 @@ async def test_set_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.set_iam_policy(request) @@ -9415,6 +9507,7 @@ async def test_test_iam_permissions_rest_asyncio_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"} await client.test_iam_permissions(request) @@ -9454,6 +9547,7 @@ async def test_test_iam_permissions_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.test_iam_permissions(request) @@ -9488,6 +9582,7 @@ async def test_cancel_operation_rest_asyncio_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"} await client.cancel_operation(request) @@ -9525,6 +9620,7 @@ async def test_cancel_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.cancel_operation(request) @@ -9559,6 +9655,7 @@ async def test_delete_operation_rest_asyncio_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"} await client.delete_operation(request) @@ -9596,6 +9693,7 @@ async def test_delete_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_operation(request) @@ -9630,6 +9728,7 @@ async def test_get_operation_rest_asyncio_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"} await client.get_operation(request) @@ -9667,6 +9766,7 @@ async def test_get_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_operation(request) @@ -9701,6 +9801,7 @@ async def test_list_operations_rest_asyncio_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"} await client.list_operations(request) @@ -9738,6 +9839,7 @@ async def test_list_operations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_operations(request) @@ -9772,6 +9874,7 @@ async def test_wait_operation_rest_asyncio_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"} await client.wait_operation(request) @@ -9809,6 +9912,7 @@ async def test_wait_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.wait_operation(request) diff --git a/tests/unit/gapic/aiplatform_v1/test_specialist_pool_service.py b/tests/unit/gapic/aiplatform_v1/test_specialist_pool_service.py index d709a57b55..fe23695ddc 100644 --- a/tests/unit/gapic/aiplatform_v1/test_specialist_pool_service.py +++ b/tests/unit/gapic/aiplatform_v1/test_specialist_pool_service.py @@ -3225,6 +3225,7 @@ def test_create_specialist_pool_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_specialist_pool(request) @@ -3277,6 +3278,7 @@ def test_create_specialist_pool_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_specialist_pool(**mock_args) @@ -3413,6 +3415,7 @@ def test_get_specialist_pool_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_specialist_pool(request) @@ -3460,6 +3463,7 @@ def test_get_specialist_pool_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_specialist_pool(**mock_args) @@ -3606,6 +3610,7 @@ def test_list_specialist_pools_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_specialist_pools(request) @@ -3662,6 +3667,7 @@ def test_list_specialist_pools_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_specialist_pools(**mock_args) @@ -3865,6 +3871,7 @@ def test_delete_specialist_pool_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_specialist_pool(request) @@ -3910,6 +3917,7 @@ def test_delete_specialist_pool_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_specialist_pool(**mock_args) @@ -4045,6 +4053,7 @@ def test_update_specialist_pool_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_specialist_pool(request) @@ -4101,6 +4110,7 @@ def test_update_specialist_pool_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_specialist_pool(**mock_args) @@ -4538,6 +4548,7 @@ def test_create_specialist_pool_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_specialist_pool(request) @@ -4654,6 +4665,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_specialist_pool(request) # Establish that the response is the type that we expect. @@ -4695,6 +4707,7 @@ def test_create_specialist_pool_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 @@ -4741,6 +4754,7 @@ def test_get_specialist_pool_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_specialist_pool(request) @@ -4783,6 +4797,7 @@ def test_get_specialist_pool_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_specialist_pool(request) # Establish that the response is the type that we expect. @@ -4828,6 +4843,7 @@ def test_get_specialist_pool_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 = specialist_pool.SpecialistPool.to_json( specialist_pool.SpecialistPool() ) @@ -4874,6 +4890,7 @@ def test_list_specialist_pools_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_specialist_pools(request) @@ -4911,6 +4928,7 @@ def test_list_specialist_pools_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_specialist_pools(request) # Establish that the response is the type that we expect. @@ -4951,6 +4969,7 @@ def test_list_specialist_pools_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 = specialist_pool_service.ListSpecialistPoolsResponse.to_json( specialist_pool_service.ListSpecialistPoolsResponse() ) @@ -4999,6 +5018,7 @@ def test_delete_specialist_pool_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_specialist_pool(request) @@ -5031,6 +5051,7 @@ def test_delete_specialist_pool_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_specialist_pool(request) # Establish that the response is the type that we expect. @@ -5072,6 +5093,7 @@ def test_delete_specialist_pool_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 @@ -5120,6 +5142,7 @@ def test_update_specialist_pool_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_specialist_pool(request) @@ -5240,6 +5263,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_specialist_pool(request) # Establish that the response is the type that we expect. @@ -5281,6 +5305,7 @@ def test_update_specialist_pool_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 @@ -5325,6 +5350,7 @@ def test_get_location_rest_bad_request(request_type=locations_pb2.GetLocationReq 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_location(request) @@ -5355,6 +5381,7 @@ def test_get_location_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_location(request) @@ -5383,6 +5410,7 @@ def test_list_locations_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_locations(request) @@ -5413,6 +5441,7 @@ def test_list_locations_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_locations(request) @@ -5444,6 +5473,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -5476,6 +5506,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -5507,6 +5538,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -5539,6 +5571,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -5570,6 +5603,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -5602,6 +5636,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -5632,6 +5667,7 @@ def test_cancel_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.cancel_operation(request) @@ -5662,6 +5698,7 @@ def test_cancel_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.cancel_operation(request) @@ -5692,6 +5729,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) @@ -5722,6 +5760,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) @@ -5752,6 +5791,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) @@ -5782,6 +5822,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) @@ -5812,6 +5853,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) @@ -5842,6 +5884,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) @@ -5872,6 +5915,7 @@ def test_wait_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.wait_operation(request) @@ -5902,6 +5946,7 @@ def test_wait_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.wait_operation(request) @@ -6079,6 +6124,7 @@ async def test_create_specialist_pool_rest_asyncio_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"} await client.create_specialist_pool(request) @@ -6202,6 +6248,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.create_specialist_pool(request) # Establish that the response is the type that we expect. @@ -6250,6 +6297,7 @@ async def test_create_specialist_pool_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -6300,6 +6348,7 @@ async def test_get_specialist_pool_rest_asyncio_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"} await client.get_specialist_pool(request) @@ -6349,6 +6398,7 @@ async def test_get_specialist_pool_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_specialist_pool(request) # Establish that the response is the type that we expect. @@ -6399,6 +6449,7 @@ async def test_get_specialist_pool_rest_asyncio_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 = specialist_pool.SpecialistPool.to_json( specialist_pool.SpecialistPool() ) @@ -6449,6 +6500,7 @@ async def test_list_specialist_pools_rest_asyncio_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"} await client.list_specialist_pools(request) @@ -6493,6 +6545,7 @@ async def test_list_specialist_pools_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_specialist_pools(request) # Establish that the response is the type that we expect. @@ -6540,6 +6593,7 @@ async def test_list_specialist_pools_rest_asyncio_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 = specialist_pool_service.ListSpecialistPoolsResponse.to_json( specialist_pool_service.ListSpecialistPoolsResponse() ) @@ -6592,6 +6646,7 @@ async def test_delete_specialist_pool_rest_asyncio_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"} await client.delete_specialist_pool(request) @@ -6631,6 +6686,7 @@ async def test_delete_specialist_pool_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_specialist_pool(request) # Establish that the response is the type that we expect. @@ -6679,6 +6735,7 @@ async def test_delete_specialist_pool_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -6731,6 +6788,7 @@ async def test_update_specialist_pool_rest_asyncio_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"} await client.update_specialist_pool(request) @@ -6858,6 +6916,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.update_specialist_pool(request) # Establish that the response is the type that we expect. @@ -6906,6 +6965,7 @@ async def test_update_specialist_pool_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -6956,6 +7016,7 @@ async def test_get_location_rest_asyncio_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"} await client.get_location(request) @@ -6993,6 +7054,7 @@ async def test_get_location_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_location(request) @@ -7025,6 +7087,7 @@ async def test_list_locations_rest_asyncio_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"} await client.list_locations(request) @@ -7062,6 +7125,7 @@ async def test_list_locations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_locations(request) @@ -7097,6 +7161,7 @@ async def test_get_iam_policy_rest_asyncio_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"} await client.get_iam_policy(request) @@ -7136,6 +7201,7 @@ async def test_get_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_iam_policy(request) @@ -7171,6 +7237,7 @@ async def test_set_iam_policy_rest_asyncio_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"} await client.set_iam_policy(request) @@ -7210,6 +7277,7 @@ async def test_set_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.set_iam_policy(request) @@ -7245,6 +7313,7 @@ async def test_test_iam_permissions_rest_asyncio_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"} await client.test_iam_permissions(request) @@ -7284,6 +7353,7 @@ async def test_test_iam_permissions_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.test_iam_permissions(request) @@ -7318,6 +7388,7 @@ async def test_cancel_operation_rest_asyncio_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"} await client.cancel_operation(request) @@ -7355,6 +7426,7 @@ async def test_cancel_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.cancel_operation(request) @@ -7389,6 +7461,7 @@ async def test_delete_operation_rest_asyncio_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"} await client.delete_operation(request) @@ -7426,6 +7499,7 @@ async def test_delete_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_operation(request) @@ -7460,6 +7534,7 @@ async def test_get_operation_rest_asyncio_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"} await client.get_operation(request) @@ -7497,6 +7572,7 @@ async def test_get_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_operation(request) @@ -7531,6 +7607,7 @@ async def test_list_operations_rest_asyncio_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"} await client.list_operations(request) @@ -7568,6 +7645,7 @@ async def test_list_operations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_operations(request) @@ -7602,6 +7680,7 @@ async def test_wait_operation_rest_asyncio_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"} await client.wait_operation(request) @@ -7639,6 +7718,7 @@ async def test_wait_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.wait_operation(request) diff --git a/tests/unit/gapic/aiplatform_v1/test_tensorboard_service.py b/tests/unit/gapic/aiplatform_v1/test_tensorboard_service.py index 76ac481082..a8bcdf8990 100644 --- a/tests/unit/gapic/aiplatform_v1/test_tensorboard_service.py +++ b/tests/unit/gapic/aiplatform_v1/test_tensorboard_service.py @@ -13057,6 +13057,7 @@ def test_create_tensorboard_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_tensorboard(request) @@ -13109,6 +13110,7 @@ def test_create_tensorboard_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_tensorboard(**mock_args) @@ -13241,6 +13243,7 @@ def test_get_tensorboard_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_tensorboard(request) @@ -13288,6 +13291,7 @@ def test_get_tensorboard_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_tensorboard(**mock_args) @@ -13422,6 +13426,7 @@ def test_update_tensorboard_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_tensorboard(request) @@ -13478,6 +13483,7 @@ def test_update_tensorboard_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_tensorboard(**mock_args) @@ -13622,6 +13628,7 @@ def test_list_tensorboards_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_tensorboards(request) @@ -13678,6 +13685,7 @@ def test_list_tensorboards_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_tensorboards(**mock_args) @@ -13877,6 +13885,7 @@ def test_delete_tensorboard_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_tensorboard(request) @@ -13922,6 +13931,7 @@ def test_delete_tensorboard_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_tensorboard(**mock_args) @@ -14060,6 +14070,7 @@ def test_read_tensorboard_usage_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.read_tensorboard_usage(request) @@ -14107,6 +14118,7 @@ def test_read_tensorboard_usage_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.read_tensorboard_usage(**mock_args) @@ -14245,6 +14257,7 @@ def test_read_tensorboard_size_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.read_tensorboard_size(request) @@ -14292,6 +14305,7 @@ def test_read_tensorboard_size_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.read_tensorboard_size(**mock_args) @@ -14446,6 +14460,7 @@ def test_create_tensorboard_experiment_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_tensorboard_experiment(request) @@ -14513,6 +14528,7 @@ def test_create_tensorboard_experiment_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_tensorboard_experiment(**mock_args) @@ -14653,6 +14669,7 @@ def test_get_tensorboard_experiment_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_tensorboard_experiment(request) @@ -14700,6 +14717,7 @@ def test_get_tensorboard_experiment_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_tensorboard_experiment(**mock_args) @@ -14836,6 +14854,7 @@ def test_update_tensorboard_experiment_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_tensorboard_experiment(request) @@ -14898,6 +14917,7 @@ def test_update_tensorboard_experiment_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_tensorboard_experiment(**mock_args) @@ -15049,6 +15069,7 @@ def test_list_tensorboard_experiments_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_tensorboard_experiments(request) @@ -15109,6 +15130,7 @@ def test_list_tensorboard_experiments_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_tensorboard_experiments(**mock_args) @@ -15314,6 +15336,7 @@ def test_delete_tensorboard_experiment_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_tensorboard_experiment(request) @@ -15361,6 +15384,7 @@ def test_delete_tensorboard_experiment_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_tensorboard_experiment(**mock_args) @@ -15507,6 +15531,7 @@ def test_create_tensorboard_run_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_tensorboard_run(request) @@ -15571,6 +15596,7 @@ def test_create_tensorboard_run_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_tensorboard_run(**mock_args) @@ -15712,6 +15738,7 @@ def test_batch_create_tensorboard_runs_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.batch_create_tensorboard_runs(request) @@ -15774,6 +15801,7 @@ def test_batch_create_tensorboard_runs_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.batch_create_tensorboard_runs(**mock_args) @@ -15912,6 +15940,7 @@ def test_get_tensorboard_run_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_tensorboard_run(request) @@ -15959,6 +15988,7 @@ def test_get_tensorboard_run_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_tensorboard_run(**mock_args) @@ -16093,6 +16123,7 @@ def test_update_tensorboard_run_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_tensorboard_run(request) @@ -16151,6 +16182,7 @@ def test_update_tensorboard_run_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_tensorboard_run(**mock_args) @@ -16300,6 +16332,7 @@ def test_list_tensorboard_runs_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_tensorboard_runs(request) @@ -16358,6 +16391,7 @@ def test_list_tensorboard_runs_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_tensorboard_runs(**mock_args) @@ -16560,6 +16594,7 @@ def test_delete_tensorboard_run_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_tensorboard_run(request) @@ -16605,6 +16640,7 @@ def test_delete_tensorboard_run_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_tensorboard_run(**mock_args) @@ -16746,6 +16782,7 @@ def test_batch_create_tensorboard_time_series_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.batch_create_tensorboard_time_series(request) @@ -16810,6 +16847,7 @@ def test_batch_create_tensorboard_time_series_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.batch_create_tensorboard_time_series(**mock_args) @@ -16958,6 +16996,7 @@ def test_create_tensorboard_time_series_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_tensorboard_time_series(request) @@ -17020,6 +17059,7 @@ def test_create_tensorboard_time_series_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_tensorboard_time_series(**mock_args) @@ -17161,6 +17201,7 @@ def test_get_tensorboard_time_series_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_tensorboard_time_series(request) @@ -17208,6 +17249,7 @@ def test_get_tensorboard_time_series_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_tensorboard_time_series(**mock_args) @@ -17344,6 +17386,7 @@ def test_update_tensorboard_time_series_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_tensorboard_time_series(request) @@ -17408,6 +17451,7 @@ def test_update_tensorboard_time_series_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_tensorboard_time_series(**mock_args) @@ -17559,6 +17603,7 @@ def test_list_tensorboard_time_series_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_tensorboard_time_series(request) @@ -17619,6 +17664,7 @@ def test_list_tensorboard_time_series_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_tensorboard_time_series(**mock_args) @@ -17825,6 +17871,7 @@ def test_delete_tensorboard_time_series_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_tensorboard_time_series(request) @@ -17872,6 +17919,7 @@ def test_delete_tensorboard_time_series_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_tensorboard_time_series(**mock_args) @@ -18025,6 +18073,7 @@ def test_batch_read_tensorboard_time_series_data_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.batch_read_tensorboard_time_series_data(request) @@ -18092,6 +18141,7 @@ def test_batch_read_tensorboard_time_series_data_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.batch_read_tensorboard_time_series_data(**mock_args) @@ -18239,6 +18289,7 @@ def test_read_tensorboard_time_series_data_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.read_tensorboard_time_series_data(request) @@ -18298,6 +18349,7 @@ def test_read_tensorboard_time_series_data_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.read_tensorboard_time_series_data(**mock_args) @@ -18441,6 +18493,7 @@ def test_read_tensorboard_blob_data_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"} with mock.patch.object(response_value, "iter_content") as iter_content: iter_content.return_value = iter(json_return_value) @@ -18493,6 +18546,7 @@ def test_read_tensorboard_blob_data_rest_flattened(): json_return_value = "[{}]".format(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"} with mock.patch.object(response_value, "iter_content") as iter_content: iter_content.return_value = iter(json_return_value) @@ -18636,6 +18690,7 @@ def test_write_tensorboard_experiment_data_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.write_tensorboard_experiment_data(request) @@ -18700,6 +18755,7 @@ def test_write_tensorboard_experiment_data_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.write_tensorboard_experiment_data(**mock_args) @@ -18846,6 +18902,7 @@ def test_write_tensorboard_run_data_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.write_tensorboard_run_data(request) @@ -18908,6 +18965,7 @@ def test_write_tensorboard_run_data_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.write_tensorboard_run_data(**mock_args) @@ -19054,6 +19112,7 @@ def test_export_tensorboard_time_series_data_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.export_tensorboard_time_series_data(request) @@ -19105,6 +19164,7 @@ def test_export_tensorboard_time_series_data_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.export_tensorboard_time_series_data(**mock_args) @@ -20936,6 +20996,7 @@ def test_create_tensorboard_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_tensorboard(request) @@ -21048,6 +21109,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_tensorboard(request) # Establish that the response is the type that we expect. @@ -21089,6 +21151,7 @@ def test_create_tensorboard_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 @@ -21133,6 +21196,7 @@ def test_get_tensorboard_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_tensorboard(request) @@ -21176,6 +21240,7 @@ def test_get_tensorboard_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_tensorboard(request) # Establish that the response is the type that we expect. @@ -21224,6 +21289,7 @@ def test_get_tensorboard_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 = tensorboard.Tensorboard.to_json(tensorboard.Tensorboard()) req.return_value.content = return_value @@ -21272,6 +21338,7 @@ def test_update_tensorboard_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_tensorboard(request) @@ -21388,6 +21455,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_tensorboard(request) # Establish that the response is the type that we expect. @@ -21429,6 +21497,7 @@ def test_update_tensorboard_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 @@ -21473,6 +21542,7 @@ def test_list_tensorboards_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_tensorboards(request) @@ -21508,6 +21578,7 @@ def test_list_tensorboards_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_tensorboards(request) # Establish that the response is the type that we expect. @@ -21548,6 +21619,7 @@ def test_list_tensorboards_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 = tensorboard_service.ListTensorboardsResponse.to_json( tensorboard_service.ListTensorboardsResponse() ) @@ -21594,6 +21666,7 @@ def test_delete_tensorboard_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_tensorboard(request) @@ -21624,6 +21697,7 @@ def test_delete_tensorboard_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_tensorboard(request) # Establish that the response is the type that we expect. @@ -21665,6 +21739,7 @@ def test_delete_tensorboard_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 @@ -21711,6 +21786,7 @@ def test_read_tensorboard_usage_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.read_tensorboard_usage(request) @@ -21746,6 +21822,7 @@ def test_read_tensorboard_usage_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.read_tensorboard_usage(request) # Establish that the response is the type that we expect. @@ -21785,6 +21862,7 @@ def test_read_tensorboard_usage_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 = tensorboard_service.ReadTensorboardUsageResponse.to_json( tensorboard_service.ReadTensorboardUsageResponse() ) @@ -21833,6 +21911,7 @@ def test_read_tensorboard_size_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.read_tensorboard_size(request) @@ -21870,6 +21949,7 @@ def test_read_tensorboard_size_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.read_tensorboard_size(request) # Establish that the response is the type that we expect. @@ -21910,6 +21990,7 @@ def test_read_tensorboard_size_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 = tensorboard_service.ReadTensorboardSizeResponse.to_json( tensorboard_service.ReadTensorboardSizeResponse() ) @@ -21956,6 +22037,7 @@ def test_create_tensorboard_experiment_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_tensorboard_experiment(request) @@ -22076,6 +22158,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_tensorboard_experiment(request) # Establish that the response is the type that we expect. @@ -22122,6 +22205,7 @@ def test_create_tensorboard_experiment_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 = gca_tensorboard_experiment.TensorboardExperiment.to_json( gca_tensorboard_experiment.TensorboardExperiment() ) @@ -22170,6 +22254,7 @@ def test_get_tensorboard_experiment_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_tensorboard_experiment(request) @@ -22211,6 +22296,7 @@ def test_get_tensorboard_experiment_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_tensorboard_experiment(request) # Establish that the response is the type that we expect. @@ -22255,6 +22341,7 @@ def test_get_tensorboard_experiment_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 = tensorboard_experiment.TensorboardExperiment.to_json( tensorboard_experiment.TensorboardExperiment() ) @@ -22305,6 +22392,7 @@ def test_update_tensorboard_experiment_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_tensorboard_experiment(request) @@ -22429,6 +22517,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_tensorboard_experiment(request) # Establish that the response is the type that we expect. @@ -22475,6 +22564,7 @@ def test_update_tensorboard_experiment_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 = gca_tensorboard_experiment.TensorboardExperiment.to_json( gca_tensorboard_experiment.TensorboardExperiment() ) @@ -22521,6 +22611,7 @@ def test_list_tensorboard_experiments_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_tensorboard_experiments(request) @@ -22558,6 +22649,7 @@ def test_list_tensorboard_experiments_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_tensorboard_experiments(request) # Establish that the response is the type that we expect. @@ -22599,6 +22691,7 @@ def test_list_tensorboard_experiments_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 = tensorboard_service.ListTensorboardExperimentsResponse.to_json( tensorboard_service.ListTensorboardExperimentsResponse() ) @@ -22647,6 +22740,7 @@ def test_delete_tensorboard_experiment_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_tensorboard_experiment(request) @@ -22679,6 +22773,7 @@ def test_delete_tensorboard_experiment_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_tensorboard_experiment(request) # Establish that the response is the type that we expect. @@ -22722,6 +22817,7 @@ def test_delete_tensorboard_experiment_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 @@ -22768,6 +22864,7 @@ def test_create_tensorboard_run_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_tensorboard_run(request) @@ -22886,6 +22983,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_tensorboard_run(request) # Establish that the response is the type that we expect. @@ -22929,6 +23027,7 @@ def test_create_tensorboard_run_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 = gca_tensorboard_run.TensorboardRun.to_json( gca_tensorboard_run.TensorboardRun() ) @@ -22977,6 +23076,7 @@ def test_batch_create_tensorboard_runs_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.batch_create_tensorboard_runs(request) @@ -23014,6 +23114,7 @@ def test_batch_create_tensorboard_runs_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.batch_create_tensorboard_runs(request) # Establish that the response is the type that we expect. @@ -23055,6 +23156,7 @@ def test_batch_create_tensorboard_runs_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 = tensorboard_service.BatchCreateTensorboardRunsResponse.to_json( tensorboard_service.BatchCreateTensorboardRunsResponse() ) @@ -23103,6 +23205,7 @@ def test_get_tensorboard_run_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_tensorboard_run(request) @@ -23143,6 +23246,7 @@ def test_get_tensorboard_run_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_tensorboard_run(request) # Establish that the response is the type that we expect. @@ -23186,6 +23290,7 @@ def test_get_tensorboard_run_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 = tensorboard_run.TensorboardRun.to_json( tensorboard_run.TensorboardRun() ) @@ -23236,6 +23341,7 @@ def test_update_tensorboard_run_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_tensorboard_run(request) @@ -23356,6 +23462,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_tensorboard_run(request) # Establish that the response is the type that we expect. @@ -23399,6 +23506,7 @@ def test_update_tensorboard_run_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 = gca_tensorboard_run.TensorboardRun.to_json( gca_tensorboard_run.TensorboardRun() ) @@ -23447,6 +23555,7 @@ def test_list_tensorboard_runs_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_tensorboard_runs(request) @@ -23484,6 +23593,7 @@ def test_list_tensorboard_runs_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_tensorboard_runs(request) # Establish that the response is the type that we expect. @@ -23524,6 +23634,7 @@ def test_list_tensorboard_runs_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 = tensorboard_service.ListTensorboardRunsResponse.to_json( tensorboard_service.ListTensorboardRunsResponse() ) @@ -23572,6 +23683,7 @@ def test_delete_tensorboard_run_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_tensorboard_run(request) @@ -23604,6 +23716,7 @@ def test_delete_tensorboard_run_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_tensorboard_run(request) # Establish that the response is the type that we expect. @@ -23645,6 +23758,7 @@ def test_delete_tensorboard_run_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 @@ -23691,6 +23805,7 @@ def test_batch_create_tensorboard_time_series_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.batch_create_tensorboard_time_series(request) @@ -23728,6 +23843,7 @@ def test_batch_create_tensorboard_time_series_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.batch_create_tensorboard_time_series(request) # Establish that the response is the type that we expect. @@ -23771,6 +23887,7 @@ def test_batch_create_tensorboard_time_series_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 = ( tensorboard_service.BatchCreateTensorboardTimeSeriesResponse.to_json( tensorboard_service.BatchCreateTensorboardTimeSeriesResponse() @@ -23823,6 +23940,7 @@ def test_create_tensorboard_time_series_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_tensorboard_time_series(request) @@ -23955,6 +24073,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_tensorboard_time_series(request) # Establish that the response is the type that we expect. @@ -24006,6 +24125,7 @@ def test_create_tensorboard_time_series_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 = gca_tensorboard_time_series.TensorboardTimeSeries.to_json( gca_tensorboard_time_series.TensorboardTimeSeries() ) @@ -24054,6 +24174,7 @@ def test_get_tensorboard_time_series_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_tensorboard_time_series(request) @@ -24097,6 +24218,7 @@ def test_get_tensorboard_time_series_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_tensorboard_time_series(request) # Establish that the response is the type that we expect. @@ -24146,6 +24268,7 @@ def test_get_tensorboard_time_series_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 = tensorboard_time_series.TensorboardTimeSeries.to_json( tensorboard_time_series.TensorboardTimeSeries() ) @@ -24196,6 +24319,7 @@ def test_update_tensorboard_time_series_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_tensorboard_time_series(request) @@ -24330,6 +24454,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_tensorboard_time_series(request) # Establish that the response is the type that we expect. @@ -24381,6 +24506,7 @@ def test_update_tensorboard_time_series_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 = gca_tensorboard_time_series.TensorboardTimeSeries.to_json( gca_tensorboard_time_series.TensorboardTimeSeries() ) @@ -24429,6 +24555,7 @@ def test_list_tensorboard_time_series_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_tensorboard_time_series(request) @@ -24468,6 +24595,7 @@ def test_list_tensorboard_time_series_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_tensorboard_time_series(request) # Establish that the response is the type that we expect. @@ -24509,6 +24637,7 @@ def test_list_tensorboard_time_series_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 = tensorboard_service.ListTensorboardTimeSeriesResponse.to_json( tensorboard_service.ListTensorboardTimeSeriesResponse() ) @@ -24557,6 +24686,7 @@ def test_delete_tensorboard_time_series_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_tensorboard_time_series(request) @@ -24589,6 +24719,7 @@ def test_delete_tensorboard_time_series_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_tensorboard_time_series(request) # Establish that the response is the type that we expect. @@ -24632,6 +24763,7 @@ def test_delete_tensorboard_time_series_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 @@ -24678,6 +24810,7 @@ def test_batch_read_tensorboard_time_series_data_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.batch_read_tensorboard_time_series_data(request) @@ -24717,6 +24850,7 @@ def test_batch_read_tensorboard_time_series_data_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.batch_read_tensorboard_time_series_data(request) # Establish that the response is the type that we expect. @@ -24760,6 +24894,7 @@ def test_batch_read_tensorboard_time_series_data_rest_interceptors(null_intercep 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 = ( tensorboard_service.BatchReadTensorboardTimeSeriesDataResponse.to_json( tensorboard_service.BatchReadTensorboardTimeSeriesDataResponse() @@ -24812,6 +24947,7 @@ def test_read_tensorboard_time_series_data_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.read_tensorboard_time_series_data(request) @@ -24849,6 +24985,7 @@ def test_read_tensorboard_time_series_data_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.read_tensorboard_time_series_data(request) # Establish that the response is the type that we expect. @@ -24892,6 +25029,7 @@ def test_read_tensorboard_time_series_data_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 = ( tensorboard_service.ReadTensorboardTimeSeriesDataResponse.to_json( tensorboard_service.ReadTensorboardTimeSeriesDataResponse() @@ -24942,6 +25080,7 @@ def test_read_tensorboard_blob_data_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.read_tensorboard_blob_data(request) @@ -24980,6 +25119,7 @@ def test_read_tensorboard_blob_data_rest_call_success(request_type): json_return_value = "[{}]".format(json_return_value) response_value.iter_content = mock.Mock(return_value=iter(json_return_value)) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.read_tensorboard_blob_data(request) assert isinstance(response, Iterable) @@ -25022,6 +25162,7 @@ def test_read_tensorboard_blob_data_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 = tensorboard_service.ReadTensorboardBlobDataResponse.to_json( tensorboard_service.ReadTensorboardBlobDataResponse() ) @@ -25070,6 +25211,7 @@ def test_write_tensorboard_experiment_data_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.write_tensorboard_experiment_data(request) @@ -25107,6 +25249,7 @@ def test_write_tensorboard_experiment_data_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.write_tensorboard_experiment_data(request) # Establish that the response is the type that we expect. @@ -25150,6 +25293,7 @@ def test_write_tensorboard_experiment_data_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 = ( tensorboard_service.WriteTensorboardExperimentDataResponse.to_json( tensorboard_service.WriteTensorboardExperimentDataResponse() @@ -25200,6 +25344,7 @@ def test_write_tensorboard_run_data_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.write_tensorboard_run_data(request) @@ -25237,6 +25382,7 @@ def test_write_tensorboard_run_data_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.write_tensorboard_run_data(request) # Establish that the response is the type that we expect. @@ -25276,6 +25422,7 @@ def test_write_tensorboard_run_data_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 = tensorboard_service.WriteTensorboardRunDataResponse.to_json( tensorboard_service.WriteTensorboardRunDataResponse() ) @@ -25324,6 +25471,7 @@ def test_export_tensorboard_time_series_data_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.export_tensorboard_time_series_data(request) @@ -25363,6 +25511,7 @@ def test_export_tensorboard_time_series_data_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.export_tensorboard_time_series_data(request) # Establish that the response is the type that we expect. @@ -25405,6 +25554,7 @@ def test_export_tensorboard_time_series_data_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 = ( tensorboard_service.ExportTensorboardTimeSeriesDataResponse.to_json( tensorboard_service.ExportTensorboardTimeSeriesDataResponse() @@ -25455,6 +25605,7 @@ def test_get_location_rest_bad_request(request_type=locations_pb2.GetLocationReq 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_location(request) @@ -25485,6 +25636,7 @@ def test_get_location_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_location(request) @@ -25513,6 +25665,7 @@ def test_list_locations_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_locations(request) @@ -25543,6 +25696,7 @@ def test_list_locations_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_locations(request) @@ -25574,6 +25728,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -25606,6 +25761,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -25637,6 +25793,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -25669,6 +25826,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -25700,6 +25858,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -25732,6 +25891,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -25762,6 +25922,7 @@ def test_cancel_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.cancel_operation(request) @@ -25792,6 +25953,7 @@ def test_cancel_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.cancel_operation(request) @@ -25822,6 +25984,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) @@ -25852,6 +26015,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) @@ -25882,6 +26046,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) @@ -25912,6 +26077,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) @@ -25942,6 +26108,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) @@ -25972,6 +26139,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) @@ -26002,6 +26170,7 @@ def test_wait_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.wait_operation(request) @@ -26032,6 +26201,7 @@ def test_wait_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.wait_operation(request) @@ -26757,6 +26927,7 @@ async def test_create_tensorboard_rest_asyncio_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"} await client.create_tensorboard(request) @@ -26876,6 +27047,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.create_tensorboard(request) # Establish that the response is the type that we expect. @@ -26922,6 +27094,7 @@ async def test_create_tensorboard_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -26970,6 +27143,7 @@ async def test_get_tensorboard_rest_asyncio_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"} await client.get_tensorboard(request) @@ -27020,6 +27194,7 @@ async def test_get_tensorboard_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_tensorboard(request) # Establish that the response is the type that we expect. @@ -27073,6 +27248,7 @@ async def test_get_tensorboard_rest_asyncio_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 = tensorboard.Tensorboard.to_json(tensorboard.Tensorboard()) req.return_value.read = mock.AsyncMock(return_value=return_value) @@ -27125,6 +27301,7 @@ async def test_update_tensorboard_rest_asyncio_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"} await client.update_tensorboard(request) @@ -27248,6 +27425,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.update_tensorboard(request) # Establish that the response is the type that we expect. @@ -27294,6 +27472,7 @@ async def test_update_tensorboard_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -27342,6 +27521,7 @@ async def test_list_tensorboards_rest_asyncio_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"} await client.list_tensorboards(request) @@ -27384,6 +27564,7 @@ async def test_list_tensorboards_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_tensorboards(request) # Establish that the response is the type that we expect. @@ -27429,6 +27610,7 @@ async def test_list_tensorboards_rest_asyncio_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 = tensorboard_service.ListTensorboardsResponse.to_json( tensorboard_service.ListTensorboardsResponse() ) @@ -27479,6 +27661,7 @@ async def test_delete_tensorboard_rest_asyncio_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"} await client.delete_tensorboard(request) @@ -27516,6 +27699,7 @@ async def test_delete_tensorboard_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_tensorboard(request) # Establish that the response is the type that we expect. @@ -27562,6 +27746,7 @@ async def test_delete_tensorboard_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -27612,6 +27797,7 @@ async def test_read_tensorboard_usage_rest_asyncio_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"} await client.read_tensorboard_usage(request) @@ -27654,6 +27840,7 @@ async def test_read_tensorboard_usage_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.read_tensorboard_usage(request) # Establish that the response is the type that we expect. @@ -27698,6 +27885,7 @@ async def test_read_tensorboard_usage_rest_asyncio_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 = tensorboard_service.ReadTensorboardUsageResponse.to_json( tensorboard_service.ReadTensorboardUsageResponse() ) @@ -27750,6 +27938,7 @@ async def test_read_tensorboard_size_rest_asyncio_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"} await client.read_tensorboard_size(request) @@ -27794,6 +27983,7 @@ async def test_read_tensorboard_size_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.read_tensorboard_size(request) # Establish that the response is the type that we expect. @@ -27839,6 +28029,7 @@ async def test_read_tensorboard_size_rest_asyncio_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 = tensorboard_service.ReadTensorboardSizeResponse.to_json( tensorboard_service.ReadTensorboardSizeResponse() ) @@ -27889,6 +28080,7 @@ async def test_create_tensorboard_experiment_rest_asyncio_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"} await client.create_tensorboard_experiment(request) @@ -28016,6 +28208,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.create_tensorboard_experiment(request) # Establish that the response is the type that we expect. @@ -28069,6 +28262,7 @@ async def test_create_tensorboard_experiment_rest_asyncio_interceptors( 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 = gca_tensorboard_experiment.TensorboardExperiment.to_json( gca_tensorboard_experiment.TensorboardExperiment() ) @@ -28121,6 +28315,7 @@ async def test_get_tensorboard_experiment_rest_asyncio_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"} await client.get_tensorboard_experiment(request) @@ -28169,6 +28364,7 @@ async def test_get_tensorboard_experiment_rest_asyncio_call_success(request_type return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_tensorboard_experiment(request) # Establish that the response is the type that we expect. @@ -28220,6 +28416,7 @@ async def test_get_tensorboard_experiment_rest_asyncio_interceptors(null_interce 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 = tensorboard_experiment.TensorboardExperiment.to_json( tensorboard_experiment.TensorboardExperiment() ) @@ -28274,6 +28471,7 @@ async def test_update_tensorboard_experiment_rest_asyncio_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"} await client.update_tensorboard_experiment(request) @@ -28405,6 +28603,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.update_tensorboard_experiment(request) # Establish that the response is the type that we expect. @@ -28458,6 +28657,7 @@ async def test_update_tensorboard_experiment_rest_asyncio_interceptors( 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 = gca_tensorboard_experiment.TensorboardExperiment.to_json( gca_tensorboard_experiment.TensorboardExperiment() ) @@ -28508,6 +28708,7 @@ async def test_list_tensorboard_experiments_rest_asyncio_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"} await client.list_tensorboard_experiments(request) @@ -28552,6 +28753,7 @@ async def test_list_tensorboard_experiments_rest_asyncio_call_success(request_ty return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_tensorboard_experiments(request) # Establish that the response is the type that we expect. @@ -28599,6 +28801,7 @@ async def test_list_tensorboard_experiments_rest_asyncio_interceptors(null_inter 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 = tensorboard_service.ListTensorboardExperimentsResponse.to_json( tensorboard_service.ListTensorboardExperimentsResponse() ) @@ -28651,6 +28854,7 @@ async def test_delete_tensorboard_experiment_rest_asyncio_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"} await client.delete_tensorboard_experiment(request) @@ -28690,6 +28894,7 @@ async def test_delete_tensorboard_experiment_rest_asyncio_call_success(request_t return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_tensorboard_experiment(request) # Establish that the response is the type that we expect. @@ -28740,6 +28945,7 @@ async def test_delete_tensorboard_experiment_rest_asyncio_interceptors( 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.read = mock.AsyncMock(return_value=return_value) @@ -28790,6 +28996,7 @@ async def test_create_tensorboard_run_rest_asyncio_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"} await client.create_tensorboard_run(request) @@ -28915,6 +29122,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.create_tensorboard_run(request) # Establish that the response is the type that we expect. @@ -28963,6 +29171,7 @@ async def test_create_tensorboard_run_rest_asyncio_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 = gca_tensorboard_run.TensorboardRun.to_json( gca_tensorboard_run.TensorboardRun() ) @@ -29015,6 +29224,7 @@ async def test_batch_create_tensorboard_runs_rest_asyncio_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"} await client.batch_create_tensorboard_runs(request) @@ -29059,6 +29269,7 @@ async def test_batch_create_tensorboard_runs_rest_asyncio_call_success(request_t return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.batch_create_tensorboard_runs(request) # Establish that the response is the type that we expect. @@ -29107,6 +29318,7 @@ async def test_batch_create_tensorboard_runs_rest_asyncio_interceptors( 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 = tensorboard_service.BatchCreateTensorboardRunsResponse.to_json( tensorboard_service.BatchCreateTensorboardRunsResponse() ) @@ -29159,6 +29371,7 @@ async def test_get_tensorboard_run_rest_asyncio_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"} await client.get_tensorboard_run(request) @@ -29206,6 +29419,7 @@ async def test_get_tensorboard_run_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_tensorboard_run(request) # Establish that the response is the type that we expect. @@ -29254,6 +29468,7 @@ async def test_get_tensorboard_run_rest_asyncio_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 = tensorboard_run.TensorboardRun.to_json( tensorboard_run.TensorboardRun() ) @@ -29308,6 +29523,7 @@ async def test_update_tensorboard_run_rest_asyncio_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"} await client.update_tensorboard_run(request) @@ -29435,6 +29651,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.update_tensorboard_run(request) # Establish that the response is the type that we expect. @@ -29483,6 +29700,7 @@ async def test_update_tensorboard_run_rest_asyncio_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 = gca_tensorboard_run.TensorboardRun.to_json( gca_tensorboard_run.TensorboardRun() ) @@ -29535,6 +29753,7 @@ async def test_list_tensorboard_runs_rest_asyncio_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"} await client.list_tensorboard_runs(request) @@ -29579,6 +29798,7 @@ async def test_list_tensorboard_runs_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_tensorboard_runs(request) # Establish that the response is the type that we expect. @@ -29624,6 +29844,7 @@ async def test_list_tensorboard_runs_rest_asyncio_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 = tensorboard_service.ListTensorboardRunsResponse.to_json( tensorboard_service.ListTensorboardRunsResponse() ) @@ -29676,6 +29897,7 @@ async def test_delete_tensorboard_run_rest_asyncio_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"} await client.delete_tensorboard_run(request) @@ -29715,6 +29937,7 @@ async def test_delete_tensorboard_run_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_tensorboard_run(request) # Establish that the response is the type that we expect. @@ -29761,6 +29984,7 @@ async def test_delete_tensorboard_run_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -29811,6 +30035,7 @@ async def test_batch_create_tensorboard_time_series_rest_asyncio_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"} await client.batch_create_tensorboard_time_series(request) @@ -29857,6 +30082,7 @@ async def test_batch_create_tensorboard_time_series_rest_asyncio_call_success( return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.batch_create_tensorboard_time_series(request) # Establish that the response is the type that we expect. @@ -29907,6 +30133,7 @@ async def test_batch_create_tensorboard_time_series_rest_asyncio_interceptors( 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 = ( tensorboard_service.BatchCreateTensorboardTimeSeriesResponse.to_json( tensorboard_service.BatchCreateTensorboardTimeSeriesResponse() @@ -29963,6 +30190,7 @@ async def test_create_tensorboard_time_series_rest_asyncio_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"} await client.create_tensorboard_time_series(request) @@ -30102,6 +30330,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.create_tensorboard_time_series(request) # Establish that the response is the type that we expect. @@ -30160,6 +30389,7 @@ async def test_create_tensorboard_time_series_rest_asyncio_interceptors( 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 = gca_tensorboard_time_series.TensorboardTimeSeries.to_json( gca_tensorboard_time_series.TensorboardTimeSeries() ) @@ -30212,6 +30442,7 @@ async def test_get_tensorboard_time_series_rest_asyncio_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"} await client.get_tensorboard_time_series(request) @@ -30262,6 +30493,7 @@ async def test_get_tensorboard_time_series_rest_asyncio_call_success(request_typ return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_tensorboard_time_series(request) # Establish that the response is the type that we expect. @@ -30318,6 +30550,7 @@ async def test_get_tensorboard_time_series_rest_asyncio_interceptors(null_interc 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 = tensorboard_time_series.TensorboardTimeSeries.to_json( tensorboard_time_series.TensorboardTimeSeries() ) @@ -30372,6 +30605,7 @@ async def test_update_tensorboard_time_series_rest_asyncio_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"} await client.update_tensorboard_time_series(request) @@ -30513,6 +30747,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.update_tensorboard_time_series(request) # Establish that the response is the type that we expect. @@ -30571,6 +30806,7 @@ async def test_update_tensorboard_time_series_rest_asyncio_interceptors( 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 = gca_tensorboard_time_series.TensorboardTimeSeries.to_json( gca_tensorboard_time_series.TensorboardTimeSeries() ) @@ -30623,6 +30859,7 @@ async def test_list_tensorboard_time_series_rest_asyncio_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"} await client.list_tensorboard_time_series(request) @@ -30669,6 +30906,7 @@ async def test_list_tensorboard_time_series_rest_asyncio_call_success(request_ty return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_tensorboard_time_series(request) # Establish that the response is the type that we expect. @@ -30716,6 +30954,7 @@ async def test_list_tensorboard_time_series_rest_asyncio_interceptors(null_inter 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 = tensorboard_service.ListTensorboardTimeSeriesResponse.to_json( tensorboard_service.ListTensorboardTimeSeriesResponse() ) @@ -30768,6 +31007,7 @@ async def test_delete_tensorboard_time_series_rest_asyncio_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"} await client.delete_tensorboard_time_series(request) @@ -30807,6 +31047,7 @@ async def test_delete_tensorboard_time_series_rest_asyncio_call_success(request_ return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_tensorboard_time_series(request) # Establish that the response is the type that we expect. @@ -30857,6 +31098,7 @@ async def test_delete_tensorboard_time_series_rest_asyncio_interceptors( 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.read = mock.AsyncMock(return_value=return_value) @@ -30907,6 +31149,7 @@ async def test_batch_read_tensorboard_time_series_data_rest_asyncio_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"} await client.batch_read_tensorboard_time_series_data(request) @@ -30955,6 +31198,7 @@ async def test_batch_read_tensorboard_time_series_data_rest_asyncio_call_success return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.batch_read_tensorboard_time_series_data(request) # Establish that the response is the type that we expect. @@ -31005,6 +31249,7 @@ async def test_batch_read_tensorboard_time_series_data_rest_asyncio_interceptors 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 = ( tensorboard_service.BatchReadTensorboardTimeSeriesDataResponse.to_json( tensorboard_service.BatchReadTensorboardTimeSeriesDataResponse() @@ -31061,6 +31306,7 @@ async def test_read_tensorboard_time_series_data_rest_asyncio_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"} await client.read_tensorboard_time_series_data(request) @@ -31107,6 +31353,7 @@ async def test_read_tensorboard_time_series_data_rest_asyncio_call_success( return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.read_tensorboard_time_series_data(request) # Establish that the response is the type that we expect. @@ -31157,6 +31404,7 @@ async def test_read_tensorboard_time_series_data_rest_asyncio_interceptors( 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 = ( tensorboard_service.ReadTensorboardTimeSeriesDataResponse.to_json( tensorboard_service.ReadTensorboardTimeSeriesDataResponse() @@ -31211,6 +31459,7 @@ async def test_read_tensorboard_blob_data_rest_asyncio_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"} await client.read_tensorboard_blob_data(request) @@ -31254,6 +31503,7 @@ async def test_read_tensorboard_blob_data_rest_asyncio_call_success(request_type json_return_value = "[{}]".format(json_return_value) response_value.content.return_value = mock_async_gen(json_return_value) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.read_tensorboard_blob_data(request) assert isinstance(response, AsyncIterable) @@ -31303,6 +31553,7 @@ async def test_read_tensorboard_blob_data_rest_asyncio_interceptors(null_interce 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 = tensorboard_service.ReadTensorboardBlobDataResponse.to_json( tensorboard_service.ReadTensorboardBlobDataResponse() ) @@ -31355,6 +31606,7 @@ async def test_write_tensorboard_experiment_data_rest_asyncio_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"} await client.write_tensorboard_experiment_data(request) @@ -31401,6 +31653,7 @@ async def test_write_tensorboard_experiment_data_rest_asyncio_call_success( return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.write_tensorboard_experiment_data(request) # Establish that the response is the type that we expect. @@ -31451,6 +31704,7 @@ async def test_write_tensorboard_experiment_data_rest_asyncio_interceptors( 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 = ( tensorboard_service.WriteTensorboardExperimentDataResponse.to_json( tensorboard_service.WriteTensorboardExperimentDataResponse() @@ -31505,6 +31759,7 @@ async def test_write_tensorboard_run_data_rest_asyncio_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"} await client.write_tensorboard_run_data(request) @@ -31549,6 +31804,7 @@ async def test_write_tensorboard_run_data_rest_asyncio_call_success(request_type return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.write_tensorboard_run_data(request) # Establish that the response is the type that we expect. @@ -31595,6 +31851,7 @@ async def test_write_tensorboard_run_data_rest_asyncio_interceptors(null_interce 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 = tensorboard_service.WriteTensorboardRunDataResponse.to_json( tensorboard_service.WriteTensorboardRunDataResponse() ) @@ -31647,6 +31904,7 @@ async def test_export_tensorboard_time_series_data_rest_asyncio_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"} await client.export_tensorboard_time_series_data(request) @@ -31695,6 +31953,7 @@ async def test_export_tensorboard_time_series_data_rest_asyncio_call_success( return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.export_tensorboard_time_series_data(request) # Establish that the response is the type that we expect. @@ -31744,6 +32003,7 @@ async def test_export_tensorboard_time_series_data_rest_asyncio_interceptors( 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 = ( tensorboard_service.ExportTensorboardTimeSeriesDataResponse.to_json( tensorboard_service.ExportTensorboardTimeSeriesDataResponse() @@ -31800,6 +32060,7 @@ async def test_get_location_rest_asyncio_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"} await client.get_location(request) @@ -31837,6 +32098,7 @@ async def test_get_location_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_location(request) @@ -31869,6 +32131,7 @@ async def test_list_locations_rest_asyncio_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"} await client.list_locations(request) @@ -31906,6 +32169,7 @@ async def test_list_locations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_locations(request) @@ -31941,6 +32205,7 @@ async def test_get_iam_policy_rest_asyncio_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"} await client.get_iam_policy(request) @@ -31980,6 +32245,7 @@ async def test_get_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_iam_policy(request) @@ -32015,6 +32281,7 @@ async def test_set_iam_policy_rest_asyncio_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"} await client.set_iam_policy(request) @@ -32054,6 +32321,7 @@ async def test_set_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.set_iam_policy(request) @@ -32089,6 +32357,7 @@ async def test_test_iam_permissions_rest_asyncio_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"} await client.test_iam_permissions(request) @@ -32128,6 +32397,7 @@ async def test_test_iam_permissions_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.test_iam_permissions(request) @@ -32162,6 +32432,7 @@ async def test_cancel_operation_rest_asyncio_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"} await client.cancel_operation(request) @@ -32199,6 +32470,7 @@ async def test_cancel_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.cancel_operation(request) @@ -32233,6 +32505,7 @@ async def test_delete_operation_rest_asyncio_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"} await client.delete_operation(request) @@ -32270,6 +32543,7 @@ async def test_delete_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_operation(request) @@ -32304,6 +32578,7 @@ async def test_get_operation_rest_asyncio_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"} await client.get_operation(request) @@ -32341,6 +32616,7 @@ async def test_get_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_operation(request) @@ -32375,6 +32651,7 @@ async def test_list_operations_rest_asyncio_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"} await client.list_operations(request) @@ -32412,6 +32689,7 @@ async def test_list_operations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_operations(request) @@ -32446,6 +32724,7 @@ async def test_wait_operation_rest_asyncio_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"} await client.wait_operation(request) @@ -32483,6 +32762,7 @@ async def test_wait_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.wait_operation(request) diff --git a/tests/unit/gapic/aiplatform_v1/test_vertex_rag_data_service.py b/tests/unit/gapic/aiplatform_v1/test_vertex_rag_data_service.py index d991e200a3..04b268c6ca 100644 --- a/tests/unit/gapic/aiplatform_v1/test_vertex_rag_data_service.py +++ b/tests/unit/gapic/aiplatform_v1/test_vertex_rag_data_service.py @@ -5074,6 +5074,7 @@ def test_create_rag_corpus_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_rag_corpus(request) @@ -5126,6 +5127,7 @@ def test_create_rag_corpus_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_rag_corpus(**mock_args) @@ -5256,6 +5258,7 @@ def test_update_rag_corpus_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_rag_corpus(request) @@ -5303,6 +5306,7 @@ def test_update_rag_corpus_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_rag_corpus(**mock_args) @@ -5434,6 +5438,7 @@ def test_get_rag_corpus_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_rag_corpus(request) @@ -5481,6 +5486,7 @@ def test_get_rag_corpus_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_rag_corpus(**mock_args) @@ -5622,6 +5628,7 @@ def test_list_rag_corpora_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_rag_corpora(request) @@ -5675,6 +5682,7 @@ def test_list_rag_corpora_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_rag_corpora(**mock_args) @@ -5873,6 +5881,7 @@ def test_delete_rag_corpus_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_rag_corpus(request) @@ -5918,6 +5927,7 @@ def test_delete_rag_corpus_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_rag_corpus(**mock_args) @@ -6051,6 +6061,7 @@ def test_upload_rag_file_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.upload_rag_file(request) @@ -6119,6 +6130,7 @@ def test_upload_rag_file_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.upload_rag_file(**mock_args) @@ -6266,6 +6278,7 @@ def test_import_rag_files_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.import_rag_files(request) @@ -6322,6 +6335,7 @@ def test_import_rag_files_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.import_rag_files(**mock_args) @@ -6456,6 +6470,7 @@ def test_get_rag_file_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_rag_file(request) @@ -6503,6 +6518,7 @@ def test_get_rag_file_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_rag_file(**mock_args) @@ -6641,6 +6657,7 @@ def test_list_rag_files_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_rag_files(request) @@ -6696,6 +6713,7 @@ def test_list_rag_files_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_rag_files(**mock_args) @@ -6893,6 +6911,7 @@ def test_delete_rag_file_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_rag_file(request) @@ -6938,6 +6957,7 @@ def test_delete_rag_file_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_rag_file(**mock_args) @@ -7599,6 +7619,7 @@ def test_create_rag_corpus_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_rag_corpus(request) @@ -7726,6 +7747,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_rag_corpus(request) # Establish that the response is the type that we expect. @@ -7767,6 +7789,7 @@ def test_create_rag_corpus_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 @@ -7813,6 +7836,7 @@ def test_update_rag_corpus_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_rag_corpus(request) @@ -7942,6 +7966,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_rag_corpus(request) # Establish that the response is the type that we expect. @@ -7983,6 +8008,7 @@ def test_update_rag_corpus_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 @@ -8027,6 +8053,7 @@ def test_get_rag_corpus_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_rag_corpus(request) @@ -8064,6 +8091,7 @@ def test_get_rag_corpus_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_rag_corpus(request) # Establish that the response is the type that we expect. @@ -8106,6 +8134,7 @@ def test_get_rag_corpus_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 = vertex_rag_data.RagCorpus.to_json(vertex_rag_data.RagCorpus()) req.return_value.content = return_value @@ -8150,6 +8179,7 @@ def test_list_rag_corpora_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_rag_corpora(request) @@ -8185,6 +8215,7 @@ def test_list_rag_corpora_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_rag_corpora(request) # Establish that the response is the type that we expect. @@ -8225,6 +8256,7 @@ def test_list_rag_corpora_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 = vertex_rag_data_service.ListRagCorporaResponse.to_json( vertex_rag_data_service.ListRagCorporaResponse() ) @@ -8271,6 +8303,7 @@ def test_delete_rag_corpus_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_rag_corpus(request) @@ -8301,6 +8334,7 @@ def test_delete_rag_corpus_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_rag_corpus(request) # Establish that the response is the type that we expect. @@ -8342,6 +8376,7 @@ def test_delete_rag_corpus_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 @@ -8386,6 +8421,7 @@ def test_upload_rag_file_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.upload_rag_file(request) @@ -8419,6 +8455,7 @@ def test_upload_rag_file_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.upload_rag_file(request) # Establish that the response is the type that we expect. @@ -8458,6 +8495,7 @@ def test_upload_rag_file_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 = vertex_rag_data_service.UploadRagFileResponse.to_json( vertex_rag_data_service.UploadRagFileResponse() ) @@ -8504,6 +8542,7 @@ def test_import_rag_files_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.import_rag_files(request) @@ -8534,6 +8573,7 @@ def test_import_rag_files_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.import_rag_files(request) # Establish that the response is the type that we expect. @@ -8575,6 +8615,7 @@ def test_import_rag_files_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 @@ -8621,6 +8662,7 @@ def test_get_rag_file_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_rag_file(request) @@ -8660,6 +8702,7 @@ def test_get_rag_file_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_rag_file(request) # Establish that the response is the type that we expect. @@ -8702,6 +8745,7 @@ def test_get_rag_file_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 = vertex_rag_data.RagFile.to_json(vertex_rag_data.RagFile()) req.return_value.content = return_value @@ -8746,6 +8790,7 @@ def test_list_rag_files_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_rag_files(request) @@ -8781,6 +8826,7 @@ def test_list_rag_files_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_rag_files(request) # Establish that the response is the type that we expect. @@ -8821,6 +8867,7 @@ def test_list_rag_files_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 = vertex_rag_data_service.ListRagFilesResponse.to_json( vertex_rag_data_service.ListRagFilesResponse() ) @@ -8869,6 +8916,7 @@ def test_delete_rag_file_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_rag_file(request) @@ -8901,6 +8949,7 @@ def test_delete_rag_file_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_rag_file(request) # Establish that the response is the type that we expect. @@ -8942,6 +8991,7 @@ def test_delete_rag_file_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 @@ -8986,6 +9036,7 @@ def test_get_location_rest_bad_request(request_type=locations_pb2.GetLocationReq 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_location(request) @@ -9016,6 +9067,7 @@ def test_get_location_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_location(request) @@ -9044,6 +9096,7 @@ def test_list_locations_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_locations(request) @@ -9074,6 +9127,7 @@ def test_list_locations_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_locations(request) @@ -9105,6 +9159,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -9137,6 +9192,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -9168,6 +9224,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -9200,6 +9257,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -9231,6 +9289,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -9263,6 +9322,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -9293,6 +9353,7 @@ def test_cancel_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.cancel_operation(request) @@ -9323,6 +9384,7 @@ def test_cancel_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.cancel_operation(request) @@ -9353,6 +9415,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) @@ -9383,6 +9446,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) @@ -9413,6 +9477,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) @@ -9443,6 +9508,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) @@ -9473,6 +9539,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) @@ -9503,6 +9570,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) @@ -9533,6 +9601,7 @@ def test_wait_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.wait_operation(request) @@ -9563,6 +9632,7 @@ def test_wait_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.wait_operation(request) @@ -9836,6 +9906,7 @@ async def test_create_rag_corpus_rest_asyncio_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"} await client.create_rag_corpus(request) @@ -9970,6 +10041,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.create_rag_corpus(request) # Establish that the response is the type that we expect. @@ -10016,6 +10088,7 @@ async def test_create_rag_corpus_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -10066,6 +10139,7 @@ async def test_update_rag_corpus_rest_asyncio_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"} await client.update_rag_corpus(request) @@ -10202,6 +10276,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.update_rag_corpus(request) # Establish that the response is the type that we expect. @@ -10248,6 +10323,7 @@ async def test_update_rag_corpus_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -10296,6 +10372,7 @@ async def test_get_rag_corpus_rest_asyncio_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"} await client.get_rag_corpus(request) @@ -10340,6 +10417,7 @@ async def test_get_rag_corpus_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_rag_corpus(request) # Establish that the response is the type that we expect. @@ -10387,6 +10465,7 @@ async def test_get_rag_corpus_rest_asyncio_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 = vertex_rag_data.RagCorpus.to_json(vertex_rag_data.RagCorpus()) req.return_value.read = mock.AsyncMock(return_value=return_value) @@ -10435,6 +10514,7 @@ async def test_list_rag_corpora_rest_asyncio_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"} await client.list_rag_corpora(request) @@ -10477,6 +10557,7 @@ async def test_list_rag_corpora_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_rag_corpora(request) # Establish that the response is the type that we expect. @@ -10522,6 +10603,7 @@ async def test_list_rag_corpora_rest_asyncio_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 = vertex_rag_data_service.ListRagCorporaResponse.to_json( vertex_rag_data_service.ListRagCorporaResponse() ) @@ -10572,6 +10654,7 @@ async def test_delete_rag_corpus_rest_asyncio_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"} await client.delete_rag_corpus(request) @@ -10609,6 +10692,7 @@ async def test_delete_rag_corpus_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_rag_corpus(request) # Establish that the response is the type that we expect. @@ -10655,6 +10739,7 @@ async def test_delete_rag_corpus_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -10703,6 +10788,7 @@ async def test_upload_rag_file_rest_asyncio_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"} await client.upload_rag_file(request) @@ -10743,6 +10829,7 @@ async def test_upload_rag_file_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.upload_rag_file(request) # Establish that the response is the type that we expect. @@ -10787,6 +10874,7 @@ async def test_upload_rag_file_rest_asyncio_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 = vertex_rag_data_service.UploadRagFileResponse.to_json( vertex_rag_data_service.UploadRagFileResponse() ) @@ -10837,6 +10925,7 @@ async def test_import_rag_files_rest_asyncio_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"} await client.import_rag_files(request) @@ -10874,6 +10963,7 @@ async def test_import_rag_files_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.import_rag_files(request) # Establish that the response is the type that we expect. @@ -10920,6 +11010,7 @@ async def test_import_rag_files_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -10970,6 +11061,7 @@ async def test_get_rag_file_rest_asyncio_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"} await client.get_rag_file(request) @@ -11016,6 +11108,7 @@ async def test_get_rag_file_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_rag_file(request) # Establish that the response is the type that we expect. @@ -11063,6 +11156,7 @@ async def test_get_rag_file_rest_asyncio_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 = vertex_rag_data.RagFile.to_json(vertex_rag_data.RagFile()) req.return_value.read = mock.AsyncMock(return_value=return_value) @@ -11111,6 +11205,7 @@ async def test_list_rag_files_rest_asyncio_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"} await client.list_rag_files(request) @@ -11153,6 +11248,7 @@ async def test_list_rag_files_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_rag_files(request) # Establish that the response is the type that we expect. @@ -11198,6 +11294,7 @@ async def test_list_rag_files_rest_asyncio_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 = vertex_rag_data_service.ListRagFilesResponse.to_json( vertex_rag_data_service.ListRagFilesResponse() ) @@ -11250,6 +11347,7 @@ async def test_delete_rag_file_rest_asyncio_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"} await client.delete_rag_file(request) @@ -11289,6 +11387,7 @@ async def test_delete_rag_file_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_rag_file(request) # Establish that the response is the type that we expect. @@ -11335,6 +11434,7 @@ async def test_delete_rag_file_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -11385,6 +11485,7 @@ async def test_get_location_rest_asyncio_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"} await client.get_location(request) @@ -11422,6 +11523,7 @@ async def test_get_location_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_location(request) @@ -11454,6 +11556,7 @@ async def test_list_locations_rest_asyncio_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"} await client.list_locations(request) @@ -11491,6 +11594,7 @@ async def test_list_locations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_locations(request) @@ -11526,6 +11630,7 @@ async def test_get_iam_policy_rest_asyncio_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"} await client.get_iam_policy(request) @@ -11565,6 +11670,7 @@ async def test_get_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_iam_policy(request) @@ -11600,6 +11706,7 @@ async def test_set_iam_policy_rest_asyncio_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"} await client.set_iam_policy(request) @@ -11639,6 +11746,7 @@ async def test_set_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.set_iam_policy(request) @@ -11674,6 +11782,7 @@ async def test_test_iam_permissions_rest_asyncio_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"} await client.test_iam_permissions(request) @@ -11713,6 +11822,7 @@ async def test_test_iam_permissions_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.test_iam_permissions(request) @@ -11747,6 +11857,7 @@ async def test_cancel_operation_rest_asyncio_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"} await client.cancel_operation(request) @@ -11784,6 +11895,7 @@ async def test_cancel_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.cancel_operation(request) @@ -11818,6 +11930,7 @@ async def test_delete_operation_rest_asyncio_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"} await client.delete_operation(request) @@ -11855,6 +11968,7 @@ async def test_delete_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_operation(request) @@ -11889,6 +12003,7 @@ async def test_get_operation_rest_asyncio_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"} await client.get_operation(request) @@ -11926,6 +12041,7 @@ async def test_get_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_operation(request) @@ -11960,6 +12076,7 @@ async def test_list_operations_rest_asyncio_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"} await client.list_operations(request) @@ -11997,6 +12114,7 @@ async def test_list_operations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_operations(request) @@ -12031,6 +12149,7 @@ async def test_wait_operation_rest_asyncio_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"} await client.wait_operation(request) @@ -12068,6 +12187,7 @@ async def test_wait_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.wait_operation(request) diff --git a/tests/unit/gapic/aiplatform_v1/test_vertex_rag_service.py b/tests/unit/gapic/aiplatform_v1/test_vertex_rag_service.py index c0baa6d669..255eb71732 100644 --- a/tests/unit/gapic/aiplatform_v1/test_vertex_rag_service.py +++ b/tests/unit/gapic/aiplatform_v1/test_vertex_rag_service.py @@ -2282,6 +2282,7 @@ def test_retrieve_contexts_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.retrieve_contexts(request) @@ -2336,6 +2337,7 @@ def test_retrieve_contexts_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.retrieve_contexts(**mock_args) @@ -2469,6 +2471,7 @@ def test_augment_prompt_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.augment_prompt(request) @@ -2515,6 +2518,7 @@ def test_augment_prompt_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.augment_prompt(**mock_args) @@ -2659,6 +2663,7 @@ def test_corroborate_content_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.corroborate_content(request) @@ -2706,6 +2711,7 @@ def test_corroborate_content_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.corroborate_content(**mock_args) @@ -3033,6 +3039,7 @@ def test_retrieve_contexts_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.retrieve_contexts(request) @@ -3066,6 +3073,7 @@ def test_retrieve_contexts_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.retrieve_contexts(request) # Establish that the response is the type that we expect. @@ -3105,6 +3113,7 @@ def test_retrieve_contexts_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 = vertex_rag_service.RetrieveContextsResponse.to_json( vertex_rag_service.RetrieveContextsResponse() ) @@ -3151,6 +3160,7 @@ def test_augment_prompt_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.augment_prompt(request) @@ -3184,6 +3194,7 @@ def test_augment_prompt_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.augment_prompt(request) # Establish that the response is the type that we expect. @@ -3223,6 +3234,7 @@ def test_augment_prompt_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 = vertex_rag_service.AugmentPromptResponse.to_json( vertex_rag_service.AugmentPromptResponse() ) @@ -3269,6 +3281,7 @@ def test_corroborate_content_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.corroborate_content(request) @@ -3304,6 +3317,7 @@ def test_corroborate_content_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.corroborate_content(request) # Establish that the response is the type that we expect. @@ -3344,6 +3358,7 @@ def test_corroborate_content_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 = vertex_rag_service.CorroborateContentResponse.to_json( vertex_rag_service.CorroborateContentResponse() ) @@ -3390,6 +3405,7 @@ def test_get_location_rest_bad_request(request_type=locations_pb2.GetLocationReq 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_location(request) @@ -3420,6 +3436,7 @@ def test_get_location_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_location(request) @@ -3448,6 +3465,7 @@ def test_list_locations_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_locations(request) @@ -3478,6 +3496,7 @@ def test_list_locations_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_locations(request) @@ -3509,6 +3528,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -3541,6 +3561,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -3572,6 +3593,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -3604,6 +3626,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -3635,6 +3658,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -3667,6 +3691,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -3697,6 +3722,7 @@ def test_cancel_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.cancel_operation(request) @@ -3727,6 +3753,7 @@ def test_cancel_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.cancel_operation(request) @@ -3757,6 +3784,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) @@ -3787,6 +3815,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) @@ -3817,6 +3846,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) @@ -3847,6 +3877,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) @@ -3877,6 +3908,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) @@ -3907,6 +3939,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) @@ -3937,6 +3970,7 @@ def test_wait_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.wait_operation(request) @@ -3967,6 +4001,7 @@ def test_wait_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.wait_operation(request) @@ -4081,6 +4116,7 @@ async def test_retrieve_contexts_rest_asyncio_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"} await client.retrieve_contexts(request) @@ -4121,6 +4157,7 @@ async def test_retrieve_contexts_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.retrieve_contexts(request) # Establish that the response is the type that we expect. @@ -4165,6 +4202,7 @@ async def test_retrieve_contexts_rest_asyncio_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 = vertex_rag_service.RetrieveContextsResponse.to_json( vertex_rag_service.RetrieveContextsResponse() ) @@ -4215,6 +4253,7 @@ async def test_augment_prompt_rest_asyncio_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"} await client.augment_prompt(request) @@ -4255,6 +4294,7 @@ async def test_augment_prompt_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.augment_prompt(request) # Establish that the response is the type that we expect. @@ -4299,6 +4339,7 @@ async def test_augment_prompt_rest_asyncio_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 = vertex_rag_service.AugmentPromptResponse.to_json( vertex_rag_service.AugmentPromptResponse() ) @@ -4349,6 +4390,7 @@ async def test_corroborate_content_rest_asyncio_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"} await client.corroborate_content(request) @@ -4391,6 +4433,7 @@ async def test_corroborate_content_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.corroborate_content(request) # Establish that the response is the type that we expect. @@ -4436,6 +4479,7 @@ async def test_corroborate_content_rest_asyncio_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 = vertex_rag_service.CorroborateContentResponse.to_json( vertex_rag_service.CorroborateContentResponse() ) @@ -4488,6 +4532,7 @@ async def test_get_location_rest_asyncio_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"} await client.get_location(request) @@ -4525,6 +4570,7 @@ async def test_get_location_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_location(request) @@ -4557,6 +4603,7 @@ async def test_list_locations_rest_asyncio_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"} await client.list_locations(request) @@ -4594,6 +4641,7 @@ async def test_list_locations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_locations(request) @@ -4629,6 +4677,7 @@ async def test_get_iam_policy_rest_asyncio_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"} await client.get_iam_policy(request) @@ -4668,6 +4717,7 @@ async def test_get_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_iam_policy(request) @@ -4703,6 +4753,7 @@ async def test_set_iam_policy_rest_asyncio_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"} await client.set_iam_policy(request) @@ -4742,6 +4793,7 @@ async def test_set_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.set_iam_policy(request) @@ -4777,6 +4829,7 @@ async def test_test_iam_permissions_rest_asyncio_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"} await client.test_iam_permissions(request) @@ -4816,6 +4869,7 @@ async def test_test_iam_permissions_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.test_iam_permissions(request) @@ -4850,6 +4904,7 @@ async def test_cancel_operation_rest_asyncio_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"} await client.cancel_operation(request) @@ -4887,6 +4942,7 @@ async def test_cancel_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.cancel_operation(request) @@ -4921,6 +4977,7 @@ async def test_delete_operation_rest_asyncio_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"} await client.delete_operation(request) @@ -4958,6 +5015,7 @@ async def test_delete_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_operation(request) @@ -4992,6 +5050,7 @@ async def test_get_operation_rest_asyncio_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"} await client.get_operation(request) @@ -5029,6 +5088,7 @@ async def test_get_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_operation(request) @@ -5063,6 +5123,7 @@ async def test_list_operations_rest_asyncio_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"} await client.list_operations(request) @@ -5100,6 +5161,7 @@ async def test_list_operations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_operations(request) @@ -5134,6 +5196,7 @@ async def test_wait_operation_rest_asyncio_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"} await client.wait_operation(request) @@ -5171,6 +5234,7 @@ async def test_wait_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.wait_operation(request) diff --git a/tests/unit/gapic/aiplatform_v1/test_vizier_service.py b/tests/unit/gapic/aiplatform_v1/test_vizier_service.py index 01235afa40..09e5ce0ffa 100644 --- a/tests/unit/gapic/aiplatform_v1/test_vizier_service.py +++ b/tests/unit/gapic/aiplatform_v1/test_vizier_service.py @@ -6170,6 +6170,7 @@ def test_create_study_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_study(request) @@ -6224,6 +6225,7 @@ def test_create_study_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_study(**mock_args) @@ -6353,6 +6355,7 @@ def test_get_study_rest_required_fields(request_type=vizier_service.GetStudyRequ 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_study(request) @@ -6398,6 +6401,7 @@ def test_get_study_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_study(**mock_args) @@ -6535,6 +6539,7 @@ def test_list_studies_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_studies(request) @@ -6588,6 +6593,7 @@ def test_list_studies_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_studies(**mock_args) @@ -6778,6 +6784,7 @@ def test_delete_study_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_study(request) @@ -6821,6 +6828,7 @@ def test_delete_study_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_study(**mock_args) @@ -6956,6 +6964,7 @@ def test_lookup_study_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.lookup_study(request) @@ -7009,6 +7018,7 @@ def test_lookup_study_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.lookup_study(**mock_args) @@ -7150,6 +7160,7 @@ def test_suggest_trials_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.suggest_trials(request) @@ -7279,6 +7290,7 @@ def test_create_trial_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_trial(request) @@ -7335,6 +7347,7 @@ def test_create_trial_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_trial(**mock_args) @@ -7465,6 +7478,7 @@ def test_get_trial_rest_required_fields(request_type=vizier_service.GetTrialRequ 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_trial(request) @@ -7512,6 +7526,7 @@ def test_get_trial_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_trial(**mock_args) @@ -7650,6 +7665,7 @@ def test_list_trials_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_trials(request) @@ -7705,6 +7721,7 @@ def test_list_trials_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_trials(**mock_args) @@ -7905,6 +7922,7 @@ def test_add_trial_measurement_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.add_trial_measurement(request) @@ -8033,6 +8051,7 @@ def test_complete_trial_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.complete_trial(request) @@ -8149,6 +8168,7 @@ def test_delete_trial_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_trial(request) @@ -8194,6 +8214,7 @@ def test_delete_trial_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_trial(**mock_args) @@ -8332,6 +8353,7 @@ def test_check_trial_early_stopping_state_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_trial_early_stopping_state(request) @@ -8452,6 +8474,7 @@ def test_stop_trial_rest_required_fields(request_type=vizier_service.StopTrialRe 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_trial(request) @@ -8576,6 +8599,7 @@ def test_list_optimal_trials_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_optimal_trials(request) @@ -8623,6 +8647,7 @@ def test_list_optimal_trials_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_optimal_trials(**mock_args) @@ -9550,6 +9575,7 @@ def test_create_study_rest_bad_request(request_type=vizier_service.CreateStudyRe 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_study(request) @@ -9733,6 +9759,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_study(request) # Establish that the response is the type that we expect. @@ -9776,6 +9803,7 @@ def test_create_study_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 = gca_study.Study.to_json(gca_study.Study()) req.return_value.content = return_value @@ -9818,6 +9846,7 @@ def test_get_study_rest_bad_request(request_type=vizier_service.GetStudyRequest) 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_study(request) @@ -9856,6 +9885,7 @@ def test_get_study_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_study(request) # Establish that the response is the type that we expect. @@ -9897,6 +9927,7 @@ def test_get_study_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 = study.Study.to_json(study.Study()) req.return_value.content = return_value @@ -9939,6 +9970,7 @@ def test_list_studies_rest_bad_request(request_type=vizier_service.ListStudiesRe 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_studies(request) @@ -9974,6 +10006,7 @@ def test_list_studies_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_studies(request) # Establish that the response is the type that we expect. @@ -10014,6 +10047,7 @@ def test_list_studies_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 = vizier_service.ListStudiesResponse.to_json( vizier_service.ListStudiesResponse() ) @@ -10058,6 +10092,7 @@ def test_delete_study_rest_bad_request(request_type=vizier_service.DeleteStudyRe 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_study(request) @@ -10088,6 +10123,7 @@ def test_delete_study_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_study(request) # Establish that the response is the type that we expect. @@ -10124,6 +10160,7 @@ def test_delete_study_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 = vizier_service.DeleteStudyRequest() metadata = [ @@ -10162,6 +10199,7 @@ def test_lookup_study_rest_bad_request(request_type=vizier_service.LookupStudyRe 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.lookup_study(request) @@ -10200,6 +10238,7 @@ def test_lookup_study_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.lookup_study(request) # Establish that the response is the type that we expect. @@ -10243,6 +10282,7 @@ def test_lookup_study_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 = study.Study.to_json(study.Study()) req.return_value.content = return_value @@ -10287,6 +10327,7 @@ def test_suggest_trials_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.suggest_trials(request) @@ -10317,6 +10358,7 @@ def test_suggest_trials_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.suggest_trials(request) # Establish that the response is the type that we expect. @@ -10358,6 +10400,7 @@ def test_suggest_trials_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 @@ -10400,6 +10443,7 @@ def test_create_trial_rest_bad_request(request_type=vizier_service.CreateTrialRe 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_trial(request) @@ -10537,6 +10581,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_trial(request) # Establish that the response is the type that we expect. @@ -10582,6 +10627,7 @@ def test_create_trial_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 = study.Trial.to_json(study.Trial()) req.return_value.content = return_value @@ -10626,6 +10672,7 @@ def test_get_trial_rest_bad_request(request_type=vizier_service.GetTrialRequest) 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_trial(request) @@ -10668,6 +10715,7 @@ def test_get_trial_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_trial(request) # Establish that the response is the type that we expect. @@ -10711,6 +10759,7 @@ def test_get_trial_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 = study.Trial.to_json(study.Trial()) req.return_value.content = return_value @@ -10753,6 +10802,7 @@ def test_list_trials_rest_bad_request(request_type=vizier_service.ListTrialsRequ 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_trials(request) @@ -10788,6 +10838,7 @@ def test_list_trials_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_trials(request) # Establish that the response is the type that we expect. @@ -10828,6 +10879,7 @@ def test_list_trials_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 = vizier_service.ListTrialsResponse.to_json( vizier_service.ListTrialsResponse() ) @@ -10876,6 +10928,7 @@ def test_add_trial_measurement_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.add_trial_measurement(request) @@ -10918,6 +10971,7 @@ def test_add_trial_measurement_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.add_trial_measurement(request) # Establish that the response is the type that we expect. @@ -10963,6 +11017,7 @@ def test_add_trial_measurement_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 = study.Trial.to_json(study.Trial()) req.return_value.content = return_value @@ -11009,6 +11064,7 @@ def test_complete_trial_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.complete_trial(request) @@ -11051,6 +11107,7 @@ def test_complete_trial_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.complete_trial(request) # Establish that the response is the type that we expect. @@ -11096,6 +11153,7 @@ def test_complete_trial_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 = study.Trial.to_json(study.Trial()) req.return_value.content = return_value @@ -11140,6 +11198,7 @@ def test_delete_trial_rest_bad_request(request_type=vizier_service.DeleteTrialRe 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_trial(request) @@ -11172,6 +11231,7 @@ def test_delete_trial_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_trial(request) # Establish that the response is the type that we expect. @@ -11208,6 +11268,7 @@ def test_delete_trial_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 = vizier_service.DeleteTrialRequest() metadata = [ @@ -11250,6 +11311,7 @@ def test_check_trial_early_stopping_state_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.check_trial_early_stopping_state(request) @@ -11282,6 +11344,7 @@ def test_check_trial_early_stopping_state_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_trial_early_stopping_state(request) # Establish that the response is the type that we expect. @@ -11323,6 +11386,7 @@ def test_check_trial_early_stopping_state_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 @@ -11367,6 +11431,7 @@ def test_stop_trial_rest_bad_request(request_type=vizier_service.StopTrialReques 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_trial(request) @@ -11409,6 +11474,7 @@ def test_stop_trial_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_trial(request) # Establish that the response is the type that we expect. @@ -11454,6 +11520,7 @@ def test_stop_trial_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 = study.Trial.to_json(study.Trial()) req.return_value.content = return_value @@ -11498,6 +11565,7 @@ def test_list_optimal_trials_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_optimal_trials(request) @@ -11531,6 +11599,7 @@ def test_list_optimal_trials_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_optimal_trials(request) # Establish that the response is the type that we expect. @@ -11570,6 +11639,7 @@ def test_list_optimal_trials_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 = vizier_service.ListOptimalTrialsResponse.to_json( vizier_service.ListOptimalTrialsResponse() ) @@ -11616,6 +11686,7 @@ def test_get_location_rest_bad_request(request_type=locations_pb2.GetLocationReq 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_location(request) @@ -11646,6 +11717,7 @@ def test_get_location_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_location(request) @@ -11674,6 +11746,7 @@ def test_list_locations_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_locations(request) @@ -11704,6 +11777,7 @@ def test_list_locations_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_locations(request) @@ -11735,6 +11809,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -11767,6 +11842,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -11798,6 +11874,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -11830,6 +11907,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -11861,6 +11939,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -11893,6 +11972,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -11923,6 +12003,7 @@ def test_cancel_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.cancel_operation(request) @@ -11953,6 +12034,7 @@ def test_cancel_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.cancel_operation(request) @@ -11983,6 +12065,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) @@ -12013,6 +12096,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) @@ -12043,6 +12127,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) @@ -12073,6 +12158,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) @@ -12103,6 +12189,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) @@ -12133,6 +12220,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) @@ -12163,6 +12251,7 @@ def test_wait_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.wait_operation(request) @@ -12193,6 +12282,7 @@ def test_wait_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.wait_operation(request) @@ -12566,6 +12656,7 @@ async def test_create_study_rest_asyncio_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"} await client.create_study(request) @@ -12756,6 +12847,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.create_study(request) # Establish that the response is the type that we expect. @@ -12804,6 +12896,7 @@ async def test_create_study_rest_asyncio_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 = gca_study.Study.to_json(gca_study.Study()) req.return_value.read = mock.AsyncMock(return_value=return_value) @@ -12852,6 +12945,7 @@ async def test_get_study_rest_asyncio_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"} await client.get_study(request) @@ -12897,6 +12991,7 @@ async def test_get_study_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_study(request) # Establish that the response is the type that we expect. @@ -12943,6 +13038,7 @@ async def test_get_study_rest_asyncio_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 = study.Study.to_json(study.Study()) req.return_value.read = mock.AsyncMock(return_value=return_value) @@ -12991,6 +13087,7 @@ async def test_list_studies_rest_asyncio_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"} await client.list_studies(request) @@ -13033,6 +13130,7 @@ async def test_list_studies_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_studies(request) # Establish that the response is the type that we expect. @@ -13078,6 +13176,7 @@ async def test_list_studies_rest_asyncio_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 = vizier_service.ListStudiesResponse.to_json( vizier_service.ListStudiesResponse() ) @@ -13128,6 +13227,7 @@ async def test_delete_study_rest_asyncio_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"} await client.delete_study(request) @@ -13165,6 +13265,7 @@ async def test_delete_study_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_study(request) # Establish that the response is the type that we expect. @@ -13206,6 +13307,7 @@ async def test_delete_study_rest_asyncio_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 = vizier_service.DeleteStudyRequest() metadata = [ @@ -13250,6 +13352,7 @@ async def test_lookup_study_rest_asyncio_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"} await client.lookup_study(request) @@ -13295,6 +13398,7 @@ async def test_lookup_study_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.lookup_study(request) # Establish that the response is the type that we expect. @@ -13343,6 +13447,7 @@ async def test_lookup_study_rest_asyncio_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 = study.Study.to_json(study.Study()) req.return_value.read = mock.AsyncMock(return_value=return_value) @@ -13391,6 +13496,7 @@ async def test_suggest_trials_rest_asyncio_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"} await client.suggest_trials(request) @@ -13428,6 +13534,7 @@ async def test_suggest_trials_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.suggest_trials(request) # Establish that the response is the type that we expect. @@ -13474,6 +13581,7 @@ async def test_suggest_trials_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -13522,6 +13630,7 @@ async def test_create_trial_rest_asyncio_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"} await client.create_trial(request) @@ -13666,6 +13775,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.create_trial(request) # Establish that the response is the type that we expect. @@ -13716,6 +13826,7 @@ async def test_create_trial_rest_asyncio_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 = study.Trial.to_json(study.Trial()) req.return_value.read = mock.AsyncMock(return_value=return_value) @@ -13766,6 +13877,7 @@ async def test_get_trial_rest_asyncio_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"} await client.get_trial(request) @@ -13815,6 +13927,7 @@ async def test_get_trial_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_trial(request) # Establish that the response is the type that we expect. @@ -13863,6 +13976,7 @@ async def test_get_trial_rest_asyncio_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 = study.Trial.to_json(study.Trial()) req.return_value.read = mock.AsyncMock(return_value=return_value) @@ -13911,6 +14025,7 @@ async def test_list_trials_rest_asyncio_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"} await client.list_trials(request) @@ -13953,6 +14068,7 @@ async def test_list_trials_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_trials(request) # Establish that the response is the type that we expect. @@ -13998,6 +14114,7 @@ async def test_list_trials_rest_asyncio_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 = vizier_service.ListTrialsResponse.to_json( vizier_service.ListTrialsResponse() ) @@ -14050,6 +14167,7 @@ async def test_add_trial_measurement_rest_asyncio_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"} await client.add_trial_measurement(request) @@ -14099,6 +14217,7 @@ async def test_add_trial_measurement_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.add_trial_measurement(request) # Establish that the response is the type that we expect. @@ -14149,6 +14268,7 @@ async def test_add_trial_measurement_rest_asyncio_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 = study.Trial.to_json(study.Trial()) req.return_value.read = mock.AsyncMock(return_value=return_value) @@ -14199,6 +14319,7 @@ async def test_complete_trial_rest_asyncio_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"} await client.complete_trial(request) @@ -14248,6 +14369,7 @@ async def test_complete_trial_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.complete_trial(request) # Establish that the response is the type that we expect. @@ -14298,6 +14420,7 @@ async def test_complete_trial_rest_asyncio_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 = study.Trial.to_json(study.Trial()) req.return_value.read = mock.AsyncMock(return_value=return_value) @@ -14348,6 +14471,7 @@ async def test_delete_trial_rest_asyncio_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"} await client.delete_trial(request) @@ -14387,6 +14511,7 @@ async def test_delete_trial_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_trial(request) # Establish that the response is the type that we expect. @@ -14428,6 +14553,7 @@ async def test_delete_trial_rest_asyncio_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 = vizier_service.DeleteTrialRequest() metadata = [ @@ -14474,6 +14600,7 @@ async def test_check_trial_early_stopping_state_rest_asyncio_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"} await client.check_trial_early_stopping_state(request) @@ -14513,6 +14640,7 @@ async def test_check_trial_early_stopping_state_rest_asyncio_call_success(reques return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.check_trial_early_stopping_state(request) # Establish that the response is the type that we expect. @@ -14563,6 +14691,7 @@ async def test_check_trial_early_stopping_state_rest_asyncio_interceptors( 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.read = mock.AsyncMock(return_value=return_value) @@ -14613,6 +14742,7 @@ async def test_stop_trial_rest_asyncio_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"} await client.stop_trial(request) @@ -14662,6 +14792,7 @@ async def test_stop_trial_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.stop_trial(request) # Establish that the response is the type that we expect. @@ -14712,6 +14843,7 @@ async def test_stop_trial_rest_asyncio_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 = study.Trial.to_json(study.Trial()) req.return_value.read = mock.AsyncMock(return_value=return_value) @@ -14760,6 +14892,7 @@ async def test_list_optimal_trials_rest_asyncio_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"} await client.list_optimal_trials(request) @@ -14800,6 +14933,7 @@ async def test_list_optimal_trials_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_optimal_trials(request) # Establish that the response is the type that we expect. @@ -14844,6 +14978,7 @@ async def test_list_optimal_trials_rest_asyncio_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 = vizier_service.ListOptimalTrialsResponse.to_json( vizier_service.ListOptimalTrialsResponse() ) @@ -14896,6 +15031,7 @@ async def test_get_location_rest_asyncio_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"} await client.get_location(request) @@ -14933,6 +15069,7 @@ async def test_get_location_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_location(request) @@ -14965,6 +15102,7 @@ async def test_list_locations_rest_asyncio_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"} await client.list_locations(request) @@ -15002,6 +15140,7 @@ async def test_list_locations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_locations(request) @@ -15037,6 +15176,7 @@ async def test_get_iam_policy_rest_asyncio_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"} await client.get_iam_policy(request) @@ -15076,6 +15216,7 @@ async def test_get_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_iam_policy(request) @@ -15111,6 +15252,7 @@ async def test_set_iam_policy_rest_asyncio_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"} await client.set_iam_policy(request) @@ -15150,6 +15292,7 @@ async def test_set_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.set_iam_policy(request) @@ -15185,6 +15328,7 @@ async def test_test_iam_permissions_rest_asyncio_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"} await client.test_iam_permissions(request) @@ -15224,6 +15368,7 @@ async def test_test_iam_permissions_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.test_iam_permissions(request) @@ -15258,6 +15403,7 @@ async def test_cancel_operation_rest_asyncio_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"} await client.cancel_operation(request) @@ -15295,6 +15441,7 @@ async def test_cancel_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.cancel_operation(request) @@ -15329,6 +15476,7 @@ async def test_delete_operation_rest_asyncio_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"} await client.delete_operation(request) @@ -15366,6 +15514,7 @@ async def test_delete_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_operation(request) @@ -15400,6 +15549,7 @@ async def test_get_operation_rest_asyncio_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"} await client.get_operation(request) @@ -15437,6 +15587,7 @@ async def test_get_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_operation(request) @@ -15471,6 +15622,7 @@ async def test_list_operations_rest_asyncio_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"} await client.list_operations(request) @@ -15508,6 +15660,7 @@ async def test_list_operations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_operations(request) @@ -15542,6 +15695,7 @@ async def test_wait_operation_rest_asyncio_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"} await client.wait_operation(request) @@ -15579,6 +15733,7 @@ async def test_wait_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.wait_operation(request) diff --git a/tests/unit/gapic/aiplatform_v1beta1/test_dataset_service.py b/tests/unit/gapic/aiplatform_v1beta1/test_dataset_service.py index b29a820c1e..8b49dddeaa 100644 --- a/tests/unit/gapic/aiplatform_v1beta1/test_dataset_service.py +++ b/tests/unit/gapic/aiplatform_v1beta1/test_dataset_service.py @@ -8919,6 +8919,7 @@ def test_create_dataset_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_dataset(request) @@ -8971,6 +8972,7 @@ def test_create_dataset_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_dataset(**mock_args) @@ -9105,6 +9107,7 @@ def test_get_dataset_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_dataset(request) @@ -9150,6 +9153,7 @@ def test_get_dataset_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_dataset(**mock_args) @@ -9279,6 +9283,7 @@ def test_update_dataset_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_dataset(request) @@ -9335,6 +9340,7 @@ def test_update_dataset_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_dataset(**mock_args) @@ -9477,6 +9483,7 @@ def test_list_datasets_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_datasets(request) @@ -9533,6 +9540,7 @@ def test_list_datasets_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_datasets(**mock_args) @@ -9728,6 +9736,7 @@ def test_delete_dataset_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_dataset(request) @@ -9771,6 +9780,7 @@ def test_delete_dataset_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_dataset(**mock_args) @@ -9904,6 +9914,7 @@ def test_import_data_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.import_data(request) @@ -9958,6 +9969,7 @@ def test_import_data_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.import_data(**mock_args) @@ -10094,6 +10106,7 @@ def test_export_data_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.export_data(request) @@ -10150,6 +10163,7 @@ def test_export_data_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.export_data(**mock_args) @@ -10293,6 +10307,7 @@ def test_create_dataset_version_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_dataset_version(request) @@ -10347,6 +10362,7 @@ def test_create_dataset_version_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_dataset_version(**mock_args) @@ -10482,6 +10498,7 @@ def test_update_dataset_version_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_dataset_version(request) @@ -10540,6 +10557,7 @@ def test_update_dataset_version_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_dataset_version(**mock_args) @@ -10678,6 +10696,7 @@ def test_delete_dataset_version_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_dataset_version(request) @@ -10723,6 +10742,7 @@ def test_delete_dataset_version_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_dataset_version(**mock_args) @@ -10860,6 +10880,7 @@ def test_get_dataset_version_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_dataset_version(request) @@ -10907,6 +10928,7 @@ def test_get_dataset_version_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_dataset_version(**mock_args) @@ -11053,6 +11075,7 @@ def test_list_dataset_versions_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_dataset_versions(request) @@ -11111,6 +11134,7 @@ def test_list_dataset_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_dataset_versions(**mock_args) @@ -11313,6 +11337,7 @@ def test_restore_dataset_version_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.restore_dataset_version(request) @@ -11358,6 +11383,7 @@ def test_restore_dataset_version_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.restore_dataset_version(**mock_args) @@ -11499,6 +11525,7 @@ def test_list_data_items_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_data_items(request) @@ -11557,6 +11584,7 @@ def test_list_data_items_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_data_items(**mock_args) @@ -11772,6 +11800,7 @@ def test_search_data_items_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.search_data_items(request) @@ -11988,6 +12017,7 @@ def test_list_saved_queries_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_saved_queries(request) @@ -12046,6 +12076,7 @@ def test_list_saved_queries_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_saved_queries(**mock_args) @@ -12247,6 +12278,7 @@ def test_delete_saved_query_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_saved_query(request) @@ -12292,6 +12324,7 @@ def test_delete_saved_query_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_saved_query(**mock_args) @@ -12429,6 +12462,7 @@ def test_get_annotation_spec_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_annotation_spec(request) @@ -12476,6 +12510,7 @@ def test_get_annotation_spec_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_annotation_spec(**mock_args) @@ -12619,6 +12654,7 @@ def test_list_annotations_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_annotations(request) @@ -12677,6 +12713,7 @@ def test_list_annotations_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_annotations(**mock_args) @@ -13887,6 +13924,7 @@ def test_create_dataset_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_dataset(request) @@ -14022,6 +14060,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_dataset(request) # Establish that the response is the type that we expect. @@ -14063,6 +14102,7 @@ def test_create_dataset_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 @@ -14105,6 +14145,7 @@ def test_get_dataset_rest_bad_request(request_type=dataset_service.GetDatasetReq 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_dataset(request) @@ -14149,6 +14190,7 @@ def test_get_dataset_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_dataset(request) # Establish that the response is the type that we expect. @@ -14198,6 +14240,7 @@ def test_get_dataset_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 = dataset.Dataset.to_json(dataset.Dataset()) req.return_value.content = return_value @@ -14244,6 +14287,7 @@ def test_update_dataset_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_dataset(request) @@ -14395,6 +14439,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_dataset(request) # Establish that the response is the type that we expect. @@ -14444,6 +14489,7 @@ def test_update_dataset_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 = gca_dataset.Dataset.to_json(gca_dataset.Dataset()) req.return_value.content = return_value @@ -14488,6 +14534,7 @@ def test_list_datasets_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_datasets(request) @@ -14523,6 +14570,7 @@ def test_list_datasets_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_datasets(request) # Establish that the response is the type that we expect. @@ -14563,6 +14611,7 @@ def test_list_datasets_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 = dataset_service.ListDatasetsResponse.to_json( dataset_service.ListDatasetsResponse() ) @@ -14609,6 +14658,7 @@ def test_delete_dataset_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_dataset(request) @@ -14639,6 +14689,7 @@ def test_delete_dataset_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_dataset(request) # Establish that the response is the type that we expect. @@ -14680,6 +14731,7 @@ def test_delete_dataset_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 @@ -14722,6 +14774,7 @@ def test_import_data_rest_bad_request(request_type=dataset_service.ImportDataReq 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.import_data(request) @@ -14752,6 +14805,7 @@ def test_import_data_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.import_data(request) # Establish that the response is the type that we expect. @@ -14793,6 +14847,7 @@ def test_import_data_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 @@ -14835,6 +14890,7 @@ def test_export_data_rest_bad_request(request_type=dataset_service.ExportDataReq 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.export_data(request) @@ -14865,6 +14921,7 @@ def test_export_data_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.export_data(request) # Establish that the response is the type that we expect. @@ -14906,6 +14963,7 @@ def test_export_data_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 @@ -14950,6 +15008,7 @@ def test_create_dataset_version_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_dataset_version(request) @@ -15068,6 +15127,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_dataset_version(request) # Establish that the response is the type that we expect. @@ -15109,6 +15169,7 @@ def test_create_dataset_version_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 @@ -15157,6 +15218,7 @@ def test_update_dataset_version_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_dataset_version(request) @@ -15290,6 +15352,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_dataset_version(request) # Establish that the response is the type that we expect. @@ -15336,6 +15399,7 @@ def test_update_dataset_version_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 = gca_dataset_version.DatasetVersion.to_json( gca_dataset_version.DatasetVersion() ) @@ -15384,6 +15448,7 @@ def test_delete_dataset_version_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_dataset_version(request) @@ -15416,6 +15481,7 @@ def test_delete_dataset_version_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_dataset_version(request) # Establish that the response is the type that we expect. @@ -15457,6 +15523,7 @@ def test_delete_dataset_version_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 @@ -15503,6 +15570,7 @@ def test_get_dataset_version_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_dataset_version(request) @@ -15546,6 +15614,7 @@ def test_get_dataset_version_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_dataset_version(request) # Establish that the response is the type that we expect. @@ -15592,6 +15661,7 @@ def test_get_dataset_version_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 = dataset_version.DatasetVersion.to_json( dataset_version.DatasetVersion() ) @@ -15638,6 +15708,7 @@ def test_list_dataset_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_dataset_versions(request) @@ -15673,6 +15744,7 @@ def test_list_dataset_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_dataset_versions(request) # Establish that the response is the type that we expect. @@ -15713,6 +15785,7 @@ def test_list_dataset_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 = dataset_service.ListDatasetVersionsResponse.to_json( dataset_service.ListDatasetVersionsResponse() ) @@ -15761,6 +15834,7 @@ def test_restore_dataset_version_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.restore_dataset_version(request) @@ -15793,6 +15867,7 @@ def test_restore_dataset_version_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.restore_dataset_version(request) # Establish that the response is the type that we expect. @@ -15834,6 +15909,7 @@ def test_restore_dataset_version_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 @@ -15878,6 +15954,7 @@ def test_list_data_items_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_data_items(request) @@ -15913,6 +15990,7 @@ def test_list_data_items_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_data_items(request) # Establish that the response is the type that we expect. @@ -15953,6 +16031,7 @@ def test_list_data_items_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 = dataset_service.ListDataItemsResponse.to_json( dataset_service.ListDataItemsResponse() ) @@ -15999,6 +16078,7 @@ def test_search_data_items_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.search_data_items(request) @@ -16034,6 +16114,7 @@ def test_search_data_items_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.search_data_items(request) # Establish that the response is the type that we expect. @@ -16074,6 +16155,7 @@ def test_search_data_items_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 = dataset_service.SearchDataItemsResponse.to_json( dataset_service.SearchDataItemsResponse() ) @@ -16120,6 +16202,7 @@ def test_list_saved_queries_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_saved_queries(request) @@ -16155,6 +16238,7 @@ def test_list_saved_queries_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_saved_queries(request) # Establish that the response is the type that we expect. @@ -16195,6 +16279,7 @@ def test_list_saved_queries_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 = dataset_service.ListSavedQueriesResponse.to_json( dataset_service.ListSavedQueriesResponse() ) @@ -16243,6 +16328,7 @@ def test_delete_saved_query_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_saved_query(request) @@ -16275,6 +16361,7 @@ def test_delete_saved_query_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_saved_query(request) # Establish that the response is the type that we expect. @@ -16316,6 +16403,7 @@ def test_delete_saved_query_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 @@ -16362,6 +16450,7 @@ def test_get_annotation_spec_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_annotation_spec(request) @@ -16401,6 +16490,7 @@ def test_get_annotation_spec_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_annotation_spec(request) # Establish that the response is the type that we expect. @@ -16443,6 +16533,7 @@ def test_get_annotation_spec_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 = annotation_spec.AnnotationSpec.to_json( annotation_spec.AnnotationSpec() ) @@ -16491,6 +16582,7 @@ def test_list_annotations_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_annotations(request) @@ -16528,6 +16620,7 @@ def test_list_annotations_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_annotations(request) # Establish that the response is the type that we expect. @@ -16568,6 +16661,7 @@ def test_list_annotations_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 = dataset_service.ListAnnotationsResponse.to_json( dataset_service.ListAnnotationsResponse() ) @@ -16614,6 +16708,7 @@ def test_get_location_rest_bad_request(request_type=locations_pb2.GetLocationReq 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_location(request) @@ -16644,6 +16739,7 @@ def test_get_location_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_location(request) @@ -16672,6 +16768,7 @@ def test_list_locations_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_locations(request) @@ -16702,6 +16799,7 @@ def test_list_locations_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_locations(request) @@ -16733,6 +16831,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -16765,6 +16864,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -16796,6 +16896,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -16828,6 +16929,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -16859,6 +16961,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -16891,6 +16994,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -16921,6 +17025,7 @@ def test_cancel_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.cancel_operation(request) @@ -16951,6 +17056,7 @@ def test_cancel_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.cancel_operation(request) @@ -16981,6 +17087,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) @@ -17011,6 +17118,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) @@ -17041,6 +17149,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) @@ -17071,6 +17180,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) @@ -17101,6 +17211,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) @@ -17131,6 +17242,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) @@ -17161,6 +17273,7 @@ def test_wait_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.wait_operation(request) @@ -17191,6 +17304,7 @@ def test_wait_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.wait_operation(request) @@ -17658,6 +17772,7 @@ async def test_create_dataset_rest_asyncio_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"} await client.create_dataset(request) @@ -17800,6 +17915,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.create_dataset(request) # Establish that the response is the type that we expect. @@ -17846,6 +17962,7 @@ async def test_create_dataset_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -17894,6 +18011,7 @@ async def test_get_dataset_rest_asyncio_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"} await client.get_dataset(request) @@ -17945,6 +18063,7 @@ async def test_get_dataset_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_dataset(request) # Establish that the response is the type that we expect. @@ -17999,6 +18118,7 @@ async def test_get_dataset_rest_asyncio_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 = dataset.Dataset.to_json(dataset.Dataset()) req.return_value.read = mock.AsyncMock(return_value=return_value) @@ -18049,6 +18169,7 @@ async def test_update_dataset_rest_asyncio_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"} await client.update_dataset(request) @@ -18207,6 +18328,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.update_dataset(request) # Establish that the response is the type that we expect. @@ -18261,6 +18383,7 @@ async def test_update_dataset_rest_asyncio_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 = gca_dataset.Dataset.to_json(gca_dataset.Dataset()) req.return_value.read = mock.AsyncMock(return_value=return_value) @@ -18309,6 +18432,7 @@ async def test_list_datasets_rest_asyncio_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"} await client.list_datasets(request) @@ -18351,6 +18475,7 @@ async def test_list_datasets_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_datasets(request) # Establish that the response is the type that we expect. @@ -18396,6 +18521,7 @@ async def test_list_datasets_rest_asyncio_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 = dataset_service.ListDatasetsResponse.to_json( dataset_service.ListDatasetsResponse() ) @@ -18446,6 +18572,7 @@ async def test_delete_dataset_rest_asyncio_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"} await client.delete_dataset(request) @@ -18483,6 +18610,7 @@ async def test_delete_dataset_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_dataset(request) # Establish that the response is the type that we expect. @@ -18529,6 +18657,7 @@ async def test_delete_dataset_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -18577,6 +18706,7 @@ async def test_import_data_rest_asyncio_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"} await client.import_data(request) @@ -18614,6 +18744,7 @@ async def test_import_data_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.import_data(request) # Establish that the response is the type that we expect. @@ -18660,6 +18791,7 @@ async def test_import_data_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -18708,6 +18840,7 @@ async def test_export_data_rest_asyncio_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"} await client.export_data(request) @@ -18745,6 +18878,7 @@ async def test_export_data_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.export_data(request) # Establish that the response is the type that we expect. @@ -18791,6 +18925,7 @@ async def test_export_data_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -18839,6 +18974,7 @@ async def test_create_dataset_version_rest_asyncio_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"} await client.create_dataset_version(request) @@ -18964,6 +19100,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.create_dataset_version(request) # Establish that the response is the type that we expect. @@ -19010,6 +19147,7 @@ async def test_create_dataset_version_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -19062,6 +19200,7 @@ async def test_update_dataset_version_rest_asyncio_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"} await client.update_dataset_version(request) @@ -19202,6 +19341,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.update_dataset_version(request) # Establish that the response is the type that we expect. @@ -19253,6 +19393,7 @@ async def test_update_dataset_version_rest_asyncio_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 = gca_dataset_version.DatasetVersion.to_json( gca_dataset_version.DatasetVersion() ) @@ -19305,6 +19446,7 @@ async def test_delete_dataset_version_rest_asyncio_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"} await client.delete_dataset_version(request) @@ -19344,6 +19486,7 @@ async def test_delete_dataset_version_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_dataset_version(request) # Establish that the response is the type that we expect. @@ -19390,6 +19533,7 @@ async def test_delete_dataset_version_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -19440,6 +19584,7 @@ async def test_get_dataset_version_rest_asyncio_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"} await client.get_dataset_version(request) @@ -19490,6 +19635,7 @@ async def test_get_dataset_version_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_dataset_version(request) # Establish that the response is the type that we expect. @@ -19541,6 +19687,7 @@ async def test_get_dataset_version_rest_asyncio_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 = dataset_version.DatasetVersion.to_json( dataset_version.DatasetVersion() ) @@ -19591,6 +19738,7 @@ async def test_list_dataset_versions_rest_asyncio_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"} await client.list_dataset_versions(request) @@ -19633,6 +19781,7 @@ async def test_list_dataset_versions_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_dataset_versions(request) # Establish that the response is the type that we expect. @@ -19678,6 +19827,7 @@ async def test_list_dataset_versions_rest_asyncio_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 = dataset_service.ListDatasetVersionsResponse.to_json( dataset_service.ListDatasetVersionsResponse() ) @@ -19730,6 +19880,7 @@ async def test_restore_dataset_version_rest_asyncio_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"} await client.restore_dataset_version(request) @@ -19769,6 +19920,7 @@ async def test_restore_dataset_version_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.restore_dataset_version(request) # Establish that the response is the type that we expect. @@ -19815,6 +19967,7 @@ async def test_restore_dataset_version_rest_asyncio_interceptors(null_intercepto 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.read = mock.AsyncMock(return_value=return_value) @@ -19863,6 +20016,7 @@ async def test_list_data_items_rest_asyncio_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"} await client.list_data_items(request) @@ -19905,6 +20059,7 @@ async def test_list_data_items_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_data_items(request) # Establish that the response is the type that we expect. @@ -19950,6 +20105,7 @@ async def test_list_data_items_rest_asyncio_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 = dataset_service.ListDataItemsResponse.to_json( dataset_service.ListDataItemsResponse() ) @@ -20000,6 +20156,7 @@ async def test_search_data_items_rest_asyncio_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"} await client.search_data_items(request) @@ -20042,6 +20199,7 @@ async def test_search_data_items_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.search_data_items(request) # Establish that the response is the type that we expect. @@ -20087,6 +20245,7 @@ async def test_search_data_items_rest_asyncio_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 = dataset_service.SearchDataItemsResponse.to_json( dataset_service.SearchDataItemsResponse() ) @@ -20137,6 +20296,7 @@ async def test_list_saved_queries_rest_asyncio_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"} await client.list_saved_queries(request) @@ -20179,6 +20339,7 @@ async def test_list_saved_queries_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_saved_queries(request) # Establish that the response is the type that we expect. @@ -20224,6 +20385,7 @@ async def test_list_saved_queries_rest_asyncio_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 = dataset_service.ListSavedQueriesResponse.to_json( dataset_service.ListSavedQueriesResponse() ) @@ -20276,6 +20438,7 @@ async def test_delete_saved_query_rest_asyncio_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"} await client.delete_saved_query(request) @@ -20315,6 +20478,7 @@ async def test_delete_saved_query_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_saved_query(request) # Establish that the response is the type that we expect. @@ -20361,6 +20525,7 @@ async def test_delete_saved_query_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -20411,6 +20576,7 @@ async def test_get_annotation_spec_rest_asyncio_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"} await client.get_annotation_spec(request) @@ -20457,6 +20623,7 @@ async def test_get_annotation_spec_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_annotation_spec(request) # Establish that the response is the type that we expect. @@ -20504,6 +20671,7 @@ async def test_get_annotation_spec_rest_asyncio_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 = annotation_spec.AnnotationSpec.to_json( annotation_spec.AnnotationSpec() ) @@ -20556,6 +20724,7 @@ async def test_list_annotations_rest_asyncio_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"} await client.list_annotations(request) @@ -20600,6 +20769,7 @@ async def test_list_annotations_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_annotations(request) # Establish that the response is the type that we expect. @@ -20645,6 +20815,7 @@ async def test_list_annotations_rest_asyncio_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 = dataset_service.ListAnnotationsResponse.to_json( dataset_service.ListAnnotationsResponse() ) @@ -20697,6 +20868,7 @@ async def test_get_location_rest_asyncio_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"} await client.get_location(request) @@ -20734,6 +20906,7 @@ async def test_get_location_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_location(request) @@ -20766,6 +20939,7 @@ async def test_list_locations_rest_asyncio_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"} await client.list_locations(request) @@ -20803,6 +20977,7 @@ async def test_list_locations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_locations(request) @@ -20838,6 +21013,7 @@ async def test_get_iam_policy_rest_asyncio_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"} await client.get_iam_policy(request) @@ -20877,6 +21053,7 @@ async def test_get_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_iam_policy(request) @@ -20912,6 +21089,7 @@ async def test_set_iam_policy_rest_asyncio_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"} await client.set_iam_policy(request) @@ -20951,6 +21129,7 @@ async def test_set_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.set_iam_policy(request) @@ -20986,6 +21165,7 @@ async def test_test_iam_permissions_rest_asyncio_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"} await client.test_iam_permissions(request) @@ -21025,6 +21205,7 @@ async def test_test_iam_permissions_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.test_iam_permissions(request) @@ -21059,6 +21240,7 @@ async def test_cancel_operation_rest_asyncio_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"} await client.cancel_operation(request) @@ -21096,6 +21278,7 @@ async def test_cancel_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.cancel_operation(request) @@ -21130,6 +21313,7 @@ async def test_delete_operation_rest_asyncio_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"} await client.delete_operation(request) @@ -21167,6 +21351,7 @@ async def test_delete_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_operation(request) @@ -21201,6 +21386,7 @@ async def test_get_operation_rest_asyncio_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"} await client.get_operation(request) @@ -21238,6 +21424,7 @@ async def test_get_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_operation(request) @@ -21272,6 +21459,7 @@ async def test_list_operations_rest_asyncio_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"} await client.list_operations(request) @@ -21309,6 +21497,7 @@ async def test_list_operations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_operations(request) @@ -21343,6 +21532,7 @@ async def test_wait_operation_rest_asyncio_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"} await client.wait_operation(request) @@ -21380,6 +21570,7 @@ async def test_wait_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.wait_operation(request) diff --git a/tests/unit/gapic/aiplatform_v1beta1/test_deployment_resource_pool_service.py b/tests/unit/gapic/aiplatform_v1beta1/test_deployment_resource_pool_service.py index 0ec7319a62..52534574e0 100644 --- a/tests/unit/gapic/aiplatform_v1beta1/test_deployment_resource_pool_service.py +++ b/tests/unit/gapic/aiplatform_v1beta1/test_deployment_resource_pool_service.py @@ -3893,6 +3893,7 @@ def test_create_deployment_resource_pool_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_deployment_resource_pool(request) @@ -3951,6 +3952,7 @@ def test_create_deployment_resource_pool_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_deployment_resource_pool(**mock_args) @@ -4093,6 +4095,7 @@ def test_get_deployment_resource_pool_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_deployment_resource_pool(request) @@ -4140,6 +4143,7 @@ def test_get_deployment_resource_pool_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_deployment_resource_pool(**mock_args) @@ -4289,6 +4293,7 @@ def test_list_deployment_resource_pools_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_deployment_resource_pools(request) @@ -4350,6 +4355,7 @@ def test_list_deployment_resource_pools_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_deployment_resource_pools(**mock_args) @@ -4556,6 +4562,7 @@ def test_update_deployment_resource_pool_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_deployment_resource_pool(request) @@ -4616,6 +4623,7 @@ def test_update_deployment_resource_pool_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_deployment_resource_pool(**mock_args) @@ -4756,6 +4764,7 @@ def test_delete_deployment_resource_pool_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_deployment_resource_pool(request) @@ -4803,6 +4812,7 @@ def test_delete_deployment_resource_pool_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_deployment_resource_pool(**mock_args) @@ -4952,6 +4962,7 @@ def test_query_deployed_models_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.query_deployed_models(request) @@ -5009,6 +5020,7 @@ def test_query_deployed_models_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.query_deployed_models(**mock_args) @@ -5588,6 +5600,7 @@ def test_create_deployment_resource_pool_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_deployment_resource_pool(request) @@ -5618,6 +5631,7 @@ def test_create_deployment_resource_pool_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.create_deployment_resource_pool(request) # Establish that the response is the type that we expect. @@ -5663,6 +5677,7 @@ def test_create_deployment_resource_pool_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 @@ -5709,6 +5724,7 @@ def test_get_deployment_resource_pool_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_deployment_resource_pool(request) @@ -5750,6 +5766,7 @@ def test_get_deployment_resource_pool_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_deployment_resource_pool(request) # Establish that the response is the type that we expect. @@ -5798,6 +5815,7 @@ def test_get_deployment_resource_pool_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 = deployment_resource_pool.DeploymentResourcePool.to_json( deployment_resource_pool.DeploymentResourcePool() ) @@ -5844,6 +5862,7 @@ def test_list_deployment_resource_pools_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_deployment_resource_pools(request) @@ -5885,6 +5904,7 @@ def test_list_deployment_resource_pools_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_deployment_resource_pools(request) # Establish that the response is the type that we expect. @@ -5929,6 +5949,7 @@ def test_list_deployment_resource_pools_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 = deployment_resource_pool_service.ListDeploymentResourcePoolsResponse.to_json( deployment_resource_pool_service.ListDeploymentResourcePoolsResponse() ) @@ -5981,6 +6002,7 @@ def test_update_deployment_resource_pool_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_deployment_resource_pool(request) @@ -6018,6 +6040,7 @@ def test_update_deployment_resource_pool_rest_call_success(request_type): }, "min_replica_count": 1803, "max_replica_count": 1805, + "required_replica_count": 2344, "autoscaling_metric_specs": [ {"metric_name": "metric_name_value", "target": 647} ], @@ -6114,6 +6137,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_deployment_resource_pool(request) # Establish that the response is the type that we expect. @@ -6159,6 +6183,7 @@ def test_update_deployment_resource_pool_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 @@ -6205,6 +6230,7 @@ def test_delete_deployment_resource_pool_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_deployment_resource_pool(request) @@ -6237,6 +6263,7 @@ def test_delete_deployment_resource_pool_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_deployment_resource_pool(request) # Establish that the response is the type that we expect. @@ -6282,6 +6309,7 @@ def test_delete_deployment_resource_pool_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 @@ -6328,6 +6356,7 @@ def test_query_deployed_models_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.query_deployed_models(request) @@ -6369,6 +6398,7 @@ def test_query_deployed_models_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.query_deployed_models(request) # Establish that the response is the type that we expect. @@ -6413,6 +6443,7 @@ def test_query_deployed_models_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 = ( deployment_resource_pool_service.QueryDeployedModelsResponse.to_json( deployment_resource_pool_service.QueryDeployedModelsResponse() @@ -6463,6 +6494,7 @@ def test_get_location_rest_bad_request(request_type=locations_pb2.GetLocationReq 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_location(request) @@ -6493,6 +6525,7 @@ def test_get_location_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_location(request) @@ -6521,6 +6554,7 @@ def test_list_locations_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_locations(request) @@ -6551,6 +6585,7 @@ def test_list_locations_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_locations(request) @@ -6582,6 +6617,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -6614,6 +6650,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -6645,6 +6682,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -6677,6 +6715,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -6708,6 +6747,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -6740,6 +6780,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -6770,6 +6811,7 @@ def test_cancel_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.cancel_operation(request) @@ -6800,6 +6842,7 @@ def test_cancel_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.cancel_operation(request) @@ -6830,6 +6873,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) @@ -6860,6 +6904,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) @@ -6890,6 +6935,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) @@ -6920,6 +6966,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) @@ -6950,6 +6997,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) @@ -6980,6 +7028,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) @@ -7010,6 +7059,7 @@ def test_wait_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.wait_operation(request) @@ -7040,6 +7090,7 @@ def test_wait_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.wait_operation(request) @@ -7249,6 +7300,7 @@ async def test_create_deployment_resource_pool_rest_asyncio_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"} await client.create_deployment_resource_pool(request) @@ -7286,6 +7338,7 @@ async def test_create_deployment_resource_pool_rest_asyncio_call_success(request return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.create_deployment_resource_pool(request) # Establish that the response is the type that we expect. @@ -7338,6 +7391,7 @@ async def test_create_deployment_resource_pool_rest_asyncio_interceptors( 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.read = mock.AsyncMock(return_value=return_value) @@ -7388,6 +7442,7 @@ async def test_get_deployment_resource_pool_rest_asyncio_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"} await client.get_deployment_resource_pool(request) @@ -7436,6 +7491,7 @@ async def test_get_deployment_resource_pool_rest_asyncio_call_success(request_ty return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_deployment_resource_pool(request) # Establish that the response is the type that we expect. @@ -7489,6 +7545,7 @@ async def test_get_deployment_resource_pool_rest_asyncio_interceptors(null_inter 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 = deployment_resource_pool.DeploymentResourcePool.to_json( deployment_resource_pool.DeploymentResourcePool() ) @@ -7539,6 +7596,7 @@ async def test_list_deployment_resource_pools_rest_asyncio_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"} await client.list_deployment_resource_pools(request) @@ -7587,6 +7645,7 @@ async def test_list_deployment_resource_pools_rest_asyncio_call_success(request_ return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_deployment_resource_pools(request) # Establish that the response is the type that we expect. @@ -7638,6 +7697,7 @@ async def test_list_deployment_resource_pools_rest_asyncio_interceptors( 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 = deployment_resource_pool_service.ListDeploymentResourcePoolsResponse.to_json( deployment_resource_pool_service.ListDeploymentResourcePoolsResponse() ) @@ -7694,6 +7754,7 @@ async def test_update_deployment_resource_pool_rest_asyncio_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"} await client.update_deployment_resource_pool(request) @@ -7736,6 +7797,7 @@ async def test_update_deployment_resource_pool_rest_asyncio_call_success(request }, "min_replica_count": 1803, "max_replica_count": 1805, + "required_replica_count": 2344, "autoscaling_metric_specs": [ {"metric_name": "metric_name_value", "target": 647} ], @@ -7834,6 +7896,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.update_deployment_resource_pool(request) # Establish that the response is the type that we expect. @@ -7886,6 +7949,7 @@ async def test_update_deployment_resource_pool_rest_asyncio_interceptors( 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.read = mock.AsyncMock(return_value=return_value) @@ -7936,6 +8000,7 @@ async def test_delete_deployment_resource_pool_rest_asyncio_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"} await client.delete_deployment_resource_pool(request) @@ -7975,6 +8040,7 @@ async def test_delete_deployment_resource_pool_rest_asyncio_call_success(request return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_deployment_resource_pool(request) # Establish that the response is the type that we expect. @@ -8027,6 +8093,7 @@ async def test_delete_deployment_resource_pool_rest_asyncio_interceptors( 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.read = mock.AsyncMock(return_value=return_value) @@ -8077,6 +8144,7 @@ async def test_query_deployed_models_rest_asyncio_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"} await client.query_deployed_models(request) @@ -8125,6 +8193,7 @@ async def test_query_deployed_models_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.query_deployed_models(request) # Establish that the response is the type that we expect. @@ -8174,6 +8243,7 @@ async def test_query_deployed_models_rest_asyncio_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 = ( deployment_resource_pool_service.QueryDeployedModelsResponse.to_json( deployment_resource_pool_service.QueryDeployedModelsResponse() @@ -8230,6 +8300,7 @@ async def test_get_location_rest_asyncio_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"} await client.get_location(request) @@ -8267,6 +8338,7 @@ async def test_get_location_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_location(request) @@ -8299,6 +8371,7 @@ async def test_list_locations_rest_asyncio_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"} await client.list_locations(request) @@ -8336,6 +8409,7 @@ async def test_list_locations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_locations(request) @@ -8371,6 +8445,7 @@ async def test_get_iam_policy_rest_asyncio_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"} await client.get_iam_policy(request) @@ -8410,6 +8485,7 @@ async def test_get_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_iam_policy(request) @@ -8445,6 +8521,7 @@ async def test_set_iam_policy_rest_asyncio_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"} await client.set_iam_policy(request) @@ -8484,6 +8561,7 @@ async def test_set_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.set_iam_policy(request) @@ -8519,6 +8597,7 @@ async def test_test_iam_permissions_rest_asyncio_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"} await client.test_iam_permissions(request) @@ -8558,6 +8637,7 @@ async def test_test_iam_permissions_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.test_iam_permissions(request) @@ -8592,6 +8672,7 @@ async def test_cancel_operation_rest_asyncio_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"} await client.cancel_operation(request) @@ -8629,6 +8710,7 @@ async def test_cancel_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.cancel_operation(request) @@ -8663,6 +8745,7 @@ async def test_delete_operation_rest_asyncio_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"} await client.delete_operation(request) @@ -8700,6 +8783,7 @@ async def test_delete_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_operation(request) @@ -8734,6 +8818,7 @@ async def test_get_operation_rest_asyncio_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"} await client.get_operation(request) @@ -8771,6 +8856,7 @@ async def test_get_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_operation(request) @@ -8805,6 +8891,7 @@ async def test_list_operations_rest_asyncio_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"} await client.list_operations(request) @@ -8842,6 +8929,7 @@ async def test_list_operations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_operations(request) @@ -8876,6 +8964,7 @@ async def test_wait_operation_rest_asyncio_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"} await client.wait_operation(request) @@ -8913,6 +9002,7 @@ async def test_wait_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.wait_operation(request) diff --git a/tests/unit/gapic/aiplatform_v1beta1/test_endpoint_service.py b/tests/unit/gapic/aiplatform_v1beta1/test_endpoint_service.py index 651d487047..8ed0b94fe0 100644 --- a/tests/unit/gapic/aiplatform_v1beta1/test_endpoint_service.py +++ b/tests/unit/gapic/aiplatform_v1beta1/test_endpoint_service.py @@ -4644,6 +4644,7 @@ def test_create_endpoint_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_endpoint(request) @@ -4697,6 +4698,7 @@ def test_create_endpoint_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_endpoint(**mock_args) @@ -4830,6 +4832,7 @@ def test_get_endpoint_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_endpoint(request) @@ -4877,6 +4880,7 @@ def test_get_endpoint_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_endpoint(**mock_args) @@ -5017,6 +5021,7 @@ def test_list_endpoints_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_endpoints(request) @@ -5072,6 +5077,7 @@ def test_list_endpoints_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_endpoints(**mock_args) @@ -5264,6 +5270,7 @@ def test_update_endpoint_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_endpoint(request) @@ -5320,6 +5327,7 @@ def test_update_endpoint_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_endpoint(**mock_args) @@ -5454,6 +5462,7 @@ def test_update_endpoint_long_running_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_endpoint_long_running(request) @@ -5499,6 +5508,7 @@ def test_update_endpoint_long_running_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_endpoint_long_running(**mock_args) @@ -5631,6 +5641,7 @@ def test_delete_endpoint_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_endpoint(request) @@ -5676,6 +5687,7 @@ def test_delete_endpoint_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_endpoint(**mock_args) @@ -5809,6 +5821,7 @@ def test_deploy_model_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.deploy_model(request) @@ -5870,6 +5883,7 @@ def test_deploy_model_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.deploy_model(**mock_args) @@ -6015,6 +6029,7 @@ def test_undeploy_model_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.undeploy_model(request) @@ -6070,6 +6085,7 @@ def test_undeploy_model_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.undeploy_model(**mock_args) @@ -6210,6 +6226,7 @@ def test_mutate_deployed_model_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.mutate_deployed_model(request) @@ -6272,6 +6289,7 @@ def test_mutate_deployed_model_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.mutate_deployed_model(**mock_args) @@ -6905,6 +6923,7 @@ def test_create_endpoint_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_endpoint(request) @@ -6942,6 +6961,7 @@ def test_create_endpoint_rest_call_success(request_type): }, "min_replica_count": 1803, "max_replica_count": 1805, + "required_replica_count": 2344, "autoscaling_metric_specs": [ {"metric_name": "metric_name_value", "target": 647} ], @@ -7016,6 +7036,11 @@ def test_create_endpoint_rest_call_success(request_type): "service_attachment": "service_attachment_value", }, "faster_deployment_config": {"fast_tryout_enabled": True}, + "status": { + "message": "message_value", + "last_update_time": {}, + "available_replica_count": 2408, + }, "system_labels": {}, } ], @@ -7130,6 +7155,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_endpoint(request) # Establish that the response is the type that we expect. @@ -7171,6 +7197,7 @@ def test_create_endpoint_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 @@ -7215,6 +7242,7 @@ def test_get_endpoint_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_endpoint(request) @@ -7260,6 +7288,7 @@ def test_get_endpoint_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_endpoint(request) # Establish that the response is the type that we expect. @@ -7313,6 +7342,7 @@ def test_get_endpoint_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 = endpoint.Endpoint.to_json(endpoint.Endpoint()) req.return_value.content = return_value @@ -7357,6 +7387,7 @@ def test_list_endpoints_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_endpoints(request) @@ -7392,6 +7423,7 @@ def test_list_endpoints_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_endpoints(request) # Establish that the response is the type that we expect. @@ -7432,6 +7464,7 @@ def test_list_endpoints_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 = endpoint_service.ListEndpointsResponse.to_json( endpoint_service.ListEndpointsResponse() ) @@ -7480,6 +7513,7 @@ def test_update_endpoint_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_endpoint(request) @@ -7519,6 +7553,7 @@ def test_update_endpoint_rest_call_success(request_type): }, "min_replica_count": 1803, "max_replica_count": 1805, + "required_replica_count": 2344, "autoscaling_metric_specs": [ {"metric_name": "metric_name_value", "target": 647} ], @@ -7593,6 +7628,11 @@ def test_update_endpoint_rest_call_success(request_type): "service_attachment": "service_attachment_value", }, "faster_deployment_config": {"fast_tryout_enabled": True}, + "status": { + "message": "message_value", + "last_update_time": {}, + "available_replica_count": 2408, + }, "system_labels": {}, } ], @@ -7722,6 +7762,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_endpoint(request) # Establish that the response is the type that we expect. @@ -7775,6 +7816,7 @@ def test_update_endpoint_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 = gca_endpoint.Endpoint.to_json(gca_endpoint.Endpoint()) req.return_value.content = return_value @@ -7821,6 +7863,7 @@ def test_update_endpoint_long_running_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_endpoint_long_running(request) @@ -7853,6 +7896,7 @@ def test_update_endpoint_long_running_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.update_endpoint_long_running(request) # Establish that the response is the type that we expect. @@ -7894,6 +7938,7 @@ def test_update_endpoint_long_running_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 @@ -7938,6 +7983,7 @@ def test_delete_endpoint_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_endpoint(request) @@ -7968,6 +8014,7 @@ def test_delete_endpoint_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_endpoint(request) # Establish that the response is the type that we expect. @@ -8009,6 +8056,7 @@ def test_delete_endpoint_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 @@ -8053,6 +8101,7 @@ def test_deploy_model_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.deploy_model(request) @@ -8083,6 +8132,7 @@ def test_deploy_model_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.deploy_model(request) # Establish that the response is the type that we expect. @@ -8124,6 +8174,7 @@ def test_deploy_model_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 @@ -8168,6 +8219,7 @@ def test_undeploy_model_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.undeploy_model(request) @@ -8198,6 +8250,7 @@ def test_undeploy_model_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.undeploy_model(request) # Establish that the response is the type that we expect. @@ -8239,6 +8292,7 @@ def test_undeploy_model_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 @@ -8283,6 +8337,7 @@ def test_mutate_deployed_model_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.mutate_deployed_model(request) @@ -8313,6 +8368,7 @@ def test_mutate_deployed_model_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.mutate_deployed_model(request) # Establish that the response is the type that we expect. @@ -8354,6 +8410,7 @@ def test_mutate_deployed_model_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 @@ -8398,6 +8455,7 @@ def test_get_location_rest_bad_request(request_type=locations_pb2.GetLocationReq 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_location(request) @@ -8428,6 +8486,7 @@ def test_get_location_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_location(request) @@ -8456,6 +8515,7 @@ def test_list_locations_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_locations(request) @@ -8486,6 +8546,7 @@ def test_list_locations_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_locations(request) @@ -8517,6 +8578,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -8549,6 +8611,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -8580,6 +8643,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -8612,6 +8676,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -8643,6 +8708,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -8675,6 +8741,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -8705,6 +8772,7 @@ def test_cancel_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.cancel_operation(request) @@ -8735,6 +8803,7 @@ def test_cancel_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.cancel_operation(request) @@ -8765,6 +8834,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) @@ -8795,6 +8865,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) @@ -8825,6 +8896,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) @@ -8855,6 +8927,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) @@ -8885,6 +8958,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) @@ -8915,6 +8989,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) @@ -8945,6 +9020,7 @@ def test_wait_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.wait_operation(request) @@ -8975,6 +9051,7 @@ def test_wait_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.wait_operation(request) @@ -9226,6 +9303,7 @@ async def test_create_endpoint_rest_asyncio_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"} await client.create_endpoint(request) @@ -9268,6 +9346,7 @@ async def test_create_endpoint_rest_asyncio_call_success(request_type): }, "min_replica_count": 1803, "max_replica_count": 1805, + "required_replica_count": 2344, "autoscaling_metric_specs": [ {"metric_name": "metric_name_value", "target": 647} ], @@ -9342,6 +9421,11 @@ async def test_create_endpoint_rest_asyncio_call_success(request_type): "service_attachment": "service_attachment_value", }, "faster_deployment_config": {"fast_tryout_enabled": True}, + "status": { + "message": "message_value", + "last_update_time": {}, + "available_replica_count": 2408, + }, "system_labels": {}, } ], @@ -9458,6 +9542,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.create_endpoint(request) # Establish that the response is the type that we expect. @@ -9504,6 +9589,7 @@ async def test_create_endpoint_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -9552,6 +9638,7 @@ async def test_get_endpoint_rest_asyncio_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"} await client.get_endpoint(request) @@ -9604,6 +9691,7 @@ async def test_get_endpoint_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_endpoint(request) # Establish that the response is the type that we expect. @@ -9662,6 +9750,7 @@ async def test_get_endpoint_rest_asyncio_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 = endpoint.Endpoint.to_json(endpoint.Endpoint()) req.return_value.read = mock.AsyncMock(return_value=return_value) @@ -9710,6 +9799,7 @@ async def test_list_endpoints_rest_asyncio_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"} await client.list_endpoints(request) @@ -9752,6 +9842,7 @@ async def test_list_endpoints_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_endpoints(request) # Establish that the response is the type that we expect. @@ -9797,6 +9888,7 @@ async def test_list_endpoints_rest_asyncio_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 = endpoint_service.ListEndpointsResponse.to_json( endpoint_service.ListEndpointsResponse() ) @@ -9849,6 +9941,7 @@ async def test_update_endpoint_rest_asyncio_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"} await client.update_endpoint(request) @@ -9893,6 +9986,7 @@ async def test_update_endpoint_rest_asyncio_call_success(request_type): }, "min_replica_count": 1803, "max_replica_count": 1805, + "required_replica_count": 2344, "autoscaling_metric_specs": [ {"metric_name": "metric_name_value", "target": 647} ], @@ -9967,6 +10061,11 @@ async def test_update_endpoint_rest_asyncio_call_success(request_type): "service_attachment": "service_attachment_value", }, "faster_deployment_config": {"fast_tryout_enabled": True}, + "status": { + "message": "message_value", + "last_update_time": {}, + "available_replica_count": 2408, + }, "system_labels": {}, } ], @@ -10098,6 +10197,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.update_endpoint(request) # Establish that the response is the type that we expect. @@ -10156,6 +10256,7 @@ async def test_update_endpoint_rest_asyncio_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 = gca_endpoint.Endpoint.to_json(gca_endpoint.Endpoint()) req.return_value.read = mock.AsyncMock(return_value=return_value) @@ -10206,6 +10307,7 @@ async def test_update_endpoint_long_running_rest_asyncio_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"} await client.update_endpoint_long_running(request) @@ -10245,6 +10347,7 @@ async def test_update_endpoint_long_running_rest_asyncio_call_success(request_ty return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.update_endpoint_long_running(request) # Establish that the response is the type that we expect. @@ -10293,6 +10396,7 @@ async def test_update_endpoint_long_running_rest_asyncio_interceptors(null_inter 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.read = mock.AsyncMock(return_value=return_value) @@ -10341,6 +10445,7 @@ async def test_delete_endpoint_rest_asyncio_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"} await client.delete_endpoint(request) @@ -10378,6 +10483,7 @@ async def test_delete_endpoint_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_endpoint(request) # Establish that the response is the type that we expect. @@ -10424,6 +10530,7 @@ async def test_delete_endpoint_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -10472,6 +10579,7 @@ async def test_deploy_model_rest_asyncio_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"} await client.deploy_model(request) @@ -10509,6 +10617,7 @@ async def test_deploy_model_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.deploy_model(request) # Establish that the response is the type that we expect. @@ -10555,6 +10664,7 @@ async def test_deploy_model_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -10603,6 +10713,7 @@ async def test_undeploy_model_rest_asyncio_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"} await client.undeploy_model(request) @@ -10640,6 +10751,7 @@ async def test_undeploy_model_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.undeploy_model(request) # Establish that the response is the type that we expect. @@ -10686,6 +10798,7 @@ async def test_undeploy_model_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -10734,6 +10847,7 @@ async def test_mutate_deployed_model_rest_asyncio_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"} await client.mutate_deployed_model(request) @@ -10771,6 +10885,7 @@ async def test_mutate_deployed_model_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.mutate_deployed_model(request) # Establish that the response is the type that we expect. @@ -10817,6 +10932,7 @@ async def test_mutate_deployed_model_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -10867,6 +10983,7 @@ async def test_get_location_rest_asyncio_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"} await client.get_location(request) @@ -10904,6 +11021,7 @@ async def test_get_location_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_location(request) @@ -10936,6 +11054,7 @@ async def test_list_locations_rest_asyncio_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"} await client.list_locations(request) @@ -10973,6 +11092,7 @@ async def test_list_locations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_locations(request) @@ -11008,6 +11128,7 @@ async def test_get_iam_policy_rest_asyncio_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"} await client.get_iam_policy(request) @@ -11047,6 +11168,7 @@ async def test_get_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_iam_policy(request) @@ -11082,6 +11204,7 @@ async def test_set_iam_policy_rest_asyncio_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"} await client.set_iam_policy(request) @@ -11121,6 +11244,7 @@ async def test_set_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.set_iam_policy(request) @@ -11156,6 +11280,7 @@ async def test_test_iam_permissions_rest_asyncio_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"} await client.test_iam_permissions(request) @@ -11195,6 +11320,7 @@ async def test_test_iam_permissions_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.test_iam_permissions(request) @@ -11229,6 +11355,7 @@ async def test_cancel_operation_rest_asyncio_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"} await client.cancel_operation(request) @@ -11266,6 +11393,7 @@ async def test_cancel_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.cancel_operation(request) @@ -11300,6 +11428,7 @@ async def test_delete_operation_rest_asyncio_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"} await client.delete_operation(request) @@ -11337,6 +11466,7 @@ async def test_delete_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_operation(request) @@ -11371,6 +11501,7 @@ async def test_get_operation_rest_asyncio_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"} await client.get_operation(request) @@ -11408,6 +11539,7 @@ async def test_get_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_operation(request) @@ -11442,6 +11574,7 @@ async def test_list_operations_rest_asyncio_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"} await client.list_operations(request) @@ -11479,6 +11612,7 @@ async def test_list_operations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_operations(request) @@ -11513,6 +11647,7 @@ async def test_wait_operation_rest_asyncio_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"} await client.wait_operation(request) @@ -11550,6 +11685,7 @@ async def test_wait_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.wait_operation(request) diff --git a/tests/unit/gapic/aiplatform_v1beta1/test_evaluation_service.py b/tests/unit/gapic/aiplatform_v1beta1/test_evaluation_service.py index cdca55f015..53a6ba23f7 100644 --- a/tests/unit/gapic/aiplatform_v1beta1/test_evaluation_service.py +++ b/tests/unit/gapic/aiplatform_v1beta1/test_evaluation_service.py @@ -1473,6 +1473,7 @@ def test_evaluate_instances_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.evaluate_instances(request) @@ -1688,6 +1689,7 @@ def test_evaluate_instances_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.evaluate_instances(request) @@ -1721,6 +1723,7 @@ def test_evaluate_instances_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.evaluate_instances(request) # Establish that the response is the type that we expect. @@ -1760,6 +1763,7 @@ def test_evaluate_instances_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 = evaluation_service.EvaluateInstancesResponse.to_json( evaluation_service.EvaluateInstancesResponse() ) @@ -1806,6 +1810,7 @@ def test_get_location_rest_bad_request(request_type=locations_pb2.GetLocationReq 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_location(request) @@ -1836,6 +1841,7 @@ def test_get_location_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_location(request) @@ -1864,6 +1870,7 @@ def test_list_locations_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_locations(request) @@ -1894,6 +1901,7 @@ def test_list_locations_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_locations(request) @@ -1925,6 +1933,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -1957,6 +1966,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -1988,6 +1998,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -2020,6 +2031,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -2051,6 +2063,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -2083,6 +2096,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -2113,6 +2127,7 @@ def test_cancel_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.cancel_operation(request) @@ -2143,6 +2158,7 @@ def test_cancel_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.cancel_operation(request) @@ -2173,6 +2189,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) @@ -2203,6 +2220,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) @@ -2233,6 +2251,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) @@ -2263,6 +2282,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) @@ -2293,6 +2313,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) @@ -2323,6 +2344,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) @@ -2353,6 +2375,7 @@ def test_wait_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.wait_operation(request) @@ -2383,6 +2406,7 @@ def test_wait_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.wait_operation(request) @@ -2455,6 +2479,7 @@ async def test_evaluate_instances_rest_asyncio_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"} await client.evaluate_instances(request) @@ -2495,6 +2520,7 @@ async def test_evaluate_instances_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.evaluate_instances(request) # Establish that the response is the type that we expect. @@ -2539,6 +2565,7 @@ async def test_evaluate_instances_rest_asyncio_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 = evaluation_service.EvaluateInstancesResponse.to_json( evaluation_service.EvaluateInstancesResponse() ) @@ -2591,6 +2618,7 @@ async def test_get_location_rest_asyncio_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"} await client.get_location(request) @@ -2628,6 +2656,7 @@ async def test_get_location_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_location(request) @@ -2660,6 +2689,7 @@ async def test_list_locations_rest_asyncio_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"} await client.list_locations(request) @@ -2697,6 +2727,7 @@ async def test_list_locations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_locations(request) @@ -2732,6 +2763,7 @@ async def test_get_iam_policy_rest_asyncio_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"} await client.get_iam_policy(request) @@ -2771,6 +2803,7 @@ async def test_get_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_iam_policy(request) @@ -2806,6 +2839,7 @@ async def test_set_iam_policy_rest_asyncio_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"} await client.set_iam_policy(request) @@ -2845,6 +2879,7 @@ async def test_set_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.set_iam_policy(request) @@ -2880,6 +2915,7 @@ async def test_test_iam_permissions_rest_asyncio_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"} await client.test_iam_permissions(request) @@ -2919,6 +2955,7 @@ async def test_test_iam_permissions_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.test_iam_permissions(request) @@ -2953,6 +2990,7 @@ async def test_cancel_operation_rest_asyncio_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"} await client.cancel_operation(request) @@ -2990,6 +3028,7 @@ async def test_cancel_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.cancel_operation(request) @@ -3024,6 +3063,7 @@ async def test_delete_operation_rest_asyncio_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"} await client.delete_operation(request) @@ -3061,6 +3101,7 @@ async def test_delete_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_operation(request) @@ -3095,6 +3136,7 @@ async def test_get_operation_rest_asyncio_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"} await client.get_operation(request) @@ -3132,6 +3174,7 @@ async def test_get_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_operation(request) @@ -3166,6 +3209,7 @@ async def test_list_operations_rest_asyncio_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"} await client.list_operations(request) @@ -3203,6 +3247,7 @@ async def test_list_operations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_operations(request) @@ -3237,6 +3282,7 @@ async def test_wait_operation_rest_asyncio_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"} await client.wait_operation(request) @@ -3274,6 +3320,7 @@ async def test_wait_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.wait_operation(request) diff --git a/tests/unit/gapic/aiplatform_v1beta1/test_extension_execution_service.py b/tests/unit/gapic/aiplatform_v1beta1/test_extension_execution_service.py index cdb137164f..116d17025e 100644 --- a/tests/unit/gapic/aiplatform_v1beta1/test_extension_execution_service.py +++ b/tests/unit/gapic/aiplatform_v1beta1/test_extension_execution_service.py @@ -1958,6 +1958,7 @@ def test_execute_extension_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.execute_extension(request) @@ -2016,6 +2017,7 @@ def test_execute_extension_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.execute_extension(**mock_args) @@ -2151,6 +2153,7 @@ def test_query_extension_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.query_extension(request) @@ -2209,6 +2212,7 @@ def test_query_extension_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.query_extension(**mock_args) @@ -2487,6 +2491,7 @@ def test_execute_extension_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_extension(request) @@ -2524,6 +2529,7 @@ def test_execute_extension_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_extension(request) # Establish that the response is the type that we expect. @@ -2564,6 +2570,7 @@ def test_execute_extension_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 = extension_execution_service.ExecuteExtensionResponse.to_json( extension_execution_service.ExecuteExtensionResponse() ) @@ -2610,6 +2617,7 @@ def test_query_extension_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.query_extension(request) @@ -2647,6 +2655,7 @@ def test_query_extension_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.query_extension(request) # Establish that the response is the type that we expect. @@ -2687,6 +2696,7 @@ def test_query_extension_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 = extension_execution_service.QueryExtensionResponse.to_json( extension_execution_service.QueryExtensionResponse() ) @@ -2733,6 +2743,7 @@ def test_get_location_rest_bad_request(request_type=locations_pb2.GetLocationReq 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_location(request) @@ -2763,6 +2774,7 @@ def test_get_location_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_location(request) @@ -2791,6 +2803,7 @@ def test_list_locations_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_locations(request) @@ -2821,6 +2834,7 @@ def test_list_locations_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_locations(request) @@ -2852,6 +2866,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -2884,6 +2899,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -2915,6 +2931,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -2947,6 +2964,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -2978,6 +2996,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -3010,6 +3029,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -3040,6 +3060,7 @@ def test_cancel_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.cancel_operation(request) @@ -3070,6 +3091,7 @@ def test_cancel_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.cancel_operation(request) @@ -3100,6 +3122,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) @@ -3130,6 +3153,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) @@ -3160,6 +3184,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) @@ -3190,6 +3215,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) @@ -3220,6 +3246,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) @@ -3250,6 +3277,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) @@ -3280,6 +3308,7 @@ def test_wait_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.wait_operation(request) @@ -3310,6 +3339,7 @@ def test_wait_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.wait_operation(request) @@ -3402,6 +3432,7 @@ async def test_execute_extension_rest_asyncio_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"} await client.execute_extension(request) @@ -3446,6 +3477,7 @@ async def test_execute_extension_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.execute_extension(request) # Establish that the response is the type that we expect. @@ -3493,6 +3525,7 @@ async def test_execute_extension_rest_asyncio_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 = extension_execution_service.ExecuteExtensionResponse.to_json( extension_execution_service.ExecuteExtensionResponse() ) @@ -3543,6 +3576,7 @@ async def test_query_extension_rest_asyncio_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"} await client.query_extension(request) @@ -3587,6 +3621,7 @@ async def test_query_extension_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.query_extension(request) # Establish that the response is the type that we expect. @@ -3632,6 +3667,7 @@ async def test_query_extension_rest_asyncio_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 = extension_execution_service.QueryExtensionResponse.to_json( extension_execution_service.QueryExtensionResponse() ) @@ -3684,6 +3720,7 @@ async def test_get_location_rest_asyncio_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"} await client.get_location(request) @@ -3721,6 +3758,7 @@ async def test_get_location_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_location(request) @@ -3753,6 +3791,7 @@ async def test_list_locations_rest_asyncio_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"} await client.list_locations(request) @@ -3790,6 +3829,7 @@ async def test_list_locations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_locations(request) @@ -3825,6 +3865,7 @@ async def test_get_iam_policy_rest_asyncio_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"} await client.get_iam_policy(request) @@ -3864,6 +3905,7 @@ async def test_get_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_iam_policy(request) @@ -3899,6 +3941,7 @@ async def test_set_iam_policy_rest_asyncio_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"} await client.set_iam_policy(request) @@ -3938,6 +3981,7 @@ async def test_set_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.set_iam_policy(request) @@ -3973,6 +4017,7 @@ async def test_test_iam_permissions_rest_asyncio_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"} await client.test_iam_permissions(request) @@ -4012,6 +4057,7 @@ async def test_test_iam_permissions_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.test_iam_permissions(request) @@ -4046,6 +4092,7 @@ async def test_cancel_operation_rest_asyncio_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"} await client.cancel_operation(request) @@ -4083,6 +4130,7 @@ async def test_cancel_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.cancel_operation(request) @@ -4117,6 +4165,7 @@ async def test_delete_operation_rest_asyncio_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"} await client.delete_operation(request) @@ -4154,6 +4203,7 @@ async def test_delete_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_operation(request) @@ -4188,6 +4238,7 @@ async def test_get_operation_rest_asyncio_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"} await client.get_operation(request) @@ -4225,6 +4276,7 @@ async def test_get_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_operation(request) @@ -4259,6 +4311,7 @@ async def test_list_operations_rest_asyncio_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"} await client.list_operations(request) @@ -4296,6 +4349,7 @@ async def test_list_operations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_operations(request) @@ -4330,6 +4384,7 @@ async def test_wait_operation_rest_asyncio_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"} await client.wait_operation(request) @@ -4367,6 +4422,7 @@ async def test_wait_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.wait_operation(request) diff --git a/tests/unit/gapic/aiplatform_v1beta1/test_extension_registry_service.py b/tests/unit/gapic/aiplatform_v1beta1/test_extension_registry_service.py index 278df0bccc..80c54e5bac 100644 --- a/tests/unit/gapic/aiplatform_v1beta1/test_extension_registry_service.py +++ b/tests/unit/gapic/aiplatform_v1beta1/test_extension_registry_service.py @@ -3140,6 +3140,7 @@ def test_import_extension_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.import_extension(request) @@ -3192,6 +3193,7 @@ def test_import_extension_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.import_extension(**mock_args) @@ -3324,6 +3326,7 @@ def test_get_extension_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_extension(request) @@ -3371,6 +3374,7 @@ def test_get_extension_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_extension(**mock_args) @@ -3513,6 +3517,7 @@ def test_list_extensions_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_extensions(request) @@ -3570,6 +3575,7 @@ def test_list_extensions_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_extensions(**mock_args) @@ -3765,6 +3771,7 @@ def test_update_extension_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_extension(request) @@ -3823,6 +3830,7 @@ def test_update_extension_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_extension(**mock_args) @@ -3958,6 +3966,7 @@ def test_delete_extension_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_extension(request) @@ -4003,6 +4012,7 @@ def test_delete_extension_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_extension(**mock_args) @@ -4422,6 +4432,7 @@ def test_import_extension_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.import_extension(request) @@ -4631,6 +4642,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.import_extension(request) # Establish that the response is the type that we expect. @@ -4672,6 +4684,7 @@ def test_import_extension_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 @@ -4716,6 +4729,7 @@ def test_get_extension_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_extension(request) @@ -4754,6 +4768,7 @@ def test_get_extension_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_extension(request) # Establish that the response is the type that we expect. @@ -4797,6 +4812,7 @@ def test_get_extension_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 = extension.Extension.to_json(extension.Extension()) req.return_value.content = return_value @@ -4841,6 +4857,7 @@ def test_list_extensions_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_extensions(request) @@ -4878,6 +4895,7 @@ def test_list_extensions_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_extensions(request) # Establish that the response is the type that we expect. @@ -4918,6 +4936,7 @@ def test_list_extensions_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 = extension_registry_service.ListExtensionsResponse.to_json( extension_registry_service.ListExtensionsResponse() ) @@ -4966,6 +4985,7 @@ def test_update_extension_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_extension(request) @@ -5185,6 +5205,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_extension(request) # Establish that the response is the type that we expect. @@ -5228,6 +5249,7 @@ def test_update_extension_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 = gca_extension.Extension.to_json(gca_extension.Extension()) req.return_value.content = return_value @@ -5272,6 +5294,7 @@ def test_delete_extension_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_extension(request) @@ -5302,6 +5325,7 @@ def test_delete_extension_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_extension(request) # Establish that the response is the type that we expect. @@ -5343,6 +5367,7 @@ def test_delete_extension_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 @@ -5387,6 +5412,7 @@ def test_get_location_rest_bad_request(request_type=locations_pb2.GetLocationReq 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_location(request) @@ -5417,6 +5443,7 @@ def test_get_location_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_location(request) @@ -5445,6 +5472,7 @@ def test_list_locations_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_locations(request) @@ -5475,6 +5503,7 @@ def test_list_locations_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_locations(request) @@ -5506,6 +5535,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -5538,6 +5568,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -5569,6 +5600,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -5601,6 +5633,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -5632,6 +5665,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -5664,6 +5698,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -5694,6 +5729,7 @@ def test_cancel_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.cancel_operation(request) @@ -5724,6 +5760,7 @@ def test_cancel_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.cancel_operation(request) @@ -5754,6 +5791,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) @@ -5784,6 +5822,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) @@ -5814,6 +5853,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) @@ -5844,6 +5884,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) @@ -5874,6 +5915,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) @@ -5904,6 +5946,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) @@ -5934,6 +5977,7 @@ def test_wait_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.wait_operation(request) @@ -5964,6 +6008,7 @@ def test_wait_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.wait_operation(request) @@ -6131,6 +6176,7 @@ async def test_import_extension_rest_asyncio_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"} await client.import_extension(request) @@ -6347,6 +6393,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.import_extension(request) # Establish that the response is the type that we expect. @@ -6393,6 +6440,7 @@ async def test_import_extension_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -6441,6 +6489,7 @@ async def test_get_extension_rest_asyncio_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"} await client.get_extension(request) @@ -6486,6 +6535,7 @@ async def test_get_extension_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_extension(request) # Establish that the response is the type that we expect. @@ -6534,6 +6584,7 @@ async def test_get_extension_rest_asyncio_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 = extension.Extension.to_json(extension.Extension()) req.return_value.read = mock.AsyncMock(return_value=return_value) @@ -6582,6 +6633,7 @@ async def test_list_extensions_rest_asyncio_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"} await client.list_extensions(request) @@ -6626,6 +6678,7 @@ async def test_list_extensions_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_extensions(request) # Establish that the response is the type that we expect. @@ -6671,6 +6724,7 @@ async def test_list_extensions_rest_asyncio_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 = extension_registry_service.ListExtensionsResponse.to_json( extension_registry_service.ListExtensionsResponse() ) @@ -6723,6 +6777,7 @@ async def test_update_extension_rest_asyncio_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"} await client.update_extension(request) @@ -6949,6 +7004,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.update_extension(request) # Establish that the response is the type that we expect. @@ -6997,6 +7053,7 @@ async def test_update_extension_rest_asyncio_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 = gca_extension.Extension.to_json(gca_extension.Extension()) req.return_value.read = mock.AsyncMock(return_value=return_value) @@ -7045,6 +7102,7 @@ async def test_delete_extension_rest_asyncio_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"} await client.delete_extension(request) @@ -7082,6 +7140,7 @@ async def test_delete_extension_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_extension(request) # Establish that the response is the type that we expect. @@ -7128,6 +7187,7 @@ async def test_delete_extension_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -7178,6 +7238,7 @@ async def test_get_location_rest_asyncio_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"} await client.get_location(request) @@ -7215,6 +7276,7 @@ async def test_get_location_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_location(request) @@ -7247,6 +7309,7 @@ async def test_list_locations_rest_asyncio_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"} await client.list_locations(request) @@ -7284,6 +7347,7 @@ async def test_list_locations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_locations(request) @@ -7319,6 +7383,7 @@ async def test_get_iam_policy_rest_asyncio_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"} await client.get_iam_policy(request) @@ -7358,6 +7423,7 @@ async def test_get_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_iam_policy(request) @@ -7393,6 +7459,7 @@ async def test_set_iam_policy_rest_asyncio_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"} await client.set_iam_policy(request) @@ -7432,6 +7499,7 @@ async def test_set_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.set_iam_policy(request) @@ -7467,6 +7535,7 @@ async def test_test_iam_permissions_rest_asyncio_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"} await client.test_iam_permissions(request) @@ -7506,6 +7575,7 @@ async def test_test_iam_permissions_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.test_iam_permissions(request) @@ -7540,6 +7610,7 @@ async def test_cancel_operation_rest_asyncio_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"} await client.cancel_operation(request) @@ -7577,6 +7648,7 @@ async def test_cancel_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.cancel_operation(request) @@ -7611,6 +7683,7 @@ async def test_delete_operation_rest_asyncio_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"} await client.delete_operation(request) @@ -7648,6 +7721,7 @@ async def test_delete_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_operation(request) @@ -7682,6 +7756,7 @@ async def test_get_operation_rest_asyncio_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"} await client.get_operation(request) @@ -7719,6 +7794,7 @@ async def test_get_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_operation(request) @@ -7753,6 +7829,7 @@ async def test_list_operations_rest_asyncio_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"} await client.list_operations(request) @@ -7790,6 +7867,7 @@ async def test_list_operations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_operations(request) @@ -7824,6 +7902,7 @@ async def test_wait_operation_rest_asyncio_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"} await client.wait_operation(request) @@ -7861,6 +7940,7 @@ async def test_wait_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.wait_operation(request) diff --git a/tests/unit/gapic/aiplatform_v1beta1/test_feature_online_store_admin_service.py b/tests/unit/gapic/aiplatform_v1beta1/test_feature_online_store_admin_service.py index eb5130edbc..ef695b7765 100644 --- a/tests/unit/gapic/aiplatform_v1beta1/test_feature_online_store_admin_service.py +++ b/tests/unit/gapic/aiplatform_v1beta1/test_feature_online_store_admin_service.py @@ -6677,6 +6677,7 @@ def test_create_feature_online_store_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_feature_online_store(request) @@ -6743,6 +6744,7 @@ def test_create_feature_online_store_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_feature_online_store(**mock_args) @@ -6887,6 +6889,7 @@ def test_get_feature_online_store_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_feature_online_store(request) @@ -6934,6 +6937,7 @@ def test_get_feature_online_store_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_feature_online_store(**mock_args) @@ -7083,6 +7087,7 @@ def test_list_feature_online_stores_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_feature_online_stores(request) @@ -7144,6 +7149,7 @@ def test_list_feature_online_stores_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_feature_online_stores(**mock_args) @@ -7347,6 +7353,7 @@ def test_update_feature_online_store_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_feature_online_store(request) @@ -7401,6 +7408,7 @@ def test_update_feature_online_store_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_feature_online_store(**mock_args) @@ -7547,6 +7555,7 @@ def test_delete_feature_online_store_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_feature_online_store(request) @@ -7593,6 +7602,7 @@ def test_delete_feature_online_store_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_feature_online_store(**mock_args) @@ -7745,6 +7755,7 @@ def test_create_feature_view_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_feature_view(request) @@ -7816,6 +7827,7 @@ def test_create_feature_view_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_feature_view(**mock_args) @@ -7955,6 +7967,7 @@ def test_get_feature_view_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_feature_view(request) @@ -8002,6 +8015,7 @@ def test_get_feature_view_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_feature_view(**mock_args) @@ -8150,6 +8164,7 @@ def test_list_feature_views_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_feature_views(request) @@ -8209,6 +8224,7 @@ def test_list_feature_views_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_feature_views(**mock_args) @@ -8409,6 +8425,7 @@ def test_update_feature_view_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_feature_view(request) @@ -8461,6 +8478,7 @@ def test_update_feature_view_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_feature_view(**mock_args) @@ -8602,6 +8620,7 @@ def test_delete_feature_view_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_feature_view(request) @@ -8647,6 +8666,7 @@ def test_delete_feature_view_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_feature_view(**mock_args) @@ -8785,6 +8805,7 @@ def test_sync_feature_view_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.sync_feature_view(request) @@ -8834,6 +8855,7 @@ def test_sync_feature_view_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.sync_feature_view(**mock_args) @@ -8970,6 +8992,7 @@ def test_get_feature_view_sync_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_feature_view_sync(request) @@ -9017,6 +9040,7 @@ def test_get_feature_view_sync_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_feature_view_sync(**mock_args) @@ -9166,6 +9190,7 @@ def test_list_feature_view_syncs_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_feature_view_syncs(request) @@ -9227,6 +9252,7 @@ def test_list_feature_view_syncs_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_feature_view_syncs(**mock_args) @@ -10163,6 +10189,7 @@ def test_create_feature_online_store_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_feature_online_store(request) @@ -10299,6 +10326,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_feature_online_store(request) # Establish that the response is the type that we expect. @@ -10344,6 +10372,7 @@ def test_create_feature_online_store_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 @@ -10390,6 +10419,7 @@ def test_get_feature_online_store_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_feature_online_store(request) @@ -10431,6 +10461,7 @@ def test_get_feature_online_store_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_feature_online_store(request) # Establish that the response is the type that we expect. @@ -10477,6 +10508,7 @@ def test_get_feature_online_store_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 = feature_online_store.FeatureOnlineStore.to_json( feature_online_store.FeatureOnlineStore() ) @@ -10523,6 +10555,7 @@ def test_list_feature_online_stores_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_feature_online_stores(request) @@ -10564,6 +10597,7 @@ def test_list_feature_online_stores_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_feature_online_stores(request) # Establish that the response is the type that we expect. @@ -10608,6 +10642,7 @@ def test_list_feature_online_stores_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 = ( feature_online_store_admin_service.ListFeatureOnlineStoresResponse.to_json( feature_online_store_admin_service.ListFeatureOnlineStoresResponse() @@ -10662,6 +10697,7 @@ def test_update_feature_online_store_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_feature_online_store(request) @@ -10802,6 +10838,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_feature_online_store(request) # Establish that the response is the type that we expect. @@ -10847,6 +10884,7 @@ def test_update_feature_online_store_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 @@ -10893,6 +10931,7 @@ def test_delete_feature_online_store_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_feature_online_store(request) @@ -10925,6 +10964,7 @@ def test_delete_feature_online_store_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_feature_online_store(request) # Establish that the response is the type that we expect. @@ -10970,6 +11010,7 @@ def test_delete_feature_online_store_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 @@ -11016,6 +11057,7 @@ def test_create_feature_view_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_feature_view(request) @@ -11172,6 +11214,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_feature_view(request) # Establish that the response is the type that we expect. @@ -11215,6 +11258,7 @@ def test_create_feature_view_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 @@ -11261,6 +11305,7 @@ def test_get_feature_view_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_feature_view(request) @@ -11303,6 +11348,7 @@ def test_get_feature_view_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_feature_view(request) # Establish that the response is the type that we expect. @@ -11352,6 +11398,7 @@ def test_get_feature_view_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 = feature_view.FeatureView.to_json(feature_view.FeatureView()) req.return_value.content = return_value @@ -11398,6 +11445,7 @@ def test_list_feature_views_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_feature_views(request) @@ -11437,6 +11485,7 @@ def test_list_feature_views_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_feature_views(request) # Establish that the response is the type that we expect. @@ -11479,6 +11528,7 @@ def test_list_feature_views_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 = ( feature_online_store_admin_service.ListFeatureViewsResponse.to_json( feature_online_store_admin_service.ListFeatureViewsResponse() @@ -11533,6 +11583,7 @@ def test_update_feature_view_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_feature_view(request) @@ -11691,6 +11742,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_feature_view(request) # Establish that the response is the type that we expect. @@ -11734,6 +11786,7 @@ def test_update_feature_view_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 @@ -11780,6 +11833,7 @@ def test_delete_feature_view_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_feature_view(request) @@ -11812,6 +11866,7 @@ def test_delete_feature_view_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_feature_view(request) # Establish that the response is the type that we expect. @@ -11855,6 +11910,7 @@ def test_delete_feature_view_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 @@ -11901,6 +11957,7 @@ def test_sync_feature_view_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.sync_feature_view(request) @@ -11940,6 +11997,7 @@ def test_sync_feature_view_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.sync_feature_view(request) # Establish that the response is the type that we expect. @@ -11984,6 +12042,7 @@ def test_sync_feature_view_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 = ( feature_online_store_admin_service.SyncFeatureViewResponse.to_json( feature_online_store_admin_service.SyncFeatureViewResponse() @@ -12034,6 +12093,7 @@ def test_get_feature_view_sync_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_feature_view_sync(request) @@ -12073,6 +12133,7 @@ def test_get_feature_view_sync_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_feature_view_sync(request) # Establish that the response is the type that we expect. @@ -12117,6 +12178,7 @@ def test_get_feature_view_sync_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 = feature_view_sync.FeatureViewSync.to_json( feature_view_sync.FeatureViewSync() ) @@ -12165,6 +12227,7 @@ def test_list_feature_view_syncs_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_feature_view_syncs(request) @@ -12206,6 +12269,7 @@ def test_list_feature_view_syncs_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_feature_view_syncs(request) # Establish that the response is the type that we expect. @@ -12248,6 +12312,7 @@ def test_list_feature_view_syncs_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 = ( feature_online_store_admin_service.ListFeatureViewSyncsResponse.to_json( feature_online_store_admin_service.ListFeatureViewSyncsResponse() @@ -12298,6 +12363,7 @@ def test_get_location_rest_bad_request(request_type=locations_pb2.GetLocationReq 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_location(request) @@ -12328,6 +12394,7 @@ def test_get_location_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_location(request) @@ -12356,6 +12423,7 @@ def test_list_locations_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_locations(request) @@ -12386,6 +12454,7 @@ def test_list_locations_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_locations(request) @@ -12417,6 +12486,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -12449,6 +12519,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -12480,6 +12551,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -12512,6 +12584,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -12543,6 +12616,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -12575,6 +12649,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -12605,6 +12680,7 @@ def test_cancel_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.cancel_operation(request) @@ -12635,6 +12711,7 @@ def test_cancel_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.cancel_operation(request) @@ -12665,6 +12742,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) @@ -12695,6 +12773,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) @@ -12725,6 +12804,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) @@ -12755,6 +12835,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) @@ -12785,6 +12866,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) @@ -12815,6 +12897,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) @@ -12845,6 +12928,7 @@ def test_wait_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.wait_operation(request) @@ -12875,6 +12959,7 @@ def test_wait_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.wait_operation(request) @@ -13234,6 +13319,7 @@ async def test_create_feature_online_store_rest_asyncio_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"} await client.create_feature_online_store(request) @@ -13377,6 +13463,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.create_feature_online_store(request) # Establish that the response is the type that we expect. @@ -13427,6 +13514,7 @@ async def test_create_feature_online_store_rest_asyncio_interceptors(null_interc 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.read = mock.AsyncMock(return_value=return_value) @@ -13477,6 +13565,7 @@ async def test_get_feature_online_store_rest_asyncio_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"} await client.get_feature_online_store(request) @@ -13525,6 +13614,7 @@ async def test_get_feature_online_store_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_feature_online_store(request) # Establish that the response is the type that we expect. @@ -13576,6 +13666,7 @@ async def test_get_feature_online_store_rest_asyncio_interceptors(null_intercept 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 = feature_online_store.FeatureOnlineStore.to_json( feature_online_store.FeatureOnlineStore() ) @@ -13626,6 +13717,7 @@ async def test_list_feature_online_stores_rest_asyncio_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"} await client.list_feature_online_stores(request) @@ -13674,6 +13766,7 @@ async def test_list_feature_online_stores_rest_asyncio_call_success(request_type return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_feature_online_stores(request) # Establish that the response is the type that we expect. @@ -13723,6 +13816,7 @@ async def test_list_feature_online_stores_rest_asyncio_interceptors(null_interce 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 = ( feature_online_store_admin_service.ListFeatureOnlineStoresResponse.to_json( feature_online_store_admin_service.ListFeatureOnlineStoresResponse() @@ -13781,6 +13875,7 @@ async def test_update_feature_online_store_rest_asyncio_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"} await client.update_feature_online_store(request) @@ -13928,6 +14023,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.update_feature_online_store(request) # Establish that the response is the type that we expect. @@ -13978,6 +14074,7 @@ async def test_update_feature_online_store_rest_asyncio_interceptors(null_interc 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.read = mock.AsyncMock(return_value=return_value) @@ -14028,6 +14125,7 @@ async def test_delete_feature_online_store_rest_asyncio_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"} await client.delete_feature_online_store(request) @@ -14067,6 +14165,7 @@ async def test_delete_feature_online_store_rest_asyncio_call_success(request_typ return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_feature_online_store(request) # Establish that the response is the type that we expect. @@ -14117,6 +14216,7 @@ async def test_delete_feature_online_store_rest_asyncio_interceptors(null_interc 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.read = mock.AsyncMock(return_value=return_value) @@ -14167,6 +14267,7 @@ async def test_create_feature_view_rest_asyncio_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"} await client.create_feature_view(request) @@ -14330,6 +14431,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.create_feature_view(request) # Establish that the response is the type that we expect. @@ -14378,6 +14480,7 @@ async def test_create_feature_view_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -14428,6 +14531,7 @@ async def test_get_feature_view_rest_asyncio_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"} await client.get_feature_view(request) @@ -14477,6 +14581,7 @@ async def test_get_feature_view_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_feature_view(request) # Establish that the response is the type that we expect. @@ -14532,6 +14637,7 @@ async def test_get_feature_view_rest_asyncio_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 = feature_view.FeatureView.to_json(feature_view.FeatureView()) req.return_value.read = mock.AsyncMock(return_value=return_value) @@ -14582,6 +14688,7 @@ async def test_list_feature_views_rest_asyncio_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"} await client.list_feature_views(request) @@ -14628,6 +14735,7 @@ async def test_list_feature_views_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_feature_views(request) # Establish that the response is the type that we expect. @@ -14675,6 +14783,7 @@ async def test_list_feature_views_rest_asyncio_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 = ( feature_online_store_admin_service.ListFeatureViewsResponse.to_json( feature_online_store_admin_service.ListFeatureViewsResponse() @@ -14733,6 +14842,7 @@ async def test_update_feature_view_rest_asyncio_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"} await client.update_feature_view(request) @@ -14898,6 +15008,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.update_feature_view(request) # Establish that the response is the type that we expect. @@ -14946,6 +15057,7 @@ async def test_update_feature_view_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -14996,6 +15108,7 @@ async def test_delete_feature_view_rest_asyncio_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"} await client.delete_feature_view(request) @@ -15035,6 +15148,7 @@ async def test_delete_feature_view_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_feature_view(request) # Establish that the response is the type that we expect. @@ -15083,6 +15197,7 @@ async def test_delete_feature_view_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -15133,6 +15248,7 @@ async def test_sync_feature_view_rest_asyncio_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"} await client.sync_feature_view(request) @@ -15179,6 +15295,7 @@ async def test_sync_feature_view_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.sync_feature_view(request) # Establish that the response is the type that we expect. @@ -15228,6 +15345,7 @@ async def test_sync_feature_view_rest_asyncio_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 = ( feature_online_store_admin_service.SyncFeatureViewResponse.to_json( feature_online_store_admin_service.SyncFeatureViewResponse() @@ -15282,6 +15400,7 @@ async def test_get_feature_view_sync_rest_asyncio_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"} await client.get_feature_view_sync(request) @@ -15328,6 +15447,7 @@ async def test_get_feature_view_sync_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_feature_view_sync(request) # Establish that the response is the type that we expect. @@ -15377,6 +15497,7 @@ async def test_get_feature_view_sync_rest_asyncio_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 = feature_view_sync.FeatureViewSync.to_json( feature_view_sync.FeatureViewSync() ) @@ -15429,6 +15550,7 @@ async def test_list_feature_view_syncs_rest_asyncio_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"} await client.list_feature_view_syncs(request) @@ -15477,6 +15599,7 @@ async def test_list_feature_view_syncs_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_feature_view_syncs(request) # Establish that the response is the type that we expect. @@ -15524,6 +15647,7 @@ async def test_list_feature_view_syncs_rest_asyncio_interceptors(null_intercepto 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 = ( feature_online_store_admin_service.ListFeatureViewSyncsResponse.to_json( feature_online_store_admin_service.ListFeatureViewSyncsResponse() @@ -15580,6 +15704,7 @@ async def test_get_location_rest_asyncio_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"} await client.get_location(request) @@ -15617,6 +15742,7 @@ async def test_get_location_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_location(request) @@ -15649,6 +15775,7 @@ async def test_list_locations_rest_asyncio_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"} await client.list_locations(request) @@ -15686,6 +15813,7 @@ async def test_list_locations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_locations(request) @@ -15721,6 +15849,7 @@ async def test_get_iam_policy_rest_asyncio_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"} await client.get_iam_policy(request) @@ -15760,6 +15889,7 @@ async def test_get_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_iam_policy(request) @@ -15795,6 +15925,7 @@ async def test_set_iam_policy_rest_asyncio_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"} await client.set_iam_policy(request) @@ -15834,6 +15965,7 @@ async def test_set_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.set_iam_policy(request) @@ -15869,6 +16001,7 @@ async def test_test_iam_permissions_rest_asyncio_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"} await client.test_iam_permissions(request) @@ -15908,6 +16041,7 @@ async def test_test_iam_permissions_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.test_iam_permissions(request) @@ -15942,6 +16076,7 @@ async def test_cancel_operation_rest_asyncio_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"} await client.cancel_operation(request) @@ -15979,6 +16114,7 @@ async def test_cancel_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.cancel_operation(request) @@ -16013,6 +16149,7 @@ async def test_delete_operation_rest_asyncio_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"} await client.delete_operation(request) @@ -16050,6 +16187,7 @@ async def test_delete_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_operation(request) @@ -16084,6 +16222,7 @@ async def test_get_operation_rest_asyncio_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"} await client.get_operation(request) @@ -16121,6 +16260,7 @@ async def test_get_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_operation(request) @@ -16155,6 +16295,7 @@ async def test_list_operations_rest_asyncio_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"} await client.list_operations(request) @@ -16192,6 +16333,7 @@ async def test_list_operations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_operations(request) @@ -16226,6 +16368,7 @@ async def test_wait_operation_rest_asyncio_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"} await client.wait_operation(request) @@ -16263,6 +16406,7 @@ async def test_wait_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.wait_operation(request) diff --git a/tests/unit/gapic/aiplatform_v1beta1/test_feature_online_store_service.py b/tests/unit/gapic/aiplatform_v1beta1/test_feature_online_store_service.py index 5f3256ca88..e01328e072 100644 --- a/tests/unit/gapic/aiplatform_v1beta1/test_feature_online_store_service.py +++ b/tests/unit/gapic/aiplatform_v1beta1/test_feature_online_store_service.py @@ -2037,6 +2037,7 @@ def test_fetch_feature_values_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_feature_values(request) @@ -2087,6 +2088,7 @@ def test_fetch_feature_values_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.fetch_feature_values(**mock_args) @@ -2240,6 +2242,7 @@ def test_search_nearest_entities_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.search_nearest_entities(request) @@ -2515,6 +2518,7 @@ def test_fetch_feature_values_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_feature_values(request) @@ -2552,6 +2556,7 @@ def test_fetch_feature_values_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_feature_values(request) # Establish that the response is the type that we expect. @@ -2591,6 +2596,7 @@ def test_fetch_feature_values_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 = feature_online_store_service.FetchFeatureValuesResponse.to_json( feature_online_store_service.FetchFeatureValuesResponse() ) @@ -2653,6 +2659,7 @@ def test_search_nearest_entities_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.search_nearest_entities(request) @@ -2690,6 +2697,7 @@ def test_search_nearest_entities_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.search_nearest_entities(request) # Establish that the response is the type that we expect. @@ -2733,6 +2741,7 @@ def test_search_nearest_entities_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 = ( feature_online_store_service.SearchNearestEntitiesResponse.to_json( feature_online_store_service.SearchNearestEntitiesResponse() @@ -2781,6 +2790,7 @@ def test_get_location_rest_bad_request(request_type=locations_pb2.GetLocationReq 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_location(request) @@ -2811,6 +2821,7 @@ def test_get_location_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_location(request) @@ -2839,6 +2850,7 @@ def test_list_locations_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_locations(request) @@ -2869,6 +2881,7 @@ def test_list_locations_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_locations(request) @@ -2900,6 +2913,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -2932,6 +2946,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -2963,6 +2978,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -2995,6 +3011,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -3026,6 +3043,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -3058,6 +3076,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -3088,6 +3107,7 @@ def test_cancel_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.cancel_operation(request) @@ -3118,6 +3138,7 @@ def test_cancel_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.cancel_operation(request) @@ -3148,6 +3169,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) @@ -3178,6 +3200,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) @@ -3208,6 +3231,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) @@ -3238,6 +3262,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) @@ -3268,6 +3293,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) @@ -3298,6 +3324,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) @@ -3328,6 +3355,7 @@ def test_wait_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.wait_operation(request) @@ -3358,6 +3386,7 @@ def test_wait_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.wait_operation(request) @@ -3454,6 +3483,7 @@ async def test_fetch_feature_values_rest_asyncio_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"} await client.fetch_feature_values(request) @@ -3498,6 +3528,7 @@ async def test_fetch_feature_values_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.fetch_feature_values(request) # Establish that the response is the type that we expect. @@ -3544,6 +3575,7 @@ async def test_fetch_feature_values_rest_asyncio_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 = feature_online_store_service.FetchFeatureValuesResponse.to_json( feature_online_store_service.FetchFeatureValuesResponse() ) @@ -3615,6 +3647,7 @@ async def test_search_nearest_entities_rest_asyncio_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"} await client.search_nearest_entities(request) @@ -3659,6 +3692,7 @@ async def test_search_nearest_entities_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.search_nearest_entities(request) # Establish that the response is the type that we expect. @@ -3707,6 +3741,7 @@ async def test_search_nearest_entities_rest_asyncio_interceptors(null_intercepto 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 = ( feature_online_store_service.SearchNearestEntitiesResponse.to_json( feature_online_store_service.SearchNearestEntitiesResponse() @@ -3761,6 +3796,7 @@ async def test_get_location_rest_asyncio_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"} await client.get_location(request) @@ -3798,6 +3834,7 @@ async def test_get_location_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_location(request) @@ -3830,6 +3867,7 @@ async def test_list_locations_rest_asyncio_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"} await client.list_locations(request) @@ -3867,6 +3905,7 @@ async def test_list_locations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_locations(request) @@ -3902,6 +3941,7 @@ async def test_get_iam_policy_rest_asyncio_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"} await client.get_iam_policy(request) @@ -3941,6 +3981,7 @@ async def test_get_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_iam_policy(request) @@ -3976,6 +4017,7 @@ async def test_set_iam_policy_rest_asyncio_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"} await client.set_iam_policy(request) @@ -4015,6 +4057,7 @@ async def test_set_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.set_iam_policy(request) @@ -4050,6 +4093,7 @@ async def test_test_iam_permissions_rest_asyncio_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"} await client.test_iam_permissions(request) @@ -4089,6 +4133,7 @@ async def test_test_iam_permissions_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.test_iam_permissions(request) @@ -4123,6 +4168,7 @@ async def test_cancel_operation_rest_asyncio_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"} await client.cancel_operation(request) @@ -4160,6 +4206,7 @@ async def test_cancel_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.cancel_operation(request) @@ -4194,6 +4241,7 @@ async def test_delete_operation_rest_asyncio_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"} await client.delete_operation(request) @@ -4231,6 +4279,7 @@ async def test_delete_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_operation(request) @@ -4265,6 +4314,7 @@ async def test_get_operation_rest_asyncio_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"} await client.get_operation(request) @@ -4302,6 +4352,7 @@ async def test_get_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_operation(request) @@ -4336,6 +4387,7 @@ async def test_list_operations_rest_asyncio_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"} await client.list_operations(request) @@ -4373,6 +4425,7 @@ async def test_list_operations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_operations(request) @@ -4407,6 +4460,7 @@ async def test_wait_operation_rest_asyncio_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"} await client.wait_operation(request) @@ -4444,6 +4498,7 @@ async def test_wait_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.wait_operation(request) diff --git a/tests/unit/gapic/aiplatform_v1beta1/test_feature_registry_service.py b/tests/unit/gapic/aiplatform_v1beta1/test_feature_registry_service.py index 6eb4469f32..7f275b1434 100644 --- a/tests/unit/gapic/aiplatform_v1beta1/test_feature_registry_service.py +++ b/tests/unit/gapic/aiplatform_v1beta1/test_feature_registry_service.py @@ -1588,6 +1588,8 @@ def test_get_feature_group(request_type, transport: str = "grpc"): name="name_value", etag="etag_value", description="description_value", + service_agent_type=feature_group.FeatureGroup.ServiceAgentType.SERVICE_AGENT_TYPE_PROJECT, + service_account_email="service_account_email_value", ) response = client.get_feature_group(request) @@ -1602,6 +1604,11 @@ def test_get_feature_group(request_type, transport: str = "grpc"): assert response.name == "name_value" assert response.etag == "etag_value" assert response.description == "description_value" + assert ( + response.service_agent_type + == feature_group.FeatureGroup.ServiceAgentType.SERVICE_AGENT_TYPE_PROJECT + ) + assert response.service_account_email == "service_account_email_value" def test_get_feature_group_non_empty_request_with_auto_populated_field(): @@ -1737,6 +1744,8 @@ async def test_get_feature_group_async( name="name_value", etag="etag_value", description="description_value", + service_agent_type=feature_group.FeatureGroup.ServiceAgentType.SERVICE_AGENT_TYPE_PROJECT, + service_account_email="service_account_email_value", ) ) response = await client.get_feature_group(request) @@ -1752,6 +1761,11 @@ async def test_get_feature_group_async( assert response.name == "name_value" assert response.etag == "etag_value" assert response.description == "description_value" + assert ( + response.service_agent_type + == feature_group.FeatureGroup.ServiceAgentType.SERVICE_AGENT_TYPE_PROJECT + ) + assert response.service_account_email == "service_account_email_value" @pytest.mark.asyncio @@ -8469,6 +8483,7 @@ def test_create_feature_group_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_feature_group(request) @@ -8533,6 +8548,7 @@ def test_create_feature_group_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_feature_group(**mock_args) @@ -8672,6 +8688,7 @@ def test_get_feature_group_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_feature_group(request) @@ -8719,6 +8736,7 @@ def test_get_feature_group_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_feature_group(**mock_args) @@ -8865,6 +8883,7 @@ def test_list_feature_groups_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_feature_groups(request) @@ -8922,6 +8941,7 @@ def test_list_feature_groups_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_feature_groups(**mock_args) @@ -9120,6 +9140,7 @@ def test_update_feature_group_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_feature_group(request) @@ -9172,6 +9193,7 @@ def test_update_feature_group_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_feature_group(**mock_args) @@ -9315,6 +9337,7 @@ def test_delete_feature_group_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_feature_group(request) @@ -9361,6 +9384,7 @@ def test_delete_feature_group_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_feature_group(**mock_args) @@ -9504,6 +9528,7 @@ def test_create_feature_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_feature(request) @@ -9566,6 +9591,7 @@ def test_create_feature_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_feature(**mock_args) @@ -9706,6 +9732,7 @@ def test_batch_create_features_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.batch_create_features(request) @@ -9760,6 +9787,7 @@ def test_batch_create_features_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.batch_create_features(**mock_args) @@ -9894,6 +9922,7 @@ def test_get_feature_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_feature(request) @@ -9941,6 +9970,7 @@ def test_get_feature_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_feature(**mock_args) @@ -10083,6 +10113,7 @@ def test_list_features_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_features(request) @@ -10142,6 +10173,7 @@ def test_list_features_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_features(**mock_args) @@ -10337,6 +10369,7 @@ def test_update_feature_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_feature(request) @@ -10385,6 +10418,7 @@ def test_update_feature_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_feature(**mock_args) @@ -10518,6 +10552,7 @@ def test_delete_feature_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_feature(request) @@ -10563,6 +10598,7 @@ def test_delete_feature_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_feature(**mock_args) @@ -10710,6 +10746,7 @@ def test_create_feature_monitor_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_feature_monitor(request) @@ -10772,6 +10809,7 @@ def test_create_feature_monitor_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_feature_monitor(**mock_args) @@ -10909,6 +10947,7 @@ def test_get_feature_monitor_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_feature_monitor(request) @@ -10956,6 +10995,7 @@ def test_get_feature_monitor_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_feature_monitor(**mock_args) @@ -11103,6 +11143,7 @@ def test_list_feature_monitors_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_feature_monitors(request) @@ -11162,6 +11203,7 @@ def test_list_feature_monitors_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_feature_monitors(**mock_args) @@ -11365,6 +11407,7 @@ def test_delete_feature_monitor_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_feature_monitor(request) @@ -11410,6 +11453,7 @@ def test_delete_feature_monitor_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_feature_monitor(**mock_args) @@ -11549,6 +11593,7 @@ def test_create_feature_monitor_job_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_feature_monitor_job(request) @@ -11608,6 +11653,7 @@ def test_create_feature_monitor_job_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_feature_monitor_job(**mock_args) @@ -11748,6 +11794,7 @@ def test_get_feature_monitor_job_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_feature_monitor_job(request) @@ -11795,6 +11842,7 @@ def test_get_feature_monitor_job_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_feature_monitor_job(**mock_args) @@ -11942,6 +11990,7 @@ def test_list_feature_monitor_jobs_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_feature_monitor_jobs(request) @@ -12001,6 +12050,7 @@ def test_list_feature_monitor_jobs_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_feature_monitor_jobs(**mock_args) @@ -12668,6 +12718,8 @@ async def test_get_feature_group_empty_call_grpc_asyncio(): name="name_value", etag="etag_value", description="description_value", + service_agent_type=feature_group.FeatureGroup.ServiceAgentType.SERVICE_AGENT_TYPE_PROJECT, + service_account_email="service_account_email_value", ) ) await client.get_feature_group(request=None) @@ -13160,6 +13212,7 @@ def test_create_feature_group_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_feature_group(request) @@ -13194,6 +13247,8 @@ def test_create_feature_group_rest_call_success(request_type): "etag": "etag_value", "labels": {}, "description": "description_value", + "service_agent_type": 1, + "service_account_email": "service_account_email_value", } # The version of a generated dependency at test runtime may differ from the version used during generation. # Delete any fields which are not present in the current runtime dependency @@ -13277,6 +13332,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_feature_group(request) # Establish that the response is the type that we expect. @@ -13318,6 +13374,7 @@ def test_create_feature_group_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 @@ -13362,6 +13419,7 @@ def test_get_feature_group_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_feature_group(request) @@ -13388,6 +13446,8 @@ def test_get_feature_group_rest_call_success(request_type): name="name_value", etag="etag_value", description="description_value", + service_agent_type=feature_group.FeatureGroup.ServiceAgentType.SERVICE_AGENT_TYPE_PROJECT, + service_account_email="service_account_email_value", ) # Wrap the value into a proper Response obj @@ -13399,6 +13459,7 @@ def test_get_feature_group_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_feature_group(request) # Establish that the response is the type that we expect. @@ -13406,6 +13467,11 @@ def test_get_feature_group_rest_call_success(request_type): assert response.name == "name_value" assert response.etag == "etag_value" assert response.description == "description_value" + assert ( + response.service_agent_type + == feature_group.FeatureGroup.ServiceAgentType.SERVICE_AGENT_TYPE_PROJECT + ) + assert response.service_account_email == "service_account_email_value" @pytest.mark.parametrize("null_interceptor", [True, False]) @@ -13441,6 +13507,7 @@ def test_get_feature_group_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 = feature_group.FeatureGroup.to_json(feature_group.FeatureGroup()) req.return_value.content = return_value @@ -13485,6 +13552,7 @@ def test_list_feature_groups_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_feature_groups(request) @@ -13522,6 +13590,7 @@ def test_list_feature_groups_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_feature_groups(request) # Establish that the response is the type that we expect. @@ -13562,6 +13631,7 @@ def test_list_feature_groups_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 = feature_registry_service.ListFeatureGroupsResponse.to_json( feature_registry_service.ListFeatureGroupsResponse() ) @@ -13612,6 +13682,7 @@ def test_update_feature_group_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_feature_group(request) @@ -13650,6 +13721,8 @@ def test_update_feature_group_rest_call_success(request_type): "etag": "etag_value", "labels": {}, "description": "description_value", + "service_agent_type": 1, + "service_account_email": "service_account_email_value", } # The version of a generated dependency at test runtime may differ from the version used during generation. # Delete any fields which are not present in the current runtime dependency @@ -13733,6 +13806,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_feature_group(request) # Establish that the response is the type that we expect. @@ -13774,6 +13848,7 @@ def test_update_feature_group_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 @@ -13818,6 +13893,7 @@ def test_delete_feature_group_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_feature_group(request) @@ -13848,6 +13924,7 @@ def test_delete_feature_group_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_feature_group(request) # Establish that the response is the type that we expect. @@ -13889,6 +13966,7 @@ def test_delete_feature_group_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 @@ -13935,6 +14013,7 @@ def test_create_feature_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_feature(request) @@ -14088,6 +14167,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_feature(request) # Establish that the response is the type that we expect. @@ -14129,6 +14209,7 @@ def test_create_feature_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 @@ -14175,6 +14256,7 @@ def test_batch_create_features_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.batch_create_features(request) @@ -14207,6 +14289,7 @@ def test_batch_create_features_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.batch_create_features(request) # Establish that the response is the type that we expect. @@ -14248,6 +14331,7 @@ def test_batch_create_features_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 @@ -14294,6 +14378,7 @@ def test_get_feature_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_feature(request) @@ -14337,6 +14422,7 @@ def test_get_feature_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_feature(request) # Establish that the response is the type that we expect. @@ -14383,6 +14469,7 @@ def test_get_feature_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 = feature.Feature.to_json(feature.Feature()) req.return_value.content = return_value @@ -14429,6 +14516,7 @@ def test_list_features_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_features(request) @@ -14466,6 +14554,7 @@ def test_list_features_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_features(request) # Establish that the response is the type that we expect. @@ -14506,6 +14595,7 @@ def test_list_features_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 = featurestore_service.ListFeaturesResponse.to_json( featurestore_service.ListFeaturesResponse() ) @@ -14556,6 +14646,7 @@ def test_update_feature_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_feature(request) @@ -14711,6 +14802,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_feature(request) # Establish that the response is the type that we expect. @@ -14752,6 +14844,7 @@ def test_update_feature_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 @@ -14798,6 +14891,7 @@ def test_delete_feature_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_feature(request) @@ -14830,6 +14924,7 @@ def test_delete_feature_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_feature(request) # Establish that the response is the type that we expect. @@ -14871,6 +14966,7 @@ def test_delete_feature_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 @@ -14917,6 +15013,7 @@ def test_create_feature_monitor_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_feature_monitor(request) @@ -15032,6 +15129,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_feature_monitor(request) # Establish that the response is the type that we expect. @@ -15073,6 +15171,7 @@ def test_create_feature_monitor_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 @@ -15119,6 +15218,7 @@ def test_get_feature_monitor_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_feature_monitor(request) @@ -15158,6 +15258,7 @@ def test_get_feature_monitor_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_feature_monitor(request) # Establish that the response is the type that we expect. @@ -15200,6 +15301,7 @@ def test_get_feature_monitor_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 = feature_monitor.FeatureMonitor.to_json( feature_monitor.FeatureMonitor() ) @@ -15248,6 +15350,7 @@ def test_list_feature_monitors_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_feature_monitors(request) @@ -15287,6 +15390,7 @@ def test_list_feature_monitors_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_feature_monitors(request) # Establish that the response is the type that we expect. @@ -15327,6 +15431,7 @@ def test_list_feature_monitors_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 = feature_registry_service.ListFeatureMonitorsResponse.to_json( feature_registry_service.ListFeatureMonitorsResponse() ) @@ -15375,6 +15480,7 @@ def test_delete_feature_monitor_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_feature_monitor(request) @@ -15407,6 +15513,7 @@ def test_delete_feature_monitor_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_feature_monitor(request) # Establish that the response is the type that we expect. @@ -15448,6 +15555,7 @@ def test_delete_feature_monitor_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 @@ -15494,6 +15602,7 @@ def test_create_feature_monitor_job_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_feature_monitor_job(request) @@ -15649,6 +15758,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_feature_monitor_job(request) # Establish that the response is the type that we expect. @@ -15697,6 +15807,7 @@ def test_create_feature_monitor_job_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 = gca_feature_monitor_job.FeatureMonitorJob.to_json( gca_feature_monitor_job.FeatureMonitorJob() ) @@ -15745,6 +15856,7 @@ def test_get_feature_monitor_job_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_feature_monitor_job(request) @@ -15785,6 +15897,7 @@ def test_get_feature_monitor_job_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_feature_monitor_job(request) # Establish that the response is the type that we expect. @@ -15831,6 +15944,7 @@ def test_get_feature_monitor_job_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 = feature_monitor_job.FeatureMonitorJob.to_json( feature_monitor_job.FeatureMonitorJob() ) @@ -15879,6 +15993,7 @@ def test_list_feature_monitor_jobs_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_feature_monitor_jobs(request) @@ -15918,6 +16033,7 @@ def test_list_feature_monitor_jobs_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_feature_monitor_jobs(request) # Establish that the response is the type that we expect. @@ -15960,6 +16076,7 @@ def test_list_feature_monitor_jobs_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 = feature_registry_service.ListFeatureMonitorJobsResponse.to_json( feature_registry_service.ListFeatureMonitorJobsResponse() ) @@ -16006,6 +16123,7 @@ def test_get_location_rest_bad_request(request_type=locations_pb2.GetLocationReq 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_location(request) @@ -16036,6 +16154,7 @@ def test_get_location_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_location(request) @@ -16064,6 +16183,7 @@ def test_list_locations_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_locations(request) @@ -16094,6 +16214,7 @@ def test_list_locations_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_locations(request) @@ -16125,6 +16246,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -16157,6 +16279,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -16188,6 +16311,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -16220,6 +16344,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -16251,6 +16376,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -16283,6 +16409,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -16313,6 +16440,7 @@ def test_cancel_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.cancel_operation(request) @@ -16343,6 +16471,7 @@ def test_cancel_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.cancel_operation(request) @@ -16373,6 +16502,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) @@ -16403,6 +16533,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) @@ -16433,6 +16564,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) @@ -16463,6 +16595,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) @@ -16493,6 +16626,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) @@ -16523,6 +16657,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) @@ -16553,6 +16688,7 @@ def test_wait_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.wait_operation(request) @@ -16583,6 +16719,7 @@ def test_wait_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.wait_operation(request) @@ -17036,6 +17173,7 @@ async def test_create_feature_group_rest_asyncio_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"} await client.create_feature_group(request) @@ -17075,6 +17213,8 @@ async def test_create_feature_group_rest_asyncio_call_success(request_type): "etag": "etag_value", "labels": {}, "description": "description_value", + "service_agent_type": 1, + "service_account_email": "service_account_email_value", } # The version of a generated dependency at test runtime may differ from the version used during generation. # Delete any fields which are not present in the current runtime dependency @@ -17160,6 +17300,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.create_feature_group(request) # Establish that the response is the type that we expect. @@ -17208,6 +17349,7 @@ async def test_create_feature_group_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -17256,6 +17398,7 @@ async def test_get_feature_group_rest_asyncio_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"} await client.get_feature_group(request) @@ -17287,6 +17430,8 @@ async def test_get_feature_group_rest_asyncio_call_success(request_type): name="name_value", etag="etag_value", description="description_value", + service_agent_type=feature_group.FeatureGroup.ServiceAgentType.SERVICE_AGENT_TYPE_PROJECT, + service_account_email="service_account_email_value", ) # Wrap the value into a proper Response obj @@ -17300,6 +17445,7 @@ async def test_get_feature_group_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_feature_group(request) # Establish that the response is the type that we expect. @@ -17307,6 +17453,11 @@ async def test_get_feature_group_rest_asyncio_call_success(request_type): assert response.name == "name_value" assert response.etag == "etag_value" assert response.description == "description_value" + assert ( + response.service_agent_type + == feature_group.FeatureGroup.ServiceAgentType.SERVICE_AGENT_TYPE_PROJECT + ) + assert response.service_account_email == "service_account_email_value" @pytest.mark.asyncio @@ -17347,6 +17498,7 @@ async def test_get_feature_group_rest_asyncio_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 = feature_group.FeatureGroup.to_json(feature_group.FeatureGroup()) req.return_value.read = mock.AsyncMock(return_value=return_value) @@ -17395,6 +17547,7 @@ async def test_list_feature_groups_rest_asyncio_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"} await client.list_feature_groups(request) @@ -17439,6 +17592,7 @@ async def test_list_feature_groups_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_feature_groups(request) # Establish that the response is the type that we expect. @@ -17485,6 +17639,7 @@ async def test_list_feature_groups_rest_asyncio_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 = feature_registry_service.ListFeatureGroupsResponse.to_json( feature_registry_service.ListFeatureGroupsResponse() ) @@ -17539,6 +17694,7 @@ async def test_update_feature_group_rest_asyncio_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"} await client.update_feature_group(request) @@ -17582,6 +17738,8 @@ async def test_update_feature_group_rest_asyncio_call_success(request_type): "etag": "etag_value", "labels": {}, "description": "description_value", + "service_agent_type": 1, + "service_account_email": "service_account_email_value", } # The version of a generated dependency at test runtime may differ from the version used during generation. # Delete any fields which are not present in the current runtime dependency @@ -17667,6 +17825,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.update_feature_group(request) # Establish that the response is the type that we expect. @@ -17715,6 +17874,7 @@ async def test_update_feature_group_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -17763,6 +17923,7 @@ async def test_delete_feature_group_rest_asyncio_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"} await client.delete_feature_group(request) @@ -17800,6 +17961,7 @@ async def test_delete_feature_group_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_feature_group(request) # Establish that the response is the type that we expect. @@ -17848,6 +18010,7 @@ async def test_delete_feature_group_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -17898,6 +18061,7 @@ async def test_create_feature_rest_asyncio_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"} await client.create_feature(request) @@ -18058,6 +18222,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.create_feature(request) # Establish that the response is the type that we expect. @@ -18104,6 +18269,7 @@ async def test_create_feature_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -18154,6 +18320,7 @@ async def test_batch_create_features_rest_asyncio_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"} await client.batch_create_features(request) @@ -18193,6 +18360,7 @@ async def test_batch_create_features_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.batch_create_features(request) # Establish that the response is the type that we expect. @@ -18241,6 +18409,7 @@ async def test_batch_create_features_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -18291,6 +18460,7 @@ async def test_get_feature_rest_asyncio_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"} await client.get_feature(request) @@ -18341,6 +18511,7 @@ async def test_get_feature_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_feature(request) # Establish that the response is the type that we expect. @@ -18392,6 +18563,7 @@ async def test_get_feature_rest_asyncio_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 = feature.Feature.to_json(feature.Feature()) req.return_value.read = mock.AsyncMock(return_value=return_value) @@ -18442,6 +18614,7 @@ async def test_list_features_rest_asyncio_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"} await client.list_features(request) @@ -18486,6 +18659,7 @@ async def test_list_features_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_features(request) # Establish that the response is the type that we expect. @@ -18531,6 +18705,7 @@ async def test_list_features_rest_asyncio_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 = featurestore_service.ListFeaturesResponse.to_json( featurestore_service.ListFeaturesResponse() ) @@ -18585,6 +18760,7 @@ async def test_update_feature_rest_asyncio_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"} await client.update_feature(request) @@ -18747,6 +18923,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.update_feature(request) # Establish that the response is the type that we expect. @@ -18793,6 +18970,7 @@ async def test_update_feature_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -18843,6 +19021,7 @@ async def test_delete_feature_rest_asyncio_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"} await client.delete_feature(request) @@ -18882,6 +19061,7 @@ async def test_delete_feature_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_feature(request) # Establish that the response is the type that we expect. @@ -18928,6 +19108,7 @@ async def test_delete_feature_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -18978,6 +19159,7 @@ async def test_create_feature_monitor_rest_asyncio_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"} await client.create_feature_monitor(request) @@ -19100,6 +19282,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.create_feature_monitor(request) # Establish that the response is the type that we expect. @@ -19148,6 +19331,7 @@ async def test_create_feature_monitor_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -19198,6 +19382,7 @@ async def test_get_feature_monitor_rest_asyncio_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"} await client.get_feature_monitor(request) @@ -19244,6 +19429,7 @@ async def test_get_feature_monitor_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_feature_monitor(request) # Establish that the response is the type that we expect. @@ -19292,6 +19478,7 @@ async def test_get_feature_monitor_rest_asyncio_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 = feature_monitor.FeatureMonitor.to_json( feature_monitor.FeatureMonitor() ) @@ -19344,6 +19531,7 @@ async def test_list_feature_monitors_rest_asyncio_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"} await client.list_feature_monitors(request) @@ -19390,6 +19578,7 @@ async def test_list_feature_monitors_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_feature_monitors(request) # Establish that the response is the type that we expect. @@ -19437,6 +19626,7 @@ async def test_list_feature_monitors_rest_asyncio_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 = feature_registry_service.ListFeatureMonitorsResponse.to_json( feature_registry_service.ListFeatureMonitorsResponse() ) @@ -19489,6 +19679,7 @@ async def test_delete_feature_monitor_rest_asyncio_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"} await client.delete_feature_monitor(request) @@ -19528,6 +19719,7 @@ async def test_delete_feature_monitor_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_feature_monitor(request) # Establish that the response is the type that we expect. @@ -19576,6 +19768,7 @@ async def test_delete_feature_monitor_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -19626,6 +19819,7 @@ async def test_create_feature_monitor_job_rest_asyncio_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"} await client.create_feature_monitor_job(request) @@ -19788,6 +19982,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.create_feature_monitor_job(request) # Establish that the response is the type that we expect. @@ -19841,6 +20036,7 @@ async def test_create_feature_monitor_job_rest_asyncio_interceptors(null_interce 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 = gca_feature_monitor_job.FeatureMonitorJob.to_json( gca_feature_monitor_job.FeatureMonitorJob() ) @@ -19893,6 +20089,7 @@ async def test_get_feature_monitor_job_rest_asyncio_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"} await client.get_feature_monitor_job(request) @@ -19940,6 +20137,7 @@ async def test_get_feature_monitor_job_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_feature_monitor_job(request) # Establish that the response is the type that we expect. @@ -19993,6 +20191,7 @@ async def test_get_feature_monitor_job_rest_asyncio_interceptors(null_intercepto 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 = feature_monitor_job.FeatureMonitorJob.to_json( feature_monitor_job.FeatureMonitorJob() ) @@ -20045,6 +20244,7 @@ async def test_list_feature_monitor_jobs_rest_asyncio_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"} await client.list_feature_monitor_jobs(request) @@ -20091,6 +20291,7 @@ async def test_list_feature_monitor_jobs_rest_asyncio_call_success(request_type) return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_feature_monitor_jobs(request) # Establish that the response is the type that we expect. @@ -20138,6 +20339,7 @@ async def test_list_feature_monitor_jobs_rest_asyncio_interceptors(null_intercep 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 = feature_registry_service.ListFeatureMonitorJobsResponse.to_json( feature_registry_service.ListFeatureMonitorJobsResponse() ) @@ -20190,6 +20392,7 @@ async def test_get_location_rest_asyncio_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"} await client.get_location(request) @@ -20227,6 +20430,7 @@ async def test_get_location_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_location(request) @@ -20259,6 +20463,7 @@ async def test_list_locations_rest_asyncio_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"} await client.list_locations(request) @@ -20296,6 +20501,7 @@ async def test_list_locations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_locations(request) @@ -20331,6 +20537,7 @@ async def test_get_iam_policy_rest_asyncio_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"} await client.get_iam_policy(request) @@ -20370,6 +20577,7 @@ async def test_get_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_iam_policy(request) @@ -20405,6 +20613,7 @@ async def test_set_iam_policy_rest_asyncio_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"} await client.set_iam_policy(request) @@ -20444,6 +20653,7 @@ async def test_set_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.set_iam_policy(request) @@ -20479,6 +20689,7 @@ async def test_test_iam_permissions_rest_asyncio_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"} await client.test_iam_permissions(request) @@ -20518,6 +20729,7 @@ async def test_test_iam_permissions_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.test_iam_permissions(request) @@ -20552,6 +20764,7 @@ async def test_cancel_operation_rest_asyncio_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"} await client.cancel_operation(request) @@ -20589,6 +20802,7 @@ async def test_cancel_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.cancel_operation(request) @@ -20623,6 +20837,7 @@ async def test_delete_operation_rest_asyncio_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"} await client.delete_operation(request) @@ -20660,6 +20875,7 @@ async def test_delete_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_operation(request) @@ -20694,6 +20910,7 @@ async def test_get_operation_rest_asyncio_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"} await client.get_operation(request) @@ -20731,6 +20948,7 @@ async def test_get_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_operation(request) @@ -20765,6 +20983,7 @@ async def test_list_operations_rest_asyncio_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"} await client.list_operations(request) @@ -20802,6 +21021,7 @@ async def test_list_operations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_operations(request) @@ -20836,6 +21056,7 @@ async def test_wait_operation_rest_asyncio_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"} await client.wait_operation(request) @@ -20873,6 +21094,7 @@ async def test_wait_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.wait_operation(request) diff --git a/tests/unit/gapic/aiplatform_v1beta1/test_featurestore_online_serving_service.py b/tests/unit/gapic/aiplatform_v1beta1/test_featurestore_online_serving_service.py index afc7feddb0..39666f8c54 100644 --- a/tests/unit/gapic/aiplatform_v1beta1/test_featurestore_online_serving_service.py +++ b/tests/unit/gapic/aiplatform_v1beta1/test_featurestore_online_serving_service.py @@ -2355,6 +2355,7 @@ def test_read_feature_values_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.read_feature_values(request) @@ -2413,6 +2414,7 @@ def test_read_feature_values_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.read_feature_values(**mock_args) @@ -2557,6 +2559,7 @@ def test_streaming_read_feature_values_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"} with mock.patch.object(response_value, "iter_content") as iter_content: iter_content.return_value = iter(json_return_value) @@ -2620,6 +2623,7 @@ def test_streaming_read_feature_values_rest_flattened(): json_return_value = "[{}]".format(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"} with mock.patch.object(response_value, "iter_content") as iter_content: iter_content.return_value = iter(json_return_value) @@ -2760,6 +2764,7 @@ def test_write_feature_values_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.write_feature_values(request) @@ -2822,6 +2827,7 @@ def test_write_feature_values_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.write_feature_values(**mock_args) @@ -3159,6 +3165,7 @@ def test_read_feature_values_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.read_feature_values(request) @@ -3196,6 +3203,7 @@ def test_read_feature_values_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.read_feature_values(request) # Establish that the response is the type that we expect. @@ -3237,6 +3245,7 @@ def test_read_feature_values_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 = featurestore_online_service.ReadFeatureValuesResponse.to_json( featurestore_online_service.ReadFeatureValuesResponse() ) @@ -3285,6 +3294,7 @@ def test_streaming_read_feature_values_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.streaming_read_feature_values(request) @@ -3323,6 +3333,7 @@ def test_streaming_read_feature_values_rest_call_success(request_type): json_return_value = "[{}]".format(json_return_value) response_value.iter_content = mock.Mock(return_value=iter(json_return_value)) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.streaming_read_feature_values(request) assert isinstance(response, Iterable) @@ -3367,6 +3378,7 @@ def test_streaming_read_feature_values_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 = featurestore_online_service.ReadFeatureValuesResponse.to_json( featurestore_online_service.ReadFeatureValuesResponse() ) @@ -3415,6 +3427,7 @@ def test_write_feature_values_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.write_feature_values(request) @@ -3452,6 +3465,7 @@ def test_write_feature_values_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.write_feature_values(request) # Establish that the response is the type that we expect. @@ -3493,6 +3507,7 @@ def test_write_feature_values_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 = featurestore_online_service.WriteFeatureValuesResponse.to_json( featurestore_online_service.WriteFeatureValuesResponse() ) @@ -3539,6 +3554,7 @@ def test_get_location_rest_bad_request(request_type=locations_pb2.GetLocationReq 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_location(request) @@ -3569,6 +3585,7 @@ def test_get_location_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_location(request) @@ -3597,6 +3614,7 @@ def test_list_locations_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_locations(request) @@ -3627,6 +3645,7 @@ def test_list_locations_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_locations(request) @@ -3658,6 +3677,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -3690,6 +3710,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -3721,6 +3742,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -3753,6 +3775,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -3784,6 +3807,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -3816,6 +3840,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -3846,6 +3871,7 @@ def test_cancel_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.cancel_operation(request) @@ -3876,6 +3902,7 @@ def test_cancel_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.cancel_operation(request) @@ -3906,6 +3933,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) @@ -3936,6 +3964,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) @@ -3966,6 +3995,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) @@ -3996,6 +4026,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) @@ -4026,6 +4057,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) @@ -4056,6 +4088,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) @@ -4086,6 +4119,7 @@ def test_wait_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.wait_operation(request) @@ -4116,6 +4150,7 @@ def test_wait_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.wait_operation(request) @@ -4234,6 +4269,7 @@ async def test_read_feature_values_rest_asyncio_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"} await client.read_feature_values(request) @@ -4278,6 +4314,7 @@ async def test_read_feature_values_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.read_feature_values(request) # Establish that the response is the type that we expect. @@ -4324,6 +4361,7 @@ async def test_read_feature_values_rest_asyncio_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 = featurestore_online_service.ReadFeatureValuesResponse.to_json( featurestore_online_service.ReadFeatureValuesResponse() ) @@ -4376,6 +4414,7 @@ async def test_streaming_read_feature_values_rest_asyncio_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"} await client.streaming_read_feature_values(request) @@ -4419,6 +4458,7 @@ async def test_streaming_read_feature_values_rest_asyncio_call_success(request_t json_return_value = "[{}]".format(json_return_value) response_value.content.return_value = mock_async_gen(json_return_value) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.streaming_read_feature_values(request) assert isinstance(response, AsyncIterable) @@ -4470,6 +4510,7 @@ async def test_streaming_read_feature_values_rest_asyncio_interceptors( 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 = featurestore_online_service.ReadFeatureValuesResponse.to_json( featurestore_online_service.ReadFeatureValuesResponse() ) @@ -4522,6 +4563,7 @@ async def test_write_feature_values_rest_asyncio_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"} await client.write_feature_values(request) @@ -4566,6 +4608,7 @@ async def test_write_feature_values_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.write_feature_values(request) # Establish that the response is the type that we expect. @@ -4612,6 +4655,7 @@ async def test_write_feature_values_rest_asyncio_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 = featurestore_online_service.WriteFeatureValuesResponse.to_json( featurestore_online_service.WriteFeatureValuesResponse() ) @@ -4664,6 +4708,7 @@ async def test_get_location_rest_asyncio_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"} await client.get_location(request) @@ -4701,6 +4746,7 @@ async def test_get_location_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_location(request) @@ -4733,6 +4779,7 @@ async def test_list_locations_rest_asyncio_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"} await client.list_locations(request) @@ -4770,6 +4817,7 @@ async def test_list_locations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_locations(request) @@ -4805,6 +4853,7 @@ async def test_get_iam_policy_rest_asyncio_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"} await client.get_iam_policy(request) @@ -4844,6 +4893,7 @@ async def test_get_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_iam_policy(request) @@ -4879,6 +4929,7 @@ async def test_set_iam_policy_rest_asyncio_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"} await client.set_iam_policy(request) @@ -4918,6 +4969,7 @@ async def test_set_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.set_iam_policy(request) @@ -4953,6 +5005,7 @@ async def test_test_iam_permissions_rest_asyncio_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"} await client.test_iam_permissions(request) @@ -4992,6 +5045,7 @@ async def test_test_iam_permissions_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.test_iam_permissions(request) @@ -5026,6 +5080,7 @@ async def test_cancel_operation_rest_asyncio_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"} await client.cancel_operation(request) @@ -5063,6 +5118,7 @@ async def test_cancel_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.cancel_operation(request) @@ -5097,6 +5153,7 @@ async def test_delete_operation_rest_asyncio_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"} await client.delete_operation(request) @@ -5134,6 +5191,7 @@ async def test_delete_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_operation(request) @@ -5168,6 +5226,7 @@ async def test_get_operation_rest_asyncio_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"} await client.get_operation(request) @@ -5205,6 +5264,7 @@ async def test_get_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_operation(request) @@ -5239,6 +5299,7 @@ async def test_list_operations_rest_asyncio_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"} await client.list_operations(request) @@ -5276,6 +5337,7 @@ async def test_list_operations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_operations(request) @@ -5310,6 +5372,7 @@ async def test_wait_operation_rest_asyncio_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"} await client.wait_operation(request) @@ -5347,6 +5410,7 @@ async def test_wait_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.wait_operation(request) diff --git a/tests/unit/gapic/aiplatform_v1beta1/test_featurestore_service.py b/tests/unit/gapic/aiplatform_v1beta1/test_featurestore_service.py index f1dc311e07..b3904bd589 100644 --- a/tests/unit/gapic/aiplatform_v1beta1/test_featurestore_service.py +++ b/tests/unit/gapic/aiplatform_v1beta1/test_featurestore_service.py @@ -9411,6 +9411,7 @@ def test_create_featurestore_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_featurestore(request) @@ -9471,6 +9472,7 @@ def test_create_featurestore_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_featurestore(**mock_args) @@ -9606,6 +9608,7 @@ def test_get_featurestore_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_featurestore(request) @@ -9653,6 +9656,7 @@ def test_get_featurestore_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_featurestore(**mock_args) @@ -9800,6 +9804,7 @@ def test_list_featurestores_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_featurestores(request) @@ -9856,6 +9861,7 @@ def test_list_featurestores_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_featurestores(**mock_args) @@ -10053,6 +10059,7 @@ def test_update_featurestore_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_featurestore(request) @@ -10101,6 +10108,7 @@ def test_update_featurestore_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_featurestore(**mock_args) @@ -10240,6 +10248,7 @@ def test_delete_featurestore_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_featurestore(request) @@ -10286,6 +10295,7 @@ def test_delete_featurestore_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_featurestore(**mock_args) @@ -10433,6 +10443,7 @@ def test_create_entity_type_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_entity_type(request) @@ -10494,6 +10505,7 @@ def test_create_entity_type_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_entity_type(**mock_args) @@ -10627,6 +10639,7 @@ def test_get_entity_type_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_entity_type(request) @@ -10674,6 +10687,7 @@ def test_get_entity_type_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_entity_type(**mock_args) @@ -10817,6 +10831,7 @@ def test_list_entity_types_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_entity_types(request) @@ -10875,6 +10890,7 @@ def test_list_entity_types_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_entity_types(**mock_args) @@ -11073,6 +11089,7 @@ def test_update_entity_type_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_entity_type(request) @@ -11123,6 +11140,7 @@ def test_update_entity_type_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_entity_type(**mock_args) @@ -11262,6 +11280,7 @@ def test_delete_entity_type_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_entity_type(request) @@ -11308,6 +11327,7 @@ def test_delete_entity_type_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_entity_type(**mock_args) @@ -11451,6 +11471,7 @@ def test_create_feature_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_feature(request) @@ -11513,6 +11534,7 @@ def test_create_feature_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_feature(**mock_args) @@ -11653,6 +11675,7 @@ def test_batch_create_features_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.batch_create_features(request) @@ -11707,6 +11730,7 @@ def test_batch_create_features_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.batch_create_features(**mock_args) @@ -11841,6 +11865,7 @@ def test_get_feature_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_feature(request) @@ -11888,6 +11913,7 @@ def test_get_feature_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_feature(**mock_args) @@ -12030,6 +12056,7 @@ def test_list_features_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_features(request) @@ -12089,6 +12116,7 @@ def test_list_features_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_features(**mock_args) @@ -12283,6 +12311,7 @@ def test_update_feature_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_feature(request) @@ -12333,6 +12362,7 @@ def test_update_feature_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_feature(**mock_args) @@ -12466,6 +12496,7 @@ def test_delete_feature_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_feature(request) @@ -12511,6 +12542,7 @@ def test_delete_feature_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_feature(**mock_args) @@ -12649,6 +12681,7 @@ def test_import_feature_values_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.import_feature_values(request) @@ -12702,6 +12735,7 @@ def test_import_feature_values_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.import_feature_values(**mock_args) @@ -12840,6 +12874,7 @@ def test_batch_read_feature_values_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.batch_read_feature_values(request) @@ -12894,6 +12929,7 @@ def test_batch_read_feature_values_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.batch_read_feature_values(**mock_args) @@ -13032,6 +13068,7 @@ def test_export_feature_values_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.export_feature_values(request) @@ -13086,6 +13123,7 @@ def test_export_feature_values_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.export_feature_values(**mock_args) @@ -13224,6 +13262,7 @@ def test_delete_feature_values_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_feature_values(request) @@ -13269,6 +13308,7 @@ def test_delete_feature_values_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_feature_values(**mock_args) @@ -13408,6 +13448,7 @@ def test_search_features_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.search_features(request) @@ -13463,6 +13504,7 @@ def test_search_features_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.search_features(**mock_args) @@ -14767,6 +14809,7 @@ def test_create_featurestore_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_featurestore(request) @@ -14886,6 +14929,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_featurestore(request) # Establish that the response is the type that we expect. @@ -14927,6 +14971,7 @@ def test_create_featurestore_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 @@ -14971,6 +15016,7 @@ def test_get_featurestore_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_featurestore(request) @@ -15011,6 +15057,7 @@ def test_get_featurestore_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_featurestore(request) # Establish that the response is the type that we expect. @@ -15056,6 +15103,7 @@ def test_get_featurestore_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 = featurestore.Featurestore.to_json(featurestore.Featurestore()) req.return_value.content = return_value @@ -15100,6 +15148,7 @@ def test_list_featurestores_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_featurestores(request) @@ -15135,6 +15184,7 @@ def test_list_featurestores_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_featurestores(request) # Establish that the response is the type that we expect. @@ -15175,6 +15225,7 @@ def test_list_featurestores_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 = featurestore_service.ListFeaturestoresResponse.to_json( featurestore_service.ListFeaturestoresResponse() ) @@ -15225,6 +15276,7 @@ def test_update_featurestore_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_featurestore(request) @@ -15348,6 +15400,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_featurestore(request) # Establish that the response is the type that we expect. @@ -15389,6 +15442,7 @@ def test_update_featurestore_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 @@ -15433,6 +15487,7 @@ def test_delete_featurestore_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_featurestore(request) @@ -15463,6 +15518,7 @@ def test_delete_featurestore_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_featurestore(request) # Establish that the response is the type that we expect. @@ -15504,6 +15560,7 @@ def test_delete_featurestore_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 +15607,7 @@ def test_create_entity_type_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_entity_type(request) @@ -15671,6 +15729,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_entity_type(request) # Establish that the response is the type that we expect. @@ -15712,6 +15771,7 @@ def test_create_entity_type_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 @@ -15758,6 +15818,7 @@ def test_get_entity_type_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_entity_type(request) @@ -15800,6 +15861,7 @@ def test_get_entity_type_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_entity_type(request) # Establish that the response is the type that we expect. @@ -15845,6 +15907,7 @@ def test_get_entity_type_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 = entity_type.EntityType.to_json(entity_type.EntityType()) req.return_value.content = return_value @@ -15891,6 +15954,7 @@ def test_list_entity_types_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_entity_types(request) @@ -15928,6 +15992,7 @@ def test_list_entity_types_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_entity_types(request) # Establish that the response is the type that we expect. @@ -15968,6 +16033,7 @@ def test_list_entity_types_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 = featurestore_service.ListEntityTypesResponse.to_json( featurestore_service.ListEntityTypesResponse() ) @@ -16018,6 +16084,7 @@ def test_update_entity_type_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_entity_type(request) @@ -16151,6 +16218,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_entity_type(request) # Establish that the response is the type that we expect. @@ -16196,6 +16264,7 @@ def test_update_entity_type_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 = gca_entity_type.EntityType.to_json(gca_entity_type.EntityType()) req.return_value.content = return_value @@ -16242,6 +16311,7 @@ def test_delete_entity_type_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_entity_type(request) @@ -16274,6 +16344,7 @@ def test_delete_entity_type_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_entity_type(request) # Establish that the response is the type that we expect. @@ -16315,6 +16386,7 @@ def test_delete_entity_type_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 @@ -16361,6 +16433,7 @@ def test_create_feature_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_feature(request) @@ -16514,6 +16587,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_feature(request) # Establish that the response is the type that we expect. @@ -16555,6 +16629,7 @@ def test_create_feature_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 @@ -16601,6 +16676,7 @@ def test_batch_create_features_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.batch_create_features(request) @@ -16633,6 +16709,7 @@ def test_batch_create_features_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.batch_create_features(request) # Establish that the response is the type that we expect. @@ -16674,6 +16751,7 @@ def test_batch_create_features_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 @@ -16720,6 +16798,7 @@ def test_get_feature_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_feature(request) @@ -16763,6 +16842,7 @@ def test_get_feature_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_feature(request) # Establish that the response is the type that we expect. @@ -16809,6 +16889,7 @@ def test_get_feature_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 = feature.Feature.to_json(feature.Feature()) req.return_value.content = return_value @@ -16855,6 +16936,7 @@ def test_list_features_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_features(request) @@ -16892,6 +16974,7 @@ def test_list_features_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_features(request) # Establish that the response is the type that we expect. @@ -16932,6 +17015,7 @@ def test_list_features_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 = featurestore_service.ListFeaturesResponse.to_json( featurestore_service.ListFeaturesResponse() ) @@ -16982,6 +17066,7 @@ def test_update_feature_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_feature(request) @@ -17148,6 +17233,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_feature(request) # Establish that the response is the type that we expect. @@ -17194,6 +17280,7 @@ def test_update_feature_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 = gca_feature.Feature.to_json(gca_feature.Feature()) req.return_value.content = return_value @@ -17240,6 +17327,7 @@ def test_delete_feature_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_feature(request) @@ -17272,6 +17360,7 @@ def test_delete_feature_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_feature(request) # Establish that the response is the type that we expect. @@ -17313,6 +17402,7 @@ def test_delete_feature_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 @@ -17359,6 +17449,7 @@ def test_import_feature_values_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.import_feature_values(request) @@ -17391,6 +17482,7 @@ def test_import_feature_values_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.import_feature_values(request) # Establish that the response is the type that we expect. @@ -17432,6 +17524,7 @@ def test_import_feature_values_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 @@ -17478,6 +17571,7 @@ def test_batch_read_feature_values_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.batch_read_feature_values(request) @@ -17510,6 +17604,7 @@ def test_batch_read_feature_values_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.batch_read_feature_values(request) # Establish that the response is the type that we expect. @@ -17551,6 +17646,7 @@ def test_batch_read_feature_values_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 @@ -17597,6 +17693,7 @@ def test_export_feature_values_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.export_feature_values(request) @@ -17629,6 +17726,7 @@ def test_export_feature_values_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.export_feature_values(request) # Establish that the response is the type that we expect. @@ -17670,6 +17768,7 @@ def test_export_feature_values_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 @@ -17716,6 +17815,7 @@ def test_delete_feature_values_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_feature_values(request) @@ -17748,6 +17848,7 @@ def test_delete_feature_values_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_feature_values(request) # Establish that the response is the type that we expect. @@ -17789,6 +17890,7 @@ def test_delete_feature_values_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 @@ -17833,6 +17935,7 @@ def test_search_features_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.search_features(request) @@ -17868,6 +17971,7 @@ def test_search_features_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.search_features(request) # Establish that the response is the type that we expect. @@ -17908,6 +18012,7 @@ def test_search_features_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 = featurestore_service.SearchFeaturesResponse.to_json( featurestore_service.SearchFeaturesResponse() ) @@ -17954,6 +18059,7 @@ def test_get_location_rest_bad_request(request_type=locations_pb2.GetLocationReq 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_location(request) @@ -17984,6 +18090,7 @@ def test_get_location_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_location(request) @@ -18012,6 +18119,7 @@ def test_list_locations_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_locations(request) @@ -18042,6 +18150,7 @@ def test_list_locations_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_locations(request) @@ -18073,6 +18182,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -18105,6 +18215,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -18136,6 +18247,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -18168,6 +18280,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -18199,6 +18312,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -18231,6 +18345,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -18261,6 +18376,7 @@ def test_cancel_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.cancel_operation(request) @@ -18291,6 +18407,7 @@ def test_cancel_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.cancel_operation(request) @@ -18321,6 +18438,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) @@ -18351,6 +18469,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) @@ -18381,6 +18500,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) @@ -18411,6 +18531,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) @@ -18441,6 +18562,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) @@ -18471,6 +18593,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) @@ -18501,6 +18624,7 @@ def test_wait_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.wait_operation(request) @@ -18531,6 +18655,7 @@ def test_wait_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.wait_operation(request) @@ -19044,6 +19169,7 @@ async def test_create_featurestore_rest_asyncio_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"} await client.create_featurestore(request) @@ -19170,6 +19296,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.create_featurestore(request) # Establish that the response is the type that we expect. @@ -19216,6 +19343,7 @@ async def test_create_featurestore_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -19264,6 +19392,7 @@ async def test_get_featurestore_rest_asyncio_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"} await client.get_featurestore(request) @@ -19311,6 +19440,7 @@ async def test_get_featurestore_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_featurestore(request) # Establish that the response is the type that we expect. @@ -19361,6 +19491,7 @@ async def test_get_featurestore_rest_asyncio_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 = featurestore.Featurestore.to_json(featurestore.Featurestore()) req.return_value.read = mock.AsyncMock(return_value=return_value) @@ -19409,6 +19540,7 @@ async def test_list_featurestores_rest_asyncio_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"} await client.list_featurestores(request) @@ -19451,6 +19583,7 @@ async def test_list_featurestores_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_featurestores(request) # Establish that the response is the type that we expect. @@ -19496,6 +19629,7 @@ async def test_list_featurestores_rest_asyncio_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 = featurestore_service.ListFeaturestoresResponse.to_json( featurestore_service.ListFeaturestoresResponse() ) @@ -19550,6 +19684,7 @@ async def test_update_featurestore_rest_asyncio_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"} await client.update_featurestore(request) @@ -19680,6 +19815,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.update_featurestore(request) # Establish that the response is the type that we expect. @@ -19726,6 +19862,7 @@ async def test_update_featurestore_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -19774,6 +19911,7 @@ async def test_delete_featurestore_rest_asyncio_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"} await client.delete_featurestore(request) @@ -19811,6 +19949,7 @@ async def test_delete_featurestore_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_featurestore(request) # Establish that the response is the type that we expect. @@ -19857,6 +19996,7 @@ async def test_delete_featurestore_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -19907,6 +20047,7 @@ async def test_create_entity_type_rest_asyncio_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"} await client.create_entity_type(request) @@ -20035,6 +20176,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.create_entity_type(request) # Establish that the response is the type that we expect. @@ -20081,6 +20223,7 @@ async def test_create_entity_type_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -20131,6 +20274,7 @@ async def test_get_entity_type_rest_asyncio_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"} await client.get_entity_type(request) @@ -20180,6 +20324,7 @@ async def test_get_entity_type_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_entity_type(request) # Establish that the response is the type that we expect. @@ -20230,6 +20375,7 @@ async def test_get_entity_type_rest_asyncio_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 = entity_type.EntityType.to_json(entity_type.EntityType()) req.return_value.read = mock.AsyncMock(return_value=return_value) @@ -20280,6 +20426,7 @@ async def test_list_entity_types_rest_asyncio_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"} await client.list_entity_types(request) @@ -20324,6 +20471,7 @@ async def test_list_entity_types_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_entity_types(request) # Establish that the response is the type that we expect. @@ -20369,6 +20517,7 @@ async def test_list_entity_types_rest_asyncio_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 = featurestore_service.ListEntityTypesResponse.to_json( featurestore_service.ListEntityTypesResponse() ) @@ -20423,6 +20572,7 @@ async def test_update_entity_type_rest_asyncio_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"} await client.update_entity_type(request) @@ -20563,6 +20713,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.update_entity_type(request) # Establish that the response is the type that we expect. @@ -20613,6 +20764,7 @@ async def test_update_entity_type_rest_asyncio_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 = gca_entity_type.EntityType.to_json(gca_entity_type.EntityType()) req.return_value.read = mock.AsyncMock(return_value=return_value) @@ -20663,6 +20815,7 @@ async def test_delete_entity_type_rest_asyncio_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"} await client.delete_entity_type(request) @@ -20702,6 +20855,7 @@ async def test_delete_entity_type_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_entity_type(request) # Establish that the response is the type that we expect. @@ -20748,6 +20902,7 @@ async def test_delete_entity_type_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -20798,6 +20953,7 @@ async def test_create_feature_rest_asyncio_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"} await client.create_feature(request) @@ -20958,6 +21114,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.create_feature(request) # Establish that the response is the type that we expect. @@ -21004,6 +21161,7 @@ async def test_create_feature_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -21054,6 +21212,7 @@ async def test_batch_create_features_rest_asyncio_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"} await client.batch_create_features(request) @@ -21093,6 +21252,7 @@ async def test_batch_create_features_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.batch_create_features(request) # Establish that the response is the type that we expect. @@ -21139,6 +21299,7 @@ async def test_batch_create_features_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -21189,6 +21350,7 @@ async def test_get_feature_rest_asyncio_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"} await client.get_feature(request) @@ -21239,6 +21401,7 @@ async def test_get_feature_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_feature(request) # Establish that the response is the type that we expect. @@ -21290,6 +21453,7 @@ async def test_get_feature_rest_asyncio_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 = feature.Feature.to_json(feature.Feature()) req.return_value.read = mock.AsyncMock(return_value=return_value) @@ -21340,6 +21504,7 @@ async def test_list_features_rest_asyncio_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"} await client.list_features(request) @@ -21384,6 +21549,7 @@ async def test_list_features_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_features(request) # Establish that the response is the type that we expect. @@ -21429,6 +21595,7 @@ async def test_list_features_rest_asyncio_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 = featurestore_service.ListFeaturesResponse.to_json( featurestore_service.ListFeaturesResponse() ) @@ -21483,6 +21650,7 @@ async def test_update_feature_rest_asyncio_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"} await client.update_feature(request) @@ -21656,6 +21824,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.update_feature(request) # Establish that the response is the type that we expect. @@ -21707,6 +21876,7 @@ async def test_update_feature_rest_asyncio_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 = gca_feature.Feature.to_json(gca_feature.Feature()) req.return_value.read = mock.AsyncMock(return_value=return_value) @@ -21757,6 +21927,7 @@ async def test_delete_feature_rest_asyncio_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"} await client.delete_feature(request) @@ -21796,6 +21967,7 @@ async def test_delete_feature_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_feature(request) # Establish that the response is the type that we expect. @@ -21842,6 +22014,7 @@ async def test_delete_feature_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -21892,6 +22065,7 @@ async def test_import_feature_values_rest_asyncio_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"} await client.import_feature_values(request) @@ -21931,6 +22105,7 @@ async def test_import_feature_values_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.import_feature_values(request) # Establish that the response is the type that we expect. @@ -21977,6 +22152,7 @@ async def test_import_feature_values_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -22027,6 +22203,7 @@ async def test_batch_read_feature_values_rest_asyncio_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"} await client.batch_read_feature_values(request) @@ -22066,6 +22243,7 @@ async def test_batch_read_feature_values_rest_asyncio_call_success(request_type) return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.batch_read_feature_values(request) # Establish that the response is the type that we expect. @@ -22114,6 +22292,7 @@ async def test_batch_read_feature_values_rest_asyncio_interceptors(null_intercep 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.read = mock.AsyncMock(return_value=return_value) @@ -22164,6 +22343,7 @@ async def test_export_feature_values_rest_asyncio_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"} await client.export_feature_values(request) @@ -22203,6 +22383,7 @@ async def test_export_feature_values_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.export_feature_values(request) # Establish that the response is the type that we expect. @@ -22249,6 +22430,7 @@ async def test_export_feature_values_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -22299,6 +22481,7 @@ async def test_delete_feature_values_rest_asyncio_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"} await client.delete_feature_values(request) @@ -22338,6 +22521,7 @@ async def test_delete_feature_values_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_feature_values(request) # Establish that the response is the type that we expect. @@ -22384,6 +22568,7 @@ async def test_delete_feature_values_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -22432,6 +22617,7 @@ async def test_search_features_rest_asyncio_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"} await client.search_features(request) @@ -22474,6 +22660,7 @@ async def test_search_features_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.search_features(request) # Establish that the response is the type that we expect. @@ -22519,6 +22706,7 @@ async def test_search_features_rest_asyncio_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 = featurestore_service.SearchFeaturesResponse.to_json( featurestore_service.SearchFeaturesResponse() ) @@ -22571,6 +22759,7 @@ async def test_get_location_rest_asyncio_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"} await client.get_location(request) @@ -22608,6 +22797,7 @@ async def test_get_location_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_location(request) @@ -22640,6 +22830,7 @@ async def test_list_locations_rest_asyncio_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"} await client.list_locations(request) @@ -22677,6 +22868,7 @@ async def test_list_locations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_locations(request) @@ -22712,6 +22904,7 @@ async def test_get_iam_policy_rest_asyncio_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"} await client.get_iam_policy(request) @@ -22751,6 +22944,7 @@ async def test_get_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_iam_policy(request) @@ -22786,6 +22980,7 @@ async def test_set_iam_policy_rest_asyncio_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"} await client.set_iam_policy(request) @@ -22825,6 +23020,7 @@ async def test_set_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.set_iam_policy(request) @@ -22860,6 +23056,7 @@ async def test_test_iam_permissions_rest_asyncio_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"} await client.test_iam_permissions(request) @@ -22899,6 +23096,7 @@ async def test_test_iam_permissions_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.test_iam_permissions(request) @@ -22933,6 +23131,7 @@ async def test_cancel_operation_rest_asyncio_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"} await client.cancel_operation(request) @@ -22970,6 +23169,7 @@ async def test_cancel_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.cancel_operation(request) @@ -23004,6 +23204,7 @@ async def test_delete_operation_rest_asyncio_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"} await client.delete_operation(request) @@ -23041,6 +23242,7 @@ async def test_delete_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_operation(request) @@ -23075,6 +23277,7 @@ async def test_get_operation_rest_asyncio_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"} await client.get_operation(request) @@ -23112,6 +23315,7 @@ async def test_get_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_operation(request) @@ -23146,6 +23350,7 @@ async def test_list_operations_rest_asyncio_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"} await client.list_operations(request) @@ -23183,6 +23388,7 @@ async def test_list_operations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_operations(request) @@ -23217,6 +23423,7 @@ async def test_wait_operation_rest_asyncio_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"} await client.wait_operation(request) @@ -23254,6 +23461,7 @@ async def test_wait_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.wait_operation(request) diff --git a/tests/unit/gapic/aiplatform_v1beta1/test_gen_ai_cache_service.py b/tests/unit/gapic/aiplatform_v1beta1/test_gen_ai_cache_service.py index facff20b30..af0b975af9 100644 --- a/tests/unit/gapic/aiplatform_v1beta1/test_gen_ai_cache_service.py +++ b/tests/unit/gapic/aiplatform_v1beta1/test_gen_ai_cache_service.py @@ -3203,6 +3203,7 @@ def test_create_cached_content_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_cached_content(request) @@ -3259,6 +3260,7 @@ def test_create_cached_content_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_cached_content(**mock_args) @@ -3397,6 +3399,7 @@ def test_get_cached_content_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_cached_content(request) @@ -3444,6 +3447,7 @@ def test_get_cached_content_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_cached_content(**mock_args) @@ -3578,6 +3582,7 @@ def test_update_cached_content_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_cached_content(request) @@ -3638,6 +3643,7 @@ def test_update_cached_content_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_cached_content(**mock_args) @@ -3774,6 +3780,7 @@ def test_delete_cached_content_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_cached_content(request) @@ -3819,6 +3826,7 @@ def test_delete_cached_content_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_cached_content(**mock_args) @@ -3963,6 +3971,7 @@ def test_list_cached_contents_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_cached_contents(request) @@ -4016,6 +4025,7 @@ def test_list_cached_contents_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_cached_contents(**mock_args) @@ -4518,6 +4528,7 @@ def test_create_cached_content_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_cached_content(request) @@ -4637,6 +4648,7 @@ def test_create_cached_content_rest_call_success(request_type): }, "disable_attribution": True, }, + "google_search": {}, "google_search_retrieval": { "dynamic_retrieval_config": {"mode": 1, "dynamic_threshold": 0.1809} }, @@ -4751,6 +4763,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_cached_content(request) # Establish that the response is the type that we expect. @@ -4793,6 +4806,7 @@ def test_create_cached_content_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 = gca_cached_content.CachedContent.to_json( gca_cached_content.CachedContent() ) @@ -4839,6 +4853,7 @@ def test_get_cached_content_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_cached_content(request) @@ -4876,6 +4891,7 @@ def test_get_cached_content_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_cached_content(request) # Establish that the response is the type that we expect. @@ -4918,6 +4934,7 @@ def test_get_cached_content_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 = cached_content.CachedContent.to_json( cached_content.CachedContent() ) @@ -4968,6 +4985,7 @@ def test_update_cached_content_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_cached_content(request) @@ -5091,6 +5109,7 @@ def test_update_cached_content_rest_call_success(request_type): }, "disable_attribution": True, }, + "google_search": {}, "google_search_retrieval": { "dynamic_retrieval_config": {"mode": 1, "dynamic_threshold": 0.1809} }, @@ -5205,6 +5224,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_cached_content(request) # Establish that the response is the type that we expect. @@ -5247,6 +5267,7 @@ def test_update_cached_content_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 = gca_cached_content.CachedContent.to_json( gca_cached_content.CachedContent() ) @@ -5293,6 +5314,7 @@ def test_delete_cached_content_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_cached_content(request) @@ -5323,6 +5345,7 @@ def test_delete_cached_content_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_cached_content(request) # Establish that the response is the type that we expect. @@ -5359,6 +5382,7 @@ def test_delete_cached_content_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 = gen_ai_cache_service.DeleteCachedContentRequest() metadata = [ @@ -5399,6 +5423,7 @@ def test_list_cached_contents_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_cached_contents(request) @@ -5434,6 +5459,7 @@ def test_list_cached_contents_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_cached_contents(request) # Establish that the response is the type that we expect. @@ -5474,6 +5500,7 @@ def test_list_cached_contents_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 = gen_ai_cache_service.ListCachedContentsResponse.to_json( gen_ai_cache_service.ListCachedContentsResponse() ) @@ -5520,6 +5547,7 @@ def test_get_location_rest_bad_request(request_type=locations_pb2.GetLocationReq 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_location(request) @@ -5550,6 +5578,7 @@ def test_get_location_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_location(request) @@ -5578,6 +5607,7 @@ def test_list_locations_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_locations(request) @@ -5608,6 +5638,7 @@ def test_list_locations_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_locations(request) @@ -5639,6 +5670,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -5671,6 +5703,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -5702,6 +5735,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -5734,6 +5768,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -5765,6 +5800,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -5797,6 +5833,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -5827,6 +5864,7 @@ def test_cancel_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.cancel_operation(request) @@ -5857,6 +5895,7 @@ def test_cancel_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.cancel_operation(request) @@ -5887,6 +5926,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) @@ -5917,6 +5957,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) @@ -5947,6 +5988,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) @@ -5977,6 +6019,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) @@ -6007,6 +6050,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) @@ -6037,6 +6081,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) @@ -6067,6 +6112,7 @@ def test_wait_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.wait_operation(request) @@ -6097,6 +6143,7 @@ def test_wait_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.wait_operation(request) @@ -6257,6 +6304,7 @@ async def test_create_cached_content_rest_asyncio_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"} await client.create_cached_content(request) @@ -6381,6 +6429,7 @@ async def test_create_cached_content_rest_asyncio_call_success(request_type): }, "disable_attribution": True, }, + "google_search": {}, "google_search_retrieval": { "dynamic_retrieval_config": {"mode": 1, "dynamic_threshold": 0.1809} }, @@ -6497,6 +6546,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.create_cached_content(request) # Establish that the response is the type that we expect. @@ -6544,6 +6594,7 @@ async def test_create_cached_content_rest_asyncio_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 = gca_cached_content.CachedContent.to_json( gca_cached_content.CachedContent() ) @@ -6594,6 +6645,7 @@ async def test_get_cached_content_rest_asyncio_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"} await client.get_cached_content(request) @@ -6638,6 +6690,7 @@ async def test_get_cached_content_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_cached_content(request) # Establish that the response is the type that we expect. @@ -6685,6 +6738,7 @@ async def test_get_cached_content_rest_asyncio_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 = cached_content.CachedContent.to_json( cached_content.CachedContent() ) @@ -6739,6 +6793,7 @@ async def test_update_cached_content_rest_asyncio_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"} await client.update_cached_content(request) @@ -6867,6 +6922,7 @@ async def test_update_cached_content_rest_asyncio_call_success(request_type): }, "disable_attribution": True, }, + "google_search": {}, "google_search_retrieval": { "dynamic_retrieval_config": {"mode": 1, "dynamic_threshold": 0.1809} }, @@ -6983,6 +7039,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.update_cached_content(request) # Establish that the response is the type that we expect. @@ -7030,6 +7087,7 @@ async def test_update_cached_content_rest_asyncio_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 = gca_cached_content.CachedContent.to_json( gca_cached_content.CachedContent() ) @@ -7080,6 +7138,7 @@ async def test_delete_cached_content_rest_asyncio_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"} await client.delete_cached_content(request) @@ -7117,6 +7176,7 @@ async def test_delete_cached_content_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_cached_content(request) # Establish that the response is the type that we expect. @@ -7158,6 +7218,7 @@ async def test_delete_cached_content_rest_asyncio_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 = gen_ai_cache_service.DeleteCachedContentRequest() metadata = [ @@ -7202,6 +7263,7 @@ async def test_list_cached_contents_rest_asyncio_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"} await client.list_cached_contents(request) @@ -7244,6 +7306,7 @@ async def test_list_cached_contents_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_cached_contents(request) # Establish that the response is the type that we expect. @@ -7289,6 +7352,7 @@ async def test_list_cached_contents_rest_asyncio_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 = gen_ai_cache_service.ListCachedContentsResponse.to_json( gen_ai_cache_service.ListCachedContentsResponse() ) @@ -7341,6 +7405,7 @@ async def test_get_location_rest_asyncio_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"} await client.get_location(request) @@ -7378,6 +7443,7 @@ async def test_get_location_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_location(request) @@ -7410,6 +7476,7 @@ async def test_list_locations_rest_asyncio_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"} await client.list_locations(request) @@ -7447,6 +7514,7 @@ async def test_list_locations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_locations(request) @@ -7482,6 +7550,7 @@ async def test_get_iam_policy_rest_asyncio_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"} await client.get_iam_policy(request) @@ -7521,6 +7590,7 @@ async def test_get_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_iam_policy(request) @@ -7556,6 +7626,7 @@ async def test_set_iam_policy_rest_asyncio_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"} await client.set_iam_policy(request) @@ -7595,6 +7666,7 @@ async def test_set_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.set_iam_policy(request) @@ -7630,6 +7702,7 @@ async def test_test_iam_permissions_rest_asyncio_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"} await client.test_iam_permissions(request) @@ -7669,6 +7742,7 @@ async def test_test_iam_permissions_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.test_iam_permissions(request) @@ -7703,6 +7777,7 @@ async def test_cancel_operation_rest_asyncio_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"} await client.cancel_operation(request) @@ -7740,6 +7815,7 @@ async def test_cancel_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.cancel_operation(request) @@ -7774,6 +7850,7 @@ async def test_delete_operation_rest_asyncio_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"} await client.delete_operation(request) @@ -7811,6 +7888,7 @@ async def test_delete_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_operation(request) @@ -7845,6 +7923,7 @@ async def test_get_operation_rest_asyncio_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"} await client.get_operation(request) @@ -7882,6 +7961,7 @@ async def test_get_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_operation(request) @@ -7916,6 +7996,7 @@ async def test_list_operations_rest_asyncio_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"} await client.list_operations(request) @@ -7953,6 +8034,7 @@ async def test_list_operations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_operations(request) @@ -7987,6 +8069,7 @@ async def test_wait_operation_rest_asyncio_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"} await client.wait_operation(request) @@ -8024,6 +8107,7 @@ async def test_wait_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.wait_operation(request) diff --git a/tests/unit/gapic/aiplatform_v1beta1/test_gen_ai_tuning_service.py b/tests/unit/gapic/aiplatform_v1beta1/test_gen_ai_tuning_service.py index 9e07929474..22131479a0 100644 --- a/tests/unit/gapic/aiplatform_v1beta1/test_gen_ai_tuning_service.py +++ b/tests/unit/gapic/aiplatform_v1beta1/test_gen_ai_tuning_service.py @@ -3174,6 +3174,7 @@ def test_create_tuning_job_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_tuning_job(request) @@ -3228,6 +3229,7 @@ def test_create_tuning_job_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_tuning_job(**mock_args) @@ -3360,6 +3362,7 @@ def test_get_tuning_job_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_tuning_job(request) @@ -3407,6 +3410,7 @@ def test_get_tuning_job_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_tuning_job(**mock_args) @@ -3548,6 +3552,7 @@ def test_list_tuning_jobs_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_tuning_jobs(request) @@ -3602,6 +3607,7 @@ def test_list_tuning_jobs_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_tuning_jobs(**mock_args) @@ -3796,6 +3802,7 @@ def test_cancel_tuning_job_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.cancel_tuning_job(request) @@ -3841,6 +3848,7 @@ def test_cancel_tuning_job_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.cancel_tuning_job(**mock_args) @@ -3978,6 +3986,7 @@ def test_rebase_tuned_model_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.rebase_tuned_model(request) @@ -4030,6 +4039,7 @@ def test_rebase_tuned_model_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.rebase_tuned_model(**mock_args) @@ -4466,6 +4476,7 @@ def test_create_tuning_job_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_tuning_job(request) @@ -4712,6 +4723,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_tuning_job(request) # Establish that the response is the type that we expect. @@ -4758,6 +4770,7 @@ def test_create_tuning_job_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 = gca_tuning_job.TuningJob.to_json(gca_tuning_job.TuningJob()) req.return_value.content = return_value @@ -4802,6 +4815,7 @@ def test_get_tuning_job_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_tuning_job(request) @@ -4844,6 +4858,7 @@ def test_get_tuning_job_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_tuning_job(request) # Establish that the response is the type that we expect. @@ -4890,6 +4905,7 @@ def test_get_tuning_job_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 = tuning_job.TuningJob.to_json(tuning_job.TuningJob()) req.return_value.content = return_value @@ -4934,6 +4950,7 @@ def test_list_tuning_jobs_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_tuning_jobs(request) @@ -4969,6 +4986,7 @@ def test_list_tuning_jobs_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_tuning_jobs(request) # Establish that the response is the type that we expect. @@ -5009,6 +5027,7 @@ def test_list_tuning_jobs_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 = genai_tuning_service.ListTuningJobsResponse.to_json( genai_tuning_service.ListTuningJobsResponse() ) @@ -5055,6 +5074,7 @@ def test_cancel_tuning_job_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.cancel_tuning_job(request) @@ -5085,6 +5105,7 @@ def test_cancel_tuning_job_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.cancel_tuning_job(request) # Establish that the response is the type that we expect. @@ -5121,6 +5142,7 @@ def test_cancel_tuning_job_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 = genai_tuning_service.CancelTuningJobRequest() metadata = [ @@ -5161,6 +5183,7 @@ def test_rebase_tuned_model_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.rebase_tuned_model(request) @@ -5191,6 +5214,7 @@ def test_rebase_tuned_model_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.rebase_tuned_model(request) # Establish that the response is the type that we expect. @@ -5232,6 +5256,7 @@ def test_rebase_tuned_model_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 @@ -5276,6 +5301,7 @@ def test_get_location_rest_bad_request(request_type=locations_pb2.GetLocationReq 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_location(request) @@ -5306,6 +5332,7 @@ def test_get_location_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_location(request) @@ -5334,6 +5361,7 @@ def test_list_locations_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_locations(request) @@ -5364,6 +5392,7 @@ def test_list_locations_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_locations(request) @@ -5395,6 +5424,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -5427,6 +5457,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -5458,6 +5489,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -5490,6 +5522,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -5521,6 +5554,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -5553,6 +5587,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -5583,6 +5618,7 @@ def test_cancel_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.cancel_operation(request) @@ -5613,6 +5649,7 @@ def test_cancel_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.cancel_operation(request) @@ -5643,6 +5680,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) @@ -5673,6 +5711,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) @@ -5703,6 +5742,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) @@ -5733,6 +5773,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) @@ -5763,6 +5804,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) @@ -5793,6 +5835,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) @@ -5823,6 +5866,7 @@ def test_wait_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.wait_operation(request) @@ -5853,6 +5897,7 @@ def test_wait_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.wait_operation(request) @@ -6026,6 +6071,7 @@ async def test_create_tuning_job_rest_asyncio_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"} await client.create_tuning_job(request) @@ -6279,6 +6325,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.create_tuning_job(request) # Establish that the response is the type that we expect. @@ -6330,6 +6377,7 @@ async def test_create_tuning_job_rest_asyncio_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 = gca_tuning_job.TuningJob.to_json(gca_tuning_job.TuningJob()) req.return_value.read = mock.AsyncMock(return_value=return_value) @@ -6378,6 +6426,7 @@ async def test_get_tuning_job_rest_asyncio_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"} await client.get_tuning_job(request) @@ -6427,6 +6476,7 @@ async def test_get_tuning_job_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_tuning_job(request) # Establish that the response is the type that we expect. @@ -6478,6 +6528,7 @@ async def test_get_tuning_job_rest_asyncio_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 = tuning_job.TuningJob.to_json(tuning_job.TuningJob()) req.return_value.read = mock.AsyncMock(return_value=return_value) @@ -6526,6 +6577,7 @@ async def test_list_tuning_jobs_rest_asyncio_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"} await client.list_tuning_jobs(request) @@ -6568,6 +6620,7 @@ async def test_list_tuning_jobs_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_tuning_jobs(request) # Establish that the response is the type that we expect. @@ -6613,6 +6666,7 @@ async def test_list_tuning_jobs_rest_asyncio_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 = genai_tuning_service.ListTuningJobsResponse.to_json( genai_tuning_service.ListTuningJobsResponse() ) @@ -6663,6 +6717,7 @@ async def test_cancel_tuning_job_rest_asyncio_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"} await client.cancel_tuning_job(request) @@ -6700,6 +6755,7 @@ async def test_cancel_tuning_job_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.cancel_tuning_job(request) # Establish that the response is the type that we expect. @@ -6741,6 +6797,7 @@ async def test_cancel_tuning_job_rest_asyncio_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 = genai_tuning_service.CancelTuningJobRequest() metadata = [ @@ -6785,6 +6842,7 @@ async def test_rebase_tuned_model_rest_asyncio_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"} await client.rebase_tuned_model(request) @@ -6822,6 +6880,7 @@ async def test_rebase_tuned_model_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.rebase_tuned_model(request) # Establish that the response is the type that we expect. @@ -6868,6 +6927,7 @@ async def test_rebase_tuned_model_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -6918,6 +6978,7 @@ async def test_get_location_rest_asyncio_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"} await client.get_location(request) @@ -6955,6 +7016,7 @@ async def test_get_location_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_location(request) @@ -6987,6 +7049,7 @@ async def test_list_locations_rest_asyncio_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"} await client.list_locations(request) @@ -7024,6 +7087,7 @@ async def test_list_locations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_locations(request) @@ -7059,6 +7123,7 @@ async def test_get_iam_policy_rest_asyncio_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"} await client.get_iam_policy(request) @@ -7098,6 +7163,7 @@ async def test_get_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_iam_policy(request) @@ -7133,6 +7199,7 @@ async def test_set_iam_policy_rest_asyncio_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"} await client.set_iam_policy(request) @@ -7172,6 +7239,7 @@ async def test_set_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.set_iam_policy(request) @@ -7207,6 +7275,7 @@ async def test_test_iam_permissions_rest_asyncio_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"} await client.test_iam_permissions(request) @@ -7246,6 +7315,7 @@ async def test_test_iam_permissions_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.test_iam_permissions(request) @@ -7280,6 +7350,7 @@ async def test_cancel_operation_rest_asyncio_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"} await client.cancel_operation(request) @@ -7317,6 +7388,7 @@ async def test_cancel_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.cancel_operation(request) @@ -7351,6 +7423,7 @@ async def test_delete_operation_rest_asyncio_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"} await client.delete_operation(request) @@ -7388,6 +7461,7 @@ async def test_delete_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_operation(request) @@ -7422,6 +7496,7 @@ async def test_get_operation_rest_asyncio_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"} await client.get_operation(request) @@ -7459,6 +7534,7 @@ async def test_get_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_operation(request) @@ -7493,6 +7569,7 @@ async def test_list_operations_rest_asyncio_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"} await client.list_operations(request) @@ -7530,6 +7607,7 @@ async def test_list_operations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_operations(request) @@ -7564,6 +7642,7 @@ async def test_wait_operation_rest_asyncio_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"} await client.wait_operation(request) @@ -7601,6 +7680,7 @@ async def test_wait_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.wait_operation(request) diff --git a/tests/unit/gapic/aiplatform_v1beta1/test_index_endpoint_service.py b/tests/unit/gapic/aiplatform_v1beta1/test_index_endpoint_service.py index 7cb6154c7d..b6b7ba7f16 100644 --- a/tests/unit/gapic/aiplatform_v1beta1/test_index_endpoint_service.py +++ b/tests/unit/gapic/aiplatform_v1beta1/test_index_endpoint_service.py @@ -4313,6 +4313,7 @@ def test_create_index_endpoint_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_index_endpoint(request) @@ -4365,6 +4366,7 @@ def test_create_index_endpoint_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_index_endpoint(**mock_args) @@ -4501,6 +4503,7 @@ def test_get_index_endpoint_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_index_endpoint(request) @@ -4548,6 +4551,7 @@ def test_get_index_endpoint_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_index_endpoint(**mock_args) @@ -4694,6 +4698,7 @@ def test_list_index_endpoints_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_index_endpoints(request) @@ -4751,6 +4756,7 @@ def test_list_index_endpoints_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_index_endpoints(**mock_args) @@ -4949,6 +4955,7 @@ def test_update_index_endpoint_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_index_endpoint(request) @@ -5007,6 +5014,7 @@ def test_update_index_endpoint_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_index_endpoint(**mock_args) @@ -5145,6 +5153,7 @@ def test_delete_index_endpoint_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_index_endpoint(request) @@ -5190,6 +5199,7 @@ def test_delete_index_endpoint_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_index_endpoint(**mock_args) @@ -5323,6 +5333,7 @@ def test_deploy_index_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.deploy_index(request) @@ -5377,6 +5388,7 @@ def test_deploy_index_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.deploy_index(**mock_args) @@ -5515,6 +5527,7 @@ def test_undeploy_index_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.undeploy_index(request) @@ -5569,6 +5582,7 @@ def test_undeploy_index_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.undeploy_index(**mock_args) @@ -5708,6 +5722,7 @@ def test_mutate_deployed_index_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.mutate_deployed_index(request) @@ -5762,6 +5777,7 @@ def test_mutate_deployed_index_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.mutate_deployed_index(**mock_args) @@ -6356,6 +6372,7 @@ def test_create_index_endpoint_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_index_endpoint(request) @@ -6413,6 +6430,7 @@ def test_create_index_endpoint_rest_call_success(request_type): }, "min_replica_count": 1803, "max_replica_count": 1805, + "required_replica_count": 2344, "autoscaling_metric_specs": [ {"metric_name": "metric_name_value", "target": 647} ], @@ -6541,6 +6559,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_index_endpoint(request) # Establish that the response is the type that we expect. @@ -6582,6 +6601,7 @@ def test_create_index_endpoint_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 @@ -6626,6 +6646,7 @@ def test_get_index_endpoint_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_index_endpoint(request) @@ -6670,6 +6691,7 @@ def test_get_index_endpoint_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_index_endpoint(request) # Establish that the response is the type that we expect. @@ -6719,6 +6741,7 @@ def test_get_index_endpoint_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 = index_endpoint.IndexEndpoint.to_json( index_endpoint.IndexEndpoint() ) @@ -6765,6 +6788,7 @@ def test_list_index_endpoints_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_index_endpoints(request) @@ -6802,6 +6826,7 @@ def test_list_index_endpoints_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_index_endpoints(request) # Establish that the response is the type that we expect. @@ -6842,6 +6867,7 @@ def test_list_index_endpoints_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 = index_endpoint_service.ListIndexEndpointsResponse.to_json( index_endpoint_service.ListIndexEndpointsResponse() ) @@ -6892,6 +6918,7 @@ def test_update_index_endpoint_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_index_endpoint(request) @@ -6953,6 +6980,7 @@ def test_update_index_endpoint_rest_call_success(request_type): }, "min_replica_count": 1803, "max_replica_count": 1805, + "required_replica_count": 2344, "autoscaling_metric_specs": [ {"metric_name": "metric_name_value", "target": 647} ], @@ -7095,6 +7123,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_index_endpoint(request) # Establish that the response is the type that we expect. @@ -7144,6 +7173,7 @@ def test_update_index_endpoint_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 = gca_index_endpoint.IndexEndpoint.to_json( gca_index_endpoint.IndexEndpoint() ) @@ -7190,6 +7220,7 @@ def test_delete_index_endpoint_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_index_endpoint(request) @@ -7220,6 +7251,7 @@ def test_delete_index_endpoint_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_index_endpoint(request) # Establish that the response is the type that we expect. @@ -7261,6 +7293,7 @@ def test_delete_index_endpoint_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 @@ -7307,6 +7340,7 @@ def test_deploy_index_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.deploy_index(request) @@ -7339,6 +7373,7 @@ def test_deploy_index_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.deploy_index(request) # Establish that the response is the type that we expect. @@ -7380,6 +7415,7 @@ def test_deploy_index_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 @@ -7426,6 +7462,7 @@ def test_undeploy_index_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.undeploy_index(request) @@ -7458,6 +7495,7 @@ def test_undeploy_index_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.undeploy_index(request) # Establish that the response is the type that we expect. @@ -7499,6 +7537,7 @@ def test_undeploy_index_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 @@ -7545,6 +7584,7 @@ def test_mutate_deployed_index_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.mutate_deployed_index(request) @@ -7596,6 +7636,7 @@ def test_mutate_deployed_index_rest_call_success(request_type): }, "min_replica_count": 1803, "max_replica_count": 1805, + "required_replica_count": 2344, "autoscaling_metric_specs": [ {"metric_name": "metric_name_value", "target": 647} ], @@ -7699,6 +7740,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.mutate_deployed_index(request) # Establish that the response is the type that we expect. @@ -7740,6 +7782,7 @@ def test_mutate_deployed_index_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 @@ -7784,6 +7827,7 @@ def test_get_location_rest_bad_request(request_type=locations_pb2.GetLocationReq 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_location(request) @@ -7814,6 +7858,7 @@ def test_get_location_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_location(request) @@ -7842,6 +7887,7 @@ def test_list_locations_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_locations(request) @@ -7872,6 +7918,7 @@ def test_list_locations_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_locations(request) @@ -7903,6 +7950,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -7935,6 +7983,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -7966,6 +8015,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -7998,6 +8048,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -8029,6 +8080,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -8061,6 +8113,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -8091,6 +8144,7 @@ def test_cancel_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.cancel_operation(request) @@ -8121,6 +8175,7 @@ def test_cancel_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.cancel_operation(request) @@ -8151,6 +8206,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) @@ -8181,6 +8237,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) @@ -8211,6 +8268,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) @@ -8241,6 +8299,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) @@ -8271,6 +8330,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) @@ -8301,6 +8361,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) @@ -8331,6 +8392,7 @@ def test_wait_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.wait_operation(request) @@ -8361,6 +8423,7 @@ def test_wait_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.wait_operation(request) @@ -8600,6 +8663,7 @@ async def test_create_index_endpoint_rest_asyncio_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"} await client.create_index_endpoint(request) @@ -8662,6 +8726,7 @@ async def test_create_index_endpoint_rest_asyncio_call_success(request_type): }, "min_replica_count": 1803, "max_replica_count": 1805, + "required_replica_count": 2344, "autoscaling_metric_specs": [ {"metric_name": "metric_name_value", "target": 647} ], @@ -8792,6 +8857,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.create_index_endpoint(request) # Establish that the response is the type that we expect. @@ -8839,6 +8905,7 @@ async def test_create_index_endpoint_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -8887,6 +8954,7 @@ async def test_get_index_endpoint_rest_asyncio_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"} await client.get_index_endpoint(request) @@ -8938,6 +9006,7 @@ async def test_get_index_endpoint_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_index_endpoint(request) # Establish that the response is the type that we expect. @@ -8992,6 +9061,7 @@ async def test_get_index_endpoint_rest_asyncio_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 = index_endpoint.IndexEndpoint.to_json( index_endpoint.IndexEndpoint() ) @@ -9042,6 +9112,7 @@ async def test_list_index_endpoints_rest_asyncio_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"} await client.list_index_endpoints(request) @@ -9086,6 +9157,7 @@ async def test_list_index_endpoints_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_index_endpoints(request) # Establish that the response is the type that we expect. @@ -9131,6 +9203,7 @@ async def test_list_index_endpoints_rest_asyncio_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 = index_endpoint_service.ListIndexEndpointsResponse.to_json( index_endpoint_service.ListIndexEndpointsResponse() ) @@ -9185,6 +9258,7 @@ async def test_update_index_endpoint_rest_asyncio_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"} await client.update_index_endpoint(request) @@ -9251,6 +9325,7 @@ async def test_update_index_endpoint_rest_asyncio_call_success(request_type): }, "min_replica_count": 1803, "max_replica_count": 1805, + "required_replica_count": 2344, "autoscaling_metric_specs": [ {"metric_name": "metric_name_value", "target": 647} ], @@ -9395,6 +9470,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.update_index_endpoint(request) # Establish that the response is the type that we expect. @@ -9450,6 +9526,7 @@ async def test_update_index_endpoint_rest_asyncio_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 = gca_index_endpoint.IndexEndpoint.to_json( gca_index_endpoint.IndexEndpoint() ) @@ -9500,6 +9577,7 @@ async def test_delete_index_endpoint_rest_asyncio_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"} await client.delete_index_endpoint(request) @@ -9537,6 +9615,7 @@ async def test_delete_index_endpoint_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_index_endpoint(request) # Establish that the response is the type that we expect. @@ -9584,6 +9663,7 @@ async def test_delete_index_endpoint_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -9634,6 +9714,7 @@ async def test_deploy_index_rest_asyncio_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"} await client.deploy_index(request) @@ -9673,6 +9754,7 @@ async def test_deploy_index_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.deploy_index(request) # Establish that the response is the type that we expect. @@ -9719,6 +9801,7 @@ async def test_deploy_index_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -9769,6 +9852,7 @@ async def test_undeploy_index_rest_asyncio_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"} await client.undeploy_index(request) @@ -9808,6 +9892,7 @@ async def test_undeploy_index_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.undeploy_index(request) # Establish that the response is the type that we expect. @@ -9854,6 +9939,7 @@ async def test_undeploy_index_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -9904,6 +9990,7 @@ async def test_mutate_deployed_index_rest_asyncio_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"} await client.mutate_deployed_index(request) @@ -9960,6 +10047,7 @@ async def test_mutate_deployed_index_rest_asyncio_call_success(request_type): }, "min_replica_count": 1803, "max_replica_count": 1805, + "required_replica_count": 2344, "autoscaling_metric_specs": [ {"metric_name": "metric_name_value", "target": 647} ], @@ -10065,6 +10153,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.mutate_deployed_index(request) # Establish that the response is the type that we expect. @@ -10112,6 +10201,7 @@ async def test_mutate_deployed_index_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -10162,6 +10252,7 @@ async def test_get_location_rest_asyncio_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"} await client.get_location(request) @@ -10199,6 +10290,7 @@ async def test_get_location_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_location(request) @@ -10231,6 +10323,7 @@ async def test_list_locations_rest_asyncio_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"} await client.list_locations(request) @@ -10268,6 +10361,7 @@ async def test_list_locations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_locations(request) @@ -10303,6 +10397,7 @@ async def test_get_iam_policy_rest_asyncio_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"} await client.get_iam_policy(request) @@ -10342,6 +10437,7 @@ async def test_get_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_iam_policy(request) @@ -10377,6 +10473,7 @@ async def test_set_iam_policy_rest_asyncio_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"} await client.set_iam_policy(request) @@ -10416,6 +10513,7 @@ async def test_set_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.set_iam_policy(request) @@ -10451,6 +10549,7 @@ async def test_test_iam_permissions_rest_asyncio_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"} await client.test_iam_permissions(request) @@ -10490,6 +10589,7 @@ async def test_test_iam_permissions_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.test_iam_permissions(request) @@ -10524,6 +10624,7 @@ async def test_cancel_operation_rest_asyncio_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"} await client.cancel_operation(request) @@ -10561,6 +10662,7 @@ async def test_cancel_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.cancel_operation(request) @@ -10595,6 +10697,7 @@ async def test_delete_operation_rest_asyncio_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"} await client.delete_operation(request) @@ -10632,6 +10735,7 @@ async def test_delete_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_operation(request) @@ -10666,6 +10770,7 @@ async def test_get_operation_rest_asyncio_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"} await client.get_operation(request) @@ -10703,6 +10808,7 @@ async def test_get_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_operation(request) @@ -10737,6 +10843,7 @@ async def test_list_operations_rest_asyncio_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"} await client.list_operations(request) @@ -10774,6 +10881,7 @@ async def test_list_operations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_operations(request) @@ -10808,6 +10916,7 @@ async def test_wait_operation_rest_asyncio_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"} await client.wait_operation(request) @@ -10845,6 +10954,7 @@ async def test_wait_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.wait_operation(request) diff --git a/tests/unit/gapic/aiplatform_v1beta1/test_index_service.py b/tests/unit/gapic/aiplatform_v1beta1/test_index_service.py index 74b46bf004..a370e0df4f 100644 --- a/tests/unit/gapic/aiplatform_v1beta1/test_index_service.py +++ b/tests/unit/gapic/aiplatform_v1beta1/test_index_service.py @@ -3528,6 +3528,7 @@ def test_create_index_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_index(request) @@ -3580,6 +3581,7 @@ def test_create_index_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_index(**mock_args) @@ -3710,6 +3712,7 @@ def test_get_index_rest_required_fields(request_type=index_service.GetIndexReque 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_index(request) @@ -3755,6 +3758,7 @@ def test_get_index_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_index(**mock_args) @@ -3895,6 +3899,7 @@ def test_list_indexes_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_indexes(request) @@ -3950,6 +3955,7 @@ def test_list_indexes_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_indexes(**mock_args) @@ -4141,6 +4147,7 @@ def test_update_index_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_index(request) @@ -4187,6 +4194,7 @@ def test_update_index_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_index(**mock_args) @@ -4320,6 +4328,7 @@ def test_delete_index_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_index(request) @@ -4363,6 +4372,7 @@ def test_delete_index_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_index(**mock_args) @@ -4497,6 +4507,7 @@ def test_upsert_datapoints_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.upsert_datapoints(request) @@ -4619,6 +4630,7 @@ def test_remove_datapoints_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.remove_datapoints(request) @@ -5123,6 +5135,7 @@ def test_create_index_rest_bad_request(request_type=index_service.CreateIndexReq 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_index(request) @@ -5254,6 +5267,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_index(request) # Establish that the response is the type that we expect. @@ -5295,6 +5309,7 @@ def test_create_index_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 @@ -5337,6 +5352,7 @@ def test_get_index_rest_bad_request(request_type=index_service.GetIndexRequest): 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_index(request) @@ -5379,6 +5395,7 @@ def test_get_index_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_index(request) # Establish that the response is the type that we expect. @@ -5424,6 +5441,7 @@ def test_get_index_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 = index.Index.to_json(index.Index()) req.return_value.content = return_value @@ -5466,6 +5484,7 @@ def test_list_indexes_rest_bad_request(request_type=index_service.ListIndexesReq 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_indexes(request) @@ -5501,6 +5520,7 @@ def test_list_indexes_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_indexes(request) # Establish that the response is the type that we expect. @@ -5541,6 +5561,7 @@ def test_list_indexes_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 = index_service.ListIndexesResponse.to_json( index_service.ListIndexesResponse() ) @@ -5587,6 +5608,7 @@ def test_update_index_rest_bad_request(request_type=index_service.UpdateIndexReq 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_index(request) @@ -5720,6 +5742,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_index(request) # Establish that the response is the type that we expect. @@ -5761,6 +5784,7 @@ def test_update_index_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 @@ -5803,6 +5827,7 @@ def test_delete_index_rest_bad_request(request_type=index_service.DeleteIndexReq 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_index(request) @@ -5833,6 +5858,7 @@ def test_delete_index_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_index(request) # Establish that the response is the type that we expect. @@ -5874,6 +5900,7 @@ def test_delete_index_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 @@ -5918,6 +5945,7 @@ def test_upsert_datapoints_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.upsert_datapoints(request) @@ -5951,6 +5979,7 @@ def test_upsert_datapoints_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.upsert_datapoints(request) # Establish that the response is the type that we expect. @@ -5990,6 +6019,7 @@ def test_upsert_datapoints_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 = index_service.UpsertDatapointsResponse.to_json( index_service.UpsertDatapointsResponse() ) @@ -6036,6 +6066,7 @@ def test_remove_datapoints_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.remove_datapoints(request) @@ -6069,6 +6100,7 @@ def test_remove_datapoints_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.remove_datapoints(request) # Establish that the response is the type that we expect. @@ -6108,6 +6140,7 @@ def test_remove_datapoints_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 = index_service.RemoveDatapointsResponse.to_json( index_service.RemoveDatapointsResponse() ) @@ -6154,6 +6187,7 @@ def test_get_location_rest_bad_request(request_type=locations_pb2.GetLocationReq 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_location(request) @@ -6184,6 +6218,7 @@ def test_get_location_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_location(request) @@ -6212,6 +6247,7 @@ def test_list_locations_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_locations(request) @@ -6242,6 +6278,7 @@ def test_list_locations_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_locations(request) @@ -6273,6 +6310,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -6305,6 +6343,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -6336,6 +6375,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -6368,6 +6408,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -6399,6 +6440,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -6431,6 +6473,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -6461,6 +6504,7 @@ def test_cancel_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.cancel_operation(request) @@ -6491,6 +6535,7 @@ def test_cancel_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.cancel_operation(request) @@ -6521,6 +6566,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) @@ -6551,6 +6597,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) @@ -6581,6 +6628,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) @@ -6611,6 +6659,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) @@ -6641,6 +6690,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) @@ -6671,6 +6721,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) @@ -6701,6 +6752,7 @@ def test_wait_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.wait_operation(request) @@ -6731,6 +6783,7 @@ def test_wait_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.wait_operation(request) @@ -6942,6 +6995,7 @@ async def test_create_index_rest_asyncio_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"} await client.create_index(request) @@ -7080,6 +7134,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.create_index(request) # Establish that the response is the type that we expect. @@ -7126,6 +7181,7 @@ async def test_create_index_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -7174,6 +7230,7 @@ async def test_get_index_rest_asyncio_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"} await client.get_index(request) @@ -7223,6 +7280,7 @@ async def test_get_index_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_index(request) # Establish that the response is the type that we expect. @@ -7273,6 +7331,7 @@ async def test_get_index_rest_asyncio_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 = index.Index.to_json(index.Index()) req.return_value.read = mock.AsyncMock(return_value=return_value) @@ -7321,6 +7380,7 @@ async def test_list_indexes_rest_asyncio_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"} await client.list_indexes(request) @@ -7363,6 +7423,7 @@ async def test_list_indexes_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_indexes(request) # Establish that the response is the type that we expect. @@ -7408,6 +7469,7 @@ async def test_list_indexes_rest_asyncio_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 = index_service.ListIndexesResponse.to_json( index_service.ListIndexesResponse() ) @@ -7460,6 +7522,7 @@ async def test_update_index_rest_asyncio_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"} await client.update_index(request) @@ -7600,6 +7663,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.update_index(request) # Establish that the response is the type that we expect. @@ -7646,6 +7710,7 @@ async def test_update_index_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -7694,6 +7759,7 @@ async def test_delete_index_rest_asyncio_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"} await client.delete_index(request) @@ -7731,6 +7797,7 @@ async def test_delete_index_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_index(request) # Establish that the response is the type that we expect. @@ -7777,6 +7844,7 @@ async def test_delete_index_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -7825,6 +7893,7 @@ async def test_upsert_datapoints_rest_asyncio_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"} await client.upsert_datapoints(request) @@ -7865,6 +7934,7 @@ async def test_upsert_datapoints_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.upsert_datapoints(request) # Establish that the response is the type that we expect. @@ -7909,6 +7979,7 @@ async def test_upsert_datapoints_rest_asyncio_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 = index_service.UpsertDatapointsResponse.to_json( index_service.UpsertDatapointsResponse() ) @@ -7959,6 +8030,7 @@ async def test_remove_datapoints_rest_asyncio_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"} await client.remove_datapoints(request) @@ -7999,6 +8071,7 @@ async def test_remove_datapoints_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.remove_datapoints(request) # Establish that the response is the type that we expect. @@ -8043,6 +8116,7 @@ async def test_remove_datapoints_rest_asyncio_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 = index_service.RemoveDatapointsResponse.to_json( index_service.RemoveDatapointsResponse() ) @@ -8095,6 +8169,7 @@ async def test_get_location_rest_asyncio_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"} await client.get_location(request) @@ -8132,6 +8207,7 @@ async def test_get_location_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_location(request) @@ -8164,6 +8240,7 @@ async def test_list_locations_rest_asyncio_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"} await client.list_locations(request) @@ -8201,6 +8278,7 @@ async def test_list_locations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_locations(request) @@ -8236,6 +8314,7 @@ async def test_get_iam_policy_rest_asyncio_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"} await client.get_iam_policy(request) @@ -8275,6 +8354,7 @@ async def test_get_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_iam_policy(request) @@ -8310,6 +8390,7 @@ async def test_set_iam_policy_rest_asyncio_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"} await client.set_iam_policy(request) @@ -8349,6 +8430,7 @@ async def test_set_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.set_iam_policy(request) @@ -8384,6 +8466,7 @@ async def test_test_iam_permissions_rest_asyncio_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"} await client.test_iam_permissions(request) @@ -8423,6 +8506,7 @@ async def test_test_iam_permissions_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.test_iam_permissions(request) @@ -8457,6 +8541,7 @@ async def test_cancel_operation_rest_asyncio_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"} await client.cancel_operation(request) @@ -8494,6 +8579,7 @@ async def test_cancel_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.cancel_operation(request) @@ -8528,6 +8614,7 @@ async def test_delete_operation_rest_asyncio_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"} await client.delete_operation(request) @@ -8565,6 +8652,7 @@ async def test_delete_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_operation(request) @@ -8599,6 +8687,7 @@ async def test_get_operation_rest_asyncio_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"} await client.get_operation(request) @@ -8636,6 +8725,7 @@ async def test_get_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_operation(request) @@ -8670,6 +8760,7 @@ async def test_list_operations_rest_asyncio_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"} await client.list_operations(request) @@ -8707,6 +8798,7 @@ async def test_list_operations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_operations(request) @@ -8741,6 +8833,7 @@ async def test_wait_operation_rest_asyncio_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"} await client.wait_operation(request) @@ -8778,6 +8871,7 @@ async def test_wait_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.wait_operation(request) diff --git a/tests/unit/gapic/aiplatform_v1beta1/test_job_service.py b/tests/unit/gapic/aiplatform_v1beta1/test_job_service.py index 0584872d0a..5e70239ad2 100644 --- a/tests/unit/gapic/aiplatform_v1beta1/test_job_service.py +++ b/tests/unit/gapic/aiplatform_v1beta1/test_job_service.py @@ -15177,6 +15177,7 @@ def test_create_custom_job_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_custom_job(request) @@ -15231,6 +15232,7 @@ def test_create_custom_job_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_custom_job(**mock_args) @@ -15363,6 +15365,7 @@ def test_get_custom_job_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_custom_job(request) @@ -15410,6 +15413,7 @@ def test_get_custom_job_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_custom_job(**mock_args) @@ -15552,6 +15556,7 @@ def test_list_custom_jobs_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_custom_jobs(request) @@ -15607,6 +15612,7 @@ def test_list_custom_jobs_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_custom_jobs(**mock_args) @@ -15804,6 +15810,7 @@ def test_delete_custom_job_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_custom_job(request) @@ -15849,6 +15856,7 @@ def test_delete_custom_job_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_custom_job(**mock_args) @@ -15980,6 +15988,7 @@ def test_cancel_custom_job_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.cancel_custom_job(request) @@ -16025,6 +16034,7 @@ def test_cancel_custom_job_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.cancel_custom_job(**mock_args) @@ -16162,6 +16172,7 @@ def test_create_data_labeling_job_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_data_labeling_job(request) @@ -16216,6 +16227,7 @@ def test_create_data_labeling_job_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_data_labeling_job(**mock_args) @@ -16353,6 +16365,7 @@ def test_get_data_labeling_job_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_data_labeling_job(request) @@ -16400,6 +16413,7 @@ def test_get_data_labeling_job_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_data_labeling_job(**mock_args) @@ -16546,6 +16560,7 @@ def test_list_data_labeling_jobs_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_data_labeling_jobs(request) @@ -16602,6 +16617,7 @@ def test_list_data_labeling_jobs_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_data_labeling_jobs(**mock_args) @@ -16802,6 +16818,7 @@ def test_delete_data_labeling_job_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_data_labeling_job(request) @@ -16847,6 +16864,7 @@ def test_delete_data_labeling_job_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_data_labeling_job(**mock_args) @@ -16981,6 +16999,7 @@ def test_cancel_data_labeling_job_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.cancel_data_labeling_job(request) @@ -17026,6 +17045,7 @@ def test_cancel_data_labeling_job_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.cancel_data_labeling_job(**mock_args) @@ -17165,6 +17185,7 @@ def test_create_hyperparameter_tuning_job_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_hyperparameter_tuning_job(request) @@ -17225,6 +17246,7 @@ def test_create_hyperparameter_tuning_job_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_hyperparameter_tuning_job(**mock_args) @@ -17366,6 +17388,7 @@ def test_get_hyperparameter_tuning_job_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_hyperparameter_tuning_job(request) @@ -17417,6 +17440,7 @@ def test_get_hyperparameter_tuning_job_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_hyperparameter_tuning_job(**mock_args) @@ -17564,6 +17588,7 @@ def test_list_hyperparameter_tuning_jobs_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_hyperparameter_tuning_jobs(request) @@ -17621,6 +17646,7 @@ def test_list_hyperparameter_tuning_jobs_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_hyperparameter_tuning_jobs(**mock_args) @@ -17827,6 +17853,7 @@ def test_delete_hyperparameter_tuning_job_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_hyperparameter_tuning_job(request) @@ -17874,6 +17901,7 @@ def test_delete_hyperparameter_tuning_job_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_hyperparameter_tuning_job(**mock_args) @@ -18008,6 +18036,7 @@ def test_cancel_hyperparameter_tuning_job_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.cancel_hyperparameter_tuning_job(request) @@ -18055,6 +18084,7 @@ def test_cancel_hyperparameter_tuning_job_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.cancel_hyperparameter_tuning_job(**mock_args) @@ -18187,6 +18217,7 @@ def test_create_nas_job_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_nas_job(request) @@ -18241,6 +18272,7 @@ def test_create_nas_job_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_nas_job(**mock_args) @@ -18371,6 +18403,7 @@ def test_get_nas_job_rest_required_fields(request_type=job_service.GetNasJobRequ 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_nas_job(request) @@ -18416,6 +18449,7 @@ def test_get_nas_job_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_nas_job(**mock_args) @@ -18556,6 +18590,7 @@ def test_list_nas_jobs_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_nas_jobs(request) @@ -18611,6 +18646,7 @@ def test_list_nas_jobs_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_nas_jobs(**mock_args) @@ -18804,6 +18840,7 @@ def test_delete_nas_job_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_nas_job(request) @@ -18847,6 +18884,7 @@ def test_delete_nas_job_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_nas_job(**mock_args) @@ -18976,6 +19014,7 @@ def test_cancel_nas_job_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.cancel_nas_job(request) @@ -19019,6 +19058,7 @@ def test_cancel_nas_job_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.cancel_nas_job(**mock_args) @@ -19154,6 +19194,7 @@ def test_get_nas_trial_detail_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_nas_trial_detail(request) @@ -19201,6 +19242,7 @@ def test_get_nas_trial_detail_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_nas_trial_detail(**mock_args) @@ -19344,6 +19386,7 @@ def test_list_nas_trial_details_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_nas_trial_details(request) @@ -19399,6 +19442,7 @@ def test_list_nas_trial_details_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_nas_trial_details(**mock_args) @@ -19601,6 +19645,7 @@ def test_create_batch_prediction_job_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_batch_prediction_job(request) @@ -19657,6 +19702,7 @@ def test_create_batch_prediction_job_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_batch_prediction_job(**mock_args) @@ -19796,6 +19842,7 @@ def test_get_batch_prediction_job_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_batch_prediction_job(request) @@ -19843,6 +19890,7 @@ def test_get_batch_prediction_job_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_batch_prediction_job(**mock_args) @@ -19988,6 +20036,7 @@ def test_list_batch_prediction_jobs_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_batch_prediction_jobs(request) @@ -20043,6 +20092,7 @@ def test_list_batch_prediction_jobs_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_batch_prediction_jobs(**mock_args) @@ -20245,6 +20295,7 @@ def test_delete_batch_prediction_job_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_batch_prediction_job(request) @@ -20290,6 +20341,7 @@ def test_delete_batch_prediction_job_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_batch_prediction_job(**mock_args) @@ -20424,6 +20476,7 @@ def test_cancel_batch_prediction_job_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.cancel_batch_prediction_job(request) @@ -20469,6 +20522,7 @@ def test_cancel_batch_prediction_job_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.cancel_batch_prediction_job(**mock_args) @@ -20614,6 +20668,7 @@ def test_create_model_deployment_monitoring_job_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_model_deployment_monitoring_job(request) @@ -20678,6 +20733,7 @@ def test_create_model_deployment_monitoring_job_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_model_deployment_monitoring_job(**mock_args) @@ -20837,6 +20893,7 @@ def test_search_model_deployment_monitoring_stats_anomalies_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.search_model_deployment_monitoring_stats_anomalies( request @@ -20904,6 +20961,7 @@ def test_search_model_deployment_monitoring_stats_anomalies_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.search_model_deployment_monitoring_stats_anomalies(**mock_args) @@ -21126,6 +21184,7 @@ def test_get_model_deployment_monitoring_job_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_model_deployment_monitoring_job(request) @@ -21177,6 +21236,7 @@ def test_get_model_deployment_monitoring_job_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_model_deployment_monitoring_job(**mock_args) @@ -21330,6 +21390,7 @@ def test_list_model_deployment_monitoring_jobs_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_model_deployment_monitoring_jobs(request) @@ -21389,6 +21450,7 @@ def test_list_model_deployment_monitoring_jobs_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_model_deployment_monitoring_jobs(**mock_args) @@ -21599,6 +21661,7 @@ def test_update_model_deployment_monitoring_job_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_model_deployment_monitoring_job(request) @@ -21659,6 +21722,7 @@ def test_update_model_deployment_monitoring_job_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_model_deployment_monitoring_job(**mock_args) @@ -21805,6 +21869,7 @@ def test_delete_model_deployment_monitoring_job_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_model_deployment_monitoring_job(request) @@ -21852,6 +21917,7 @@ def test_delete_model_deployment_monitoring_job_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_model_deployment_monitoring_job(**mock_args) @@ -21992,6 +22058,7 @@ def test_pause_model_deployment_monitoring_job_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.pause_model_deployment_monitoring_job(request) @@ -22039,6 +22106,7 @@ def test_pause_model_deployment_monitoring_job_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.pause_model_deployment_monitoring_job(**mock_args) @@ -22179,6 +22247,7 @@ def test_resume_model_deployment_monitoring_job_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.resume_model_deployment_monitoring_job(request) @@ -22226,6 +22295,7 @@ def test_resume_model_deployment_monitoring_job_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.resume_model_deployment_monitoring_job(**mock_args) @@ -24248,6 +24318,7 @@ def test_create_custom_job_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_custom_job(request) @@ -24443,6 +24514,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_custom_job(request) # Establish that the response is the type that we expect. @@ -24487,6 +24559,7 @@ def test_create_custom_job_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 = gca_custom_job.CustomJob.to_json(gca_custom_job.CustomJob()) req.return_value.content = return_value @@ -24529,6 +24602,7 @@ def test_get_custom_job_rest_bad_request(request_type=job_service.GetCustomJobRe 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_custom_job(request) @@ -24568,6 +24642,7 @@ def test_get_custom_job_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_custom_job(request) # Establish that the response is the type that we expect. @@ -24612,6 +24687,7 @@ def test_get_custom_job_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 = custom_job.CustomJob.to_json(custom_job.CustomJob()) req.return_value.content = return_value @@ -24656,6 +24732,7 @@ def test_list_custom_jobs_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_custom_jobs(request) @@ -24691,6 +24768,7 @@ def test_list_custom_jobs_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_custom_jobs(request) # Establish that the response is the type that we expect. @@ -24731,6 +24809,7 @@ def test_list_custom_jobs_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 = job_service.ListCustomJobsResponse.to_json( job_service.ListCustomJobsResponse() ) @@ -24777,6 +24856,7 @@ def test_delete_custom_job_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_custom_job(request) @@ -24807,6 +24887,7 @@ def test_delete_custom_job_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_custom_job(request) # Establish that the response is the type that we expect. @@ -24848,6 +24929,7 @@ def test_delete_custom_job_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 @@ -24892,6 +24974,7 @@ def test_cancel_custom_job_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.cancel_custom_job(request) @@ -24922,6 +25005,7 @@ def test_cancel_custom_job_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.cancel_custom_job(request) # Establish that the response is the type that we expect. @@ -24958,6 +25042,7 @@ def test_cancel_custom_job_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 = job_service.CancelCustomJobRequest() metadata = [ @@ -24998,6 +25083,7 @@ def test_create_data_labeling_job_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_data_labeling_job(request) @@ -25159,6 +25245,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_data_labeling_job(request) # Establish that the response is the type that we expect. @@ -25207,6 +25294,7 @@ def test_create_data_labeling_job_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 = gca_data_labeling_job.DataLabelingJob.to_json( gca_data_labeling_job.DataLabelingJob() ) @@ -25255,6 +25343,7 @@ def test_get_data_labeling_job_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_data_labeling_job(request) @@ -25300,6 +25389,7 @@ def test_get_data_labeling_job_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_data_labeling_job(request) # Establish that the response is the type that we expect. @@ -25348,6 +25438,7 @@ def test_get_data_labeling_job_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 = data_labeling_job.DataLabelingJob.to_json( data_labeling_job.DataLabelingJob() ) @@ -25394,6 +25485,7 @@ def test_list_data_labeling_jobs_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_data_labeling_jobs(request) @@ -25429,6 +25521,7 @@ def test_list_data_labeling_jobs_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_data_labeling_jobs(request) # Establish that the response is the type that we expect. @@ -25469,6 +25562,7 @@ def test_list_data_labeling_jobs_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 = job_service.ListDataLabelingJobsResponse.to_json( job_service.ListDataLabelingJobsResponse() ) @@ -25517,6 +25611,7 @@ def test_delete_data_labeling_job_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_data_labeling_job(request) @@ -25549,6 +25644,7 @@ def test_delete_data_labeling_job_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_data_labeling_job(request) # Establish that the response is the type that we expect. @@ -25590,6 +25686,7 @@ def test_delete_data_labeling_job_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 @@ -25636,6 +25733,7 @@ def test_cancel_data_labeling_job_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.cancel_data_labeling_job(request) @@ -25668,6 +25766,7 @@ def test_cancel_data_labeling_job_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.cancel_data_labeling_job(request) # Establish that the response is the type that we expect. @@ -25704,6 +25803,7 @@ def test_cancel_data_labeling_job_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 = job_service.CancelDataLabelingJobRequest() metadata = [ @@ -25744,6 +25844,7 @@ def test_create_hyperparameter_tuning_job_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_hyperparameter_tuning_job(request) @@ -26069,6 +26170,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_hyperparameter_tuning_job(request) # Establish that the response is the type that we expect. @@ -26116,6 +26218,7 @@ def test_create_hyperparameter_tuning_job_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 = gca_hyperparameter_tuning_job.HyperparameterTuningJob.to_json( gca_hyperparameter_tuning_job.HyperparameterTuningJob() ) @@ -26164,6 +26267,7 @@ def test_get_hyperparameter_tuning_job_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_hyperparameter_tuning_job(request) @@ -26210,6 +26314,7 @@ def test_get_hyperparameter_tuning_job_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_hyperparameter_tuning_job(request) # Establish that the response is the type that we expect. @@ -26257,6 +26362,7 @@ def test_get_hyperparameter_tuning_job_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 = hyperparameter_tuning_job.HyperparameterTuningJob.to_json( hyperparameter_tuning_job.HyperparameterTuningJob() ) @@ -26303,6 +26409,7 @@ def test_list_hyperparameter_tuning_jobs_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_hyperparameter_tuning_jobs(request) @@ -26338,6 +26445,7 @@ def test_list_hyperparameter_tuning_jobs_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_hyperparameter_tuning_jobs(request) # Establish that the response is the type that we expect. @@ -26378,6 +26486,7 @@ def test_list_hyperparameter_tuning_jobs_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 = job_service.ListHyperparameterTuningJobsResponse.to_json( job_service.ListHyperparameterTuningJobsResponse() ) @@ -26426,6 +26535,7 @@ def test_delete_hyperparameter_tuning_job_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_hyperparameter_tuning_job(request) @@ -26458,6 +26568,7 @@ def test_delete_hyperparameter_tuning_job_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_hyperparameter_tuning_job(request) # Establish that the response is the type that we expect. @@ -26499,6 +26610,7 @@ def test_delete_hyperparameter_tuning_job_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 @@ -26545,6 +26657,7 @@ def test_cancel_hyperparameter_tuning_job_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.cancel_hyperparameter_tuning_job(request) @@ -26577,6 +26690,7 @@ def test_cancel_hyperparameter_tuning_job_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.cancel_hyperparameter_tuning_job(request) # Establish that the response is the type that we expect. @@ -26613,6 +26727,7 @@ def test_cancel_hyperparameter_tuning_job_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 = job_service.CancelHyperparameterTuningJobRequest() metadata = [ @@ -26651,6 +26766,7 @@ def test_create_nas_job_rest_bad_request(request_type=job_service.CreateNasJobRe 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_nas_job(request) @@ -26894,6 +27010,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_nas_job(request) # Establish that the response is the type that we expect. @@ -26939,6 +27056,7 @@ def test_create_nas_job_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 = gca_nas_job.NasJob.to_json(gca_nas_job.NasJob()) req.return_value.content = return_value @@ -26981,6 +27099,7 @@ def test_get_nas_job_rest_bad_request(request_type=job_service.GetNasJobRequest) 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_nas_job(request) @@ -27021,6 +27140,7 @@ def test_get_nas_job_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_nas_job(request) # Establish that the response is the type that we expect. @@ -27064,6 +27184,7 @@ def test_get_nas_job_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 = nas_job.NasJob.to_json(nas_job.NasJob()) req.return_value.content = return_value @@ -27106,6 +27227,7 @@ def test_list_nas_jobs_rest_bad_request(request_type=job_service.ListNasJobsRequ 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_nas_jobs(request) @@ -27141,6 +27263,7 @@ def test_list_nas_jobs_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_nas_jobs(request) # Establish that the response is the type that we expect. @@ -27179,6 +27302,7 @@ def test_list_nas_jobs_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 = job_service.ListNasJobsResponse.to_json( job_service.ListNasJobsResponse() ) @@ -27223,6 +27347,7 @@ def test_delete_nas_job_rest_bad_request(request_type=job_service.DeleteNasJobRe 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_nas_job(request) @@ -27253,6 +27378,7 @@ def test_delete_nas_job_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_nas_job(request) # Establish that the response is the type that we expect. @@ -27294,6 +27420,7 @@ def test_delete_nas_job_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 @@ -27336,6 +27463,7 @@ def test_cancel_nas_job_rest_bad_request(request_type=job_service.CancelNasJobRe 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.cancel_nas_job(request) @@ -27366,6 +27494,7 @@ def test_cancel_nas_job_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.cancel_nas_job(request) # Establish that the response is the type that we expect. @@ -27402,6 +27531,7 @@ def test_cancel_nas_job_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 = job_service.CancelNasJobRequest() metadata = [ @@ -27444,6 +27574,7 @@ def test_get_nas_trial_detail_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_nas_trial_detail(request) @@ -27482,6 +27613,7 @@ def test_get_nas_trial_detail_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_nas_trial_detail(request) # Establish that the response is the type that we expect. @@ -27523,6 +27655,7 @@ def test_get_nas_trial_detail_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 = nas_job.NasTrialDetail.to_json(nas_job.NasTrialDetail()) req.return_value.content = return_value @@ -27567,6 +27700,7 @@ def test_list_nas_trial_details_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_nas_trial_details(request) @@ -27602,6 +27736,7 @@ def test_list_nas_trial_details_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_nas_trial_details(request) # Establish that the response is the type that we expect. @@ -27642,6 +27777,7 @@ def test_list_nas_trial_details_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 = job_service.ListNasTrialDetailsResponse.to_json( job_service.ListNasTrialDetailsResponse() ) @@ -27688,6 +27824,7 @@ def test_create_batch_prediction_job_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_batch_prediction_job(request) @@ -28016,6 +28153,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_batch_prediction_job(request) # Establish that the response is the type that we expect. @@ -28065,6 +28203,7 @@ def test_create_batch_prediction_job_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 = gca_batch_prediction_job.BatchPredictionJob.to_json( gca_batch_prediction_job.BatchPredictionJob() ) @@ -28113,6 +28252,7 @@ def test_get_batch_prediction_job_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_batch_prediction_job(request) @@ -28159,6 +28299,7 @@ def test_get_batch_prediction_job_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_batch_prediction_job(request) # Establish that the response is the type that we expect. @@ -28208,6 +28349,7 @@ def test_get_batch_prediction_job_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 = batch_prediction_job.BatchPredictionJob.to_json( batch_prediction_job.BatchPredictionJob() ) @@ -28254,6 +28396,7 @@ def test_list_batch_prediction_jobs_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_batch_prediction_jobs(request) @@ -28289,6 +28432,7 @@ def test_list_batch_prediction_jobs_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_batch_prediction_jobs(request) # Establish that the response is the type that we expect. @@ -28329,6 +28473,7 @@ def test_list_batch_prediction_jobs_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 = job_service.ListBatchPredictionJobsResponse.to_json( job_service.ListBatchPredictionJobsResponse() ) @@ -28377,6 +28522,7 @@ def test_delete_batch_prediction_job_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_batch_prediction_job(request) @@ -28409,6 +28555,7 @@ def test_delete_batch_prediction_job_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_batch_prediction_job(request) # Establish that the response is the type that we expect. @@ -28450,6 +28597,7 @@ def test_delete_batch_prediction_job_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 @@ -28496,6 +28644,7 @@ def test_cancel_batch_prediction_job_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.cancel_batch_prediction_job(request) @@ -28528,6 +28677,7 @@ def test_cancel_batch_prediction_job_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.cancel_batch_prediction_job(request) # Establish that the response is the type that we expect. @@ -28564,6 +28714,7 @@ def test_cancel_batch_prediction_job_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 = job_service.CancelBatchPredictionJobRequest() metadata = [ @@ -28604,6 +28755,7 @@ def test_create_model_deployment_monitoring_job_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_model_deployment_monitoring_job(request) @@ -28826,6 +28978,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_model_deployment_monitoring_job(request) # Establish that the response is the type that we expect. @@ -28882,6 +29035,7 @@ def test_create_model_deployment_monitoring_job_rest_interceptors(null_intercept 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 = ( gca_model_deployment_monitoring_job.ModelDeploymentMonitoringJob.to_json( gca_model_deployment_monitoring_job.ModelDeploymentMonitoringJob() @@ -28934,6 +29088,7 @@ def test_search_model_deployment_monitoring_stats_anomalies_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.search_model_deployment_monitoring_stats_anomalies(request) @@ -28979,6 +29134,7 @@ def test_search_model_deployment_monitoring_stats_anomalies_rest_call_success( 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.search_model_deployment_monitoring_stats_anomalies(request) # Establish that the response is the type that we expect. @@ -29027,6 +29183,7 @@ def test_search_model_deployment_monitoring_stats_anomalies_rest_interceptors( 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 = ( job_service.SearchModelDeploymentMonitoringStatsAnomaliesResponse.to_json( job_service.SearchModelDeploymentMonitoringStatsAnomaliesResponse() @@ -29079,6 +29236,7 @@ def test_get_model_deployment_monitoring_job_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_model_deployment_monitoring_job(request) @@ -29127,6 +29285,7 @@ def test_get_model_deployment_monitoring_job_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_model_deployment_monitoring_job(request) # Establish that the response is the type that we expect. @@ -29181,6 +29340,7 @@ def test_get_model_deployment_monitoring_job_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 = ( model_deployment_monitoring_job.ModelDeploymentMonitoringJob.to_json( model_deployment_monitoring_job.ModelDeploymentMonitoringJob() @@ -29231,6 +29391,7 @@ def test_list_model_deployment_monitoring_jobs_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_model_deployment_monitoring_jobs(request) @@ -29268,6 +29429,7 @@ def test_list_model_deployment_monitoring_jobs_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_model_deployment_monitoring_jobs(request) # Establish that the response is the type that we expect. @@ -29310,6 +29472,7 @@ def test_list_model_deployment_monitoring_jobs_rest_interceptors(null_intercepto 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 = job_service.ListModelDeploymentMonitoringJobsResponse.to_json( job_service.ListModelDeploymentMonitoringJobsResponse() ) @@ -29360,6 +29523,7 @@ def test_update_model_deployment_monitoring_job_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_model_deployment_monitoring_job(request) @@ -29568,6 +29732,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_model_deployment_monitoring_job(request) # Establish that the response is the type that we expect. @@ -29611,6 +29776,7 @@ def test_update_model_deployment_monitoring_job_rest_interceptors(null_intercept 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 @@ -29657,6 +29823,7 @@ def test_delete_model_deployment_monitoring_job_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_model_deployment_monitoring_job(request) @@ -29689,6 +29856,7 @@ def test_delete_model_deployment_monitoring_job_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_model_deployment_monitoring_job(request) # Establish that the response is the type that we expect. @@ -29732,6 +29900,7 @@ def test_delete_model_deployment_monitoring_job_rest_interceptors(null_intercept 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 @@ -29778,6 +29947,7 @@ def test_pause_model_deployment_monitoring_job_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.pause_model_deployment_monitoring_job(request) @@ -29810,6 +29980,7 @@ def test_pause_model_deployment_monitoring_job_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.pause_model_deployment_monitoring_job(request) # Establish that the response is the type that we expect. @@ -29847,6 +30018,7 @@ def test_pause_model_deployment_monitoring_job_rest_interceptors(null_intercepto req.return_value = mock.Mock() req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} request = job_service.PauseModelDeploymentMonitoringJobRequest() metadata = [ @@ -29889,6 +30061,7 @@ def test_resume_model_deployment_monitoring_job_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.resume_model_deployment_monitoring_job(request) @@ -29921,6 +30094,7 @@ def test_resume_model_deployment_monitoring_job_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.resume_model_deployment_monitoring_job(request) # Establish that the response is the type that we expect. @@ -29958,6 +30132,7 @@ def test_resume_model_deployment_monitoring_job_rest_interceptors(null_intercept req.return_value = mock.Mock() req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} request = job_service.ResumeModelDeploymentMonitoringJobRequest() metadata = [ @@ -29998,6 +30173,7 @@ def test_get_location_rest_bad_request(request_type=locations_pb2.GetLocationReq 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_location(request) @@ -30028,6 +30204,7 @@ def test_get_location_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_location(request) @@ -30056,6 +30233,7 @@ def test_list_locations_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_locations(request) @@ -30086,6 +30264,7 @@ def test_list_locations_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_locations(request) @@ -30117,6 +30296,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -30149,6 +30329,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -30180,6 +30361,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -30212,6 +30394,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -30243,6 +30426,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -30275,6 +30459,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -30305,6 +30490,7 @@ def test_cancel_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.cancel_operation(request) @@ -30335,6 +30521,7 @@ def test_cancel_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.cancel_operation(request) @@ -30365,6 +30552,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) @@ -30395,6 +30583,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) @@ -30425,6 +30614,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) @@ -30455,6 +30645,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) @@ -30485,6 +30676,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) @@ -30515,6 +30707,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) @@ -30545,6 +30738,7 @@ def test_wait_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.wait_operation(request) @@ -30575,6 +30769,7 @@ def test_wait_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.wait_operation(request) @@ -31399,6 +31594,7 @@ async def test_create_custom_job_rest_asyncio_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"} await client.create_custom_job(request) @@ -31601,6 +31797,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.create_custom_job(request) # Establish that the response is the type that we expect. @@ -31650,6 +31847,7 @@ async def test_create_custom_job_rest_asyncio_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 = gca_custom_job.CustomJob.to_json(gca_custom_job.CustomJob()) req.return_value.read = mock.AsyncMock(return_value=return_value) @@ -31698,6 +31896,7 @@ async def test_get_custom_job_rest_asyncio_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"} await client.get_custom_job(request) @@ -31744,6 +31943,7 @@ async def test_get_custom_job_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_custom_job(request) # Establish that the response is the type that we expect. @@ -31793,6 +31993,7 @@ async def test_get_custom_job_rest_asyncio_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 = custom_job.CustomJob.to_json(custom_job.CustomJob()) req.return_value.read = mock.AsyncMock(return_value=return_value) @@ -31841,6 +32042,7 @@ async def test_list_custom_jobs_rest_asyncio_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"} await client.list_custom_jobs(request) @@ -31883,6 +32085,7 @@ async def test_list_custom_jobs_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_custom_jobs(request) # Establish that the response is the type that we expect. @@ -31928,6 +32131,7 @@ async def test_list_custom_jobs_rest_asyncio_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 = job_service.ListCustomJobsResponse.to_json( job_service.ListCustomJobsResponse() ) @@ -31978,6 +32182,7 @@ async def test_delete_custom_job_rest_asyncio_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"} await client.delete_custom_job(request) @@ -32015,6 +32220,7 @@ async def test_delete_custom_job_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_custom_job(request) # Establish that the response is the type that we expect. @@ -32061,6 +32267,7 @@ async def test_delete_custom_job_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -32109,6 +32316,7 @@ async def test_cancel_custom_job_rest_asyncio_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"} await client.cancel_custom_job(request) @@ -32146,6 +32354,7 @@ async def test_cancel_custom_job_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.cancel_custom_job(request) # Establish that the response is the type that we expect. @@ -32187,6 +32396,7 @@ async def test_cancel_custom_job_rest_asyncio_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 = job_service.CancelCustomJobRequest() metadata = [ @@ -32231,6 +32441,7 @@ async def test_create_data_labeling_job_rest_asyncio_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"} await client.create_data_labeling_job(request) @@ -32399,6 +32610,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.create_data_labeling_job(request) # Establish that the response is the type that we expect. @@ -32452,6 +32664,7 @@ async def test_create_data_labeling_job_rest_asyncio_interceptors(null_intercept 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 = gca_data_labeling_job.DataLabelingJob.to_json( gca_data_labeling_job.DataLabelingJob() ) @@ -32504,6 +32717,7 @@ async def test_get_data_labeling_job_rest_asyncio_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"} await client.get_data_labeling_job(request) @@ -32556,6 +32770,7 @@ async def test_get_data_labeling_job_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_data_labeling_job(request) # Establish that the response is the type that we expect. @@ -32609,6 +32824,7 @@ async def test_get_data_labeling_job_rest_asyncio_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 = data_labeling_job.DataLabelingJob.to_json( data_labeling_job.DataLabelingJob() ) @@ -32659,6 +32875,7 @@ async def test_list_data_labeling_jobs_rest_asyncio_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"} await client.list_data_labeling_jobs(request) @@ -32701,6 +32918,7 @@ async def test_list_data_labeling_jobs_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_data_labeling_jobs(request) # Establish that the response is the type that we expect. @@ -32746,6 +32964,7 @@ async def test_list_data_labeling_jobs_rest_asyncio_interceptors(null_intercepto 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 = job_service.ListDataLabelingJobsResponse.to_json( job_service.ListDataLabelingJobsResponse() ) @@ -32798,6 +33017,7 @@ async def test_delete_data_labeling_job_rest_asyncio_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"} await client.delete_data_labeling_job(request) @@ -32837,6 +33057,7 @@ async def test_delete_data_labeling_job_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_data_labeling_job(request) # Establish that the response is the type that we expect. @@ -32883,6 +33104,7 @@ async def test_delete_data_labeling_job_rest_asyncio_interceptors(null_intercept 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.read = mock.AsyncMock(return_value=return_value) @@ -32933,6 +33155,7 @@ async def test_cancel_data_labeling_job_rest_asyncio_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"} await client.cancel_data_labeling_job(request) @@ -32972,6 +33195,7 @@ async def test_cancel_data_labeling_job_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.cancel_data_labeling_job(request) # Establish that the response is the type that we expect. @@ -33013,6 +33237,7 @@ async def test_cancel_data_labeling_job_rest_asyncio_interceptors(null_intercept req.return_value = mock.Mock() req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} request = job_service.CancelDataLabelingJobRequest() metadata = [ @@ -33057,6 +33282,7 @@ async def test_create_hyperparameter_tuning_job_rest_asyncio_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"} await client.create_hyperparameter_tuning_job(request) @@ -33389,6 +33615,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.create_hyperparameter_tuning_job(request) # Establish that the response is the type that we expect. @@ -33445,6 +33672,7 @@ async def test_create_hyperparameter_tuning_job_rest_asyncio_interceptors( 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 = gca_hyperparameter_tuning_job.HyperparameterTuningJob.to_json( gca_hyperparameter_tuning_job.HyperparameterTuningJob() ) @@ -33497,6 +33725,7 @@ async def test_get_hyperparameter_tuning_job_rest_asyncio_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"} await client.get_hyperparameter_tuning_job(request) @@ -33550,6 +33779,7 @@ async def test_get_hyperparameter_tuning_job_rest_asyncio_call_success(request_t return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_hyperparameter_tuning_job(request) # Establish that the response is the type that we expect. @@ -33604,6 +33834,7 @@ async def test_get_hyperparameter_tuning_job_rest_asyncio_interceptors( 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 = hyperparameter_tuning_job.HyperparameterTuningJob.to_json( hyperparameter_tuning_job.HyperparameterTuningJob() ) @@ -33654,6 +33885,7 @@ async def test_list_hyperparameter_tuning_jobs_rest_asyncio_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"} await client.list_hyperparameter_tuning_jobs(request) @@ -33696,6 +33928,7 @@ async def test_list_hyperparameter_tuning_jobs_rest_asyncio_call_success(request return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_hyperparameter_tuning_jobs(request) # Establish that the response is the type that we expect. @@ -33744,6 +33977,7 @@ async def test_list_hyperparameter_tuning_jobs_rest_asyncio_interceptors( 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 = job_service.ListHyperparameterTuningJobsResponse.to_json( job_service.ListHyperparameterTuningJobsResponse() ) @@ -33796,6 +34030,7 @@ async def test_delete_hyperparameter_tuning_job_rest_asyncio_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"} await client.delete_hyperparameter_tuning_job(request) @@ -33835,6 +34070,7 @@ async def test_delete_hyperparameter_tuning_job_rest_asyncio_call_success(reques return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_hyperparameter_tuning_job(request) # Establish that the response is the type that we expect. @@ -33885,6 +34121,7 @@ async def test_delete_hyperparameter_tuning_job_rest_asyncio_interceptors( 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.read = mock.AsyncMock(return_value=return_value) @@ -33935,6 +34172,7 @@ async def test_cancel_hyperparameter_tuning_job_rest_asyncio_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"} await client.cancel_hyperparameter_tuning_job(request) @@ -33974,6 +34212,7 @@ async def test_cancel_hyperparameter_tuning_job_rest_asyncio_call_success(reques return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.cancel_hyperparameter_tuning_job(request) # Establish that the response is the type that we expect. @@ -34018,6 +34257,7 @@ async def test_cancel_hyperparameter_tuning_job_rest_asyncio_interceptors( req.return_value = mock.Mock() req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} request = job_service.CancelHyperparameterTuningJobRequest() metadata = [ @@ -34062,6 +34302,7 @@ async def test_create_nas_job_rest_asyncio_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"} await client.create_nas_job(request) @@ -34312,6 +34553,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.create_nas_job(request) # Establish that the response is the type that we expect. @@ -34362,6 +34604,7 @@ async def test_create_nas_job_rest_asyncio_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 = gca_nas_job.NasJob.to_json(gca_nas_job.NasJob()) req.return_value.read = mock.AsyncMock(return_value=return_value) @@ -34410,6 +34653,7 @@ async def test_get_nas_job_rest_asyncio_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"} await client.get_nas_job(request) @@ -34457,6 +34701,7 @@ async def test_get_nas_job_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_nas_job(request) # Establish that the response is the type that we expect. @@ -34505,6 +34750,7 @@ async def test_get_nas_job_rest_asyncio_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 = nas_job.NasJob.to_json(nas_job.NasJob()) req.return_value.read = mock.AsyncMock(return_value=return_value) @@ -34553,6 +34799,7 @@ async def test_list_nas_jobs_rest_asyncio_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"} await client.list_nas_jobs(request) @@ -34595,6 +34842,7 @@ async def test_list_nas_jobs_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_nas_jobs(request) # Establish that the response is the type that we expect. @@ -34638,6 +34886,7 @@ async def test_list_nas_jobs_rest_asyncio_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 = job_service.ListNasJobsResponse.to_json( job_service.ListNasJobsResponse() ) @@ -34688,6 +34937,7 @@ async def test_delete_nas_job_rest_asyncio_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"} await client.delete_nas_job(request) @@ -34725,6 +34975,7 @@ async def test_delete_nas_job_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_nas_job(request) # Establish that the response is the type that we expect. @@ -34771,6 +35022,7 @@ async def test_delete_nas_job_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -34819,6 +35071,7 @@ async def test_cancel_nas_job_rest_asyncio_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"} await client.cancel_nas_job(request) @@ -34856,6 +35109,7 @@ async def test_cancel_nas_job_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.cancel_nas_job(request) # Establish that the response is the type that we expect. @@ -34897,6 +35151,7 @@ async def test_cancel_nas_job_rest_asyncio_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 = job_service.CancelNasJobRequest() metadata = [ @@ -34943,6 +35198,7 @@ async def test_get_nas_trial_detail_rest_asyncio_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"} await client.get_nas_trial_detail(request) @@ -34988,6 +35244,7 @@ async def test_get_nas_trial_detail_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_nas_trial_detail(request) # Establish that the response is the type that we expect. @@ -35034,6 +35291,7 @@ async def test_get_nas_trial_detail_rest_asyncio_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 = nas_job.NasTrialDetail.to_json(nas_job.NasTrialDetail()) req.return_value.read = mock.AsyncMock(return_value=return_value) @@ -35082,6 +35340,7 @@ async def test_list_nas_trial_details_rest_asyncio_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"} await client.list_nas_trial_details(request) @@ -35124,6 +35383,7 @@ async def test_list_nas_trial_details_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_nas_trial_details(request) # Establish that the response is the type that we expect. @@ -35169,6 +35429,7 @@ async def test_list_nas_trial_details_rest_asyncio_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 = job_service.ListNasTrialDetailsResponse.to_json( job_service.ListNasTrialDetailsResponse() ) @@ -35219,6 +35480,7 @@ async def test_create_batch_prediction_job_rest_asyncio_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"} await client.create_batch_prediction_job(request) @@ -35554,6 +35816,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.create_batch_prediction_job(request) # Establish that the response is the type that we expect. @@ -35608,6 +35871,7 @@ async def test_create_batch_prediction_job_rest_asyncio_interceptors(null_interc 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 = gca_batch_prediction_job.BatchPredictionJob.to_json( gca_batch_prediction_job.BatchPredictionJob() ) @@ -35660,6 +35924,7 @@ async def test_get_batch_prediction_job_rest_asyncio_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"} await client.get_batch_prediction_job(request) @@ -35713,6 +35978,7 @@ async def test_get_batch_prediction_job_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_batch_prediction_job(request) # Establish that the response is the type that we expect. @@ -35767,6 +36033,7 @@ async def test_get_batch_prediction_job_rest_asyncio_interceptors(null_intercept 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 = batch_prediction_job.BatchPredictionJob.to_json( batch_prediction_job.BatchPredictionJob() ) @@ -35817,6 +36084,7 @@ async def test_list_batch_prediction_jobs_rest_asyncio_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"} await client.list_batch_prediction_jobs(request) @@ -35859,6 +36127,7 @@ async def test_list_batch_prediction_jobs_rest_asyncio_call_success(request_type return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_batch_prediction_jobs(request) # Establish that the response is the type that we expect. @@ -35904,6 +36173,7 @@ async def test_list_batch_prediction_jobs_rest_asyncio_interceptors(null_interce 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 = job_service.ListBatchPredictionJobsResponse.to_json( job_service.ListBatchPredictionJobsResponse() ) @@ -35956,6 +36226,7 @@ async def test_delete_batch_prediction_job_rest_asyncio_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"} await client.delete_batch_prediction_job(request) @@ -35995,6 +36266,7 @@ async def test_delete_batch_prediction_job_rest_asyncio_call_success(request_typ return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_batch_prediction_job(request) # Establish that the response is the type that we expect. @@ -36041,6 +36313,7 @@ async def test_delete_batch_prediction_job_rest_asyncio_interceptors(null_interc 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.read = mock.AsyncMock(return_value=return_value) @@ -36091,6 +36364,7 @@ async def test_cancel_batch_prediction_job_rest_asyncio_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"} await client.cancel_batch_prediction_job(request) @@ -36130,6 +36404,7 @@ async def test_cancel_batch_prediction_job_rest_asyncio_call_success(request_typ return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.cancel_batch_prediction_job(request) # Establish that the response is the type that we expect. @@ -36171,6 +36446,7 @@ async def test_cancel_batch_prediction_job_rest_asyncio_interceptors(null_interc req.return_value = mock.Mock() req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} request = job_service.CancelBatchPredictionJobRequest() metadata = [ @@ -36215,6 +36491,7 @@ async def test_create_model_deployment_monitoring_job_rest_asyncio_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"} await client.create_model_deployment_monitoring_job(request) @@ -36446,6 +36723,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.create_model_deployment_monitoring_job(request) # Establish that the response is the type that we expect. @@ -36509,6 +36787,7 @@ async def test_create_model_deployment_monitoring_job_rest_asyncio_interceptors( 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 = ( gca_model_deployment_monitoring_job.ModelDeploymentMonitoringJob.to_json( gca_model_deployment_monitoring_job.ModelDeploymentMonitoringJob() @@ -36565,6 +36844,7 @@ async def test_search_model_deployment_monitoring_stats_anomalies_rest_asyncio_b 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"} await client.search_model_deployment_monitoring_stats_anomalies(request) @@ -36617,6 +36897,7 @@ async def test_search_model_deployment_monitoring_stats_anomalies_rest_asyncio_c return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.search_model_deployment_monitoring_stats_anomalies( request ) @@ -36672,6 +36953,7 @@ async def test_search_model_deployment_monitoring_stats_anomalies_rest_asyncio_i 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 = ( job_service.SearchModelDeploymentMonitoringStatsAnomaliesResponse.to_json( job_service.SearchModelDeploymentMonitoringStatsAnomaliesResponse() @@ -36728,6 +37010,7 @@ async def test_get_model_deployment_monitoring_job_rest_asyncio_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"} await client.get_model_deployment_monitoring_job(request) @@ -36785,6 +37068,7 @@ async def test_get_model_deployment_monitoring_job_rest_asyncio_call_success( return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_model_deployment_monitoring_job(request) # Establish that the response is the type that we expect. @@ -36848,6 +37132,7 @@ async def test_get_model_deployment_monitoring_job_rest_asyncio_interceptors( 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 = ( model_deployment_monitoring_job.ModelDeploymentMonitoringJob.to_json( model_deployment_monitoring_job.ModelDeploymentMonitoringJob() @@ -36902,6 +37187,7 @@ async def test_list_model_deployment_monitoring_jobs_rest_asyncio_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"} await client.list_model_deployment_monitoring_jobs(request) @@ -36948,6 +37234,7 @@ async def test_list_model_deployment_monitoring_jobs_rest_asyncio_call_success( return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_model_deployment_monitoring_jobs(request) # Establish that the response is the type that we expect. @@ -36997,6 +37284,7 @@ async def test_list_model_deployment_monitoring_jobs_rest_asyncio_interceptors( 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 = job_service.ListModelDeploymentMonitoringJobsResponse.to_json( job_service.ListModelDeploymentMonitoringJobsResponse() ) @@ -37051,6 +37339,7 @@ async def test_update_model_deployment_monitoring_job_rest_asyncio_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"} await client.update_model_deployment_monitoring_job(request) @@ -37268,6 +37557,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.update_model_deployment_monitoring_job(request) # Establish that the response is the type that we expect. @@ -37318,6 +37608,7 @@ async def test_update_model_deployment_monitoring_job_rest_asyncio_interceptors( 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.read = mock.AsyncMock(return_value=return_value) @@ -37368,6 +37659,7 @@ async def test_delete_model_deployment_monitoring_job_rest_asyncio_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"} await client.delete_model_deployment_monitoring_job(request) @@ -37409,6 +37701,7 @@ async def test_delete_model_deployment_monitoring_job_rest_asyncio_call_success( return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_model_deployment_monitoring_job(request) # Establish that the response is the type that we expect. @@ -37459,6 +37752,7 @@ async def test_delete_model_deployment_monitoring_job_rest_asyncio_interceptors( 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.read = mock.AsyncMock(return_value=return_value) @@ -37509,6 +37803,7 @@ async def test_pause_model_deployment_monitoring_job_rest_asyncio_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"} await client.pause_model_deployment_monitoring_job(request) @@ -37550,6 +37845,7 @@ async def test_pause_model_deployment_monitoring_job_rest_asyncio_call_success( return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.pause_model_deployment_monitoring_job(request) # Establish that the response is the type that we expect. @@ -37594,6 +37890,7 @@ async def test_pause_model_deployment_monitoring_job_rest_asyncio_interceptors( req.return_value = mock.Mock() req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} request = job_service.PauseModelDeploymentMonitoringJobRequest() metadata = [ @@ -37640,6 +37937,7 @@ async def test_resume_model_deployment_monitoring_job_rest_asyncio_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"} await client.resume_model_deployment_monitoring_job(request) @@ -37681,6 +37979,7 @@ async def test_resume_model_deployment_monitoring_job_rest_asyncio_call_success( return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.resume_model_deployment_monitoring_job(request) # Establish that the response is the type that we expect. @@ -37725,6 +38024,7 @@ async def test_resume_model_deployment_monitoring_job_rest_asyncio_interceptors( req.return_value = mock.Mock() req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} request = job_service.ResumeModelDeploymentMonitoringJobRequest() metadata = [ @@ -37771,6 +38071,7 @@ async def test_get_location_rest_asyncio_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"} await client.get_location(request) @@ -37808,6 +38109,7 @@ async def test_get_location_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_location(request) @@ -37840,6 +38142,7 @@ async def test_list_locations_rest_asyncio_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"} await client.list_locations(request) @@ -37877,6 +38180,7 @@ async def test_list_locations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_locations(request) @@ -37912,6 +38216,7 @@ async def test_get_iam_policy_rest_asyncio_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"} await client.get_iam_policy(request) @@ -37951,6 +38256,7 @@ async def test_get_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_iam_policy(request) @@ -37986,6 +38292,7 @@ async def test_set_iam_policy_rest_asyncio_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"} await client.set_iam_policy(request) @@ -38025,6 +38332,7 @@ async def test_set_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.set_iam_policy(request) @@ -38060,6 +38368,7 @@ async def test_test_iam_permissions_rest_asyncio_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"} await client.test_iam_permissions(request) @@ -38099,6 +38408,7 @@ async def test_test_iam_permissions_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.test_iam_permissions(request) @@ -38133,6 +38443,7 @@ async def test_cancel_operation_rest_asyncio_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"} await client.cancel_operation(request) @@ -38170,6 +38481,7 @@ async def test_cancel_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.cancel_operation(request) @@ -38204,6 +38516,7 @@ async def test_delete_operation_rest_asyncio_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"} await client.delete_operation(request) @@ -38241,6 +38554,7 @@ async def test_delete_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_operation(request) @@ -38275,6 +38589,7 @@ async def test_get_operation_rest_asyncio_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"} await client.get_operation(request) @@ -38312,6 +38627,7 @@ async def test_get_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_operation(request) @@ -38346,6 +38662,7 @@ async def test_list_operations_rest_asyncio_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"} await client.list_operations(request) @@ -38383,6 +38700,7 @@ async def test_list_operations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_operations(request) @@ -38417,6 +38735,7 @@ async def test_wait_operation_rest_asyncio_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"} await client.wait_operation(request) @@ -38454,6 +38773,7 @@ async def test_wait_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.wait_operation(request) diff --git a/tests/unit/gapic/aiplatform_v1beta1/test_llm_utility_service.py b/tests/unit/gapic/aiplatform_v1beta1/test_llm_utility_service.py index 0ddcbd01ee..dbda418ab7 100644 --- a/tests/unit/gapic/aiplatform_v1beta1/test_llm_utility_service.py +++ b/tests/unit/gapic/aiplatform_v1beta1/test_llm_utility_service.py @@ -1553,6 +1553,7 @@ def test_compute_tokens_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.compute_tokens(request) @@ -1601,6 +1602,7 @@ def test_compute_tokens_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.compute_tokens(**mock_args) @@ -1825,6 +1827,7 @@ def test_compute_tokens_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.compute_tokens(request) @@ -1858,6 +1861,7 @@ def test_compute_tokens_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.compute_tokens(request) # Establish that the response is the type that we expect. @@ -1897,6 +1901,7 @@ def test_compute_tokens_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 = llm_utility_service.ComputeTokensResponse.to_json( llm_utility_service.ComputeTokensResponse() ) @@ -1943,6 +1948,7 @@ def test_get_location_rest_bad_request(request_type=locations_pb2.GetLocationReq 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_location(request) @@ -1973,6 +1979,7 @@ def test_get_location_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_location(request) @@ -2001,6 +2008,7 @@ def test_list_locations_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_locations(request) @@ -2031,6 +2039,7 @@ def test_list_locations_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_locations(request) @@ -2062,6 +2071,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -2094,6 +2104,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -2125,6 +2136,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -2157,6 +2169,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -2188,6 +2201,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -2220,6 +2234,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -2250,6 +2265,7 @@ def test_cancel_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.cancel_operation(request) @@ -2280,6 +2296,7 @@ def test_cancel_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.cancel_operation(request) @@ -2310,6 +2327,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) @@ -2340,6 +2358,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) @@ -2370,6 +2389,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) @@ -2400,6 +2420,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) @@ -2430,6 +2451,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) @@ -2460,6 +2482,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) @@ -2490,6 +2513,7 @@ def test_wait_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.wait_operation(request) @@ -2520,6 +2544,7 @@ def test_wait_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.wait_operation(request) @@ -2590,6 +2615,7 @@ async def test_compute_tokens_rest_asyncio_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"} await client.compute_tokens(request) @@ -2630,6 +2656,7 @@ async def test_compute_tokens_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.compute_tokens(request) # Establish that the response is the type that we expect. @@ -2674,6 +2701,7 @@ async def test_compute_tokens_rest_asyncio_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 = llm_utility_service.ComputeTokensResponse.to_json( llm_utility_service.ComputeTokensResponse() ) @@ -2726,6 +2754,7 @@ async def test_get_location_rest_asyncio_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"} await client.get_location(request) @@ -2763,6 +2792,7 @@ async def test_get_location_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_location(request) @@ -2795,6 +2825,7 @@ async def test_list_locations_rest_asyncio_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"} await client.list_locations(request) @@ -2832,6 +2863,7 @@ async def test_list_locations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_locations(request) @@ -2867,6 +2899,7 @@ async def test_get_iam_policy_rest_asyncio_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"} await client.get_iam_policy(request) @@ -2906,6 +2939,7 @@ async def test_get_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_iam_policy(request) @@ -2941,6 +2975,7 @@ async def test_set_iam_policy_rest_asyncio_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"} await client.set_iam_policy(request) @@ -2980,6 +3015,7 @@ async def test_set_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.set_iam_policy(request) @@ -3015,6 +3051,7 @@ async def test_test_iam_permissions_rest_asyncio_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"} await client.test_iam_permissions(request) @@ -3054,6 +3091,7 @@ async def test_test_iam_permissions_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.test_iam_permissions(request) @@ -3088,6 +3126,7 @@ async def test_cancel_operation_rest_asyncio_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"} await client.cancel_operation(request) @@ -3125,6 +3164,7 @@ async def test_cancel_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.cancel_operation(request) @@ -3159,6 +3199,7 @@ async def test_delete_operation_rest_asyncio_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"} await client.delete_operation(request) @@ -3196,6 +3237,7 @@ async def test_delete_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_operation(request) @@ -3230,6 +3272,7 @@ async def test_get_operation_rest_asyncio_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"} await client.get_operation(request) @@ -3267,6 +3310,7 @@ async def test_get_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_operation(request) @@ -3301,6 +3345,7 @@ async def test_list_operations_rest_asyncio_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"} await client.list_operations(request) @@ -3338,6 +3383,7 @@ async def test_list_operations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_operations(request) @@ -3372,6 +3418,7 @@ async def test_wait_operation_rest_asyncio_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"} await client.wait_operation(request) @@ -3409,6 +3456,7 @@ async def test_wait_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.wait_operation(request) diff --git a/tests/unit/gapic/aiplatform_v1beta1/test_match_service.py b/tests/unit/gapic/aiplatform_v1beta1/test_match_service.py index eff7126aea..85353fcbb8 100644 --- a/tests/unit/gapic/aiplatform_v1beta1/test_match_service.py +++ b/tests/unit/gapic/aiplatform_v1beta1/test_match_service.py @@ -1647,6 +1647,7 @@ def test_find_neighbors_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.find_neighbors(request) @@ -1772,6 +1773,7 @@ def test_read_index_datapoints_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.read_index_datapoints(request) @@ -2035,6 +2037,7 @@ def test_find_neighbors_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.find_neighbors(request) @@ -2070,6 +2073,7 @@ def test_find_neighbors_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.find_neighbors(request) # Establish that the response is the type that we expect. @@ -2109,6 +2113,7 @@ def test_find_neighbors_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 = match_service.FindNeighborsResponse.to_json( match_service.FindNeighborsResponse() ) @@ -2157,6 +2162,7 @@ def test_read_index_datapoints_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.read_index_datapoints(request) @@ -2192,6 +2198,7 @@ def test_read_index_datapoints_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.read_index_datapoints(request) # Establish that the response is the type that we expect. @@ -2231,6 +2238,7 @@ def test_read_index_datapoints_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 = match_service.ReadIndexDatapointsResponse.to_json( match_service.ReadIndexDatapointsResponse() ) @@ -2277,6 +2285,7 @@ def test_get_location_rest_bad_request(request_type=locations_pb2.GetLocationReq 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_location(request) @@ -2307,6 +2316,7 @@ def test_get_location_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_location(request) @@ -2335,6 +2345,7 @@ def test_list_locations_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_locations(request) @@ -2365,6 +2376,7 @@ def test_list_locations_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_locations(request) @@ -2396,6 +2408,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -2428,6 +2441,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -2459,6 +2473,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -2491,6 +2506,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -2522,6 +2538,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -2554,6 +2571,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -2584,6 +2602,7 @@ def test_cancel_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.cancel_operation(request) @@ -2614,6 +2633,7 @@ def test_cancel_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.cancel_operation(request) @@ -2644,6 +2664,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) @@ -2674,6 +2695,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) @@ -2704,6 +2726,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) @@ -2734,6 +2757,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) @@ -2764,6 +2788,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) @@ -2794,6 +2819,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) @@ -2824,6 +2850,7 @@ def test_wait_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.wait_operation(request) @@ -2854,6 +2881,7 @@ def test_wait_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.wait_operation(request) @@ -2948,6 +2976,7 @@ async def test_find_neighbors_rest_asyncio_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"} await client.find_neighbors(request) @@ -2990,6 +3019,7 @@ async def test_find_neighbors_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.find_neighbors(request) # Establish that the response is the type that we expect. @@ -3034,6 +3064,7 @@ async def test_find_neighbors_rest_asyncio_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 = match_service.FindNeighborsResponse.to_json( match_service.FindNeighborsResponse() ) @@ -3086,6 +3117,7 @@ async def test_read_index_datapoints_rest_asyncio_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"} await client.read_index_datapoints(request) @@ -3128,6 +3160,7 @@ async def test_read_index_datapoints_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.read_index_datapoints(request) # Establish that the response is the type that we expect. @@ -3172,6 +3205,7 @@ async def test_read_index_datapoints_rest_asyncio_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 = match_service.ReadIndexDatapointsResponse.to_json( match_service.ReadIndexDatapointsResponse() ) @@ -3224,6 +3258,7 @@ async def test_get_location_rest_asyncio_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"} await client.get_location(request) @@ -3261,6 +3296,7 @@ async def test_get_location_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_location(request) @@ -3293,6 +3329,7 @@ async def test_list_locations_rest_asyncio_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"} await client.list_locations(request) @@ -3330,6 +3367,7 @@ async def test_list_locations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_locations(request) @@ -3365,6 +3403,7 @@ async def test_get_iam_policy_rest_asyncio_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"} await client.get_iam_policy(request) @@ -3404,6 +3443,7 @@ async def test_get_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_iam_policy(request) @@ -3439,6 +3479,7 @@ async def test_set_iam_policy_rest_asyncio_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"} await client.set_iam_policy(request) @@ -3478,6 +3519,7 @@ async def test_set_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.set_iam_policy(request) @@ -3513,6 +3555,7 @@ async def test_test_iam_permissions_rest_asyncio_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"} await client.test_iam_permissions(request) @@ -3552,6 +3595,7 @@ async def test_test_iam_permissions_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.test_iam_permissions(request) @@ -3586,6 +3630,7 @@ async def test_cancel_operation_rest_asyncio_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"} await client.cancel_operation(request) @@ -3623,6 +3668,7 @@ async def test_cancel_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.cancel_operation(request) @@ -3657,6 +3703,7 @@ async def test_delete_operation_rest_asyncio_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"} await client.delete_operation(request) @@ -3694,6 +3741,7 @@ async def test_delete_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_operation(request) @@ -3728,6 +3776,7 @@ async def test_get_operation_rest_asyncio_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"} await client.get_operation(request) @@ -3765,6 +3814,7 @@ async def test_get_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_operation(request) @@ -3799,6 +3849,7 @@ async def test_list_operations_rest_asyncio_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"} await client.list_operations(request) @@ -3836,6 +3887,7 @@ async def test_list_operations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_operations(request) @@ -3870,6 +3922,7 @@ async def test_wait_operation_rest_asyncio_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"} await client.wait_operation(request) @@ -3907,6 +3960,7 @@ async def test_wait_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.wait_operation(request) diff --git a/tests/unit/gapic/aiplatform_v1beta1/test_metadata_service.py b/tests/unit/gapic/aiplatform_v1beta1/test_metadata_service.py index 18534ff617..744ef459a2 100644 --- a/tests/unit/gapic/aiplatform_v1beta1/test_metadata_service.py +++ b/tests/unit/gapic/aiplatform_v1beta1/test_metadata_service.py @@ -13311,6 +13311,7 @@ def test_create_metadata_store_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_metadata_store(request) @@ -13364,6 +13365,7 @@ def test_create_metadata_store_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_metadata_store(**mock_args) @@ -13501,6 +13503,7 @@ def test_get_metadata_store_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_metadata_store(request) @@ -13548,6 +13551,7 @@ def test_get_metadata_store_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_metadata_store(**mock_args) @@ -13690,6 +13694,7 @@ def test_list_metadata_stores_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_metadata_stores(request) @@ -13743,6 +13748,7 @@ def test_list_metadata_stores_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_metadata_stores(**mock_args) @@ -13945,6 +13951,7 @@ def test_delete_metadata_store_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_metadata_store(request) @@ -13990,6 +13997,7 @@ def test_delete_metadata_store_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_metadata_store(**mock_args) @@ -14124,6 +14132,7 @@ def test_create_artifact_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_artifact(request) @@ -14181,6 +14190,7 @@ def test_create_artifact_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_artifact(**mock_args) @@ -14314,6 +14324,7 @@ def test_get_artifact_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_artifact(request) @@ -14361,6 +14372,7 @@ def test_get_artifact_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_artifact(**mock_args) @@ -14501,6 +14513,7 @@ def test_list_artifacts_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_artifacts(request) @@ -14558,6 +14571,7 @@ def test_list_artifacts_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_artifacts(**mock_args) @@ -14757,6 +14771,7 @@ def test_update_artifact_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_artifact(request) @@ -14815,6 +14830,7 @@ def test_update_artifact_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_artifact(**mock_args) @@ -14950,6 +14966,7 @@ def test_delete_artifact_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_artifact(request) @@ -14995,6 +15012,7 @@ def test_delete_artifact_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_artifact(**mock_args) @@ -15132,6 +15150,7 @@ def test_purge_artifacts_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.purge_artifacts(request) @@ -15185,6 +15204,7 @@ def test_purge_artifacts_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.purge_artifacts(**mock_args) @@ -15319,6 +15339,7 @@ def test_create_context_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_context(request) @@ -15376,6 +15397,7 @@ def test_create_context_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_context(**mock_args) @@ -15509,6 +15531,7 @@ def test_get_context_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_context(request) @@ -15556,6 +15579,7 @@ def test_get_context_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_context(**mock_args) @@ -15696,6 +15720,7 @@ def test_list_contexts_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_contexts(request) @@ -15753,6 +15778,7 @@ def test_list_contexts_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_contexts(**mock_args) @@ -15952,6 +15978,7 @@ def test_update_context_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_context(request) @@ -16010,6 +16037,7 @@ def test_update_context_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_context(**mock_args) @@ -16150,6 +16178,7 @@ def test_delete_context_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_context(request) @@ -16203,6 +16232,7 @@ def test_delete_context_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_context(**mock_args) @@ -16340,6 +16370,7 @@ def test_purge_contexts_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.purge_contexts(request) @@ -16393,6 +16424,7 @@ def test_purge_contexts_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.purge_contexts(**mock_args) @@ -16532,6 +16564,7 @@ def test_add_context_artifacts_and_executions_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.add_context_artifacts_and_executions(request) @@ -16585,6 +16618,7 @@ def test_add_context_artifacts_and_executions_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.add_context_artifacts_and_executions(**mock_args) @@ -16725,6 +16759,7 @@ def test_add_context_children_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.add_context_children(request) @@ -16773,6 +16808,7 @@ def test_add_context_children_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.add_context_children(**mock_args) @@ -16913,6 +16949,7 @@ def test_remove_context_children_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.remove_context_children(request) @@ -16961,6 +16998,7 @@ def test_remove_context_children_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.remove_context_children(**mock_args) @@ -17098,6 +17136,7 @@ def test_query_context_lineage_subgraph_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.query_context_lineage_subgraph(request) @@ -17147,6 +17186,7 @@ def test_query_context_lineage_subgraph_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.query_context_lineage_subgraph(**mock_args) @@ -17283,6 +17323,7 @@ def test_create_execution_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_execution(request) @@ -17340,6 +17381,7 @@ def test_create_execution_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_execution(**mock_args) @@ -17473,6 +17515,7 @@ def test_get_execution_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_execution(request) @@ -17520,6 +17563,7 @@ def test_get_execution_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_execution(**mock_args) @@ -17660,6 +17704,7 @@ def test_list_executions_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_executions(request) @@ -17717,6 +17762,7 @@ def test_list_executions_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_executions(**mock_args) @@ -17918,6 +17964,7 @@ def test_update_execution_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_execution(request) @@ -17976,6 +18023,7 @@ def test_update_execution_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_execution(**mock_args) @@ -18113,6 +18161,7 @@ def test_delete_execution_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_execution(request) @@ -18158,6 +18207,7 @@ def test_delete_execution_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_execution(**mock_args) @@ -18297,6 +18347,7 @@ def test_purge_executions_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.purge_executions(request) @@ -18350,6 +18401,7 @@ def test_purge_executions_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.purge_executions(**mock_args) @@ -18486,6 +18538,7 @@ def test_add_execution_events_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.add_execution_events(request) @@ -18534,6 +18587,7 @@ def test_add_execution_events_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.add_execution_events(**mock_args) @@ -18671,6 +18725,7 @@ def test_query_execution_inputs_and_outputs_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.query_execution_inputs_and_outputs(request) @@ -18720,6 +18775,7 @@ def test_query_execution_inputs_and_outputs_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.query_execution_inputs_and_outputs(**mock_args) @@ -18861,6 +18917,7 @@ def test_create_metadata_schema_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_metadata_schema(request) @@ -18918,6 +18975,7 @@ def test_create_metadata_schema_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_metadata_schema(**mock_args) @@ -19055,6 +19113,7 @@ def test_get_metadata_schema_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_metadata_schema(request) @@ -19102,6 +19161,7 @@ def test_get_metadata_schema_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_metadata_schema(**mock_args) @@ -19246,6 +19306,7 @@ def test_list_metadata_schemas_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_metadata_schemas(request) @@ -19302,6 +19363,7 @@ def test_list_metadata_schemas_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_metadata_schemas(**mock_args) @@ -19510,6 +19572,7 @@ def test_query_artifact_lineage_subgraph_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.query_artifact_lineage_subgraph(request) @@ -19567,6 +19630,7 @@ def test_query_artifact_lineage_subgraph_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.query_artifact_lineage_subgraph(**mock_args) @@ -21372,6 +21436,7 @@ def test_create_metadata_store_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_metadata_store(request) @@ -21480,6 +21545,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_metadata_store(request) # Establish that the response is the type that we expect. @@ -21521,6 +21587,7 @@ def test_create_metadata_store_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 @@ -21565,6 +21632,7 @@ def test_get_metadata_store_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_metadata_store(request) @@ -21601,6 +21669,7 @@ def test_get_metadata_store_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_metadata_store(request) # Establish that the response is the type that we expect. @@ -21642,6 +21711,7 @@ def test_get_metadata_store_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 = metadata_store.MetadataStore.to_json( metadata_store.MetadataStore() ) @@ -21688,6 +21758,7 @@ def test_list_metadata_stores_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_metadata_stores(request) @@ -21723,6 +21794,7 @@ def test_list_metadata_stores_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_metadata_stores(request) # Establish that the response is the type that we expect. @@ -21763,6 +21835,7 @@ def test_list_metadata_stores_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 = metadata_service.ListMetadataStoresResponse.to_json( metadata_service.ListMetadataStoresResponse() ) @@ -21809,6 +21882,7 @@ def test_delete_metadata_store_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_metadata_store(request) @@ -21839,6 +21913,7 @@ def test_delete_metadata_store_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_metadata_store(request) # Establish that the response is the type that we expect. @@ -21880,6 +21955,7 @@ def test_delete_metadata_store_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 @@ -21926,6 +22002,7 @@ def test_create_artifact_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_artifact(request) @@ -22051,6 +22128,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_artifact(request) # Establish that the response is the type that we expect. @@ -22098,6 +22176,7 @@ def test_create_artifact_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 = gca_artifact.Artifact.to_json(gca_artifact.Artifact()) req.return_value.content = return_value @@ -22144,6 +22223,7 @@ def test_get_artifact_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_artifact(request) @@ -22188,6 +22268,7 @@ def test_get_artifact_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_artifact(request) # Establish that the response is the type that we expect. @@ -22235,6 +22316,7 @@ def test_get_artifact_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 = artifact.Artifact.to_json(artifact.Artifact()) req.return_value.content = return_value @@ -22281,6 +22363,7 @@ def test_list_artifacts_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_artifacts(request) @@ -22318,6 +22401,7 @@ def test_list_artifacts_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_artifacts(request) # Establish that the response is the type that we expect. @@ -22358,6 +22442,7 @@ def test_list_artifacts_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 = metadata_service.ListArtifactsResponse.to_json( metadata_service.ListArtifactsResponse() ) @@ -22408,6 +22493,7 @@ def test_update_artifact_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_artifact(request) @@ -22535,6 +22621,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_artifact(request) # Establish that the response is the type that we expect. @@ -22582,6 +22669,7 @@ def test_update_artifact_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 = gca_artifact.Artifact.to_json(gca_artifact.Artifact()) req.return_value.content = return_value @@ -22628,6 +22716,7 @@ def test_delete_artifact_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_artifact(request) @@ -22660,6 +22749,7 @@ def test_delete_artifact_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_artifact(request) # Establish that the response is the type that we expect. @@ -22701,6 +22791,7 @@ def test_delete_artifact_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 @@ -22747,6 +22838,7 @@ def test_purge_artifacts_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.purge_artifacts(request) @@ -22779,6 +22871,7 @@ def test_purge_artifacts_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.purge_artifacts(request) # Establish that the response is the type that we expect. @@ -22820,6 +22913,7 @@ def test_purge_artifacts_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 @@ -22866,6 +22960,7 @@ def test_create_context_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_context(request) @@ -22989,6 +23084,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_context(request) # Establish that the response is the type that we expect. @@ -23035,6 +23131,7 @@ def test_create_context_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 = gca_context.Context.to_json(gca_context.Context()) req.return_value.content = return_value @@ -23079,6 +23176,7 @@ def test_get_context_rest_bad_request(request_type=metadata_service.GetContextRe 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_context(request) @@ -23122,6 +23220,7 @@ def test_get_context_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_context(request) # Establish that the response is the type that we expect. @@ -23168,6 +23267,7 @@ def test_get_context_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 = context.Context.to_json(context.Context()) req.return_value.content = return_value @@ -23214,6 +23314,7 @@ def test_list_contexts_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_contexts(request) @@ -23251,6 +23352,7 @@ def test_list_contexts_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_contexts(request) # Establish that the response is the type that we expect. @@ -23291,6 +23393,7 @@ def test_list_contexts_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 = metadata_service.ListContextsResponse.to_json( metadata_service.ListContextsResponse() ) @@ -23341,6 +23444,7 @@ def test_update_context_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_context(request) @@ -23466,6 +23570,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_context(request) # Establish that the response is the type that we expect. @@ -23512,6 +23617,7 @@ def test_update_context_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 = gca_context.Context.to_json(gca_context.Context()) req.return_value.content = return_value @@ -23558,6 +23664,7 @@ def test_delete_context_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_context(request) @@ -23590,6 +23697,7 @@ def test_delete_context_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_context(request) # Establish that the response is the type that we expect. @@ -23631,6 +23739,7 @@ def test_delete_context_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 @@ -23677,6 +23786,7 @@ def test_purge_contexts_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.purge_contexts(request) @@ -23709,6 +23819,7 @@ def test_purge_contexts_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.purge_contexts(request) # Establish that the response is the type that we expect. @@ -23750,6 +23861,7 @@ def test_purge_contexts_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 @@ -23796,6 +23908,7 @@ def test_add_context_artifacts_and_executions_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.add_context_artifacts_and_executions(request) @@ -23833,6 +23946,7 @@ def test_add_context_artifacts_and_executions_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.add_context_artifacts_and_executions(request) # Establish that the response is the type that we expect. @@ -23876,6 +23990,7 @@ def test_add_context_artifacts_and_executions_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 = ( metadata_service.AddContextArtifactsAndExecutionsResponse.to_json( metadata_service.AddContextArtifactsAndExecutionsResponse() @@ -23926,6 +24041,7 @@ def test_add_context_children_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.add_context_children(request) @@ -23961,6 +24077,7 @@ def test_add_context_children_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.add_context_children(request) # Establish that the response is the type that we expect. @@ -24000,6 +24117,7 @@ def test_add_context_children_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 = metadata_service.AddContextChildrenResponse.to_json( metadata_service.AddContextChildrenResponse() ) @@ -24048,6 +24166,7 @@ def test_remove_context_children_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.remove_context_children(request) @@ -24083,6 +24202,7 @@ def test_remove_context_children_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.remove_context_children(request) # Establish that the response is the type that we expect. @@ -24122,6 +24242,7 @@ def test_remove_context_children_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 = metadata_service.RemoveContextChildrenResponse.to_json( metadata_service.RemoveContextChildrenResponse() ) @@ -24170,6 +24291,7 @@ def test_query_context_lineage_subgraph_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.query_context_lineage_subgraph(request) @@ -24205,6 +24327,7 @@ def test_query_context_lineage_subgraph_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.query_context_lineage_subgraph(request) # Establish that the response is the type that we expect. @@ -24244,6 +24367,7 @@ def test_query_context_lineage_subgraph_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 = lineage_subgraph.LineageSubgraph.to_json( lineage_subgraph.LineageSubgraph() ) @@ -24292,6 +24416,7 @@ def test_create_execution_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_execution(request) @@ -24415,6 +24540,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_execution(request) # Establish that the response is the type that we expect. @@ -24461,6 +24587,7 @@ def test_create_execution_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 = gca_execution.Execution.to_json(gca_execution.Execution()) req.return_value.content = return_value @@ -24507,6 +24634,7 @@ def test_get_execution_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_execution(request) @@ -24550,6 +24678,7 @@ def test_get_execution_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_execution(request) # Establish that the response is the type that we expect. @@ -24596,6 +24725,7 @@ def test_get_execution_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 = execution.Execution.to_json(execution.Execution()) req.return_value.content = return_value @@ -24642,6 +24772,7 @@ def test_list_executions_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_executions(request) @@ -24679,6 +24810,7 @@ def test_list_executions_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_executions(request) # Establish that the response is the type that we expect. @@ -24719,6 +24851,7 @@ def test_list_executions_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 = metadata_service.ListExecutionsResponse.to_json( metadata_service.ListExecutionsResponse() ) @@ -24769,6 +24902,7 @@ def test_update_execution_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_execution(request) @@ -24894,6 +25028,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_execution(request) # Establish that the response is the type that we expect. @@ -24940,6 +25075,7 @@ def test_update_execution_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 = gca_execution.Execution.to_json(gca_execution.Execution()) req.return_value.content = return_value @@ -24986,6 +25122,7 @@ def test_delete_execution_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_execution(request) @@ -25018,6 +25155,7 @@ def test_delete_execution_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_execution(request) # Establish that the response is the type that we expect. @@ -25059,6 +25197,7 @@ def test_delete_execution_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 @@ -25105,6 +25244,7 @@ def test_purge_executions_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.purge_executions(request) @@ -25137,6 +25277,7 @@ def test_purge_executions_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.purge_executions(request) # Establish that the response is the type that we expect. @@ -25178,6 +25319,7 @@ def test_purge_executions_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 @@ -25224,6 +25366,7 @@ def test_add_execution_events_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.add_execution_events(request) @@ -25259,6 +25402,7 @@ def test_add_execution_events_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.add_execution_events(request) # Establish that the response is the type that we expect. @@ -25298,6 +25442,7 @@ def test_add_execution_events_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 = metadata_service.AddExecutionEventsResponse.to_json( metadata_service.AddExecutionEventsResponse() ) @@ -25346,6 +25491,7 @@ def test_query_execution_inputs_and_outputs_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.query_execution_inputs_and_outputs(request) @@ -25381,6 +25527,7 @@ def test_query_execution_inputs_and_outputs_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.query_execution_inputs_and_outputs(request) # Establish that the response is the type that we expect. @@ -25422,6 +25569,7 @@ def test_query_execution_inputs_and_outputs_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 = lineage_subgraph.LineageSubgraph.to_json( lineage_subgraph.LineageSubgraph() ) @@ -25470,6 +25618,7 @@ def test_create_metadata_schema_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_metadata_schema(request) @@ -25588,6 +25737,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_metadata_schema(request) # Establish that the response is the type that we expect. @@ -25635,6 +25785,7 @@ def test_create_metadata_schema_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 = gca_metadata_schema.MetadataSchema.to_json( gca_metadata_schema.MetadataSchema() ) @@ -25683,6 +25834,7 @@ def test_get_metadata_schema_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_metadata_schema(request) @@ -25724,6 +25876,7 @@ def test_get_metadata_schema_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_metadata_schema(request) # Establish that the response is the type that we expect. @@ -25771,6 +25924,7 @@ def test_get_metadata_schema_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 = metadata_schema.MetadataSchema.to_json( metadata_schema.MetadataSchema() ) @@ -25819,6 +25973,7 @@ def test_list_metadata_schemas_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_metadata_schemas(request) @@ -25856,6 +26011,7 @@ def test_list_metadata_schemas_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_metadata_schemas(request) # Establish that the response is the type that we expect. @@ -25896,6 +26052,7 @@ def test_list_metadata_schemas_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 = metadata_service.ListMetadataSchemasResponse.to_json( metadata_service.ListMetadataSchemasResponse() ) @@ -25944,6 +26101,7 @@ def test_query_artifact_lineage_subgraph_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.query_artifact_lineage_subgraph(request) @@ -25979,6 +26137,7 @@ def test_query_artifact_lineage_subgraph_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.query_artifact_lineage_subgraph(request) # Establish that the response is the type that we expect. @@ -26019,6 +26178,7 @@ def test_query_artifact_lineage_subgraph_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 = lineage_subgraph.LineageSubgraph.to_json( lineage_subgraph.LineageSubgraph() ) @@ -26065,6 +26225,7 @@ def test_get_location_rest_bad_request(request_type=locations_pb2.GetLocationReq 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_location(request) @@ -26095,6 +26256,7 @@ def test_get_location_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_location(request) @@ -26123,6 +26285,7 @@ def test_list_locations_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_locations(request) @@ -26153,6 +26316,7 @@ def test_list_locations_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_locations(request) @@ -26184,6 +26348,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -26216,6 +26381,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -26247,6 +26413,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -26279,6 +26446,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -26310,6 +26478,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -26342,6 +26511,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -26372,6 +26542,7 @@ def test_cancel_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.cancel_operation(request) @@ -26402,6 +26573,7 @@ def test_cancel_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.cancel_operation(request) @@ -26432,6 +26604,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) @@ -26462,6 +26635,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) @@ -26492,6 +26666,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) @@ -26522,6 +26697,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) @@ -26552,6 +26728,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) @@ -26582,6 +26759,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) @@ -26612,6 +26790,7 @@ def test_wait_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.wait_operation(request) @@ -26642,6 +26821,7 @@ def test_wait_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.wait_operation(request) @@ -27377,6 +27557,7 @@ async def test_create_metadata_store_rest_asyncio_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"} await client.create_metadata_store(request) @@ -27492,6 +27673,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.create_metadata_store(request) # Establish that the response is the type that we expect. @@ -27538,6 +27720,7 @@ async def test_create_metadata_store_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -27586,6 +27769,7 @@ async def test_get_metadata_store_rest_asyncio_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"} await client.get_metadata_store(request) @@ -27629,6 +27813,7 @@ async def test_get_metadata_store_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_metadata_store(request) # Establish that the response is the type that we expect. @@ -27675,6 +27860,7 @@ async def test_get_metadata_store_rest_asyncio_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 = metadata_store.MetadataStore.to_json( metadata_store.MetadataStore() ) @@ -27725,6 +27911,7 @@ async def test_list_metadata_stores_rest_asyncio_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"} await client.list_metadata_stores(request) @@ -27767,6 +27954,7 @@ async def test_list_metadata_stores_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_metadata_stores(request) # Establish that the response is the type that we expect. @@ -27812,6 +28000,7 @@ async def test_list_metadata_stores_rest_asyncio_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 = metadata_service.ListMetadataStoresResponse.to_json( metadata_service.ListMetadataStoresResponse() ) @@ -27862,6 +28051,7 @@ async def test_delete_metadata_store_rest_asyncio_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"} await client.delete_metadata_store(request) @@ -27899,6 +28089,7 @@ async def test_delete_metadata_store_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_metadata_store(request) # Establish that the response is the type that we expect. @@ -27945,6 +28136,7 @@ async def test_delete_metadata_store_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -27995,6 +28187,7 @@ async def test_create_artifact_rest_asyncio_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"} await client.create_artifact(request) @@ -28127,6 +28320,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.create_artifact(request) # Establish that the response is the type that we expect. @@ -28179,6 +28373,7 @@ async def test_create_artifact_rest_asyncio_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 = gca_artifact.Artifact.to_json(gca_artifact.Artifact()) req.return_value.read = mock.AsyncMock(return_value=return_value) @@ -28229,6 +28424,7 @@ async def test_get_artifact_rest_asyncio_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"} await client.get_artifact(request) @@ -28280,6 +28476,7 @@ async def test_get_artifact_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_artifact(request) # Establish that the response is the type that we expect. @@ -28332,6 +28529,7 @@ async def test_get_artifact_rest_asyncio_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 = artifact.Artifact.to_json(artifact.Artifact()) req.return_value.read = mock.AsyncMock(return_value=return_value) @@ -28382,6 +28580,7 @@ async def test_list_artifacts_rest_asyncio_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"} await client.list_artifacts(request) @@ -28426,6 +28625,7 @@ async def test_list_artifacts_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_artifacts(request) # Establish that the response is the type that we expect. @@ -28471,6 +28671,7 @@ async def test_list_artifacts_rest_asyncio_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 = metadata_service.ListArtifactsResponse.to_json( metadata_service.ListArtifactsResponse() ) @@ -28525,6 +28726,7 @@ async def test_update_artifact_rest_asyncio_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"} await client.update_artifact(request) @@ -28659,6 +28861,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.update_artifact(request) # Establish that the response is the type that we expect. @@ -28711,6 +28914,7 @@ async def test_update_artifact_rest_asyncio_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 = gca_artifact.Artifact.to_json(gca_artifact.Artifact()) req.return_value.read = mock.AsyncMock(return_value=return_value) @@ -28761,6 +28965,7 @@ async def test_delete_artifact_rest_asyncio_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"} await client.delete_artifact(request) @@ -28800,6 +29005,7 @@ async def test_delete_artifact_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_artifact(request) # Establish that the response is the type that we expect. @@ -28846,6 +29052,7 @@ async def test_delete_artifact_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -28896,6 +29103,7 @@ async def test_purge_artifacts_rest_asyncio_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"} await client.purge_artifacts(request) @@ -28935,6 +29143,7 @@ async def test_purge_artifacts_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.purge_artifacts(request) # Establish that the response is the type that we expect. @@ -28981,6 +29190,7 @@ async def test_purge_artifacts_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -29031,6 +29241,7 @@ async def test_create_context_rest_asyncio_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"} await client.create_context(request) @@ -29161,6 +29372,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.create_context(request) # Establish that the response is the type that we expect. @@ -29212,6 +29424,7 @@ async def test_create_context_rest_asyncio_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 = gca_context.Context.to_json(gca_context.Context()) req.return_value.read = mock.AsyncMock(return_value=return_value) @@ -29262,6 +29475,7 @@ async def test_get_context_rest_asyncio_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"} await client.get_context(request) @@ -29312,6 +29526,7 @@ async def test_get_context_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_context(request) # Establish that the response is the type that we expect. @@ -29363,6 +29578,7 @@ async def test_get_context_rest_asyncio_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 = context.Context.to_json(context.Context()) req.return_value.read = mock.AsyncMock(return_value=return_value) @@ -29413,6 +29629,7 @@ async def test_list_contexts_rest_asyncio_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"} await client.list_contexts(request) @@ -29457,6 +29674,7 @@ async def test_list_contexts_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_contexts(request) # Establish that the response is the type that we expect. @@ -29502,6 +29720,7 @@ async def test_list_contexts_rest_asyncio_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 = metadata_service.ListContextsResponse.to_json( metadata_service.ListContextsResponse() ) @@ -29556,6 +29775,7 @@ async def test_update_context_rest_asyncio_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"} await client.update_context(request) @@ -29688,6 +29908,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.update_context(request) # Establish that the response is the type that we expect. @@ -29739,6 +29960,7 @@ async def test_update_context_rest_asyncio_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 = gca_context.Context.to_json(gca_context.Context()) req.return_value.read = mock.AsyncMock(return_value=return_value) @@ -29789,6 +30011,7 @@ async def test_delete_context_rest_asyncio_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"} await client.delete_context(request) @@ -29828,6 +30051,7 @@ async def test_delete_context_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_context(request) # Establish that the response is the type that we expect. @@ -29874,6 +30098,7 @@ async def test_delete_context_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -29924,6 +30149,7 @@ async def test_purge_contexts_rest_asyncio_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"} await client.purge_contexts(request) @@ -29963,6 +30189,7 @@ async def test_purge_contexts_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.purge_contexts(request) # Establish that the response is the type that we expect. @@ -30009,6 +30236,7 @@ async def test_purge_contexts_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -30059,6 +30287,7 @@ async def test_add_context_artifacts_and_executions_rest_asyncio_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"} await client.add_context_artifacts_and_executions(request) @@ -30105,6 +30334,7 @@ async def test_add_context_artifacts_and_executions_rest_asyncio_call_success( return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.add_context_artifacts_and_executions(request) # Establish that the response is the type that we expect. @@ -30155,6 +30385,7 @@ async def test_add_context_artifacts_and_executions_rest_asyncio_interceptors( 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 = ( metadata_service.AddContextArtifactsAndExecutionsResponse.to_json( metadata_service.AddContextArtifactsAndExecutionsResponse() @@ -30209,6 +30440,7 @@ async def test_add_context_children_rest_asyncio_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"} await client.add_context_children(request) @@ -30251,6 +30483,7 @@ async def test_add_context_children_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.add_context_children(request) # Establish that the response is the type that we expect. @@ -30295,6 +30528,7 @@ async def test_add_context_children_rest_asyncio_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 = metadata_service.AddContextChildrenResponse.to_json( metadata_service.AddContextChildrenResponse() ) @@ -30347,6 +30581,7 @@ async def test_remove_context_children_rest_asyncio_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"} await client.remove_context_children(request) @@ -30389,6 +30624,7 @@ async def test_remove_context_children_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.remove_context_children(request) # Establish that the response is the type that we expect. @@ -30433,6 +30669,7 @@ async def test_remove_context_children_rest_asyncio_interceptors(null_intercepto 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 = metadata_service.RemoveContextChildrenResponse.to_json( metadata_service.RemoveContextChildrenResponse() ) @@ -30485,6 +30722,7 @@ async def test_query_context_lineage_subgraph_rest_asyncio_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"} await client.query_context_lineage_subgraph(request) @@ -30527,6 +30765,7 @@ async def test_query_context_lineage_subgraph_rest_asyncio_call_success(request_ return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.query_context_lineage_subgraph(request) # Establish that the response is the type that we expect. @@ -30575,6 +30814,7 @@ async def test_query_context_lineage_subgraph_rest_asyncio_interceptors( 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 = lineage_subgraph.LineageSubgraph.to_json( lineage_subgraph.LineageSubgraph() ) @@ -30627,6 +30867,7 @@ async def test_create_execution_rest_asyncio_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"} await client.create_execution(request) @@ -30757,6 +30998,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.create_execution(request) # Establish that the response is the type that we expect. @@ -30808,6 +31050,7 @@ async def test_create_execution_rest_asyncio_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 = gca_execution.Execution.to_json(gca_execution.Execution()) req.return_value.read = mock.AsyncMock(return_value=return_value) @@ -30858,6 +31101,7 @@ async def test_get_execution_rest_asyncio_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"} await client.get_execution(request) @@ -30908,6 +31152,7 @@ async def test_get_execution_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_execution(request) # Establish that the response is the type that we expect. @@ -30959,6 +31204,7 @@ async def test_get_execution_rest_asyncio_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 = execution.Execution.to_json(execution.Execution()) req.return_value.read = mock.AsyncMock(return_value=return_value) @@ -31009,6 +31255,7 @@ async def test_list_executions_rest_asyncio_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"} await client.list_executions(request) @@ -31053,6 +31300,7 @@ async def test_list_executions_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_executions(request) # Establish that the response is the type that we expect. @@ -31098,6 +31346,7 @@ async def test_list_executions_rest_asyncio_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 = metadata_service.ListExecutionsResponse.to_json( metadata_service.ListExecutionsResponse() ) @@ -31152,6 +31401,7 @@ async def test_update_execution_rest_asyncio_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"} await client.update_execution(request) @@ -31284,6 +31534,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.update_execution(request) # Establish that the response is the type that we expect. @@ -31335,6 +31586,7 @@ async def test_update_execution_rest_asyncio_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 = gca_execution.Execution.to_json(gca_execution.Execution()) req.return_value.read = mock.AsyncMock(return_value=return_value) @@ -31385,6 +31637,7 @@ async def test_delete_execution_rest_asyncio_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"} await client.delete_execution(request) @@ -31424,6 +31677,7 @@ async def test_delete_execution_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_execution(request) # Establish that the response is the type that we expect. @@ -31470,6 +31724,7 @@ async def test_delete_execution_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -31520,6 +31775,7 @@ async def test_purge_executions_rest_asyncio_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"} await client.purge_executions(request) @@ -31559,6 +31815,7 @@ async def test_purge_executions_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.purge_executions(request) # Establish that the response is the type that we expect. @@ -31605,6 +31862,7 @@ async def test_purge_executions_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -31655,6 +31913,7 @@ async def test_add_execution_events_rest_asyncio_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"} await client.add_execution_events(request) @@ -31697,6 +31956,7 @@ async def test_add_execution_events_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.add_execution_events(request) # Establish that the response is the type that we expect. @@ -31741,6 +32001,7 @@ async def test_add_execution_events_rest_asyncio_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 = metadata_service.AddExecutionEventsResponse.to_json( metadata_service.AddExecutionEventsResponse() ) @@ -31793,6 +32054,7 @@ async def test_query_execution_inputs_and_outputs_rest_asyncio_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"} await client.query_execution_inputs_and_outputs(request) @@ -31837,6 +32099,7 @@ async def test_query_execution_inputs_and_outputs_rest_asyncio_call_success( return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.query_execution_inputs_and_outputs(request) # Establish that the response is the type that we expect. @@ -31885,6 +32148,7 @@ async def test_query_execution_inputs_and_outputs_rest_asyncio_interceptors( 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 = lineage_subgraph.LineageSubgraph.to_json( lineage_subgraph.LineageSubgraph() ) @@ -31937,6 +32201,7 @@ async def test_create_metadata_schema_rest_asyncio_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"} await client.create_metadata_schema(request) @@ -32062,6 +32327,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.create_metadata_schema(request) # Establish that the response is the type that we expect. @@ -32114,6 +32380,7 @@ async def test_create_metadata_schema_rest_asyncio_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 = gca_metadata_schema.MetadataSchema.to_json( gca_metadata_schema.MetadataSchema() ) @@ -32166,6 +32433,7 @@ async def test_get_metadata_schema_rest_asyncio_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"} await client.get_metadata_schema(request) @@ -32214,6 +32482,7 @@ async def test_get_metadata_schema_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_metadata_schema(request) # Establish that the response is the type that we expect. @@ -32266,6 +32535,7 @@ async def test_get_metadata_schema_rest_asyncio_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 = metadata_schema.MetadataSchema.to_json( metadata_schema.MetadataSchema() ) @@ -32318,6 +32588,7 @@ async def test_list_metadata_schemas_rest_asyncio_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"} await client.list_metadata_schemas(request) @@ -32362,6 +32633,7 @@ async def test_list_metadata_schemas_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_metadata_schemas(request) # Establish that the response is the type that we expect. @@ -32407,6 +32679,7 @@ async def test_list_metadata_schemas_rest_asyncio_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 = metadata_service.ListMetadataSchemasResponse.to_json( metadata_service.ListMetadataSchemasResponse() ) @@ -32459,6 +32732,7 @@ async def test_query_artifact_lineage_subgraph_rest_asyncio_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"} await client.query_artifact_lineage_subgraph(request) @@ -32501,6 +32775,7 @@ async def test_query_artifact_lineage_subgraph_rest_asyncio_call_success(request return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.query_artifact_lineage_subgraph(request) # Establish that the response is the type that we expect. @@ -32549,6 +32824,7 @@ async def test_query_artifact_lineage_subgraph_rest_asyncio_interceptors( 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 = lineage_subgraph.LineageSubgraph.to_json( lineage_subgraph.LineageSubgraph() ) @@ -32601,6 +32877,7 @@ async def test_get_location_rest_asyncio_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"} await client.get_location(request) @@ -32638,6 +32915,7 @@ async def test_get_location_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_location(request) @@ -32670,6 +32948,7 @@ async def test_list_locations_rest_asyncio_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"} await client.list_locations(request) @@ -32707,6 +32986,7 @@ async def test_list_locations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_locations(request) @@ -32742,6 +33022,7 @@ async def test_get_iam_policy_rest_asyncio_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"} await client.get_iam_policy(request) @@ -32781,6 +33062,7 @@ async def test_get_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_iam_policy(request) @@ -32816,6 +33098,7 @@ async def test_set_iam_policy_rest_asyncio_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"} await client.set_iam_policy(request) @@ -32855,6 +33138,7 @@ async def test_set_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.set_iam_policy(request) @@ -32890,6 +33174,7 @@ async def test_test_iam_permissions_rest_asyncio_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"} await client.test_iam_permissions(request) @@ -32929,6 +33214,7 @@ async def test_test_iam_permissions_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.test_iam_permissions(request) @@ -32963,6 +33249,7 @@ async def test_cancel_operation_rest_asyncio_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"} await client.cancel_operation(request) @@ -33000,6 +33287,7 @@ async def test_cancel_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.cancel_operation(request) @@ -33034,6 +33322,7 @@ async def test_delete_operation_rest_asyncio_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"} await client.delete_operation(request) @@ -33071,6 +33360,7 @@ async def test_delete_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_operation(request) @@ -33105,6 +33395,7 @@ async def test_get_operation_rest_asyncio_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"} await client.get_operation(request) @@ -33142,6 +33433,7 @@ async def test_get_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_operation(request) @@ -33176,6 +33468,7 @@ async def test_list_operations_rest_asyncio_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"} await client.list_operations(request) @@ -33213,6 +33506,7 @@ async def test_list_operations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_operations(request) @@ -33247,6 +33541,7 @@ async def test_wait_operation_rest_asyncio_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"} await client.wait_operation(request) @@ -33284,6 +33579,7 @@ async def test_wait_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.wait_operation(request) diff --git a/tests/unit/gapic/aiplatform_v1beta1/test_migration_service.py b/tests/unit/gapic/aiplatform_v1beta1/test_migration_service.py index 0414e4462b..fdd44aa1b9 100644 --- a/tests/unit/gapic/aiplatform_v1beta1/test_migration_service.py +++ b/tests/unit/gapic/aiplatform_v1beta1/test_migration_service.py @@ -2172,6 +2172,7 @@ def test_search_migratable_resources_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.search_migratable_resources(request) @@ -2219,6 +2220,7 @@ def test_search_migratable_resources_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.search_migratable_resources(**mock_args) @@ -2423,6 +2425,7 @@ def test_batch_migrate_resources_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.batch_migrate_resources(request) @@ -2481,6 +2484,7 @@ def test_batch_migrate_resources_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.batch_migrate_resources(**mock_args) @@ -2767,6 +2771,7 @@ def test_search_migratable_resources_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.search_migratable_resources(request) @@ -2804,6 +2809,7 @@ def test_search_migratable_resources_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.search_migratable_resources(request) # Establish that the response is the type that we expect. @@ -2844,6 +2850,7 @@ def test_search_migratable_resources_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 = migration_service.SearchMigratableResourcesResponse.to_json( migration_service.SearchMigratableResourcesResponse() ) @@ -2890,6 +2897,7 @@ def test_batch_migrate_resources_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.batch_migrate_resources(request) @@ -2920,6 +2928,7 @@ def test_batch_migrate_resources_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.batch_migrate_resources(request) # Establish that the response is the type that we expect. @@ -2961,6 +2970,7 @@ def test_batch_migrate_resources_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 @@ -3005,6 +3015,7 @@ def test_get_location_rest_bad_request(request_type=locations_pb2.GetLocationReq 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_location(request) @@ -3035,6 +3046,7 @@ def test_get_location_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_location(request) @@ -3063,6 +3075,7 @@ def test_list_locations_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_locations(request) @@ -3093,6 +3106,7 @@ def test_list_locations_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_locations(request) @@ -3124,6 +3138,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -3156,6 +3171,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -3187,6 +3203,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -3219,6 +3236,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -3250,6 +3268,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -3282,6 +3301,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -3312,6 +3332,7 @@ def test_cancel_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.cancel_operation(request) @@ -3342,6 +3363,7 @@ def test_cancel_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.cancel_operation(request) @@ -3372,6 +3394,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) @@ -3402,6 +3425,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) @@ -3432,6 +3456,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) @@ -3462,6 +3487,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) @@ -3492,6 +3518,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) @@ -3522,6 +3549,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) @@ -3552,6 +3580,7 @@ def test_wait_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.wait_operation(request) @@ -3582,6 +3611,7 @@ def test_wait_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.wait_operation(request) @@ -3693,6 +3723,7 @@ async def test_search_migratable_resources_rest_asyncio_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"} await client.search_migratable_resources(request) @@ -3737,6 +3768,7 @@ async def test_search_migratable_resources_rest_asyncio_call_success(request_typ return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.search_migratable_resources(request) # Establish that the response is the type that we expect. @@ -3784,6 +3816,7 @@ async def test_search_migratable_resources_rest_asyncio_interceptors(null_interc 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 = migration_service.SearchMigratableResourcesResponse.to_json( migration_service.SearchMigratableResourcesResponse() ) @@ -3834,6 +3867,7 @@ async def test_batch_migrate_resources_rest_asyncio_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"} await client.batch_migrate_resources(request) @@ -3871,6 +3905,7 @@ async def test_batch_migrate_resources_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.batch_migrate_resources(request) # Establish that the response is the type that we expect. @@ -3917,6 +3952,7 @@ async def test_batch_migrate_resources_rest_asyncio_interceptors(null_intercepto 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.read = mock.AsyncMock(return_value=return_value) @@ -3967,6 +4003,7 @@ async def test_get_location_rest_asyncio_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"} await client.get_location(request) @@ -4004,6 +4041,7 @@ async def test_get_location_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_location(request) @@ -4036,6 +4074,7 @@ async def test_list_locations_rest_asyncio_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"} await client.list_locations(request) @@ -4073,6 +4112,7 @@ async def test_list_locations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_locations(request) @@ -4108,6 +4148,7 @@ async def test_get_iam_policy_rest_asyncio_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"} await client.get_iam_policy(request) @@ -4147,6 +4188,7 @@ async def test_get_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_iam_policy(request) @@ -4182,6 +4224,7 @@ async def test_set_iam_policy_rest_asyncio_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"} await client.set_iam_policy(request) @@ -4221,6 +4264,7 @@ async def test_set_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.set_iam_policy(request) @@ -4256,6 +4300,7 @@ async def test_test_iam_permissions_rest_asyncio_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"} await client.test_iam_permissions(request) @@ -4295,6 +4340,7 @@ async def test_test_iam_permissions_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.test_iam_permissions(request) @@ -4329,6 +4375,7 @@ async def test_cancel_operation_rest_asyncio_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"} await client.cancel_operation(request) @@ -4366,6 +4413,7 @@ async def test_cancel_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.cancel_operation(request) @@ -4400,6 +4448,7 @@ async def test_delete_operation_rest_asyncio_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"} await client.delete_operation(request) @@ -4437,6 +4486,7 @@ async def test_delete_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_operation(request) @@ -4471,6 +4521,7 @@ async def test_get_operation_rest_asyncio_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"} await client.get_operation(request) @@ -4508,6 +4559,7 @@ async def test_get_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_operation(request) @@ -4542,6 +4594,7 @@ async def test_list_operations_rest_asyncio_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"} await client.list_operations(request) @@ -4579,6 +4632,7 @@ async def test_list_operations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_operations(request) @@ -4613,6 +4667,7 @@ async def test_wait_operation_rest_asyncio_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"} await client.wait_operation(request) @@ -4650,6 +4705,7 @@ async def test_wait_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.wait_operation(request) diff --git a/tests/unit/gapic/aiplatform_v1beta1/test_model_garden_service.py b/tests/unit/gapic/aiplatform_v1beta1/test_model_garden_service.py index 02b39c6985..07e30eac1b 100644 --- a/tests/unit/gapic/aiplatform_v1beta1/test_model_garden_service.py +++ b/tests/unit/gapic/aiplatform_v1beta1/test_model_garden_service.py @@ -2177,6 +2177,7 @@ def test_get_publisher_model_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_publisher_model(request) @@ -2232,6 +2233,7 @@ def test_get_publisher_model_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_publisher_model(**mock_args) @@ -2332,6 +2334,7 @@ def test_list_publisher_models_rest_required_fields( ( "filter", "language_code", + "list_all_versions", "order_by", "page_size", "page_token", @@ -2379,6 +2382,7 @@ def test_list_publisher_models_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_publisher_models(request) @@ -2398,6 +2402,7 @@ def test_list_publisher_models_rest_unset_required_fields(): ( "filter", "languageCode", + "listAllVersions", "orderBy", "pageSize", "pageToken", @@ -2436,6 +2441,7 @@ def test_list_publisher_models_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_publisher_models(**mock_args) @@ -2785,6 +2791,7 @@ def test_get_publisher_model_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_publisher_model(request) @@ -2826,6 +2833,7 @@ def test_get_publisher_model_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_publisher_model(request) # Establish that the response is the type that we expect. @@ -2880,6 +2888,7 @@ def test_get_publisher_model_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 = publisher_model.PublisherModel.to_json( publisher_model.PublisherModel() ) @@ -2926,6 +2935,7 @@ def test_list_publisher_models_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_publisher_models(request) @@ -2961,6 +2971,7 @@ def test_list_publisher_models_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_publisher_models(request) # Establish that the response is the type that we expect. @@ -3001,6 +3012,7 @@ def test_list_publisher_models_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 = model_garden_service.ListPublisherModelsResponse.to_json( model_garden_service.ListPublisherModelsResponse() ) @@ -3047,6 +3059,7 @@ def test_get_location_rest_bad_request(request_type=locations_pb2.GetLocationReq 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_location(request) @@ -3077,6 +3090,7 @@ def test_get_location_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_location(request) @@ -3105,6 +3119,7 @@ def test_list_locations_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_locations(request) @@ -3135,6 +3150,7 @@ def test_list_locations_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_locations(request) @@ -3166,6 +3182,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -3198,6 +3215,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -3229,6 +3247,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -3261,6 +3280,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -3292,6 +3312,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -3324,6 +3345,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -3354,6 +3376,7 @@ def test_cancel_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.cancel_operation(request) @@ -3384,6 +3407,7 @@ def test_cancel_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.cancel_operation(request) @@ -3414,6 +3438,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) @@ -3444,6 +3469,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) @@ -3474,6 +3500,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) @@ -3504,6 +3531,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) @@ -3534,6 +3562,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) @@ -3564,6 +3593,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) @@ -3594,6 +3624,7 @@ def test_wait_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.wait_operation(request) @@ -3624,6 +3655,7 @@ def test_wait_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.wait_operation(request) @@ -3718,6 +3750,7 @@ async def test_get_publisher_model_rest_asyncio_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"} await client.get_publisher_model(request) @@ -3766,6 +3799,7 @@ async def test_get_publisher_model_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_publisher_model(request) # Establish that the response is the type that we expect. @@ -3825,6 +3859,7 @@ async def test_get_publisher_model_rest_asyncio_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 = publisher_model.PublisherModel.to_json( publisher_model.PublisherModel() ) @@ -3875,6 +3910,7 @@ async def test_list_publisher_models_rest_asyncio_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"} await client.list_publisher_models(request) @@ -3917,6 +3953,7 @@ async def test_list_publisher_models_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_publisher_models(request) # Establish that the response is the type that we expect. @@ -3962,6 +3999,7 @@ async def test_list_publisher_models_rest_asyncio_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 = model_garden_service.ListPublisherModelsResponse.to_json( model_garden_service.ListPublisherModelsResponse() ) @@ -4014,6 +4052,7 @@ async def test_get_location_rest_asyncio_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"} await client.get_location(request) @@ -4051,6 +4090,7 @@ async def test_get_location_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_location(request) @@ -4083,6 +4123,7 @@ async def test_list_locations_rest_asyncio_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"} await client.list_locations(request) @@ -4120,6 +4161,7 @@ async def test_list_locations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_locations(request) @@ -4155,6 +4197,7 @@ async def test_get_iam_policy_rest_asyncio_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"} await client.get_iam_policy(request) @@ -4194,6 +4237,7 @@ async def test_get_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_iam_policy(request) @@ -4229,6 +4273,7 @@ async def test_set_iam_policy_rest_asyncio_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"} await client.set_iam_policy(request) @@ -4268,6 +4313,7 @@ async def test_set_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.set_iam_policy(request) @@ -4303,6 +4349,7 @@ async def test_test_iam_permissions_rest_asyncio_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"} await client.test_iam_permissions(request) @@ -4342,6 +4389,7 @@ async def test_test_iam_permissions_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.test_iam_permissions(request) @@ -4376,6 +4424,7 @@ async def test_cancel_operation_rest_asyncio_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"} await client.cancel_operation(request) @@ -4413,6 +4462,7 @@ async def test_cancel_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.cancel_operation(request) @@ -4447,6 +4497,7 @@ async def test_delete_operation_rest_asyncio_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"} await client.delete_operation(request) @@ -4484,6 +4535,7 @@ async def test_delete_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_operation(request) @@ -4518,6 +4570,7 @@ async def test_get_operation_rest_asyncio_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"} await client.get_operation(request) @@ -4555,6 +4608,7 @@ async def test_get_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_operation(request) @@ -4589,6 +4643,7 @@ async def test_list_operations_rest_asyncio_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"} await client.list_operations(request) @@ -4626,6 +4681,7 @@ async def test_list_operations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_operations(request) @@ -4660,6 +4716,7 @@ async def test_wait_operation_rest_asyncio_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"} await client.wait_operation(request) @@ -4697,6 +4754,7 @@ async def test_wait_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.wait_operation(request) diff --git a/tests/unit/gapic/aiplatform_v1beta1/test_model_monitoring_service.py b/tests/unit/gapic/aiplatform_v1beta1/test_model_monitoring_service.py index 6428b11323..e5667505be 100644 --- a/tests/unit/gapic/aiplatform_v1beta1/test_model_monitoring_service.py +++ b/tests/unit/gapic/aiplatform_v1beta1/test_model_monitoring_service.py @@ -6073,6 +6073,7 @@ def test_create_model_monitor_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_model_monitor(request) @@ -6131,6 +6132,7 @@ def test_create_model_monitor_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_model_monitor(**mock_args) @@ -6272,6 +6274,7 @@ def test_update_model_monitor_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_model_monitor(request) @@ -6334,6 +6337,7 @@ def test_update_model_monitor_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_model_monitor(**mock_args) @@ -6474,6 +6478,7 @@ def test_get_model_monitor_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_model_monitor(request) @@ -6521,6 +6526,7 @@ def test_get_model_monitor_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_model_monitor(**mock_args) @@ -6667,6 +6673,7 @@ def test_list_model_monitors_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_model_monitors(request) @@ -6724,6 +6731,7 @@ def test_list_model_monitors_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_model_monitors(**mock_args) @@ -6926,6 +6934,7 @@ def test_delete_model_monitor_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_model_monitor(request) @@ -6971,6 +6980,7 @@ def test_delete_model_monitor_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_model_monitor(**mock_args) @@ -7110,6 +7120,7 @@ def test_create_model_monitoring_job_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_model_monitoring_job(request) @@ -7168,6 +7179,7 @@ def test_create_model_monitoring_job_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_model_monitoring_job(**mock_args) @@ -7307,6 +7319,7 @@ def test_get_model_monitoring_job_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_model_monitoring_job(request) @@ -7354,6 +7367,7 @@ def test_get_model_monitoring_job_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_model_monitoring_job(**mock_args) @@ -7501,6 +7515,7 @@ def test_list_model_monitoring_jobs_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_model_monitoring_jobs(request) @@ -7560,6 +7575,7 @@ def test_list_model_monitoring_jobs_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_model_monitoring_jobs(**mock_args) @@ -7765,6 +7781,7 @@ def test_delete_model_monitoring_job_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_model_monitoring_job(request) @@ -7810,6 +7827,7 @@ def test_delete_model_monitoring_job_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_model_monitoring_job(**mock_args) @@ -7951,6 +7969,7 @@ def test_search_model_monitoring_stats_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.search_model_monitoring_stats(request) @@ -8002,6 +8021,7 @@ def test_search_model_monitoring_stats_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.search_model_monitoring_stats(**mock_args) @@ -8211,6 +8231,7 @@ def test_search_model_monitoring_alerts_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.search_model_monitoring_alerts(request) @@ -8262,6 +8283,7 @@ def test_search_model_monitoring_alerts_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.search_model_monitoring_alerts(**mock_args) @@ -9087,6 +9109,7 @@ def test_create_model_monitor_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_model_monitor(request) @@ -9318,6 +9341,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_model_monitor(request) # Establish that the response is the type that we expect. @@ -9359,6 +9383,7 @@ def test_create_model_monitor_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 @@ -9407,6 +9432,7 @@ def test_update_model_monitor_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_model_monitor(request) @@ -9642,6 +9668,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_model_monitor(request) # Establish that the response is the type that we expect. @@ -9683,6 +9710,7 @@ def test_update_model_monitor_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 @@ -9727,6 +9755,7 @@ def test_get_model_monitor_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_model_monitor(request) @@ -9765,6 +9794,7 @@ def test_get_model_monitor_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_model_monitor(request) # Establish that the response is the type that we expect. @@ -9808,6 +9838,7 @@ def test_get_model_monitor_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 = model_monitor.ModelMonitor.to_json(model_monitor.ModelMonitor()) req.return_value.content = return_value @@ -9852,6 +9883,7 @@ def test_list_model_monitors_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_model_monitors(request) @@ -9889,6 +9921,7 @@ def test_list_model_monitors_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_model_monitors(request) # Establish that the response is the type that we expect. @@ -9929,6 +9962,7 @@ def test_list_model_monitors_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 = model_monitoring_service.ListModelMonitorsResponse.to_json( model_monitoring_service.ListModelMonitorsResponse() ) @@ -9975,6 +10009,7 @@ def test_delete_model_monitor_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_model_monitor(request) @@ -10005,6 +10040,7 @@ def test_delete_model_monitor_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_model_monitor(request) # Establish that the response is the type that we expect. @@ -10046,6 +10082,7 @@ def test_delete_model_monitor_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 @@ -10092,6 +10129,7 @@ def test_create_model_monitoring_job_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_model_monitoring_job(request) @@ -10345,6 +10383,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_model_monitoring_job(request) # Establish that the response is the type that we expect. @@ -10390,6 +10429,7 @@ def test_create_model_monitoring_job_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 = gca_model_monitoring_job.ModelMonitoringJob.to_json( gca_model_monitoring_job.ModelMonitoringJob() ) @@ -10438,6 +10478,7 @@ def test_get_model_monitoring_job_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_model_monitoring_job(request) @@ -10478,6 +10519,7 @@ def test_get_model_monitoring_job_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_model_monitoring_job(request) # Establish that the response is the type that we expect. @@ -10522,6 +10564,7 @@ def test_get_model_monitoring_job_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 = model_monitoring_job.ModelMonitoringJob.to_json( model_monitoring_job.ModelMonitoringJob() ) @@ -10570,6 +10613,7 @@ def test_list_model_monitoring_jobs_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_model_monitoring_jobs(request) @@ -10609,6 +10653,7 @@ def test_list_model_monitoring_jobs_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_model_monitoring_jobs(request) # Establish that the response is the type that we expect. @@ -10651,6 +10696,7 @@ def test_list_model_monitoring_jobs_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 = model_monitoring_service.ListModelMonitoringJobsResponse.to_json( model_monitoring_service.ListModelMonitoringJobsResponse() ) @@ -10699,6 +10745,7 @@ def test_delete_model_monitoring_job_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_model_monitoring_job(request) @@ -10731,6 +10778,7 @@ def test_delete_model_monitoring_job_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_model_monitoring_job(request) # Establish that the response is the type that we expect. @@ -10774,6 +10822,7 @@ def test_delete_model_monitoring_job_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 @@ -10820,6 +10869,7 @@ def test_search_model_monitoring_stats_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.search_model_monitoring_stats(request) @@ -10859,6 +10909,7 @@ def test_search_model_monitoring_stats_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.search_model_monitoring_stats(request) # Establish that the response is the type that we expect. @@ -10901,6 +10952,7 @@ def test_search_model_monitoring_stats_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 = ( model_monitoring_service.SearchModelMonitoringStatsResponse.to_json( model_monitoring_service.SearchModelMonitoringStatsResponse() @@ -10953,6 +11005,7 @@ def test_search_model_monitoring_alerts_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.search_model_monitoring_alerts(request) @@ -10993,6 +11046,7 @@ def test_search_model_monitoring_alerts_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.search_model_monitoring_alerts(request) # Establish that the response is the type that we expect. @@ -11036,6 +11090,7 @@ def test_search_model_monitoring_alerts_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 = ( model_monitoring_service.SearchModelMonitoringAlertsResponse.to_json( model_monitoring_service.SearchModelMonitoringAlertsResponse() @@ -11086,6 +11141,7 @@ def test_get_location_rest_bad_request(request_type=locations_pb2.GetLocationReq 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_location(request) @@ -11116,6 +11172,7 @@ def test_get_location_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_location(request) @@ -11144,6 +11201,7 @@ def test_list_locations_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_locations(request) @@ -11174,6 +11232,7 @@ def test_list_locations_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_locations(request) @@ -11205,6 +11264,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -11237,6 +11297,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -11268,6 +11329,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -11300,6 +11362,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -11331,6 +11394,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -11363,6 +11427,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -11393,6 +11458,7 @@ def test_cancel_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.cancel_operation(request) @@ -11423,6 +11489,7 @@ def test_cancel_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.cancel_operation(request) @@ -11453,6 +11520,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) @@ -11483,6 +11551,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) @@ -11513,6 +11582,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) @@ -11543,6 +11613,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) @@ -11573,6 +11644,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) @@ -11603,6 +11675,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) @@ -11633,6 +11706,7 @@ def test_wait_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.wait_operation(request) @@ -11663,6 +11737,7 @@ def test_wait_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.wait_operation(request) @@ -11972,6 +12047,7 @@ async def test_create_model_monitor_rest_asyncio_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"} await client.create_model_monitor(request) @@ -12210,6 +12286,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.create_model_monitor(request) # Establish that the response is the type that we expect. @@ -12258,6 +12335,7 @@ async def test_create_model_monitor_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -12310,6 +12388,7 @@ async def test_update_model_monitor_rest_asyncio_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"} await client.update_model_monitor(request) @@ -12552,6 +12631,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.update_model_monitor(request) # Establish that the response is the type that we expect. @@ -12600,6 +12680,7 @@ async def test_update_model_monitor_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -12648,6 +12729,7 @@ async def test_get_model_monitor_rest_asyncio_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"} await client.get_model_monitor(request) @@ -12693,6 +12775,7 @@ async def test_get_model_monitor_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_model_monitor(request) # Establish that the response is the type that we expect. @@ -12741,6 +12824,7 @@ async def test_get_model_monitor_rest_asyncio_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 = model_monitor.ModelMonitor.to_json(model_monitor.ModelMonitor()) req.return_value.read = mock.AsyncMock(return_value=return_value) @@ -12789,6 +12873,7 @@ async def test_list_model_monitors_rest_asyncio_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"} await client.list_model_monitors(request) @@ -12833,6 +12918,7 @@ async def test_list_model_monitors_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_model_monitors(request) # Establish that the response is the type that we expect. @@ -12879,6 +12965,7 @@ async def test_list_model_monitors_rest_asyncio_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 = model_monitoring_service.ListModelMonitorsResponse.to_json( model_monitoring_service.ListModelMonitorsResponse() ) @@ -12929,6 +13016,7 @@ async def test_delete_model_monitor_rest_asyncio_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"} await client.delete_model_monitor(request) @@ -12966,6 +13054,7 @@ async def test_delete_model_monitor_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_model_monitor(request) # Establish that the response is the type that we expect. @@ -13014,6 +13103,7 @@ async def test_delete_model_monitor_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -13064,6 +13154,7 @@ async def test_create_model_monitoring_job_rest_asyncio_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"} await client.create_model_monitoring_job(request) @@ -13324,6 +13415,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.create_model_monitoring_job(request) # Establish that the response is the type that we expect. @@ -13374,6 +13466,7 @@ async def test_create_model_monitoring_job_rest_asyncio_interceptors(null_interc 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 = gca_model_monitoring_job.ModelMonitoringJob.to_json( gca_model_monitoring_job.ModelMonitoringJob() ) @@ -13426,6 +13519,7 @@ async def test_get_model_monitoring_job_rest_asyncio_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"} await client.get_model_monitoring_job(request) @@ -13473,6 +13567,7 @@ async def test_get_model_monitoring_job_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_model_monitoring_job(request) # Establish that the response is the type that we expect. @@ -13523,6 +13618,7 @@ async def test_get_model_monitoring_job_rest_asyncio_interceptors(null_intercept 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 = model_monitoring_job.ModelMonitoringJob.to_json( model_monitoring_job.ModelMonitoringJob() ) @@ -13575,6 +13671,7 @@ async def test_list_model_monitoring_jobs_rest_asyncio_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"} await client.list_model_monitoring_jobs(request) @@ -13621,6 +13718,7 @@ async def test_list_model_monitoring_jobs_rest_asyncio_call_success(request_type return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_model_monitoring_jobs(request) # Establish that the response is the type that we expect. @@ -13668,6 +13766,7 @@ async def test_list_model_monitoring_jobs_rest_asyncio_interceptors(null_interce 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 = model_monitoring_service.ListModelMonitoringJobsResponse.to_json( model_monitoring_service.ListModelMonitoringJobsResponse() ) @@ -13720,6 +13819,7 @@ async def test_delete_model_monitoring_job_rest_asyncio_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"} await client.delete_model_monitoring_job(request) @@ -13759,6 +13859,7 @@ async def test_delete_model_monitoring_job_rest_asyncio_call_success(request_typ return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_model_monitoring_job(request) # Establish that the response is the type that we expect. @@ -13807,6 +13908,7 @@ async def test_delete_model_monitoring_job_rest_asyncio_interceptors(null_interc 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.read = mock.AsyncMock(return_value=return_value) @@ -13857,6 +13959,7 @@ async def test_search_model_monitoring_stats_rest_asyncio_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"} await client.search_model_monitoring_stats(request) @@ -13903,6 +14006,7 @@ async def test_search_model_monitoring_stats_rest_asyncio_call_success(request_t return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.search_model_monitoring_stats(request) # Establish that the response is the type that we expect. @@ -13952,6 +14056,7 @@ async def test_search_model_monitoring_stats_rest_asyncio_interceptors( 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 = ( model_monitoring_service.SearchModelMonitoringStatsResponse.to_json( model_monitoring_service.SearchModelMonitoringStatsResponse() @@ -14008,6 +14113,7 @@ async def test_search_model_monitoring_alerts_rest_asyncio_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"} await client.search_model_monitoring_alerts(request) @@ -14055,6 +14161,7 @@ async def test_search_model_monitoring_alerts_rest_asyncio_call_success(request_ return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.search_model_monitoring_alerts(request) # Establish that the response is the type that we expect. @@ -14105,6 +14212,7 @@ async def test_search_model_monitoring_alerts_rest_asyncio_interceptors( 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 = ( model_monitoring_service.SearchModelMonitoringAlertsResponse.to_json( model_monitoring_service.SearchModelMonitoringAlertsResponse() @@ -14161,6 +14269,7 @@ async def test_get_location_rest_asyncio_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"} await client.get_location(request) @@ -14198,6 +14307,7 @@ async def test_get_location_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_location(request) @@ -14230,6 +14340,7 @@ async def test_list_locations_rest_asyncio_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"} await client.list_locations(request) @@ -14267,6 +14378,7 @@ async def test_list_locations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_locations(request) @@ -14302,6 +14414,7 @@ async def test_get_iam_policy_rest_asyncio_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"} await client.get_iam_policy(request) @@ -14341,6 +14454,7 @@ async def test_get_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_iam_policy(request) @@ -14376,6 +14490,7 @@ async def test_set_iam_policy_rest_asyncio_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"} await client.set_iam_policy(request) @@ -14415,6 +14530,7 @@ async def test_set_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.set_iam_policy(request) @@ -14450,6 +14566,7 @@ async def test_test_iam_permissions_rest_asyncio_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"} await client.test_iam_permissions(request) @@ -14489,6 +14606,7 @@ async def test_test_iam_permissions_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.test_iam_permissions(request) @@ -14523,6 +14641,7 @@ async def test_cancel_operation_rest_asyncio_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"} await client.cancel_operation(request) @@ -14560,6 +14679,7 @@ async def test_cancel_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.cancel_operation(request) @@ -14594,6 +14714,7 @@ async def test_delete_operation_rest_asyncio_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"} await client.delete_operation(request) @@ -14631,6 +14752,7 @@ async def test_delete_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_operation(request) @@ -14665,6 +14787,7 @@ async def test_get_operation_rest_asyncio_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"} await client.get_operation(request) @@ -14702,6 +14825,7 @@ async def test_get_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_operation(request) @@ -14736,6 +14860,7 @@ async def test_list_operations_rest_asyncio_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"} await client.list_operations(request) @@ -14773,6 +14898,7 @@ async def test_list_operations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_operations(request) @@ -14807,6 +14933,7 @@ async def test_wait_operation_rest_asyncio_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"} await client.wait_operation(request) @@ -14844,6 +14971,7 @@ async def test_wait_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.wait_operation(request) diff --git a/tests/unit/gapic/aiplatform_v1beta1/test_model_service.py b/tests/unit/gapic/aiplatform_v1beta1/test_model_service.py index c07093d7ae..4ce5f5836a 100644 --- a/tests/unit/gapic/aiplatform_v1beta1/test_model_service.py +++ b/tests/unit/gapic/aiplatform_v1beta1/test_model_service.py @@ -8452,6 +8452,7 @@ def test_upload_model_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.upload_model(request) @@ -8504,6 +8505,7 @@ def test_upload_model_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.upload_model(**mock_args) @@ -8634,6 +8636,7 @@ def test_get_model_rest_required_fields(request_type=model_service.GetModelReque 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_model(request) @@ -8679,6 +8682,7 @@ def test_get_model_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_model(**mock_args) @@ -8817,6 +8821,7 @@ def test_list_models_rest_required_fields(request_type=model_service.ListModelsR 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_models(request) @@ -8872,6 +8877,7 @@ def test_list_models_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_models(**mock_args) @@ -9078,6 +9084,7 @@ def test_list_model_versions_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_model_versions(request) @@ -9134,6 +9141,7 @@ def test_list_model_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_model_versions(**mock_args) @@ -9326,6 +9334,7 @@ def test_update_model_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_model(request) @@ -9382,6 +9391,7 @@ def test_update_model_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_model(**mock_args) @@ -9521,6 +9531,7 @@ def test_update_explanation_dataset_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_explanation_dataset(request) @@ -9564,6 +9575,7 @@ def test_update_explanation_dataset_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_explanation_dataset(**mock_args) @@ -9696,6 +9708,7 @@ def test_delete_model_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_model(request) @@ -9739,6 +9752,7 @@ def test_delete_model_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_model(**mock_args) @@ -9875,6 +9889,7 @@ def test_delete_model_version_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_model_version(request) @@ -9918,6 +9933,7 @@ def test_delete_model_version_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_model_version(**mock_args) @@ -10059,6 +10075,7 @@ def test_merge_version_aliases_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.merge_version_aliases(request) @@ -10113,6 +10130,7 @@ def test_merge_version_aliases_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.merge_version_aliases(**mock_args) @@ -10247,6 +10265,7 @@ def test_export_model_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.export_model(request) @@ -10301,6 +10320,7 @@ def test_export_model_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.export_model(**mock_args) @@ -10439,6 +10459,7 @@ def test_copy_model_rest_required_fields(request_type=model_service.CopyModelReq 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.copy_model(request) @@ -10491,6 +10512,7 @@ def test_copy_model_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.copy_model(**mock_args) @@ -10629,6 +10651,7 @@ def test_import_model_evaluation_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.import_model_evaluation(request) @@ -10683,6 +10706,7 @@ def test_import_model_evaluation_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.import_model_evaluation(**mock_args) @@ -10823,6 +10847,7 @@ def test_batch_import_model_evaluation_slices_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.batch_import_model_evaluation_slices(request) @@ -10885,6 +10910,7 @@ def test_batch_import_model_evaluation_slices_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.batch_import_model_evaluation_slices(**mock_args) @@ -11029,6 +11055,7 @@ def test_batch_import_evaluated_annotations_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.batch_import_evaluated_annotations(request) @@ -11093,6 +11120,7 @@ def test_batch_import_evaluated_annotations_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.batch_import_evaluated_annotations(**mock_args) @@ -11235,6 +11263,7 @@ def test_get_model_evaluation_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_model_evaluation(request) @@ -11282,6 +11311,7 @@ def test_get_model_evaluation_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_model_evaluation(**mock_args) @@ -11427,6 +11457,7 @@ def test_list_model_evaluations_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_model_evaluations(request) @@ -11482,6 +11513,7 @@ def test_list_model_evaluations_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_model_evaluations(**mock_args) @@ -11681,6 +11713,7 @@ def test_get_model_evaluation_slice_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_model_evaluation_slice(request) @@ -11728,6 +11761,7 @@ def test_get_model_evaluation_slice_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_model_evaluation_slice(**mock_args) @@ -11875,6 +11909,7 @@ def test_list_model_evaluation_slices_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_model_evaluation_slices(request) @@ -11932,6 +11967,7 @@ def test_list_model_evaluation_slices_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_model_evaluation_slices(**mock_args) @@ -13142,6 +13178,7 @@ def test_upload_model_rest_bad_request(request_type=model_service.UploadModelReq 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.upload_model(request) @@ -13172,6 +13209,7 @@ def test_upload_model_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.upload_model(request) # Establish that the response is the type that we expect. @@ -13213,6 +13251,7 @@ def test_upload_model_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 @@ -13255,6 +13294,7 @@ def test_get_model_rest_bad_request(request_type=model_service.GetModelRequest): 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_model(request) @@ -13307,6 +13347,7 @@ def test_get_model_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_model(request) # Establish that the response is the type that we expect. @@ -13366,6 +13407,7 @@ def test_get_model_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 = model.Model.to_json(model.Model()) req.return_value.content = return_value @@ -13408,6 +13450,7 @@ def test_list_models_rest_bad_request(request_type=model_service.ListModelsReque 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_models(request) @@ -13443,6 +13486,7 @@ def test_list_models_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_models(request) # Establish that the response is the type that we expect. @@ -13483,6 +13527,7 @@ def test_list_models_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 = model_service.ListModelsResponse.to_json( model_service.ListModelsResponse() ) @@ -13529,6 +13574,7 @@ def test_list_model_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_model_versions(request) @@ -13564,6 +13610,7 @@ def test_list_model_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_model_versions(request) # Establish that the response is the type that we expect. @@ -13604,6 +13651,7 @@ def test_list_model_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 = model_service.ListModelVersionsResponse.to_json( model_service.ListModelVersionsResponse() ) @@ -13650,6 +13698,7 @@ def test_update_model_rest_bad_request(request_type=model_service.UpdateModelReq 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_model(request) @@ -13884,6 +13933,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_model(request) # Establish that the response is the type that we expect. @@ -13945,6 +13995,7 @@ def test_update_model_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 = gca_model.Model.to_json(gca_model.Model()) req.return_value.content = return_value @@ -13989,6 +14040,7 @@ def test_update_explanation_dataset_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_explanation_dataset(request) @@ -14019,6 +14071,7 @@ def test_update_explanation_dataset_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.update_explanation_dataset(request) # Establish that the response is the type that we expect. @@ -14060,6 +14113,7 @@ def test_update_explanation_dataset_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 @@ -14102,6 +14156,7 @@ def test_delete_model_rest_bad_request(request_type=model_service.DeleteModelReq 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_model(request) @@ -14132,6 +14187,7 @@ def test_delete_model_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_model(request) # Establish that the response is the type that we expect. @@ -14173,6 +14229,7 @@ def test_delete_model_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 @@ -14217,6 +14274,7 @@ def test_delete_model_version_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_model_version(request) @@ -14247,6 +14305,7 @@ def test_delete_model_version_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_model_version(request) # Establish that the response is the type that we expect. @@ -14288,6 +14347,7 @@ def test_delete_model_version_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 @@ -14332,6 +14392,7 @@ def test_merge_version_aliases_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.merge_version_aliases(request) @@ -14384,6 +14445,7 @@ def test_merge_version_aliases_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.merge_version_aliases(request) # Establish that the response is the type that we expect. @@ -14445,6 +14507,7 @@ def test_merge_version_aliases_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 = model.Model.to_json(model.Model()) req.return_value.content = return_value @@ -14487,6 +14550,7 @@ def test_export_model_rest_bad_request(request_type=model_service.ExportModelReq 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.export_model(request) @@ -14517,6 +14581,7 @@ def test_export_model_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.export_model(request) # Establish that the response is the type that we expect. @@ -14558,6 +14623,7 @@ def test_export_model_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 @@ -14600,6 +14666,7 @@ def test_copy_model_rest_bad_request(request_type=model_service.CopyModelRequest 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.copy_model(request) @@ -14630,6 +14697,7 @@ def test_copy_model_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.copy_model(request) # Establish that the response is the type that we expect. @@ -14669,6 +14737,7 @@ def test_copy_model_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 @@ -14713,6 +14782,7 @@ def test_import_model_evaluation_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.import_model_evaluation(request) @@ -14751,6 +14821,7 @@ def test_import_model_evaluation_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.import_model_evaluation(request) # Establish that the response is the type that we expect. @@ -14794,6 +14865,7 @@ def test_import_model_evaluation_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 = gca_model_evaluation.ModelEvaluation.to_json( gca_model_evaluation.ModelEvaluation() ) @@ -14842,6 +14914,7 @@ def test_batch_import_model_evaluation_slices_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.batch_import_model_evaluation_slices(request) @@ -14881,6 +14954,7 @@ def test_batch_import_model_evaluation_slices_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.batch_import_model_evaluation_slices(request) # Establish that the response is the type that we expect. @@ -14925,6 +14999,7 @@ def test_batch_import_model_evaluation_slices_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 = model_service.BatchImportModelEvaluationSlicesResponse.to_json( model_service.BatchImportModelEvaluationSlicesResponse() ) @@ -14973,6 +15048,7 @@ def test_batch_import_evaluated_annotations_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.batch_import_evaluated_annotations(request) @@ -15012,6 +15088,7 @@ def test_batch_import_evaluated_annotations_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.batch_import_evaluated_annotations(request) # Establish that the response is the type that we expect. @@ -15053,6 +15130,7 @@ def test_batch_import_evaluated_annotations_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 = model_service.BatchImportEvaluatedAnnotationsResponse.to_json( model_service.BatchImportEvaluatedAnnotationsResponse() ) @@ -15101,6 +15179,7 @@ def test_get_model_evaluation_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_model_evaluation(request) @@ -15141,6 +15220,7 @@ def test_get_model_evaluation_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_model_evaluation(request) # Establish that the response is the type that we expect. @@ -15184,6 +15264,7 @@ def test_get_model_evaluation_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 = model_evaluation.ModelEvaluation.to_json( model_evaluation.ModelEvaluation() ) @@ -15230,6 +15311,7 @@ def test_list_model_evaluations_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_model_evaluations(request) @@ -15265,6 +15347,7 @@ def test_list_model_evaluations_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_model_evaluations(request) # Establish that the response is the type that we expect. @@ -15305,6 +15388,7 @@ def test_list_model_evaluations_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 = model_service.ListModelEvaluationsResponse.to_json( model_service.ListModelEvaluationsResponse() ) @@ -15353,6 +15437,7 @@ def test_get_model_evaluation_slice_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_model_evaluation_slice(request) @@ -15391,6 +15476,7 @@ def test_get_model_evaluation_slice_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_model_evaluation_slice(request) # Establish that the response is the type that we expect. @@ -15432,6 +15518,7 @@ def test_get_model_evaluation_slice_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 = model_evaluation_slice.ModelEvaluationSlice.to_json( model_evaluation_slice.ModelEvaluationSlice() ) @@ -15480,6 +15567,7 @@ def test_list_model_evaluation_slices_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_model_evaluation_slices(request) @@ -15517,6 +15605,7 @@ def test_list_model_evaluation_slices_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_model_evaluation_slices(request) # Establish that the response is the type that we expect. @@ -15557,6 +15646,7 @@ def test_list_model_evaluation_slices_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 = model_service.ListModelEvaluationSlicesResponse.to_json( model_service.ListModelEvaluationSlicesResponse() ) @@ -15603,6 +15693,7 @@ def test_get_location_rest_bad_request(request_type=locations_pb2.GetLocationReq 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_location(request) @@ -15633,6 +15724,7 @@ def test_get_location_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_location(request) @@ -15661,6 +15753,7 @@ def test_list_locations_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_locations(request) @@ -15691,6 +15784,7 @@ def test_list_locations_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_locations(request) @@ -15722,6 +15816,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -15754,6 +15849,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -15785,6 +15881,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -15817,6 +15914,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -15848,6 +15946,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -15880,6 +15979,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -15910,6 +16010,7 @@ def test_cancel_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.cancel_operation(request) @@ -15940,6 +16041,7 @@ def test_cancel_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.cancel_operation(request) @@ -15970,6 +16072,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) @@ -16000,6 +16103,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) @@ -16030,6 +16134,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) @@ -16060,6 +16165,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) @@ -16090,6 +16196,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) @@ -16120,6 +16227,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) @@ -16150,6 +16258,7 @@ def test_wait_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.wait_operation(request) @@ -16180,6 +16289,7 @@ def test_wait_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.wait_operation(request) @@ -16629,6 +16739,7 @@ async def test_upload_model_rest_asyncio_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"} await client.upload_model(request) @@ -16666,6 +16777,7 @@ async def test_upload_model_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.upload_model(request) # Establish that the response is the type that we expect. @@ -16712,6 +16824,7 @@ async def test_upload_model_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -16760,6 +16873,7 @@ async def test_get_model_rest_asyncio_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"} await client.get_model(request) @@ -16819,6 +16933,7 @@ async def test_get_model_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_model(request) # Establish that the response is the type that we expect. @@ -16883,6 +16998,7 @@ async def test_get_model_rest_asyncio_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 = model.Model.to_json(model.Model()) req.return_value.read = mock.AsyncMock(return_value=return_value) @@ -16931,6 +17047,7 @@ async def test_list_models_rest_asyncio_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"} await client.list_models(request) @@ -16973,6 +17090,7 @@ async def test_list_models_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_models(request) # Establish that the response is the type that we expect. @@ -17018,6 +17136,7 @@ async def test_list_models_rest_asyncio_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 = model_service.ListModelsResponse.to_json( model_service.ListModelsResponse() ) @@ -17068,6 +17187,7 @@ async def test_list_model_versions_rest_asyncio_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"} await client.list_model_versions(request) @@ -17110,6 +17230,7 @@ async def test_list_model_versions_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_model_versions(request) # Establish that the response is the type that we expect. @@ -17155,6 +17276,7 @@ async def test_list_model_versions_rest_asyncio_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 = model_service.ListModelVersionsResponse.to_json( model_service.ListModelVersionsResponse() ) @@ -17207,6 +17329,7 @@ async def test_update_model_rest_asyncio_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"} await client.update_model(request) @@ -17448,6 +17571,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.update_model(request) # Establish that the response is the type that we expect. @@ -17514,6 +17638,7 @@ async def test_update_model_rest_asyncio_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 = gca_model.Model.to_json(gca_model.Model()) req.return_value.read = mock.AsyncMock(return_value=return_value) @@ -17562,6 +17687,7 @@ async def test_update_explanation_dataset_rest_asyncio_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"} await client.update_explanation_dataset(request) @@ -17599,6 +17725,7 @@ async def test_update_explanation_dataset_rest_asyncio_call_success(request_type return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.update_explanation_dataset(request) # Establish that the response is the type that we expect. @@ -17645,6 +17772,7 @@ async def test_update_explanation_dataset_rest_asyncio_interceptors(null_interce 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.read = mock.AsyncMock(return_value=return_value) @@ -17693,6 +17821,7 @@ async def test_delete_model_rest_asyncio_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"} await client.delete_model(request) @@ -17730,6 +17859,7 @@ async def test_delete_model_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_model(request) # Establish that the response is the type that we expect. @@ -17776,6 +17906,7 @@ async def test_delete_model_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -17824,6 +17955,7 @@ async def test_delete_model_version_rest_asyncio_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"} await client.delete_model_version(request) @@ -17861,6 +17993,7 @@ async def test_delete_model_version_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_model_version(request) # Establish that the response is the type that we expect. @@ -17907,6 +18040,7 @@ async def test_delete_model_version_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -17955,6 +18089,7 @@ async def test_merge_version_aliases_rest_asyncio_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"} await client.merge_version_aliases(request) @@ -18014,6 +18149,7 @@ async def test_merge_version_aliases_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.merge_version_aliases(request) # Establish that the response is the type that we expect. @@ -18080,6 +18216,7 @@ async def test_merge_version_aliases_rest_asyncio_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 = model.Model.to_json(model.Model()) req.return_value.read = mock.AsyncMock(return_value=return_value) @@ -18128,6 +18265,7 @@ async def test_export_model_rest_asyncio_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"} await client.export_model(request) @@ -18165,6 +18303,7 @@ async def test_export_model_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.export_model(request) # Establish that the response is the type that we expect. @@ -18211,6 +18350,7 @@ async def test_export_model_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -18259,6 +18399,7 @@ async def test_copy_model_rest_asyncio_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"} await client.copy_model(request) @@ -18296,6 +18437,7 @@ async def test_copy_model_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.copy_model(request) # Establish that the response is the type that we expect. @@ -18340,6 +18482,7 @@ async def test_copy_model_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -18388,6 +18531,7 @@ async def test_import_model_evaluation_rest_asyncio_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"} await client.import_model_evaluation(request) @@ -18433,6 +18577,7 @@ async def test_import_model_evaluation_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.import_model_evaluation(request) # Establish that the response is the type that we expect. @@ -18481,6 +18626,7 @@ async def test_import_model_evaluation_rest_asyncio_interceptors(null_intercepto 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 = gca_model_evaluation.ModelEvaluation.to_json( gca_model_evaluation.ModelEvaluation() ) @@ -18533,6 +18679,7 @@ async def test_batch_import_model_evaluation_slices_rest_asyncio_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"} await client.batch_import_model_evaluation_slices(request) @@ -18581,6 +18728,7 @@ async def test_batch_import_model_evaluation_slices_rest_asyncio_call_success( return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.batch_import_model_evaluation_slices(request) # Establish that the response is the type that we expect. @@ -18632,6 +18780,7 @@ async def test_batch_import_model_evaluation_slices_rest_asyncio_interceptors( 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 = model_service.BatchImportModelEvaluationSlicesResponse.to_json( model_service.BatchImportModelEvaluationSlicesResponse() ) @@ -18684,6 +18833,7 @@ async def test_batch_import_evaluated_annotations_rest_asyncio_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"} await client.batch_import_evaluated_annotations(request) @@ -18732,6 +18882,7 @@ async def test_batch_import_evaluated_annotations_rest_asyncio_call_success( return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.batch_import_evaluated_annotations(request) # Establish that the response is the type that we expect. @@ -18781,6 +18932,7 @@ async def test_batch_import_evaluated_annotations_rest_asyncio_interceptors( 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 = model_service.BatchImportEvaluatedAnnotationsResponse.to_json( model_service.BatchImportEvaluatedAnnotationsResponse() ) @@ -18833,6 +18985,7 @@ async def test_get_model_evaluation_rest_asyncio_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"} await client.get_model_evaluation(request) @@ -18880,6 +19033,7 @@ async def test_get_model_evaluation_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_model_evaluation(request) # Establish that the response is the type that we expect. @@ -18928,6 +19082,7 @@ async def test_get_model_evaluation_rest_asyncio_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 = model_evaluation.ModelEvaluation.to_json( model_evaluation.ModelEvaluation() ) @@ -18978,6 +19133,7 @@ async def test_list_model_evaluations_rest_asyncio_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"} await client.list_model_evaluations(request) @@ -19020,6 +19176,7 @@ async def test_list_model_evaluations_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_model_evaluations(request) # Establish that the response is the type that we expect. @@ -19065,6 +19222,7 @@ async def test_list_model_evaluations_rest_asyncio_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 = model_service.ListModelEvaluationsResponse.to_json( model_service.ListModelEvaluationsResponse() ) @@ -19117,6 +19275,7 @@ async def test_get_model_evaluation_slice_rest_asyncio_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"} await client.get_model_evaluation_slice(request) @@ -19162,6 +19321,7 @@ async def test_get_model_evaluation_slice_rest_asyncio_call_success(request_type return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_model_evaluation_slice(request) # Establish that the response is the type that we expect. @@ -19208,6 +19368,7 @@ async def test_get_model_evaluation_slice_rest_asyncio_interceptors(null_interce 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 = model_evaluation_slice.ModelEvaluationSlice.to_json( model_evaluation_slice.ModelEvaluationSlice() ) @@ -19260,6 +19421,7 @@ async def test_list_model_evaluation_slices_rest_asyncio_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"} await client.list_model_evaluation_slices(request) @@ -19304,6 +19466,7 @@ async def test_list_model_evaluation_slices_rest_asyncio_call_success(request_ty return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_model_evaluation_slices(request) # Establish that the response is the type that we expect. @@ -19349,6 +19512,7 @@ async def test_list_model_evaluation_slices_rest_asyncio_interceptors(null_inter 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 = model_service.ListModelEvaluationSlicesResponse.to_json( model_service.ListModelEvaluationSlicesResponse() ) @@ -19401,6 +19565,7 @@ async def test_get_location_rest_asyncio_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"} await client.get_location(request) @@ -19438,6 +19603,7 @@ async def test_get_location_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_location(request) @@ -19470,6 +19636,7 @@ async def test_list_locations_rest_asyncio_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"} await client.list_locations(request) @@ -19507,6 +19674,7 @@ async def test_list_locations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_locations(request) @@ -19542,6 +19710,7 @@ async def test_get_iam_policy_rest_asyncio_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"} await client.get_iam_policy(request) @@ -19581,6 +19750,7 @@ async def test_get_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_iam_policy(request) @@ -19616,6 +19786,7 @@ async def test_set_iam_policy_rest_asyncio_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"} await client.set_iam_policy(request) @@ -19655,6 +19826,7 @@ async def test_set_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.set_iam_policy(request) @@ -19690,6 +19862,7 @@ async def test_test_iam_permissions_rest_asyncio_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"} await client.test_iam_permissions(request) @@ -19729,6 +19902,7 @@ async def test_test_iam_permissions_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.test_iam_permissions(request) @@ -19763,6 +19937,7 @@ async def test_cancel_operation_rest_asyncio_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"} await client.cancel_operation(request) @@ -19800,6 +19975,7 @@ async def test_cancel_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.cancel_operation(request) @@ -19834,6 +20010,7 @@ async def test_delete_operation_rest_asyncio_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"} await client.delete_operation(request) @@ -19871,6 +20048,7 @@ async def test_delete_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_operation(request) @@ -19905,6 +20083,7 @@ async def test_get_operation_rest_asyncio_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"} await client.get_operation(request) @@ -19942,6 +20121,7 @@ async def test_get_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_operation(request) @@ -19976,6 +20156,7 @@ async def test_list_operations_rest_asyncio_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"} await client.list_operations(request) @@ -20013,6 +20194,7 @@ async def test_list_operations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_operations(request) @@ -20047,6 +20229,7 @@ async def test_wait_operation_rest_asyncio_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"} await client.wait_operation(request) @@ -20084,6 +20267,7 @@ async def test_wait_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.wait_operation(request) diff --git a/tests/unit/gapic/aiplatform_v1beta1/test_notebook_service.py b/tests/unit/gapic/aiplatform_v1beta1/test_notebook_service.py index ad87ff698d..39cf8eef7c 100644 --- a/tests/unit/gapic/aiplatform_v1beta1/test_notebook_service.py +++ b/tests/unit/gapic/aiplatform_v1beta1/test_notebook_service.py @@ -6324,6 +6324,7 @@ def test_get_notebook_execution_job(request_type, transport: str = "grpc"): display_name="display_name_value", schedule_resource_name="schedule_resource_name_value", job_state=job_state.JobState.JOB_STATE_QUEUED, + kernel_name="kernel_name_value", notebook_runtime_template_resource_name="notebook_runtime_template_resource_name_value", gcs_output_uri="gcs_output_uri_value", execution_user="execution_user_value", @@ -6342,6 +6343,7 @@ def test_get_notebook_execution_job(request_type, transport: str = "grpc"): assert response.display_name == "display_name_value" assert response.schedule_resource_name == "schedule_resource_name_value" assert response.job_state == job_state.JobState.JOB_STATE_QUEUED + assert response.kernel_name == "kernel_name_value" def test_get_notebook_execution_job_non_empty_request_with_auto_populated_field(): @@ -6481,6 +6483,7 @@ async def test_get_notebook_execution_job_async( display_name="display_name_value", schedule_resource_name="schedule_resource_name_value", job_state=job_state.JobState.JOB_STATE_QUEUED, + kernel_name="kernel_name_value", ) ) response = await client.get_notebook_execution_job(request) @@ -6497,6 +6500,7 @@ async def test_get_notebook_execution_job_async( assert response.display_name == "display_name_value" assert response.schedule_resource_name == "schedule_resource_name_value" assert response.job_state == job_state.JobState.JOB_STATE_QUEUED + assert response.kernel_name == "kernel_name_value" @pytest.mark.asyncio @@ -7671,6 +7675,7 @@ def test_create_notebook_runtime_template_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_notebook_runtime_template(request) @@ -7728,6 +7733,7 @@ def test_create_notebook_runtime_template_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_notebook_runtime_template(**mock_args) @@ -7868,6 +7874,7 @@ def test_get_notebook_runtime_template_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_notebook_runtime_template(request) @@ -7917,6 +7924,7 @@ def test_get_notebook_runtime_template_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_notebook_runtime_template(**mock_args) @@ -8065,6 +8073,7 @@ def test_list_notebook_runtime_templates_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_notebook_runtime_templates(request) @@ -8125,6 +8134,7 @@ def test_list_notebook_runtime_templates_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_notebook_runtime_templates(**mock_args) @@ -8330,6 +8340,7 @@ def test_delete_notebook_runtime_template_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_notebook_runtime_template(request) @@ -8377,6 +8388,7 @@ def test_delete_notebook_runtime_template_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_notebook_runtime_template(**mock_args) @@ -8511,6 +8523,7 @@ def test_update_notebook_runtime_template_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_notebook_runtime_template(request) @@ -8573,6 +8586,7 @@ def test_update_notebook_runtime_template_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_notebook_runtime_template(**mock_args) @@ -8721,6 +8735,7 @@ def test_assign_notebook_runtime_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.assign_notebook_runtime(request) @@ -8776,6 +8791,7 @@ def test_assign_notebook_runtime_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.assign_notebook_runtime(**mock_args) @@ -8914,6 +8930,7 @@ def test_get_notebook_runtime_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_notebook_runtime(request) @@ -8961,6 +8978,7 @@ def test_get_notebook_runtime_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_notebook_runtime(**mock_args) @@ -9109,6 +9127,7 @@ def test_list_notebook_runtimes_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_notebook_runtimes(request) @@ -9165,6 +9184,7 @@ def test_list_notebook_runtimes_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_notebook_runtimes(**mock_args) @@ -9365,6 +9385,7 @@ def test_delete_notebook_runtime_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_notebook_runtime(request) @@ -9410,6 +9431,7 @@ def test_delete_notebook_runtime_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_notebook_runtime(**mock_args) @@ -9548,6 +9570,7 @@ def test_upgrade_notebook_runtime_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.upgrade_notebook_runtime(request) @@ -9593,6 +9616,7 @@ def test_upgrade_notebook_runtime_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.upgrade_notebook_runtime(**mock_args) @@ -9731,6 +9755,7 @@ def test_start_notebook_runtime_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.start_notebook_runtime(request) @@ -9776,6 +9801,7 @@ def test_start_notebook_runtime_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.start_notebook_runtime(**mock_args) @@ -9914,6 +9940,7 @@ def test_stop_notebook_runtime_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.stop_notebook_runtime(request) @@ -9959,6 +9986,7 @@ def test_stop_notebook_runtime_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.stop_notebook_runtime(**mock_args) @@ -10099,6 +10127,7 @@ def test_create_notebook_execution_job_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_notebook_execution_job(request) @@ -10158,6 +10187,7 @@ def test_create_notebook_execution_job_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_notebook_execution_job(**mock_args) @@ -10302,6 +10332,7 @@ def test_get_notebook_execution_job_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_notebook_execution_job(request) @@ -10349,6 +10380,7 @@ def test_get_notebook_execution_job_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_notebook_execution_job(**mock_args) @@ -10497,6 +10529,7 @@ def test_list_notebook_execution_jobs_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_notebook_execution_jobs(request) @@ -10555,6 +10588,7 @@ def test_list_notebook_execution_jobs_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_notebook_execution_jobs(**mock_args) @@ -10758,6 +10792,7 @@ def test_delete_notebook_execution_job_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_notebook_execution_job(request) @@ -10805,6 +10840,7 @@ def test_delete_notebook_execution_job_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_notebook_execution_job(**mock_args) @@ -11730,6 +11766,7 @@ async def test_get_notebook_execution_job_empty_call_grpc_asyncio(): display_name="display_name_value", schedule_resource_name="schedule_resource_name_value", job_state=job_state.JobState.JOB_STATE_QUEUED, + kernel_name="kernel_name_value", ) ) await client.get_notebook_execution_job(request=None) @@ -11826,6 +11863,7 @@ def test_create_notebook_runtime_template_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_notebook_runtime_template(request) @@ -11969,6 +12007,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_notebook_runtime_template(request) # Establish that the response is the type that we expect. @@ -12012,6 +12051,7 @@ def test_create_notebook_runtime_template_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 @@ -12058,6 +12098,7 @@ def test_get_notebook_runtime_template_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_notebook_runtime_template(request) @@ -12102,6 +12143,7 @@ def test_get_notebook_runtime_template_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_notebook_runtime_template(request) # Establish that the response is the type that we expect. @@ -12152,6 +12194,7 @@ def test_get_notebook_runtime_template_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 = notebook_runtime.NotebookRuntimeTemplate.to_json( notebook_runtime.NotebookRuntimeTemplate() ) @@ -12198,6 +12241,7 @@ def test_list_notebook_runtime_templates_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_notebook_runtime_templates(request) @@ -12235,6 +12279,7 @@ def test_list_notebook_runtime_templates_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_notebook_runtime_templates(request) # Establish that the response is the type that we expect. @@ -12276,6 +12321,7 @@ def test_list_notebook_runtime_templates_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 = notebook_service.ListNotebookRuntimeTemplatesResponse.to_json( notebook_service.ListNotebookRuntimeTemplatesResponse() ) @@ -12324,6 +12370,7 @@ def test_delete_notebook_runtime_template_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_notebook_runtime_template(request) @@ -12356,6 +12403,7 @@ def test_delete_notebook_runtime_template_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_notebook_runtime_template(request) # Establish that the response is the type that we expect. @@ -12399,6 +12447,7 @@ def test_delete_notebook_runtime_template_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 @@ -12447,6 +12496,7 @@ def test_update_notebook_runtime_template_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_notebook_runtime_template(request) @@ -12606,6 +12656,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_notebook_runtime_template(request) # Establish that the response is the type that we expect. @@ -12658,6 +12709,7 @@ def test_update_notebook_runtime_template_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 = notebook_runtime.NotebookRuntimeTemplate.to_json( notebook_runtime.NotebookRuntimeTemplate() ) @@ -12704,6 +12756,7 @@ def test_assign_notebook_runtime_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.assign_notebook_runtime(request) @@ -12734,6 +12787,7 @@ def test_assign_notebook_runtime_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.assign_notebook_runtime(request) # Establish that the response is the type that we expect. @@ -12775,6 +12829,7 @@ def test_assign_notebook_runtime_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 @@ -12821,6 +12876,7 @@ def test_get_notebook_runtime_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_notebook_runtime(request) @@ -12871,6 +12927,7 @@ def test_get_notebook_runtime_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_notebook_runtime(request) # Establish that the response is the type that we expect. @@ -12929,6 +12986,7 @@ def test_get_notebook_runtime_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 = notebook_runtime.NotebookRuntime.to_json( notebook_runtime.NotebookRuntime() ) @@ -12975,6 +13033,7 @@ def test_list_notebook_runtimes_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_notebook_runtimes(request) @@ -13010,6 +13069,7 @@ def test_list_notebook_runtimes_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_notebook_runtimes(request) # Establish that the response is the type that we expect. @@ -13050,6 +13110,7 @@ def test_list_notebook_runtimes_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 = notebook_service.ListNotebookRuntimesResponse.to_json( notebook_service.ListNotebookRuntimesResponse() ) @@ -13098,6 +13159,7 @@ def test_delete_notebook_runtime_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_notebook_runtime(request) @@ -13130,6 +13192,7 @@ def test_delete_notebook_runtime_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_notebook_runtime(request) # Establish that the response is the type that we expect. @@ -13171,6 +13234,7 @@ def test_delete_notebook_runtime_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 @@ -13217,6 +13281,7 @@ def test_upgrade_notebook_runtime_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.upgrade_notebook_runtime(request) @@ -13249,6 +13314,7 @@ def test_upgrade_notebook_runtime_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.upgrade_notebook_runtime(request) # Establish that the response is the type that we expect. @@ -13290,6 +13356,7 @@ def test_upgrade_notebook_runtime_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 @@ -13336,6 +13403,7 @@ def test_start_notebook_runtime_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.start_notebook_runtime(request) @@ -13368,6 +13436,7 @@ def test_start_notebook_runtime_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.start_notebook_runtime(request) # Establish that the response is the type that we expect. @@ -13409,6 +13478,7 @@ def test_start_notebook_runtime_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 @@ -13455,6 +13525,7 @@ def test_stop_notebook_runtime_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_notebook_runtime(request) @@ -13487,6 +13558,7 @@ def test_stop_notebook_runtime_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_notebook_runtime(request) # Establish that the response is the type that we expect. @@ -13528,6 +13600,7 @@ def test_stop_notebook_runtime_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 @@ -13572,6 +13645,7 @@ def test_create_notebook_execution_job_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_notebook_execution_job(request) @@ -13622,6 +13696,7 @@ def test_create_notebook_execution_job_rest_call_success(request_type): "gcs_output_uri": "gcs_output_uri_value", "execution_user": "execution_user_value", "service_account": "service_account_value", + "workbench_runtime": {}, "name": "name_value", "display_name": "display_name_value", "execution_timeout": {"seconds": 751, "nanos": 543}, @@ -13640,6 +13715,7 @@ def test_create_notebook_execution_job_rest_call_success(request_type): "create_time": {"seconds": 751, "nanos": 543}, "update_time": {}, "labels": {}, + "kernel_name": "kernel_name_value", "encryption_spec": {"kms_key_name": "kms_key_name_value"}, } # The version of a generated dependency at test runtime may differ from the version used during generation. @@ -13726,6 +13802,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_notebook_execution_job(request) # Establish that the response is the type that we expect. @@ -13767,6 +13844,7 @@ def test_create_notebook_execution_job_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 @@ -13813,6 +13891,7 @@ def test_get_notebook_execution_job_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_notebook_execution_job(request) @@ -13842,6 +13921,7 @@ def test_get_notebook_execution_job_rest_call_success(request_type): display_name="display_name_value", schedule_resource_name="schedule_resource_name_value", job_state=job_state.JobState.JOB_STATE_QUEUED, + kernel_name="kernel_name_value", notebook_runtime_template_resource_name="notebook_runtime_template_resource_name_value", gcs_output_uri="gcs_output_uri_value", execution_user="execution_user_value", @@ -13856,6 +13936,7 @@ def test_get_notebook_execution_job_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_notebook_execution_job(request) # Establish that the response is the type that we expect. @@ -13864,6 +13945,7 @@ def test_get_notebook_execution_job_rest_call_success(request_type): assert response.display_name == "display_name_value" assert response.schedule_resource_name == "schedule_resource_name_value" assert response.job_state == job_state.JobState.JOB_STATE_QUEUED + assert response.kernel_name == "kernel_name_value" @pytest.mark.parametrize("null_interceptor", [True, False]) @@ -13899,6 +13981,7 @@ def test_get_notebook_execution_job_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 = notebook_execution_job.NotebookExecutionJob.to_json( notebook_execution_job.NotebookExecutionJob() ) @@ -13945,6 +14028,7 @@ def test_list_notebook_execution_jobs_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_notebook_execution_jobs(request) @@ -13982,6 +14066,7 @@ def test_list_notebook_execution_jobs_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_notebook_execution_jobs(request) # Establish that the response is the type that we expect. @@ -14022,6 +14107,7 @@ def test_list_notebook_execution_jobs_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 = notebook_service.ListNotebookExecutionJobsResponse.to_json( notebook_service.ListNotebookExecutionJobsResponse() ) @@ -14070,6 +14156,7 @@ def test_delete_notebook_execution_job_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_notebook_execution_job(request) @@ -14102,6 +14189,7 @@ def test_delete_notebook_execution_job_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_notebook_execution_job(request) # Establish that the response is the type that we expect. @@ -14143,6 +14231,7 @@ def test_delete_notebook_execution_job_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 @@ -14187,6 +14276,7 @@ def test_get_location_rest_bad_request(request_type=locations_pb2.GetLocationReq 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_location(request) @@ -14217,6 +14307,7 @@ def test_get_location_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_location(request) @@ -14245,6 +14336,7 @@ def test_list_locations_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_locations(request) @@ -14275,6 +14367,7 @@ def test_list_locations_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_locations(request) @@ -14306,6 +14399,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -14338,6 +14432,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -14369,6 +14464,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -14401,6 +14497,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -14432,6 +14529,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -14464,6 +14562,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -14494,6 +14593,7 @@ def test_cancel_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.cancel_operation(request) @@ -14524,6 +14624,7 @@ def test_cancel_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.cancel_operation(request) @@ -14554,6 +14655,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) @@ -14584,6 +14686,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) @@ -14614,6 +14717,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) @@ -14644,6 +14748,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) @@ -14674,6 +14779,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) @@ -14704,6 +14810,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) @@ -14734,6 +14841,7 @@ def test_wait_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.wait_operation(request) @@ -14764,6 +14872,7 @@ def test_wait_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.wait_operation(request) @@ -15183,6 +15292,7 @@ async def test_create_notebook_runtime_template_rest_asyncio_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"} await client.create_notebook_runtime_template(request) @@ -15333,6 +15443,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.create_notebook_runtime_template(request) # Establish that the response is the type that we expect. @@ -15383,6 +15494,7 @@ async def test_create_notebook_runtime_template_rest_asyncio_interceptors( 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.read = mock.AsyncMock(return_value=return_value) @@ -15433,6 +15545,7 @@ async def test_get_notebook_runtime_template_rest_asyncio_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"} await client.get_notebook_runtime_template(request) @@ -15484,6 +15597,7 @@ async def test_get_notebook_runtime_template_rest_asyncio_call_success(request_t return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_notebook_runtime_template(request) # Establish that the response is the type that we expect. @@ -15543,6 +15657,7 @@ async def test_get_notebook_runtime_template_rest_asyncio_interceptors( 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 = notebook_runtime.NotebookRuntimeTemplate.to_json( notebook_runtime.NotebookRuntimeTemplate() ) @@ -15593,6 +15708,7 @@ async def test_list_notebook_runtime_templates_rest_asyncio_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"} await client.list_notebook_runtime_templates(request) @@ -15637,6 +15753,7 @@ async def test_list_notebook_runtime_templates_rest_asyncio_call_success(request return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_notebook_runtime_templates(request) # Establish that the response is the type that we expect. @@ -15686,6 +15803,7 @@ async def test_list_notebook_runtime_templates_rest_asyncio_interceptors( 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 = notebook_service.ListNotebookRuntimeTemplatesResponse.to_json( notebook_service.ListNotebookRuntimeTemplatesResponse() ) @@ -15738,6 +15856,7 @@ async def test_delete_notebook_runtime_template_rest_asyncio_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"} await client.delete_notebook_runtime_template(request) @@ -15777,6 +15896,7 @@ async def test_delete_notebook_runtime_template_rest_asyncio_call_success(reques return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_notebook_runtime_template(request) # Establish that the response is the type that we expect. @@ -15827,6 +15947,7 @@ async def test_delete_notebook_runtime_template_rest_asyncio_interceptors( 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.read = mock.AsyncMock(return_value=return_value) @@ -15879,6 +16000,7 @@ async def test_update_notebook_runtime_template_rest_asyncio_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"} await client.update_notebook_runtime_template(request) @@ -16045,6 +16167,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.update_notebook_runtime_template(request) # Establish that the response is the type that we expect. @@ -16104,6 +16227,7 @@ async def test_update_notebook_runtime_template_rest_asyncio_interceptors( 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 = notebook_runtime.NotebookRuntimeTemplate.to_json( notebook_runtime.NotebookRuntimeTemplate() ) @@ -16154,6 +16278,7 @@ async def test_assign_notebook_runtime_rest_asyncio_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"} await client.assign_notebook_runtime(request) @@ -16191,6 +16316,7 @@ async def test_assign_notebook_runtime_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.assign_notebook_runtime(request) # Establish that the response is the type that we expect. @@ -16237,6 +16363,7 @@ async def test_assign_notebook_runtime_rest_asyncio_interceptors(null_intercepto 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.read = mock.AsyncMock(return_value=return_value) @@ -16287,6 +16414,7 @@ async def test_get_notebook_runtime_rest_asyncio_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"} await client.get_notebook_runtime(request) @@ -16344,6 +16472,7 @@ async def test_get_notebook_runtime_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_notebook_runtime(request) # Establish that the response is the type that we expect. @@ -16407,6 +16536,7 @@ async def test_get_notebook_runtime_rest_asyncio_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 = notebook_runtime.NotebookRuntime.to_json( notebook_runtime.NotebookRuntime() ) @@ -16457,6 +16587,7 @@ async def test_list_notebook_runtimes_rest_asyncio_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"} await client.list_notebook_runtimes(request) @@ -16499,6 +16630,7 @@ async def test_list_notebook_runtimes_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_notebook_runtimes(request) # Establish that the response is the type that we expect. @@ -16544,6 +16676,7 @@ async def test_list_notebook_runtimes_rest_asyncio_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 = notebook_service.ListNotebookRuntimesResponse.to_json( notebook_service.ListNotebookRuntimesResponse() ) @@ -16596,6 +16729,7 @@ async def test_delete_notebook_runtime_rest_asyncio_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"} await client.delete_notebook_runtime(request) @@ -16635,6 +16769,7 @@ async def test_delete_notebook_runtime_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_notebook_runtime(request) # Establish that the response is the type that we expect. @@ -16681,6 +16816,7 @@ async def test_delete_notebook_runtime_rest_asyncio_interceptors(null_intercepto 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.read = mock.AsyncMock(return_value=return_value) @@ -16731,6 +16867,7 @@ async def test_upgrade_notebook_runtime_rest_asyncio_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"} await client.upgrade_notebook_runtime(request) @@ -16770,6 +16907,7 @@ async def test_upgrade_notebook_runtime_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.upgrade_notebook_runtime(request) # Establish that the response is the type that we expect. @@ -16816,6 +16954,7 @@ async def test_upgrade_notebook_runtime_rest_asyncio_interceptors(null_intercept 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.read = mock.AsyncMock(return_value=return_value) @@ -16866,6 +17005,7 @@ async def test_start_notebook_runtime_rest_asyncio_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"} await client.start_notebook_runtime(request) @@ -16905,6 +17045,7 @@ async def test_start_notebook_runtime_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.start_notebook_runtime(request) # Establish that the response is the type that we expect. @@ -16951,6 +17092,7 @@ async def test_start_notebook_runtime_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -17001,6 +17143,7 @@ async def test_stop_notebook_runtime_rest_asyncio_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"} await client.stop_notebook_runtime(request) @@ -17040,6 +17183,7 @@ async def test_stop_notebook_runtime_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.stop_notebook_runtime(request) # Establish that the response is the type that we expect. @@ -17086,6 +17230,7 @@ async def test_stop_notebook_runtime_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -17134,6 +17279,7 @@ async def test_create_notebook_execution_job_rest_asyncio_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"} await client.create_notebook_execution_job(request) @@ -17189,6 +17335,7 @@ async def test_create_notebook_execution_job_rest_asyncio_call_success(request_t "gcs_output_uri": "gcs_output_uri_value", "execution_user": "execution_user_value", "service_account": "service_account_value", + "workbench_runtime": {}, "name": "name_value", "display_name": "display_name_value", "execution_timeout": {"seconds": 751, "nanos": 543}, @@ -17207,6 +17354,7 @@ async def test_create_notebook_execution_job_rest_asyncio_call_success(request_t "create_time": {"seconds": 751, "nanos": 543}, "update_time": {}, "labels": {}, + "kernel_name": "kernel_name_value", "encryption_spec": {"kms_key_name": "kms_key_name_value"}, } # The version of a generated dependency at test runtime may differ from the version used during generation. @@ -17295,6 +17443,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.create_notebook_execution_job(request) # Establish that the response is the type that we expect. @@ -17345,6 +17494,7 @@ async def test_create_notebook_execution_job_rest_asyncio_interceptors( 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.read = mock.AsyncMock(return_value=return_value) @@ -17395,6 +17545,7 @@ async def test_get_notebook_execution_job_rest_asyncio_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"} await client.get_notebook_execution_job(request) @@ -17429,6 +17580,7 @@ async def test_get_notebook_execution_job_rest_asyncio_call_success(request_type display_name="display_name_value", schedule_resource_name="schedule_resource_name_value", job_state=job_state.JobState.JOB_STATE_QUEUED, + kernel_name="kernel_name_value", notebook_runtime_template_resource_name="notebook_runtime_template_resource_name_value", gcs_output_uri="gcs_output_uri_value", execution_user="execution_user_value", @@ -17445,6 +17597,7 @@ async def test_get_notebook_execution_job_rest_asyncio_call_success(request_type return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_notebook_execution_job(request) # Establish that the response is the type that we expect. @@ -17453,6 +17606,7 @@ async def test_get_notebook_execution_job_rest_asyncio_call_success(request_type assert response.display_name == "display_name_value" assert response.schedule_resource_name == "schedule_resource_name_value" assert response.job_state == job_state.JobState.JOB_STATE_QUEUED + assert response.kernel_name == "kernel_name_value" @pytest.mark.asyncio @@ -17494,6 +17648,7 @@ async def test_get_notebook_execution_job_rest_asyncio_interceptors(null_interce 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 = notebook_execution_job.NotebookExecutionJob.to_json( notebook_execution_job.NotebookExecutionJob() ) @@ -17544,6 +17699,7 @@ async def test_list_notebook_execution_jobs_rest_asyncio_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"} await client.list_notebook_execution_jobs(request) @@ -17588,6 +17744,7 @@ async def test_list_notebook_execution_jobs_rest_asyncio_call_success(request_ty return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_notebook_execution_jobs(request) # Establish that the response is the type that we expect. @@ -17635,6 +17792,7 @@ async def test_list_notebook_execution_jobs_rest_asyncio_interceptors(null_inter 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 = notebook_service.ListNotebookExecutionJobsResponse.to_json( notebook_service.ListNotebookExecutionJobsResponse() ) @@ -17687,6 +17845,7 @@ async def test_delete_notebook_execution_job_rest_asyncio_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"} await client.delete_notebook_execution_job(request) @@ -17726,6 +17885,7 @@ async def test_delete_notebook_execution_job_rest_asyncio_call_success(request_t return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_notebook_execution_job(request) # Establish that the response is the type that we expect. @@ -17776,6 +17936,7 @@ async def test_delete_notebook_execution_job_rest_asyncio_interceptors( 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.read = mock.AsyncMock(return_value=return_value) @@ -17826,6 +17987,7 @@ async def test_get_location_rest_asyncio_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"} await client.get_location(request) @@ -17863,6 +18025,7 @@ async def test_get_location_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_location(request) @@ -17895,6 +18058,7 @@ async def test_list_locations_rest_asyncio_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"} await client.list_locations(request) @@ -17932,6 +18096,7 @@ async def test_list_locations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_locations(request) @@ -17967,6 +18132,7 @@ async def test_get_iam_policy_rest_asyncio_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"} await client.get_iam_policy(request) @@ -18006,6 +18172,7 @@ async def test_get_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_iam_policy(request) @@ -18041,6 +18208,7 @@ async def test_set_iam_policy_rest_asyncio_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"} await client.set_iam_policy(request) @@ -18080,6 +18248,7 @@ async def test_set_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.set_iam_policy(request) @@ -18115,6 +18284,7 @@ async def test_test_iam_permissions_rest_asyncio_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"} await client.test_iam_permissions(request) @@ -18154,6 +18324,7 @@ async def test_test_iam_permissions_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.test_iam_permissions(request) @@ -18188,6 +18359,7 @@ async def test_cancel_operation_rest_asyncio_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"} await client.cancel_operation(request) @@ -18225,6 +18397,7 @@ async def test_cancel_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.cancel_operation(request) @@ -18259,6 +18432,7 @@ async def test_delete_operation_rest_asyncio_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"} await client.delete_operation(request) @@ -18296,6 +18470,7 @@ async def test_delete_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_operation(request) @@ -18330,6 +18505,7 @@ async def test_get_operation_rest_asyncio_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"} await client.get_operation(request) @@ -18367,6 +18543,7 @@ async def test_get_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_operation(request) @@ -18401,6 +18578,7 @@ async def test_list_operations_rest_asyncio_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"} await client.list_operations(request) @@ -18438,6 +18616,7 @@ async def test_list_operations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_operations(request) @@ -18472,6 +18651,7 @@ async def test_wait_operation_rest_asyncio_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"} await client.wait_operation(request) @@ -18509,6 +18689,7 @@ async def test_wait_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.wait_operation(request) diff --git a/tests/unit/gapic/aiplatform_v1beta1/test_persistent_resource_service.py b/tests/unit/gapic/aiplatform_v1beta1/test_persistent_resource_service.py index b98f7af7f8..745f1cd69b 100644 --- a/tests/unit/gapic/aiplatform_v1beta1/test_persistent_resource_service.py +++ b/tests/unit/gapic/aiplatform_v1beta1/test_persistent_resource_service.py @@ -3655,6 +3655,7 @@ def test_create_persistent_resource_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_persistent_resource(request) @@ -3717,6 +3718,7 @@ def test_create_persistent_resource_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_persistent_resource(**mock_args) @@ -3857,6 +3859,7 @@ def test_get_persistent_resource_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_persistent_resource(request) @@ -3904,6 +3907,7 @@ def test_get_persistent_resource_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_persistent_resource(**mock_args) @@ -4051,6 +4055,7 @@ def test_list_persistent_resources_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_persistent_resources(request) @@ -4106,6 +4111,7 @@ def test_list_persistent_resources_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_persistent_resources(**mock_args) @@ -4309,6 +4315,7 @@ def test_delete_persistent_resource_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_persistent_resource(request) @@ -4354,6 +4361,7 @@ def test_delete_persistent_resource_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_persistent_resource(**mock_args) @@ -4489,6 +4497,7 @@ def test_update_persistent_resource_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_persistent_resource(request) @@ -4547,6 +4556,7 @@ def test_update_persistent_resource_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_persistent_resource(**mock_args) @@ -4688,6 +4698,7 @@ def test_reboot_persistent_resource_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.reboot_persistent_resource(request) @@ -4733,6 +4744,7 @@ def test_reboot_persistent_resource_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.reboot_persistent_resource(**mock_args) @@ -5222,6 +5234,7 @@ def test_create_persistent_resource_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_persistent_resource(request) @@ -5401,6 +5414,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_persistent_resource(request) # Establish that the response is the type that we expect. @@ -5444,6 +5458,7 @@ def test_create_persistent_resource_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 @@ -5490,6 +5505,7 @@ def test_get_persistent_resource_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_persistent_resource(request) @@ -5533,6 +5549,7 @@ def test_get_persistent_resource_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_persistent_resource(request) # Establish that the response is the type that we expect. @@ -5581,6 +5598,7 @@ def test_get_persistent_resource_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 = persistent_resource.PersistentResource.to_json( persistent_resource.PersistentResource() ) @@ -5627,6 +5645,7 @@ def test_list_persistent_resources_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_persistent_resources(request) @@ -5664,6 +5683,7 @@ def test_list_persistent_resources_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_persistent_resources(request) # Establish that the response is the type that we expect. @@ -5706,6 +5726,7 @@ def test_list_persistent_resources_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 = ( persistent_resource_service.ListPersistentResourcesResponse.to_json( persistent_resource_service.ListPersistentResourcesResponse() @@ -5758,6 +5779,7 @@ def test_delete_persistent_resource_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_persistent_resource(request) @@ -5790,6 +5812,7 @@ def test_delete_persistent_resource_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_persistent_resource(request) # Establish that the response is the type that we expect. @@ -5833,6 +5856,7 @@ def test_delete_persistent_resource_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 @@ -5881,6 +5905,7 @@ def test_update_persistent_resource_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_persistent_resource(request) @@ -6064,6 +6089,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_persistent_resource(request) # Establish that the response is the type that we expect. @@ -6107,6 +6133,7 @@ def test_update_persistent_resource_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 @@ -6153,6 +6180,7 @@ def test_reboot_persistent_resource_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.reboot_persistent_resource(request) @@ -6185,6 +6213,7 @@ def test_reboot_persistent_resource_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.reboot_persistent_resource(request) # Establish that the response is the type that we expect. @@ -6228,6 +6257,7 @@ def test_reboot_persistent_resource_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 @@ -6272,6 +6302,7 @@ def test_get_location_rest_bad_request(request_type=locations_pb2.GetLocationReq 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_location(request) @@ -6302,6 +6333,7 @@ def test_get_location_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_location(request) @@ -6330,6 +6362,7 @@ def test_list_locations_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_locations(request) @@ -6360,6 +6393,7 @@ def test_list_locations_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_locations(request) @@ -6391,6 +6425,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -6423,6 +6458,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -6454,6 +6490,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -6486,6 +6523,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -6517,6 +6555,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -6549,6 +6588,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -6579,6 +6619,7 @@ def test_cancel_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.cancel_operation(request) @@ -6609,6 +6650,7 @@ def test_cancel_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.cancel_operation(request) @@ -6639,6 +6681,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) @@ -6669,6 +6712,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) @@ -6699,6 +6743,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) @@ -6729,6 +6774,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) @@ -6759,6 +6805,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) @@ -6789,6 +6836,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) @@ -6819,6 +6867,7 @@ def test_wait_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.wait_operation(request) @@ -6849,6 +6898,7 @@ def test_wait_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.wait_operation(request) @@ -7048,6 +7098,7 @@ async def test_create_persistent_resource_rest_asyncio_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"} await client.create_persistent_resource(request) @@ -7234,6 +7285,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.create_persistent_resource(request) # Establish that the response is the type that we expect. @@ -7282,6 +7334,7 @@ async def test_create_persistent_resource_rest_asyncio_interceptors(null_interce 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.read = mock.AsyncMock(return_value=return_value) @@ -7332,6 +7385,7 @@ async def test_get_persistent_resource_rest_asyncio_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"} await client.get_persistent_resource(request) @@ -7382,6 +7436,7 @@ async def test_get_persistent_resource_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_persistent_resource(request) # Establish that the response is the type that we expect. @@ -7435,6 +7490,7 @@ async def test_get_persistent_resource_rest_asyncio_interceptors(null_intercepto 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 = persistent_resource.PersistentResource.to_json( persistent_resource.PersistentResource() ) @@ -7485,6 +7541,7 @@ async def test_list_persistent_resources_rest_asyncio_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"} await client.list_persistent_resources(request) @@ -7529,6 +7586,7 @@ async def test_list_persistent_resources_rest_asyncio_call_success(request_type) return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_persistent_resources(request) # Establish that the response is the type that we expect. @@ -7576,6 +7634,7 @@ async def test_list_persistent_resources_rest_asyncio_interceptors(null_intercep 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 = ( persistent_resource_service.ListPersistentResourcesResponse.to_json( persistent_resource_service.ListPersistentResourcesResponse() @@ -7632,6 +7691,7 @@ async def test_delete_persistent_resource_rest_asyncio_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"} await client.delete_persistent_resource(request) @@ -7671,6 +7731,7 @@ async def test_delete_persistent_resource_rest_asyncio_call_success(request_type return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_persistent_resource(request) # Establish that the response is the type that we expect. @@ -7719,6 +7780,7 @@ async def test_delete_persistent_resource_rest_asyncio_interceptors(null_interce 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.read = mock.AsyncMock(return_value=return_value) @@ -7771,6 +7833,7 @@ async def test_update_persistent_resource_rest_asyncio_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"} await client.update_persistent_resource(request) @@ -7961,6 +8024,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.update_persistent_resource(request) # Establish that the response is the type that we expect. @@ -8009,6 +8073,7 @@ async def test_update_persistent_resource_rest_asyncio_interceptors(null_interce 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.read = mock.AsyncMock(return_value=return_value) @@ -8059,6 +8124,7 @@ async def test_reboot_persistent_resource_rest_asyncio_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"} await client.reboot_persistent_resource(request) @@ -8098,6 +8164,7 @@ async def test_reboot_persistent_resource_rest_asyncio_call_success(request_type return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.reboot_persistent_resource(request) # Establish that the response is the type that we expect. @@ -8146,6 +8213,7 @@ async def test_reboot_persistent_resource_rest_asyncio_interceptors(null_interce 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.read = mock.AsyncMock(return_value=return_value) @@ -8196,6 +8264,7 @@ async def test_get_location_rest_asyncio_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"} await client.get_location(request) @@ -8233,6 +8302,7 @@ async def test_get_location_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_location(request) @@ -8265,6 +8335,7 @@ async def test_list_locations_rest_asyncio_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"} await client.list_locations(request) @@ -8302,6 +8373,7 @@ async def test_list_locations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_locations(request) @@ -8337,6 +8409,7 @@ async def test_get_iam_policy_rest_asyncio_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"} await client.get_iam_policy(request) @@ -8376,6 +8449,7 @@ async def test_get_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_iam_policy(request) @@ -8411,6 +8485,7 @@ async def test_set_iam_policy_rest_asyncio_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"} await client.set_iam_policy(request) @@ -8450,6 +8525,7 @@ async def test_set_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.set_iam_policy(request) @@ -8485,6 +8561,7 @@ async def test_test_iam_permissions_rest_asyncio_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"} await client.test_iam_permissions(request) @@ -8524,6 +8601,7 @@ async def test_test_iam_permissions_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.test_iam_permissions(request) @@ -8558,6 +8636,7 @@ async def test_cancel_operation_rest_asyncio_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"} await client.cancel_operation(request) @@ -8595,6 +8674,7 @@ async def test_cancel_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.cancel_operation(request) @@ -8629,6 +8709,7 @@ async def test_delete_operation_rest_asyncio_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"} await client.delete_operation(request) @@ -8666,6 +8747,7 @@ async def test_delete_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_operation(request) @@ -8700,6 +8782,7 @@ async def test_get_operation_rest_asyncio_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"} await client.get_operation(request) @@ -8737,6 +8820,7 @@ async def test_get_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_operation(request) @@ -8771,6 +8855,7 @@ async def test_list_operations_rest_asyncio_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"} await client.list_operations(request) @@ -8808,6 +8893,7 @@ async def test_list_operations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_operations(request) @@ -8842,6 +8928,7 @@ async def test_wait_operation_rest_asyncio_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"} await client.wait_operation(request) @@ -8879,6 +8966,7 @@ async def test_wait_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.wait_operation(request) diff --git a/tests/unit/gapic/aiplatform_v1beta1/test_pipeline_service.py b/tests/unit/gapic/aiplatform_v1beta1/test_pipeline_service.py index 509b657793..ff5d304edd 100644 --- a/tests/unit/gapic/aiplatform_v1beta1/test_pipeline_service.py +++ b/tests/unit/gapic/aiplatform_v1beta1/test_pipeline_service.py @@ -5924,6 +5924,7 @@ def test_create_training_pipeline_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_training_pipeline(request) @@ -5978,6 +5979,7 @@ def test_create_training_pipeline_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_training_pipeline(**mock_args) @@ -6115,6 +6117,7 @@ def test_get_training_pipeline_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_training_pipeline(request) @@ -6162,6 +6165,7 @@ def test_get_training_pipeline_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_training_pipeline(**mock_args) @@ -6309,6 +6313,7 @@ def test_list_training_pipelines_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_training_pipelines(request) @@ -6364,6 +6369,7 @@ def test_list_training_pipelines_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_training_pipelines(**mock_args) @@ -6564,6 +6570,7 @@ def test_delete_training_pipeline_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_training_pipeline(request) @@ -6609,6 +6616,7 @@ def test_delete_training_pipeline_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_training_pipeline(**mock_args) @@ -6743,6 +6751,7 @@ def test_cancel_training_pipeline_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.cancel_training_pipeline(request) @@ -6788,6 +6797,7 @@ def test_cancel_training_pipeline_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.cancel_training_pipeline(**mock_args) @@ -6926,6 +6936,7 @@ def test_create_pipeline_job_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_pipeline_job(request) @@ -6981,6 +6992,7 @@ def test_create_pipeline_job_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_pipeline_job(**mock_args) @@ -7116,6 +7128,7 @@ def test_get_pipeline_job_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_pipeline_job(request) @@ -7163,6 +7176,7 @@ def test_get_pipeline_job_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_pipeline_job(**mock_args) @@ -7308,6 +7322,7 @@ def test_list_pipeline_jobs_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_pipeline_jobs(request) @@ -7364,6 +7379,7 @@ def test_list_pipeline_jobs_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_pipeline_jobs(**mock_args) @@ -7563,6 +7579,7 @@ def test_delete_pipeline_job_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_pipeline_job(request) @@ -7608,6 +7625,7 @@ def test_delete_pipeline_job_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_pipeline_job(**mock_args) @@ -7750,6 +7768,7 @@ def test_batch_delete_pipeline_jobs_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.batch_delete_pipeline_jobs(request) @@ -7802,6 +7821,7 @@ def test_batch_delete_pipeline_jobs_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.batch_delete_pipeline_jobs(**mock_args) @@ -7936,6 +7956,7 @@ def test_cancel_pipeline_job_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.cancel_pipeline_job(request) @@ -7981,6 +8002,7 @@ def test_cancel_pipeline_job_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.cancel_pipeline_job(**mock_args) @@ -8123,6 +8145,7 @@ def test_batch_cancel_pipeline_jobs_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.batch_cancel_pipeline_jobs(request) @@ -8175,6 +8198,7 @@ def test_batch_cancel_pipeline_jobs_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.batch_cancel_pipeline_jobs(**mock_args) @@ -8989,6 +9013,7 @@ def test_create_training_pipeline_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_training_pipeline(request) @@ -9271,6 +9296,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_training_pipeline(request) # Establish that the response is the type that we expect. @@ -9316,6 +9342,7 @@ def test_create_training_pipeline_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 = gca_training_pipeline.TrainingPipeline.to_json( gca_training_pipeline.TrainingPipeline() ) @@ -9364,6 +9391,7 @@ def test_get_training_pipeline_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_training_pipeline(request) @@ -9406,6 +9434,7 @@ def test_get_training_pipeline_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_training_pipeline(request) # Establish that the response is the type that we expect. @@ -9451,6 +9480,7 @@ def test_get_training_pipeline_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 = training_pipeline.TrainingPipeline.to_json( training_pipeline.TrainingPipeline() ) @@ -9497,6 +9527,7 @@ def test_list_training_pipelines_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_training_pipelines(request) @@ -9532,6 +9563,7 @@ def test_list_training_pipelines_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_training_pipelines(request) # Establish that the response is the type that we expect. @@ -9572,6 +9604,7 @@ def test_list_training_pipelines_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 = pipeline_service.ListTrainingPipelinesResponse.to_json( pipeline_service.ListTrainingPipelinesResponse() ) @@ -9620,6 +9653,7 @@ def test_delete_training_pipeline_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_training_pipeline(request) @@ -9652,6 +9686,7 @@ def test_delete_training_pipeline_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_training_pipeline(request) # Establish that the response is the type that we expect. @@ -9693,6 +9728,7 @@ def test_delete_training_pipeline_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 @@ -9739,6 +9775,7 @@ def test_cancel_training_pipeline_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.cancel_training_pipeline(request) @@ -9771,6 +9808,7 @@ def test_cancel_training_pipeline_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.cancel_training_pipeline(request) # Establish that the response is the type that we expect. @@ -9807,6 +9845,7 @@ def test_cancel_training_pipeline_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 = pipeline_service.CancelTrainingPipelineRequest() metadata = [ @@ -9847,6 +9886,7 @@ def test_create_pipeline_job_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_pipeline_job(request) @@ -10083,6 +10123,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_pipeline_job(request) # Establish that the response is the type that we expect. @@ -10134,6 +10175,7 @@ def test_create_pipeline_job_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 = gca_pipeline_job.PipelineJob.to_json( gca_pipeline_job.PipelineJob() ) @@ -10180,6 +10222,7 @@ def test_get_pipeline_job_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_pipeline_job(request) @@ -10226,6 +10269,7 @@ def test_get_pipeline_job_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_pipeline_job(request) # Establish that the response is the type that we expect. @@ -10277,6 +10321,7 @@ def test_get_pipeline_job_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 = pipeline_job.PipelineJob.to_json(pipeline_job.PipelineJob()) req.return_value.content = return_value @@ -10321,6 +10366,7 @@ def test_list_pipeline_jobs_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_pipeline_jobs(request) @@ -10356,6 +10402,7 @@ def test_list_pipeline_jobs_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_pipeline_jobs(request) # Establish that the response is the type that we expect. @@ -10396,6 +10443,7 @@ def test_list_pipeline_jobs_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 = pipeline_service.ListPipelineJobsResponse.to_json( pipeline_service.ListPipelineJobsResponse() ) @@ -10442,6 +10490,7 @@ def test_delete_pipeline_job_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_pipeline_job(request) @@ -10472,6 +10521,7 @@ def test_delete_pipeline_job_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_pipeline_job(request) # Establish that the response is the type that we expect. @@ -10513,6 +10563,7 @@ def test_delete_pipeline_job_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 @@ -10557,6 +10608,7 @@ def test_batch_delete_pipeline_jobs_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.batch_delete_pipeline_jobs(request) @@ -10587,6 +10639,7 @@ def test_batch_delete_pipeline_jobs_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.batch_delete_pipeline_jobs(request) # Establish that the response is the type that we expect. @@ -10628,6 +10681,7 @@ def test_batch_delete_pipeline_jobs_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 @@ -10672,6 +10726,7 @@ def test_cancel_pipeline_job_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.cancel_pipeline_job(request) @@ -10702,6 +10757,7 @@ def test_cancel_pipeline_job_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.cancel_pipeline_job(request) # Establish that the response is the type that we expect. @@ -10738,6 +10794,7 @@ def test_cancel_pipeline_job_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 = pipeline_service.CancelPipelineJobRequest() metadata = [ @@ -10778,6 +10835,7 @@ def test_batch_cancel_pipeline_jobs_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.batch_cancel_pipeline_jobs(request) @@ -10808,6 +10866,7 @@ def test_batch_cancel_pipeline_jobs_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.batch_cancel_pipeline_jobs(request) # Establish that the response is the type that we expect. @@ -10849,6 +10908,7 @@ def test_batch_cancel_pipeline_jobs_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 @@ -10893,6 +10953,7 @@ def test_get_location_rest_bad_request(request_type=locations_pb2.GetLocationReq 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_location(request) @@ -10923,6 +10984,7 @@ def test_get_location_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_location(request) @@ -10951,6 +11013,7 @@ def test_list_locations_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_locations(request) @@ -10981,6 +11044,7 @@ def test_list_locations_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_locations(request) @@ -11012,6 +11076,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -11044,6 +11109,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -11075,6 +11141,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -11107,6 +11174,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -11138,6 +11206,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -11170,6 +11239,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -11200,6 +11270,7 @@ def test_cancel_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.cancel_operation(request) @@ -11230,6 +11301,7 @@ def test_cancel_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.cancel_operation(request) @@ -11260,6 +11332,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) @@ -11290,6 +11363,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) @@ -11320,6 +11394,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) @@ -11350,6 +11425,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) @@ -11380,6 +11456,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) @@ -11410,6 +11487,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) @@ -11440,6 +11518,7 @@ def test_wait_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.wait_operation(request) @@ -11470,6 +11549,7 @@ def test_wait_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.wait_operation(request) @@ -11799,6 +11879,7 @@ async def test_create_training_pipeline_rest_asyncio_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"} await client.create_training_pipeline(request) @@ -12088,6 +12169,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.create_training_pipeline(request) # Establish that the response is the type that we expect. @@ -12138,6 +12220,7 @@ async def test_create_training_pipeline_rest_asyncio_interceptors(null_intercept 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 = gca_training_pipeline.TrainingPipeline.to_json( gca_training_pipeline.TrainingPipeline() ) @@ -12190,6 +12273,7 @@ async def test_get_training_pipeline_rest_asyncio_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"} await client.get_training_pipeline(request) @@ -12239,6 +12323,7 @@ async def test_get_training_pipeline_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_training_pipeline(request) # Establish that the response is the type that we expect. @@ -12289,6 +12374,7 @@ async def test_get_training_pipeline_rest_asyncio_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 = training_pipeline.TrainingPipeline.to_json( training_pipeline.TrainingPipeline() ) @@ -12339,6 +12425,7 @@ async def test_list_training_pipelines_rest_asyncio_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"} await client.list_training_pipelines(request) @@ -12381,6 +12468,7 @@ async def test_list_training_pipelines_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_training_pipelines(request) # Establish that the response is the type that we expect. @@ -12426,6 +12514,7 @@ async def test_list_training_pipelines_rest_asyncio_interceptors(null_intercepto 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 = pipeline_service.ListTrainingPipelinesResponse.to_json( pipeline_service.ListTrainingPipelinesResponse() ) @@ -12478,6 +12567,7 @@ async def test_delete_training_pipeline_rest_asyncio_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"} await client.delete_training_pipeline(request) @@ -12517,6 +12607,7 @@ async def test_delete_training_pipeline_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_training_pipeline(request) # Establish that the response is the type that we expect. @@ -12563,6 +12654,7 @@ async def test_delete_training_pipeline_rest_asyncio_interceptors(null_intercept 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.read = mock.AsyncMock(return_value=return_value) @@ -12613,6 +12705,7 @@ async def test_cancel_training_pipeline_rest_asyncio_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"} await client.cancel_training_pipeline(request) @@ -12652,6 +12745,7 @@ async def test_cancel_training_pipeline_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.cancel_training_pipeline(request) # Establish that the response is the type that we expect. @@ -12693,6 +12787,7 @@ async def test_cancel_training_pipeline_rest_asyncio_interceptors(null_intercept req.return_value = mock.Mock() req.return_value.status_code = 200 + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} request = pipeline_service.CancelTrainingPipelineRequest() metadata = [ @@ -12737,6 +12832,7 @@ async def test_create_pipeline_job_rest_asyncio_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"} await client.create_pipeline_job(request) @@ -12980,6 +13076,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.create_pipeline_job(request) # Establish that the response is the type that we expect. @@ -13036,6 +13133,7 @@ async def test_create_pipeline_job_rest_asyncio_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 = gca_pipeline_job.PipelineJob.to_json( gca_pipeline_job.PipelineJob() ) @@ -13086,6 +13184,7 @@ async def test_get_pipeline_job_rest_asyncio_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"} await client.get_pipeline_job(request) @@ -13139,6 +13238,7 @@ async def test_get_pipeline_job_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_pipeline_job(request) # Establish that the response is the type that we expect. @@ -13195,6 +13295,7 @@ async def test_get_pipeline_job_rest_asyncio_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 = pipeline_job.PipelineJob.to_json(pipeline_job.PipelineJob()) req.return_value.read = mock.AsyncMock(return_value=return_value) @@ -13243,6 +13344,7 @@ async def test_list_pipeline_jobs_rest_asyncio_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"} await client.list_pipeline_jobs(request) @@ -13285,6 +13387,7 @@ async def test_list_pipeline_jobs_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_pipeline_jobs(request) # Establish that the response is the type that we expect. @@ -13330,6 +13433,7 @@ async def test_list_pipeline_jobs_rest_asyncio_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 = pipeline_service.ListPipelineJobsResponse.to_json( pipeline_service.ListPipelineJobsResponse() ) @@ -13380,6 +13484,7 @@ async def test_delete_pipeline_job_rest_asyncio_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"} await client.delete_pipeline_job(request) @@ -13417,6 +13522,7 @@ async def test_delete_pipeline_job_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_pipeline_job(request) # Establish that the response is the type that we expect. @@ -13463,6 +13569,7 @@ async def test_delete_pipeline_job_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -13511,6 +13618,7 @@ async def test_batch_delete_pipeline_jobs_rest_asyncio_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"} await client.batch_delete_pipeline_jobs(request) @@ -13548,6 +13656,7 @@ async def test_batch_delete_pipeline_jobs_rest_asyncio_call_success(request_type return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.batch_delete_pipeline_jobs(request) # Establish that the response is the type that we expect. @@ -13595,6 +13704,7 @@ async def test_batch_delete_pipeline_jobs_rest_asyncio_interceptors(null_interce 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.read = mock.AsyncMock(return_value=return_value) @@ -13643,6 +13753,7 @@ async def test_cancel_pipeline_job_rest_asyncio_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"} await client.cancel_pipeline_job(request) @@ -13680,6 +13791,7 @@ async def test_cancel_pipeline_job_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.cancel_pipeline_job(request) # Establish that the response is the type that we expect. @@ -13721,6 +13833,7 @@ async def test_cancel_pipeline_job_rest_asyncio_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 = pipeline_service.CancelPipelineJobRequest() metadata = [ @@ -13765,6 +13878,7 @@ async def test_batch_cancel_pipeline_jobs_rest_asyncio_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"} await client.batch_cancel_pipeline_jobs(request) @@ -13802,6 +13916,7 @@ async def test_batch_cancel_pipeline_jobs_rest_asyncio_call_success(request_type return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.batch_cancel_pipeline_jobs(request) # Establish that the response is the type that we expect. @@ -13849,6 +13964,7 @@ async def test_batch_cancel_pipeline_jobs_rest_asyncio_interceptors(null_interce 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.read = mock.AsyncMock(return_value=return_value) @@ -13899,6 +14015,7 @@ async def test_get_location_rest_asyncio_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"} await client.get_location(request) @@ -13936,6 +14053,7 @@ async def test_get_location_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_location(request) @@ -13968,6 +14086,7 @@ async def test_list_locations_rest_asyncio_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"} await client.list_locations(request) @@ -14005,6 +14124,7 @@ async def test_list_locations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_locations(request) @@ -14040,6 +14160,7 @@ async def test_get_iam_policy_rest_asyncio_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"} await client.get_iam_policy(request) @@ -14079,6 +14200,7 @@ async def test_get_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_iam_policy(request) @@ -14114,6 +14236,7 @@ async def test_set_iam_policy_rest_asyncio_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"} await client.set_iam_policy(request) @@ -14153,6 +14276,7 @@ async def test_set_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.set_iam_policy(request) @@ -14188,6 +14312,7 @@ async def test_test_iam_permissions_rest_asyncio_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"} await client.test_iam_permissions(request) @@ -14227,6 +14352,7 @@ async def test_test_iam_permissions_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.test_iam_permissions(request) @@ -14261,6 +14387,7 @@ async def test_cancel_operation_rest_asyncio_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"} await client.cancel_operation(request) @@ -14298,6 +14425,7 @@ async def test_cancel_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.cancel_operation(request) @@ -14332,6 +14460,7 @@ async def test_delete_operation_rest_asyncio_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"} await client.delete_operation(request) @@ -14369,6 +14498,7 @@ async def test_delete_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_operation(request) @@ -14403,6 +14533,7 @@ async def test_get_operation_rest_asyncio_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"} await client.get_operation(request) @@ -14440,6 +14571,7 @@ async def test_get_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_operation(request) @@ -14474,6 +14606,7 @@ async def test_list_operations_rest_asyncio_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"} await client.list_operations(request) @@ -14511,6 +14644,7 @@ async def test_list_operations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_operations(request) @@ -14545,6 +14679,7 @@ async def test_wait_operation_rest_asyncio_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"} await client.wait_operation(request) @@ -14582,6 +14717,7 @@ async def test_wait_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.wait_operation(request) diff --git a/tests/unit/gapic/aiplatform_v1beta1/test_prediction_service.py b/tests/unit/gapic/aiplatform_v1beta1/test_prediction_service.py index 04a41d5fa2..c48e4305a4 100644 --- a/tests/unit/gapic/aiplatform_v1beta1/test_prediction_service.py +++ b/tests/unit/gapic/aiplatform_v1beta1/test_prediction_service.py @@ -5209,6 +5209,7 @@ def test_predict_rest_required_fields(request_type=prediction_service.PredictReq 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.predict(request) @@ -5266,6 +5267,7 @@ def test_predict_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.predict(**mock_args) @@ -5398,6 +5400,7 @@ def test_raw_predict_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.raw_predict(request) @@ -5444,6 +5447,7 @@ def test_raw_predict_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.raw_predict(**mock_args) @@ -5580,6 +5584,7 @@ def test_stream_raw_predict_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"} with mock.patch.object(response_value, "iter_content") as iter_content: iter_content.return_value = iter(json_return_value) @@ -5629,6 +5634,7 @@ def test_stream_raw_predict_rest_flattened(): json_return_value = "[{}]".format(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"} with mock.patch.object(response_value, "iter_content") as iter_content: iter_content.return_value = iter(json_return_value) @@ -5764,6 +5770,7 @@ def test_direct_predict_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.direct_predict(request) @@ -5888,6 +5895,7 @@ def test_direct_raw_predict_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.direct_raw_predict(request) @@ -6047,6 +6055,7 @@ def test_server_streaming_predict_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"} with mock.patch.object(response_value, "iter_content") as iter_content: iter_content.return_value = iter(json_return_value) @@ -6178,6 +6187,7 @@ def test_explain_rest_required_fields(request_type=prediction_service.ExplainReq 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.explain(request) @@ -6236,6 +6246,7 @@ def test_explain_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.explain(**mock_args) @@ -6371,6 +6382,7 @@ def test_count_tokens_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.count_tokens(request) @@ -6419,6 +6431,7 @@ def test_count_tokens_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.count_tokens(**mock_args) @@ -6554,6 +6567,7 @@ def test_generate_content_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.generate_content(request) @@ -6610,6 +6624,7 @@ def test_generate_content_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.generate_content(**mock_args) @@ -6749,6 +6764,7 @@ def test_stream_generate_content_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"} with mock.patch.object(response_value, "iter_content") as iter_content: iter_content.return_value = iter(json_return_value) @@ -6808,6 +6824,7 @@ def test_stream_generate_content_rest_flattened(): json_return_value = "[{}]".format(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"} with mock.patch.object(response_value, "iter_content") as iter_content: iter_content.return_value = iter(json_return_value) @@ -6944,6 +6961,7 @@ def test_chat_completions_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"} with mock.patch.object(response_value, "iter_content") as iter_content: iter_content.return_value = iter(json_return_value) @@ -6993,6 +7011,7 @@ def test_chat_completions_rest_flattened(): json_return_value = "[{}]".format(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"} with mock.patch.object(response_value, "iter_content") as iter_content: iter_content.return_value = iter(json_return_value) @@ -7762,6 +7781,7 @@ def test_predict_rest_bad_request(request_type=prediction_service.PredictRequest 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.predict(request) @@ -7800,6 +7820,7 @@ def test_predict_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.predict(request) # Establish that the response is the type that we expect. @@ -7843,6 +7864,7 @@ def test_predict_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 = prediction_service.PredictResponse.to_json( prediction_service.PredictResponse() ) @@ -7889,6 +7911,7 @@ def test_raw_predict_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.raw_predict(request) @@ -7922,6 +7945,7 @@ def test_raw_predict_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.raw_predict(request) # Establish that the response is the type that we expect. @@ -7963,6 +7987,7 @@ def test_raw_predict_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(httpbody_pb2.HttpBody()) req.return_value.content = return_value @@ -8007,6 +8032,7 @@ def test_stream_raw_predict_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.stream_raw_predict(request) @@ -8041,6 +8067,7 @@ def test_stream_raw_predict_rest_call_success(request_type): json_return_value = "[{}]".format(json_return_value) response_value.iter_content = mock.Mock(return_value=iter(json_return_value)) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.stream_raw_predict(request) assert isinstance(response, Iterable) @@ -8085,6 +8112,7 @@ def test_stream_raw_predict_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(httpbody_pb2.HttpBody()) req.return_value.iter_content = mock.Mock(return_value=iter(return_value)) @@ -8129,6 +8157,7 @@ def test_direct_predict_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.direct_predict(request) @@ -8162,6 +8191,7 @@ def test_direct_predict_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.direct_predict(request) # Establish that the response is the type that we expect. @@ -8201,6 +8231,7 @@ def test_direct_predict_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 = prediction_service.DirectPredictResponse.to_json( prediction_service.DirectPredictResponse() ) @@ -8247,6 +8278,7 @@ def test_direct_raw_predict_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.direct_raw_predict(request) @@ -8282,6 +8314,7 @@ def test_direct_raw_predict_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.direct_raw_predict(request) # Establish that the response is the type that we expect. @@ -8322,6 +8355,7 @@ def test_direct_raw_predict_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 = prediction_service.DirectRawPredictResponse.to_json( prediction_service.DirectRawPredictResponse() ) @@ -8407,6 +8441,7 @@ def test_server_streaming_predict_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.server_streaming_predict(request) @@ -8441,6 +8476,7 @@ def test_server_streaming_predict_rest_call_success(request_type): json_return_value = "[{}]".format(json_return_value) response_value.iter_content = mock.Mock(return_value=iter(json_return_value)) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.server_streaming_predict(request) assert isinstance(response, Iterable) @@ -8483,6 +8519,7 @@ def test_server_streaming_predict_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 = prediction_service.StreamingPredictResponse.to_json( prediction_service.StreamingPredictResponse() ) @@ -8540,6 +8577,7 @@ def test_explain_rest_bad_request(request_type=prediction_service.ExplainRequest 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.explain(request) @@ -8575,6 +8613,7 @@ def test_explain_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.explain(request) # Establish that the response is the type that we expect. @@ -8615,6 +8654,7 @@ def test_explain_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 = prediction_service.ExplainResponse.to_json( prediction_service.ExplainResponse() ) @@ -8661,6 +8701,7 @@ def test_count_tokens_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.count_tokens(request) @@ -8697,6 +8738,7 @@ def test_count_tokens_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.count_tokens(request) # Establish that the response is the type that we expect. @@ -8738,6 +8780,7 @@ def test_count_tokens_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 = prediction_service.CountTokensResponse.to_json( prediction_service.CountTokensResponse() ) @@ -8784,6 +8827,7 @@ def test_generate_content_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.generate_content(request) @@ -8819,6 +8863,7 @@ def test_generate_content_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.generate_content(request) # Establish that the response is the type that we expect. @@ -8859,6 +8904,7 @@ def test_generate_content_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 = prediction_service.GenerateContentResponse.to_json( prediction_service.GenerateContentResponse() ) @@ -8905,6 +8951,7 @@ def test_stream_generate_content_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.stream_generate_content(request) @@ -8941,6 +8988,7 @@ def test_stream_generate_content_rest_call_success(request_type): json_return_value = "[{}]".format(json_return_value) response_value.iter_content = mock.Mock(return_value=iter(json_return_value)) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.stream_generate_content(request) assert isinstance(response, Iterable) @@ -8984,6 +9032,7 @@ def test_stream_generate_content_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 = prediction_service.GenerateContentResponse.to_json( prediction_service.GenerateContentResponse() ) @@ -9030,6 +9079,7 @@ def test_chat_completions_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.chat_completions(request) @@ -9141,6 +9191,7 @@ def get_message_fields(field): json_return_value = "[{}]".format(json_return_value) response_value.iter_content = mock.Mock(return_value=iter(json_return_value)) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.chat_completions(request) assert isinstance(response, Iterable) @@ -9185,6 +9236,7 @@ def test_chat_completions_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(httpbody_pb2.HttpBody()) req.return_value.iter_content = mock.Mock(return_value=iter(return_value)) @@ -9229,6 +9281,7 @@ def test_get_location_rest_bad_request(request_type=locations_pb2.GetLocationReq 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_location(request) @@ -9259,6 +9312,7 @@ def test_get_location_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_location(request) @@ -9287,6 +9341,7 @@ def test_list_locations_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_locations(request) @@ -9317,6 +9372,7 @@ def test_list_locations_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_locations(request) @@ -9348,6 +9404,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -9380,6 +9437,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -9411,6 +9469,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -9443,6 +9502,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -9474,6 +9534,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -9506,6 +9567,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -9536,6 +9598,7 @@ def test_cancel_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.cancel_operation(request) @@ -9566,6 +9629,7 @@ def test_cancel_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.cancel_operation(request) @@ -9596,6 +9660,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) @@ -9626,6 +9691,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) @@ -9656,6 +9722,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) @@ -9686,6 +9753,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) @@ -9716,6 +9784,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) @@ -9746,6 +9815,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) @@ -9776,6 +9846,7 @@ def test_wait_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.wait_operation(request) @@ -9806,6 +9877,7 @@ def test_wait_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.wait_operation(request) @@ -10084,6 +10156,7 @@ async def test_predict_rest_asyncio_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"} await client.predict(request) @@ -10129,6 +10202,7 @@ async def test_predict_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.predict(request) # Establish that the response is the type that we expect. @@ -10177,6 +10251,7 @@ async def test_predict_rest_asyncio_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 = prediction_service.PredictResponse.to_json( prediction_service.PredictResponse() ) @@ -10227,6 +10302,7 @@ async def test_raw_predict_rest_asyncio_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"} await client.raw_predict(request) @@ -10267,6 +10343,7 @@ async def test_raw_predict_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.raw_predict(request) # Establish that the response is the type that we expect. @@ -10313,6 +10390,7 @@ async def test_raw_predict_rest_asyncio_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(httpbody_pb2.HttpBody()) req.return_value.read = mock.AsyncMock(return_value=return_value) @@ -10361,6 +10439,7 @@ async def test_stream_raw_predict_rest_asyncio_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"} await client.stream_raw_predict(request) @@ -10400,6 +10479,7 @@ async def test_stream_raw_predict_rest_asyncio_call_success(request_type): json_return_value = "[{}]".format(json_return_value) response_value.content.return_value = mock_async_gen(json_return_value) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.stream_raw_predict(request) assert isinstance(response, AsyncIterable) @@ -10449,6 +10529,7 @@ async def test_stream_raw_predict_rest_asyncio_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(httpbody_pb2.HttpBody()) req.return_value.content.return_value = mock_async_gen(return_value) @@ -10497,6 +10578,7 @@ async def test_direct_predict_rest_asyncio_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"} await client.direct_predict(request) @@ -10537,6 +10619,7 @@ async def test_direct_predict_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.direct_predict(request) # Establish that the response is the type that we expect. @@ -10581,6 +10664,7 @@ async def test_direct_predict_rest_asyncio_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 = prediction_service.DirectPredictResponse.to_json( prediction_service.DirectPredictResponse() ) @@ -10631,6 +10715,7 @@ async def test_direct_raw_predict_rest_asyncio_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"} await client.direct_raw_predict(request) @@ -10673,6 +10758,7 @@ async def test_direct_raw_predict_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.direct_raw_predict(request) # Establish that the response is the type that we expect. @@ -10718,6 +10804,7 @@ async def test_direct_raw_predict_rest_asyncio_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 = prediction_service.DirectRawPredictResponse.to_json( prediction_service.DirectRawPredictResponse() ) @@ -10822,6 +10909,7 @@ async def test_server_streaming_predict_rest_asyncio_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"} await client.server_streaming_predict(request) @@ -10861,6 +10949,7 @@ async def test_server_streaming_predict_rest_asyncio_call_success(request_type): json_return_value = "[{}]".format(json_return_value) response_value.content.return_value = mock_async_gen(json_return_value) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.server_streaming_predict(request) assert isinstance(response, AsyncIterable) @@ -10909,6 +10998,7 @@ async def test_server_streaming_predict_rest_asyncio_interceptors(null_intercept 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 = prediction_service.StreamingPredictResponse.to_json( prediction_service.StreamingPredictResponse() ) @@ -10977,6 +11067,7 @@ async def test_explain_rest_asyncio_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"} await client.explain(request) @@ -11019,6 +11110,7 @@ async def test_explain_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.explain(request) # Establish that the response is the type that we expect. @@ -11064,6 +11156,7 @@ async def test_explain_rest_asyncio_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 = prediction_service.ExplainResponse.to_json( prediction_service.ExplainResponse() ) @@ -11114,6 +11207,7 @@ async def test_count_tokens_rest_asyncio_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"} await client.count_tokens(request) @@ -11157,6 +11251,7 @@ async def test_count_tokens_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.count_tokens(request) # Establish that the response is the type that we expect. @@ -11203,6 +11298,7 @@ async def test_count_tokens_rest_asyncio_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 = prediction_service.CountTokensResponse.to_json( prediction_service.CountTokensResponse() ) @@ -11253,6 +11349,7 @@ async def test_generate_content_rest_asyncio_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"} await client.generate_content(request) @@ -11295,6 +11392,7 @@ async def test_generate_content_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.generate_content(request) # Establish that the response is the type that we expect. @@ -11340,6 +11438,7 @@ async def test_generate_content_rest_asyncio_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 = prediction_service.GenerateContentResponse.to_json( prediction_service.GenerateContentResponse() ) @@ -11390,6 +11489,7 @@ async def test_stream_generate_content_rest_asyncio_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"} await client.stream_generate_content(request) @@ -11431,6 +11531,7 @@ async def test_stream_generate_content_rest_asyncio_call_success(request_type): json_return_value = "[{}]".format(json_return_value) response_value.content.return_value = mock_async_gen(json_return_value) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.stream_generate_content(request) assert isinstance(response, AsyncIterable) @@ -11479,6 +11580,7 @@ async def test_stream_generate_content_rest_asyncio_interceptors(null_intercepto 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 = prediction_service.GenerateContentResponse.to_json( prediction_service.GenerateContentResponse() ) @@ -11529,6 +11631,7 @@ async def test_chat_completions_rest_asyncio_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"} await client.chat_completions(request) @@ -11645,6 +11748,7 @@ def get_message_fields(field): json_return_value = "[{}]".format(json_return_value) response_value.content.return_value = mock_async_gen(json_return_value) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.chat_completions(request) assert isinstance(response, AsyncIterable) @@ -11694,6 +11798,7 @@ async def test_chat_completions_rest_asyncio_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(httpbody_pb2.HttpBody()) req.return_value.content.return_value = mock_async_gen(return_value) @@ -11744,6 +11849,7 @@ async def test_get_location_rest_asyncio_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"} await client.get_location(request) @@ -11781,6 +11887,7 @@ async def test_get_location_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_location(request) @@ -11813,6 +11920,7 @@ async def test_list_locations_rest_asyncio_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"} await client.list_locations(request) @@ -11850,6 +11958,7 @@ async def test_list_locations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_locations(request) @@ -11885,6 +11994,7 @@ async def test_get_iam_policy_rest_asyncio_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"} await client.get_iam_policy(request) @@ -11924,6 +12034,7 @@ async def test_get_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_iam_policy(request) @@ -11959,6 +12070,7 @@ async def test_set_iam_policy_rest_asyncio_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"} await client.set_iam_policy(request) @@ -11998,6 +12110,7 @@ async def test_set_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.set_iam_policy(request) @@ -12033,6 +12146,7 @@ async def test_test_iam_permissions_rest_asyncio_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"} await client.test_iam_permissions(request) @@ -12072,6 +12186,7 @@ async def test_test_iam_permissions_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.test_iam_permissions(request) @@ -12106,6 +12221,7 @@ async def test_cancel_operation_rest_asyncio_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"} await client.cancel_operation(request) @@ -12143,6 +12259,7 @@ async def test_cancel_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.cancel_operation(request) @@ -12177,6 +12294,7 @@ async def test_delete_operation_rest_asyncio_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"} await client.delete_operation(request) @@ -12214,6 +12332,7 @@ async def test_delete_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_operation(request) @@ -12248,6 +12367,7 @@ async def test_get_operation_rest_asyncio_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"} await client.get_operation(request) @@ -12285,6 +12405,7 @@ async def test_get_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_operation(request) @@ -12319,6 +12440,7 @@ async def test_list_operations_rest_asyncio_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"} await client.list_operations(request) @@ -12356,6 +12478,7 @@ async def test_list_operations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_operations(request) @@ -12390,6 +12513,7 @@ async def test_wait_operation_rest_asyncio_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"} await client.wait_operation(request) @@ -12427,6 +12551,7 @@ async def test_wait_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.wait_operation(request) diff --git a/tests/unit/gapic/aiplatform_v1beta1/test_reasoning_engine_execution_service.py b/tests/unit/gapic/aiplatform_v1beta1/test_reasoning_engine_execution_service.py index 53f5af6268..855b569109 100644 --- a/tests/unit/gapic/aiplatform_v1beta1/test_reasoning_engine_execution_service.py +++ b/tests/unit/gapic/aiplatform_v1beta1/test_reasoning_engine_execution_service.py @@ -1809,6 +1809,7 @@ def test_query_reasoning_engine_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.query_reasoning_engine(request) @@ -1933,6 +1934,7 @@ def test_stream_query_reasoning_engine_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"} with mock.patch.object(response_value, "iter_content") as iter_content: iter_content.return_value = iter(json_return_value) @@ -2209,6 +2211,7 @@ def test_query_reasoning_engine_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.query_reasoning_engine(request) @@ -2248,6 +2251,7 @@ def test_query_reasoning_engine_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.query_reasoning_engine(request) # Establish that the response is the type that we expect. @@ -2291,6 +2295,7 @@ def test_query_reasoning_engine_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 = ( reasoning_engine_execution_service.QueryReasoningEngineResponse.to_json( reasoning_engine_execution_service.QueryReasoningEngineResponse() @@ -2343,6 +2348,7 @@ def test_stream_query_reasoning_engine_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.stream_query_reasoning_engine(request) @@ -2379,6 +2385,7 @@ def test_stream_query_reasoning_engine_rest_call_success(request_type): json_return_value = "[{}]".format(json_return_value) response_value.iter_content = mock.Mock(return_value=iter(json_return_value)) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.stream_query_reasoning_engine(request) assert isinstance(response, Iterable) @@ -2427,6 +2434,7 @@ def test_stream_query_reasoning_engine_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(httpbody_pb2.HttpBody()) req.return_value.iter_content = mock.Mock(return_value=iter(return_value)) @@ -2471,6 +2479,7 @@ def test_get_location_rest_bad_request(request_type=locations_pb2.GetLocationReq 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_location(request) @@ -2501,6 +2510,7 @@ def test_get_location_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_location(request) @@ -2529,6 +2539,7 @@ def test_list_locations_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_locations(request) @@ -2559,6 +2570,7 @@ def test_list_locations_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_locations(request) @@ -2590,6 +2602,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -2622,6 +2635,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -2653,6 +2667,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -2685,6 +2700,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -2716,6 +2732,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -2748,6 +2765,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -2778,6 +2796,7 @@ def test_cancel_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.cancel_operation(request) @@ -2808,6 +2827,7 @@ def test_cancel_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.cancel_operation(request) @@ -2838,6 +2858,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) @@ -2868,6 +2889,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) @@ -2898,6 +2920,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) @@ -2928,6 +2951,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) @@ -2958,6 +2982,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) @@ -2988,6 +3013,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) @@ -3018,6 +3044,7 @@ def test_wait_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.wait_operation(request) @@ -3048,6 +3075,7 @@ def test_wait_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.wait_operation(request) @@ -3146,6 +3174,7 @@ async def test_query_reasoning_engine_rest_asyncio_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"} await client.query_reasoning_engine(request) @@ -3192,6 +3221,7 @@ async def test_query_reasoning_engine_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.query_reasoning_engine(request) # Establish that the response is the type that we expect. @@ -3240,6 +3270,7 @@ async def test_query_reasoning_engine_rest_asyncio_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 = ( reasoning_engine_execution_service.QueryReasoningEngineResponse.to_json( reasoning_engine_execution_service.QueryReasoningEngineResponse() @@ -3296,6 +3327,7 @@ async def test_stream_query_reasoning_engine_rest_asyncio_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"} await client.stream_query_reasoning_engine(request) @@ -3337,6 +3369,7 @@ async def test_stream_query_reasoning_engine_rest_asyncio_call_success(request_t json_return_value = "[{}]".format(json_return_value) response_value.content.return_value = mock_async_gen(json_return_value) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.stream_query_reasoning_engine(request) assert isinstance(response, AsyncIterable) @@ -3392,6 +3425,7 @@ async def test_stream_query_reasoning_engine_rest_asyncio_interceptors( 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(httpbody_pb2.HttpBody()) req.return_value.content.return_value = mock_async_gen(return_value) @@ -3442,6 +3476,7 @@ async def test_get_location_rest_asyncio_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"} await client.get_location(request) @@ -3479,6 +3514,7 @@ async def test_get_location_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_location(request) @@ -3511,6 +3547,7 @@ async def test_list_locations_rest_asyncio_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"} await client.list_locations(request) @@ -3548,6 +3585,7 @@ async def test_list_locations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_locations(request) @@ -3583,6 +3621,7 @@ async def test_get_iam_policy_rest_asyncio_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"} await client.get_iam_policy(request) @@ -3622,6 +3661,7 @@ async def test_get_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_iam_policy(request) @@ -3657,6 +3697,7 @@ async def test_set_iam_policy_rest_asyncio_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"} await client.set_iam_policy(request) @@ -3696,6 +3737,7 @@ async def test_set_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.set_iam_policy(request) @@ -3731,6 +3773,7 @@ async def test_test_iam_permissions_rest_asyncio_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"} await client.test_iam_permissions(request) @@ -3770,6 +3813,7 @@ async def test_test_iam_permissions_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.test_iam_permissions(request) @@ -3804,6 +3848,7 @@ async def test_cancel_operation_rest_asyncio_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"} await client.cancel_operation(request) @@ -3841,6 +3886,7 @@ async def test_cancel_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.cancel_operation(request) @@ -3875,6 +3921,7 @@ async def test_delete_operation_rest_asyncio_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"} await client.delete_operation(request) @@ -3912,6 +3959,7 @@ async def test_delete_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_operation(request) @@ -3946,6 +3994,7 @@ async def test_get_operation_rest_asyncio_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"} await client.get_operation(request) @@ -3983,6 +4032,7 @@ async def test_get_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_operation(request) @@ -4017,6 +4067,7 @@ async def test_list_operations_rest_asyncio_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"} await client.list_operations(request) @@ -4054,6 +4105,7 @@ async def test_list_operations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_operations(request) @@ -4088,6 +4140,7 @@ async def test_wait_operation_rest_asyncio_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"} await client.wait_operation(request) @@ -4125,6 +4178,7 @@ async def test_wait_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.wait_operation(request) diff --git a/tests/unit/gapic/aiplatform_v1beta1/test_reasoning_engine_service.py b/tests/unit/gapic/aiplatform_v1beta1/test_reasoning_engine_service.py index 76c57b705d..bd7a704224 100644 --- a/tests/unit/gapic/aiplatform_v1beta1/test_reasoning_engine_service.py +++ b/tests/unit/gapic/aiplatform_v1beta1/test_reasoning_engine_service.py @@ -3225,6 +3225,7 @@ def test_create_reasoning_engine_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_reasoning_engine(request) @@ -3277,6 +3278,7 @@ def test_create_reasoning_engine_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_reasoning_engine(**mock_args) @@ -3413,6 +3415,7 @@ def test_get_reasoning_engine_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_reasoning_engine(request) @@ -3460,6 +3463,7 @@ def test_get_reasoning_engine_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_reasoning_engine(**mock_args) @@ -3606,6 +3610,7 @@ def test_list_reasoning_engines_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_reasoning_engines(request) @@ -3662,6 +3667,7 @@ def test_list_reasoning_engines_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_reasoning_engines(**mock_args) @@ -3861,6 +3867,7 @@ def test_update_reasoning_engine_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_reasoning_engine(request) @@ -3909,6 +3916,7 @@ def test_update_reasoning_engine_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_reasoning_engine(**mock_args) @@ -4047,6 +4055,7 @@ def test_delete_reasoning_engine_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_reasoning_engine(request) @@ -4092,6 +4101,7 @@ def test_delete_reasoning_engine_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_reasoning_engine(**mock_args) @@ -4526,6 +4536,7 @@ def test_create_reasoning_engine_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_reasoning_engine(request) @@ -4642,6 +4653,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_reasoning_engine(request) # Establish that the response is the type that we expect. @@ -4683,6 +4695,7 @@ def test_create_reasoning_engine_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 @@ -4729,6 +4742,7 @@ def test_get_reasoning_engine_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_reasoning_engine(request) @@ -4769,6 +4783,7 @@ def test_get_reasoning_engine_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_reasoning_engine(request) # Establish that the response is the type that we expect. @@ -4812,6 +4827,7 @@ def test_get_reasoning_engine_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 = reasoning_engine.ReasoningEngine.to_json( reasoning_engine.ReasoningEngine() ) @@ -4858,6 +4874,7 @@ def test_list_reasoning_engines_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_reasoning_engines(request) @@ -4895,6 +4912,7 @@ def test_list_reasoning_engines_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_reasoning_engines(request) # Establish that the response is the type that we expect. @@ -4935,6 +4953,7 @@ def test_list_reasoning_engines_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 = reasoning_engine_service.ListReasoningEnginesResponse.to_json( reasoning_engine_service.ListReasoningEnginesResponse() ) @@ -4985,6 +5004,7 @@ def test_update_reasoning_engine_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_reasoning_engine(request) @@ -5105,6 +5125,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_reasoning_engine(request) # Establish that the response is the type that we expect. @@ -5146,6 +5167,7 @@ def test_update_reasoning_engine_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 @@ -5192,6 +5214,7 @@ def test_delete_reasoning_engine_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_reasoning_engine(request) @@ -5224,6 +5247,7 @@ def test_delete_reasoning_engine_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_reasoning_engine(request) # Establish that the response is the type that we expect. @@ -5265,6 +5289,7 @@ def test_delete_reasoning_engine_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 @@ -5309,6 +5334,7 @@ def test_get_location_rest_bad_request(request_type=locations_pb2.GetLocationReq 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_location(request) @@ -5339,6 +5365,7 @@ def test_get_location_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_location(request) @@ -5367,6 +5394,7 @@ def test_list_locations_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_locations(request) @@ -5397,6 +5425,7 @@ def test_list_locations_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_locations(request) @@ -5428,6 +5457,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -5460,6 +5490,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -5491,6 +5522,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -5523,6 +5555,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -5554,6 +5587,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -5586,6 +5620,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -5616,6 +5651,7 @@ def test_cancel_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.cancel_operation(request) @@ -5646,6 +5682,7 @@ def test_cancel_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.cancel_operation(request) @@ -5676,6 +5713,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) @@ -5706,6 +5744,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) @@ -5736,6 +5775,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) @@ -5766,6 +5806,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) @@ -5796,6 +5837,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) @@ -5826,6 +5868,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) @@ -5856,6 +5899,7 @@ def test_wait_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.wait_operation(request) @@ -5886,6 +5930,7 @@ def test_wait_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.wait_operation(request) @@ -6063,6 +6108,7 @@ async def test_create_reasoning_engine_rest_asyncio_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"} await client.create_reasoning_engine(request) @@ -6186,6 +6232,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.create_reasoning_engine(request) # Establish that the response is the type that we expect. @@ -6234,6 +6281,7 @@ async def test_create_reasoning_engine_rest_asyncio_interceptors(null_intercepto 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.read = mock.AsyncMock(return_value=return_value) @@ -6284,6 +6332,7 @@ async def test_get_reasoning_engine_rest_asyncio_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"} await client.get_reasoning_engine(request) @@ -6331,6 +6380,7 @@ async def test_get_reasoning_engine_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_reasoning_engine(request) # Establish that the response is the type that we expect. @@ -6381,6 +6431,7 @@ async def test_get_reasoning_engine_rest_asyncio_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 = reasoning_engine.ReasoningEngine.to_json( reasoning_engine.ReasoningEngine() ) @@ -6431,6 +6482,7 @@ async def test_list_reasoning_engines_rest_asyncio_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"} await client.list_reasoning_engines(request) @@ -6475,6 +6527,7 @@ async def test_list_reasoning_engines_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_reasoning_engines(request) # Establish that the response is the type that we expect. @@ -6522,6 +6575,7 @@ async def test_list_reasoning_engines_rest_asyncio_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 = reasoning_engine_service.ListReasoningEnginesResponse.to_json( reasoning_engine_service.ListReasoningEnginesResponse() ) @@ -6576,6 +6630,7 @@ async def test_update_reasoning_engine_rest_asyncio_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"} await client.update_reasoning_engine(request) @@ -6703,6 +6758,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.update_reasoning_engine(request) # Establish that the response is the type that we expect. @@ -6751,6 +6807,7 @@ async def test_update_reasoning_engine_rest_asyncio_interceptors(null_intercepto 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.read = mock.AsyncMock(return_value=return_value) @@ -6801,6 +6858,7 @@ async def test_delete_reasoning_engine_rest_asyncio_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"} await client.delete_reasoning_engine(request) @@ -6840,6 +6898,7 @@ async def test_delete_reasoning_engine_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_reasoning_engine(request) # Establish that the response is the type that we expect. @@ -6888,6 +6947,7 @@ async def test_delete_reasoning_engine_rest_asyncio_interceptors(null_intercepto 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.read = mock.AsyncMock(return_value=return_value) @@ -6938,6 +6998,7 @@ async def test_get_location_rest_asyncio_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"} await client.get_location(request) @@ -6975,6 +7036,7 @@ async def test_get_location_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_location(request) @@ -7007,6 +7069,7 @@ async def test_list_locations_rest_asyncio_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"} await client.list_locations(request) @@ -7044,6 +7107,7 @@ async def test_list_locations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_locations(request) @@ -7079,6 +7143,7 @@ async def test_get_iam_policy_rest_asyncio_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"} await client.get_iam_policy(request) @@ -7118,6 +7183,7 @@ async def test_get_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_iam_policy(request) @@ -7153,6 +7219,7 @@ async def test_set_iam_policy_rest_asyncio_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"} await client.set_iam_policy(request) @@ -7192,6 +7259,7 @@ async def test_set_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.set_iam_policy(request) @@ -7227,6 +7295,7 @@ async def test_test_iam_permissions_rest_asyncio_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"} await client.test_iam_permissions(request) @@ -7266,6 +7335,7 @@ async def test_test_iam_permissions_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.test_iam_permissions(request) @@ -7300,6 +7370,7 @@ async def test_cancel_operation_rest_asyncio_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"} await client.cancel_operation(request) @@ -7337,6 +7408,7 @@ async def test_cancel_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.cancel_operation(request) @@ -7371,6 +7443,7 @@ async def test_delete_operation_rest_asyncio_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"} await client.delete_operation(request) @@ -7408,6 +7481,7 @@ async def test_delete_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_operation(request) @@ -7442,6 +7516,7 @@ async def test_get_operation_rest_asyncio_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"} await client.get_operation(request) @@ -7479,6 +7554,7 @@ async def test_get_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_operation(request) @@ -7513,6 +7589,7 @@ async def test_list_operations_rest_asyncio_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"} await client.list_operations(request) @@ -7550,6 +7627,7 @@ async def test_list_operations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_operations(request) @@ -7584,6 +7662,7 @@ async def test_wait_operation_rest_asyncio_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"} await client.wait_operation(request) @@ -7621,6 +7700,7 @@ async def test_wait_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.wait_operation(request) diff --git a/tests/unit/gapic/aiplatform_v1beta1/test_schedule_service.py b/tests/unit/gapic/aiplatform_v1beta1/test_schedule_service.py index d911f54629..44dcd27823 100644 --- a/tests/unit/gapic/aiplatform_v1beta1/test_schedule_service.py +++ b/tests/unit/gapic/aiplatform_v1beta1/test_schedule_service.py @@ -3796,6 +3796,7 @@ def test_create_schedule_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_schedule(request) @@ -3850,6 +3851,7 @@ def test_create_schedule_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_schedule(**mock_args) @@ -3983,6 +3985,7 @@ def test_delete_schedule_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_schedule(request) @@ -4028,6 +4031,7 @@ def test_delete_schedule_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_schedule(**mock_args) @@ -4159,6 +4163,7 @@ def test_get_schedule_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_schedule(request) @@ -4206,6 +4211,7 @@ def test_get_schedule_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_schedule(**mock_args) @@ -4346,6 +4352,7 @@ def test_list_schedules_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_schedules(request) @@ -4401,6 +4408,7 @@ def test_list_schedules_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_schedules(**mock_args) @@ -4593,6 +4601,7 @@ def test_pause_schedule_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.pause_schedule(request) @@ -4638,6 +4647,7 @@ def test_pause_schedule_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.pause_schedule(**mock_args) @@ -4767,6 +4777,7 @@ def test_resume_schedule_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.resume_schedule(request) @@ -4813,6 +4824,7 @@ def test_resume_schedule_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.resume_schedule(**mock_args) @@ -4943,6 +4955,7 @@ def test_update_schedule_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_schedule(request) @@ -4999,6 +5012,7 @@ def test_update_schedule_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_schedule(**mock_args) @@ -5524,6 +5538,7 @@ def test_create_schedule_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_schedule(request) @@ -5857,6 +5872,7 @@ def test_create_schedule_rest_call_success(request_type): "gcs_output_uri": "gcs_output_uri_value", "execution_user": "execution_user_value", "service_account": "service_account_value", + "workbench_runtime": {}, "name": "name_value", "display_name": "display_name_value", "execution_timeout": {"seconds": 751, "nanos": 543}, @@ -5866,6 +5882,7 @@ def test_create_schedule_rest_call_success(request_type): "create_time": {}, "update_time": {}, "labels": {}, + "kernel_name": "kernel_name_value", "encryption_spec": {}, }, "notebook_execution_job_id": "notebook_execution_job_id_value", @@ -5983,6 +6000,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_schedule(request) # Establish that the response is the type that we expect. @@ -6030,6 +6048,7 @@ def test_create_schedule_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 = gca_schedule.Schedule.to_json(gca_schedule.Schedule()) req.return_value.content = return_value @@ -6074,6 +6093,7 @@ def test_delete_schedule_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_schedule(request) @@ -6104,6 +6124,7 @@ def test_delete_schedule_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_schedule(request) # Establish that the response is the type that we expect. @@ -6145,6 +6166,7 @@ def test_delete_schedule_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 @@ -6189,6 +6211,7 @@ def test_get_schedule_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_schedule(request) @@ -6232,6 +6255,7 @@ def test_get_schedule_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_schedule(request) # Establish that the response is the type that we expect. @@ -6279,6 +6303,7 @@ def test_get_schedule_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 = schedule.Schedule.to_json(schedule.Schedule()) req.return_value.content = return_value @@ -6323,6 +6348,7 @@ def test_list_schedules_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_schedules(request) @@ -6358,6 +6384,7 @@ def test_list_schedules_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_schedules(request) # Establish that the response is the type that we expect. @@ -6398,6 +6425,7 @@ def test_list_schedules_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 = schedule_service.ListSchedulesResponse.to_json( schedule_service.ListSchedulesResponse() ) @@ -6444,6 +6472,7 @@ def test_pause_schedule_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.pause_schedule(request) @@ -6474,6 +6503,7 @@ def test_pause_schedule_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.pause_schedule(request) # Establish that the response is the type that we expect. @@ -6510,6 +6540,7 @@ def test_pause_schedule_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 = schedule_service.PauseScheduleRequest() metadata = [ @@ -6550,6 +6581,7 @@ def test_resume_schedule_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.resume_schedule(request) @@ -6580,6 +6612,7 @@ def test_resume_schedule_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.resume_schedule(request) # Establish that the response is the type that we expect. @@ -6616,6 +6649,7 @@ def test_resume_schedule_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 = schedule_service.ResumeScheduleRequest() metadata = [ @@ -6658,6 +6692,7 @@ def test_update_schedule_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_schedule(request) @@ -6993,6 +7028,7 @@ def test_update_schedule_rest_call_success(request_type): "gcs_output_uri": "gcs_output_uri_value", "execution_user": "execution_user_value", "service_account": "service_account_value", + "workbench_runtime": {}, "name": "name_value", "display_name": "display_name_value", "execution_timeout": {"seconds": 751, "nanos": 543}, @@ -7002,6 +7038,7 @@ def test_update_schedule_rest_call_success(request_type): "create_time": {}, "update_time": {}, "labels": {}, + "kernel_name": "kernel_name_value", "encryption_spec": {}, }, "notebook_execution_job_id": "notebook_execution_job_id_value", @@ -7119,6 +7156,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_schedule(request) # Establish that the response is the type that we expect. @@ -7166,6 +7204,7 @@ def test_update_schedule_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 = gca_schedule.Schedule.to_json(gca_schedule.Schedule()) req.return_value.content = return_value @@ -7210,6 +7249,7 @@ def test_get_location_rest_bad_request(request_type=locations_pb2.GetLocationReq 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_location(request) @@ -7240,6 +7280,7 @@ def test_get_location_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_location(request) @@ -7268,6 +7309,7 @@ def test_list_locations_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_locations(request) @@ -7298,6 +7340,7 @@ def test_list_locations_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_locations(request) @@ -7329,6 +7372,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -7361,6 +7405,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -7392,6 +7437,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -7424,6 +7470,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -7455,6 +7502,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -7487,6 +7535,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -7517,6 +7566,7 @@ def test_cancel_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.cancel_operation(request) @@ -7547,6 +7597,7 @@ def test_cancel_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.cancel_operation(request) @@ -7577,6 +7628,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) @@ -7607,6 +7659,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) @@ -7637,6 +7690,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) @@ -7667,6 +7721,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) @@ -7697,6 +7752,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) @@ -7727,6 +7783,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) @@ -7757,6 +7814,7 @@ def test_wait_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.wait_operation(request) @@ -7787,6 +7845,7 @@ def test_wait_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.wait_operation(request) @@ -7994,6 +8053,7 @@ async def test_create_schedule_rest_asyncio_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"} await client.create_schedule(request) @@ -8332,6 +8392,7 @@ async def test_create_schedule_rest_asyncio_call_success(request_type): "gcs_output_uri": "gcs_output_uri_value", "execution_user": "execution_user_value", "service_account": "service_account_value", + "workbench_runtime": {}, "name": "name_value", "display_name": "display_name_value", "execution_timeout": {"seconds": 751, "nanos": 543}, @@ -8341,6 +8402,7 @@ async def test_create_schedule_rest_asyncio_call_success(request_type): "create_time": {}, "update_time": {}, "labels": {}, + "kernel_name": "kernel_name_value", "encryption_spec": {}, }, "notebook_execution_job_id": "notebook_execution_job_id_value", @@ -8460,6 +8522,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.create_schedule(request) # Establish that the response is the type that we expect. @@ -8512,6 +8575,7 @@ async def test_create_schedule_rest_asyncio_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 = gca_schedule.Schedule.to_json(gca_schedule.Schedule()) req.return_value.read = mock.AsyncMock(return_value=return_value) @@ -8560,6 +8624,7 @@ async def test_delete_schedule_rest_asyncio_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"} await client.delete_schedule(request) @@ -8597,6 +8662,7 @@ async def test_delete_schedule_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_schedule(request) # Establish that the response is the type that we expect. @@ -8643,6 +8709,7 @@ async def test_delete_schedule_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -8691,6 +8758,7 @@ async def test_get_schedule_rest_asyncio_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"} await client.get_schedule(request) @@ -8741,6 +8809,7 @@ async def test_get_schedule_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_schedule(request) # Establish that the response is the type that we expect. @@ -8793,6 +8862,7 @@ async def test_get_schedule_rest_asyncio_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 = schedule.Schedule.to_json(schedule.Schedule()) req.return_value.read = mock.AsyncMock(return_value=return_value) @@ -8841,6 +8911,7 @@ async def test_list_schedules_rest_asyncio_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"} await client.list_schedules(request) @@ -8883,6 +8954,7 @@ async def test_list_schedules_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_schedules(request) # Establish that the response is the type that we expect. @@ -8928,6 +9000,7 @@ async def test_list_schedules_rest_asyncio_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 = schedule_service.ListSchedulesResponse.to_json( schedule_service.ListSchedulesResponse() ) @@ -8978,6 +9051,7 @@ async def test_pause_schedule_rest_asyncio_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"} await client.pause_schedule(request) @@ -9015,6 +9089,7 @@ async def test_pause_schedule_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.pause_schedule(request) # Establish that the response is the type that we expect. @@ -9056,6 +9131,7 @@ async def test_pause_schedule_rest_asyncio_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 = schedule_service.PauseScheduleRequest() metadata = [ @@ -9100,6 +9176,7 @@ async def test_resume_schedule_rest_asyncio_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"} await client.resume_schedule(request) @@ -9137,6 +9214,7 @@ async def test_resume_schedule_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.resume_schedule(request) # Establish that the response is the type that we expect. @@ -9178,6 +9256,7 @@ async def test_resume_schedule_rest_asyncio_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 = schedule_service.ResumeScheduleRequest() metadata = [ @@ -9224,6 +9303,7 @@ async def test_update_schedule_rest_asyncio_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"} await client.update_schedule(request) @@ -9564,6 +9644,7 @@ async def test_update_schedule_rest_asyncio_call_success(request_type): "gcs_output_uri": "gcs_output_uri_value", "execution_user": "execution_user_value", "service_account": "service_account_value", + "workbench_runtime": {}, "name": "name_value", "display_name": "display_name_value", "execution_timeout": {"seconds": 751, "nanos": 543}, @@ -9573,6 +9654,7 @@ async def test_update_schedule_rest_asyncio_call_success(request_type): "create_time": {}, "update_time": {}, "labels": {}, + "kernel_name": "kernel_name_value", "encryption_spec": {}, }, "notebook_execution_job_id": "notebook_execution_job_id_value", @@ -9692,6 +9774,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.update_schedule(request) # Establish that the response is the type that we expect. @@ -9744,6 +9827,7 @@ async def test_update_schedule_rest_asyncio_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 = gca_schedule.Schedule.to_json(gca_schedule.Schedule()) req.return_value.read = mock.AsyncMock(return_value=return_value) @@ -9794,6 +9878,7 @@ async def test_get_location_rest_asyncio_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"} await client.get_location(request) @@ -9831,6 +9916,7 @@ async def test_get_location_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_location(request) @@ -9863,6 +9949,7 @@ async def test_list_locations_rest_asyncio_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"} await client.list_locations(request) @@ -9900,6 +9987,7 @@ async def test_list_locations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_locations(request) @@ -9935,6 +10023,7 @@ async def test_get_iam_policy_rest_asyncio_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"} await client.get_iam_policy(request) @@ -9974,6 +10063,7 @@ async def test_get_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_iam_policy(request) @@ -10009,6 +10099,7 @@ async def test_set_iam_policy_rest_asyncio_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"} await client.set_iam_policy(request) @@ -10048,6 +10139,7 @@ async def test_set_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.set_iam_policy(request) @@ -10083,6 +10175,7 @@ async def test_test_iam_permissions_rest_asyncio_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"} await client.test_iam_permissions(request) @@ -10122,6 +10215,7 @@ async def test_test_iam_permissions_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.test_iam_permissions(request) @@ -10156,6 +10250,7 @@ async def test_cancel_operation_rest_asyncio_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"} await client.cancel_operation(request) @@ -10193,6 +10288,7 @@ async def test_cancel_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.cancel_operation(request) @@ -10227,6 +10323,7 @@ async def test_delete_operation_rest_asyncio_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"} await client.delete_operation(request) @@ -10264,6 +10361,7 @@ async def test_delete_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_operation(request) @@ -10298,6 +10396,7 @@ async def test_get_operation_rest_asyncio_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"} await client.get_operation(request) @@ -10335,6 +10434,7 @@ async def test_get_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_operation(request) @@ -10369,6 +10469,7 @@ async def test_list_operations_rest_asyncio_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"} await client.list_operations(request) @@ -10406,6 +10507,7 @@ async def test_list_operations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_operations(request) @@ -10440,6 +10542,7 @@ async def test_wait_operation_rest_asyncio_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"} await client.wait_operation(request) @@ -10477,6 +10580,7 @@ async def test_wait_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.wait_operation(request) diff --git a/tests/unit/gapic/aiplatform_v1beta1/test_specialist_pool_service.py b/tests/unit/gapic/aiplatform_v1beta1/test_specialist_pool_service.py index c0dface095..187cc99ba0 100644 --- a/tests/unit/gapic/aiplatform_v1beta1/test_specialist_pool_service.py +++ b/tests/unit/gapic/aiplatform_v1beta1/test_specialist_pool_service.py @@ -3225,6 +3225,7 @@ def test_create_specialist_pool_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_specialist_pool(request) @@ -3277,6 +3278,7 @@ def test_create_specialist_pool_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_specialist_pool(**mock_args) @@ -3413,6 +3415,7 @@ def test_get_specialist_pool_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_specialist_pool(request) @@ -3460,6 +3463,7 @@ def test_get_specialist_pool_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_specialist_pool(**mock_args) @@ -3606,6 +3610,7 @@ def test_list_specialist_pools_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_specialist_pools(request) @@ -3662,6 +3667,7 @@ def test_list_specialist_pools_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_specialist_pools(**mock_args) @@ -3865,6 +3871,7 @@ def test_delete_specialist_pool_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_specialist_pool(request) @@ -3910,6 +3917,7 @@ def test_delete_specialist_pool_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_specialist_pool(**mock_args) @@ -4045,6 +4053,7 @@ def test_update_specialist_pool_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_specialist_pool(request) @@ -4101,6 +4110,7 @@ def test_update_specialist_pool_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_specialist_pool(**mock_args) @@ -4538,6 +4548,7 @@ def test_create_specialist_pool_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_specialist_pool(request) @@ -4654,6 +4665,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_specialist_pool(request) # Establish that the response is the type that we expect. @@ -4695,6 +4707,7 @@ def test_create_specialist_pool_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 @@ -4741,6 +4754,7 @@ def test_get_specialist_pool_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_specialist_pool(request) @@ -4783,6 +4797,7 @@ def test_get_specialist_pool_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_specialist_pool(request) # Establish that the response is the type that we expect. @@ -4828,6 +4843,7 @@ def test_get_specialist_pool_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 = specialist_pool.SpecialistPool.to_json( specialist_pool.SpecialistPool() ) @@ -4874,6 +4890,7 @@ def test_list_specialist_pools_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_specialist_pools(request) @@ -4911,6 +4928,7 @@ def test_list_specialist_pools_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_specialist_pools(request) # Establish that the response is the type that we expect. @@ -4951,6 +4969,7 @@ def test_list_specialist_pools_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 = specialist_pool_service.ListSpecialistPoolsResponse.to_json( specialist_pool_service.ListSpecialistPoolsResponse() ) @@ -4999,6 +5018,7 @@ def test_delete_specialist_pool_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_specialist_pool(request) @@ -5031,6 +5051,7 @@ def test_delete_specialist_pool_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_specialist_pool(request) # Establish that the response is the type that we expect. @@ -5072,6 +5093,7 @@ def test_delete_specialist_pool_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 @@ -5120,6 +5142,7 @@ def test_update_specialist_pool_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_specialist_pool(request) @@ -5240,6 +5263,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_specialist_pool(request) # Establish that the response is the type that we expect. @@ -5281,6 +5305,7 @@ def test_update_specialist_pool_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 @@ -5325,6 +5350,7 @@ def test_get_location_rest_bad_request(request_type=locations_pb2.GetLocationReq 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_location(request) @@ -5355,6 +5381,7 @@ def test_get_location_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_location(request) @@ -5383,6 +5410,7 @@ def test_list_locations_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_locations(request) @@ -5413,6 +5441,7 @@ def test_list_locations_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_locations(request) @@ -5444,6 +5473,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -5476,6 +5506,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -5507,6 +5538,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -5539,6 +5571,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -5570,6 +5603,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -5602,6 +5636,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -5632,6 +5667,7 @@ def test_cancel_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.cancel_operation(request) @@ -5662,6 +5698,7 @@ def test_cancel_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.cancel_operation(request) @@ -5692,6 +5729,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) @@ -5722,6 +5760,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) @@ -5752,6 +5791,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) @@ -5782,6 +5822,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) @@ -5812,6 +5853,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) @@ -5842,6 +5884,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) @@ -5872,6 +5915,7 @@ def test_wait_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.wait_operation(request) @@ -5902,6 +5946,7 @@ def test_wait_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.wait_operation(request) @@ -6079,6 +6124,7 @@ async def test_create_specialist_pool_rest_asyncio_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"} await client.create_specialist_pool(request) @@ -6202,6 +6248,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.create_specialist_pool(request) # Establish that the response is the type that we expect. @@ -6250,6 +6297,7 @@ async def test_create_specialist_pool_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -6300,6 +6348,7 @@ async def test_get_specialist_pool_rest_asyncio_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"} await client.get_specialist_pool(request) @@ -6349,6 +6398,7 @@ async def test_get_specialist_pool_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_specialist_pool(request) # Establish that the response is the type that we expect. @@ -6399,6 +6449,7 @@ async def test_get_specialist_pool_rest_asyncio_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 = specialist_pool.SpecialistPool.to_json( specialist_pool.SpecialistPool() ) @@ -6449,6 +6500,7 @@ async def test_list_specialist_pools_rest_asyncio_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"} await client.list_specialist_pools(request) @@ -6493,6 +6545,7 @@ async def test_list_specialist_pools_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_specialist_pools(request) # Establish that the response is the type that we expect. @@ -6540,6 +6593,7 @@ async def test_list_specialist_pools_rest_asyncio_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 = specialist_pool_service.ListSpecialistPoolsResponse.to_json( specialist_pool_service.ListSpecialistPoolsResponse() ) @@ -6592,6 +6646,7 @@ async def test_delete_specialist_pool_rest_asyncio_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"} await client.delete_specialist_pool(request) @@ -6631,6 +6686,7 @@ async def test_delete_specialist_pool_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_specialist_pool(request) # Establish that the response is the type that we expect. @@ -6679,6 +6735,7 @@ async def test_delete_specialist_pool_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -6731,6 +6788,7 @@ async def test_update_specialist_pool_rest_asyncio_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"} await client.update_specialist_pool(request) @@ -6858,6 +6916,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.update_specialist_pool(request) # Establish that the response is the type that we expect. @@ -6906,6 +6965,7 @@ async def test_update_specialist_pool_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -6956,6 +7016,7 @@ async def test_get_location_rest_asyncio_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"} await client.get_location(request) @@ -6993,6 +7054,7 @@ async def test_get_location_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_location(request) @@ -7025,6 +7087,7 @@ async def test_list_locations_rest_asyncio_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"} await client.list_locations(request) @@ -7062,6 +7125,7 @@ async def test_list_locations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_locations(request) @@ -7097,6 +7161,7 @@ async def test_get_iam_policy_rest_asyncio_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"} await client.get_iam_policy(request) @@ -7136,6 +7201,7 @@ async def test_get_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_iam_policy(request) @@ -7171,6 +7237,7 @@ async def test_set_iam_policy_rest_asyncio_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"} await client.set_iam_policy(request) @@ -7210,6 +7277,7 @@ async def test_set_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.set_iam_policy(request) @@ -7245,6 +7313,7 @@ async def test_test_iam_permissions_rest_asyncio_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"} await client.test_iam_permissions(request) @@ -7284,6 +7353,7 @@ async def test_test_iam_permissions_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.test_iam_permissions(request) @@ -7318,6 +7388,7 @@ async def test_cancel_operation_rest_asyncio_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"} await client.cancel_operation(request) @@ -7355,6 +7426,7 @@ async def test_cancel_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.cancel_operation(request) @@ -7389,6 +7461,7 @@ async def test_delete_operation_rest_asyncio_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"} await client.delete_operation(request) @@ -7426,6 +7499,7 @@ async def test_delete_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_operation(request) @@ -7460,6 +7534,7 @@ async def test_get_operation_rest_asyncio_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"} await client.get_operation(request) @@ -7497,6 +7572,7 @@ async def test_get_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_operation(request) @@ -7531,6 +7607,7 @@ async def test_list_operations_rest_asyncio_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"} await client.list_operations(request) @@ -7568,6 +7645,7 @@ async def test_list_operations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_operations(request) @@ -7602,6 +7680,7 @@ async def test_wait_operation_rest_asyncio_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"} await client.wait_operation(request) @@ -7639,6 +7718,7 @@ async def test_wait_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.wait_operation(request) diff --git a/tests/unit/gapic/aiplatform_v1beta1/test_tensorboard_service.py b/tests/unit/gapic/aiplatform_v1beta1/test_tensorboard_service.py index 2769a5536b..1694fd457b 100644 --- a/tests/unit/gapic/aiplatform_v1beta1/test_tensorboard_service.py +++ b/tests/unit/gapic/aiplatform_v1beta1/test_tensorboard_service.py @@ -13054,6 +13054,7 @@ def test_create_tensorboard_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_tensorboard(request) @@ -13106,6 +13107,7 @@ def test_create_tensorboard_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_tensorboard(**mock_args) @@ -13238,6 +13240,7 @@ def test_get_tensorboard_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_tensorboard(request) @@ -13285,6 +13288,7 @@ def test_get_tensorboard_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_tensorboard(**mock_args) @@ -13419,6 +13423,7 @@ def test_update_tensorboard_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_tensorboard(request) @@ -13475,6 +13480,7 @@ def test_update_tensorboard_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_tensorboard(**mock_args) @@ -13619,6 +13625,7 @@ def test_list_tensorboards_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_tensorboards(request) @@ -13675,6 +13682,7 @@ def test_list_tensorboards_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_tensorboards(**mock_args) @@ -13874,6 +13882,7 @@ def test_delete_tensorboard_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_tensorboard(request) @@ -13919,6 +13928,7 @@ def test_delete_tensorboard_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_tensorboard(**mock_args) @@ -14057,6 +14067,7 @@ def test_read_tensorboard_usage_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.read_tensorboard_usage(request) @@ -14104,6 +14115,7 @@ def test_read_tensorboard_usage_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.read_tensorboard_usage(**mock_args) @@ -14242,6 +14254,7 @@ def test_read_tensorboard_size_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.read_tensorboard_size(request) @@ -14289,6 +14302,7 @@ def test_read_tensorboard_size_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.read_tensorboard_size(**mock_args) @@ -14443,6 +14457,7 @@ def test_create_tensorboard_experiment_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_tensorboard_experiment(request) @@ -14510,6 +14525,7 @@ def test_create_tensorboard_experiment_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_tensorboard_experiment(**mock_args) @@ -14650,6 +14666,7 @@ def test_get_tensorboard_experiment_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_tensorboard_experiment(request) @@ -14697,6 +14714,7 @@ def test_get_tensorboard_experiment_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_tensorboard_experiment(**mock_args) @@ -14833,6 +14851,7 @@ def test_update_tensorboard_experiment_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_tensorboard_experiment(request) @@ -14895,6 +14914,7 @@ def test_update_tensorboard_experiment_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_tensorboard_experiment(**mock_args) @@ -15046,6 +15066,7 @@ def test_list_tensorboard_experiments_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_tensorboard_experiments(request) @@ -15106,6 +15127,7 @@ def test_list_tensorboard_experiments_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_tensorboard_experiments(**mock_args) @@ -15311,6 +15333,7 @@ def test_delete_tensorboard_experiment_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_tensorboard_experiment(request) @@ -15358,6 +15381,7 @@ def test_delete_tensorboard_experiment_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_tensorboard_experiment(**mock_args) @@ -15504,6 +15528,7 @@ def test_create_tensorboard_run_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_tensorboard_run(request) @@ -15568,6 +15593,7 @@ def test_create_tensorboard_run_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_tensorboard_run(**mock_args) @@ -15709,6 +15735,7 @@ def test_batch_create_tensorboard_runs_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.batch_create_tensorboard_runs(request) @@ -15771,6 +15798,7 @@ def test_batch_create_tensorboard_runs_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.batch_create_tensorboard_runs(**mock_args) @@ -15909,6 +15937,7 @@ def test_get_tensorboard_run_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_tensorboard_run(request) @@ -15956,6 +15985,7 @@ def test_get_tensorboard_run_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_tensorboard_run(**mock_args) @@ -16090,6 +16120,7 @@ def test_update_tensorboard_run_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_tensorboard_run(request) @@ -16148,6 +16179,7 @@ def test_update_tensorboard_run_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_tensorboard_run(**mock_args) @@ -16297,6 +16329,7 @@ def test_list_tensorboard_runs_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_tensorboard_runs(request) @@ -16355,6 +16388,7 @@ def test_list_tensorboard_runs_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_tensorboard_runs(**mock_args) @@ -16557,6 +16591,7 @@ def test_delete_tensorboard_run_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_tensorboard_run(request) @@ -16602,6 +16637,7 @@ def test_delete_tensorboard_run_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_tensorboard_run(**mock_args) @@ -16743,6 +16779,7 @@ def test_batch_create_tensorboard_time_series_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.batch_create_tensorboard_time_series(request) @@ -16807,6 +16844,7 @@ def test_batch_create_tensorboard_time_series_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.batch_create_tensorboard_time_series(**mock_args) @@ -16955,6 +16993,7 @@ def test_create_tensorboard_time_series_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_tensorboard_time_series(request) @@ -17017,6 +17056,7 @@ def test_create_tensorboard_time_series_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_tensorboard_time_series(**mock_args) @@ -17158,6 +17198,7 @@ def test_get_tensorboard_time_series_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_tensorboard_time_series(request) @@ -17205,6 +17246,7 @@ def test_get_tensorboard_time_series_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_tensorboard_time_series(**mock_args) @@ -17341,6 +17383,7 @@ def test_update_tensorboard_time_series_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_tensorboard_time_series(request) @@ -17405,6 +17448,7 @@ def test_update_tensorboard_time_series_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_tensorboard_time_series(**mock_args) @@ -17556,6 +17600,7 @@ def test_list_tensorboard_time_series_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_tensorboard_time_series(request) @@ -17616,6 +17661,7 @@ def test_list_tensorboard_time_series_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_tensorboard_time_series(**mock_args) @@ -17822,6 +17868,7 @@ def test_delete_tensorboard_time_series_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_tensorboard_time_series(request) @@ -17869,6 +17916,7 @@ def test_delete_tensorboard_time_series_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_tensorboard_time_series(**mock_args) @@ -18022,6 +18070,7 @@ def test_batch_read_tensorboard_time_series_data_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.batch_read_tensorboard_time_series_data(request) @@ -18089,6 +18138,7 @@ def test_batch_read_tensorboard_time_series_data_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.batch_read_tensorboard_time_series_data(**mock_args) @@ -18236,6 +18286,7 @@ def test_read_tensorboard_time_series_data_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.read_tensorboard_time_series_data(request) @@ -18295,6 +18346,7 @@ def test_read_tensorboard_time_series_data_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.read_tensorboard_time_series_data(**mock_args) @@ -18438,6 +18490,7 @@ def test_read_tensorboard_blob_data_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"} with mock.patch.object(response_value, "iter_content") as iter_content: iter_content.return_value = iter(json_return_value) @@ -18490,6 +18543,7 @@ def test_read_tensorboard_blob_data_rest_flattened(): json_return_value = "[{}]".format(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"} with mock.patch.object(response_value, "iter_content") as iter_content: iter_content.return_value = iter(json_return_value) @@ -18633,6 +18687,7 @@ def test_write_tensorboard_experiment_data_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.write_tensorboard_experiment_data(request) @@ -18697,6 +18752,7 @@ def test_write_tensorboard_experiment_data_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.write_tensorboard_experiment_data(**mock_args) @@ -18843,6 +18899,7 @@ def test_write_tensorboard_run_data_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.write_tensorboard_run_data(request) @@ -18905,6 +18962,7 @@ def test_write_tensorboard_run_data_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.write_tensorboard_run_data(**mock_args) @@ -19051,6 +19109,7 @@ def test_export_tensorboard_time_series_data_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.export_tensorboard_time_series_data(request) @@ -19102,6 +19161,7 @@ def test_export_tensorboard_time_series_data_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.export_tensorboard_time_series_data(**mock_args) @@ -20933,6 +20993,7 @@ def test_create_tensorboard_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_tensorboard(request) @@ -21045,6 +21106,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_tensorboard(request) # Establish that the response is the type that we expect. @@ -21086,6 +21148,7 @@ def test_create_tensorboard_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 @@ -21130,6 +21193,7 @@ def test_get_tensorboard_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_tensorboard(request) @@ -21173,6 +21237,7 @@ def test_get_tensorboard_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_tensorboard(request) # Establish that the response is the type that we expect. @@ -21221,6 +21286,7 @@ def test_get_tensorboard_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 = tensorboard.Tensorboard.to_json(tensorboard.Tensorboard()) req.return_value.content = return_value @@ -21269,6 +21335,7 @@ def test_update_tensorboard_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_tensorboard(request) @@ -21385,6 +21452,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_tensorboard(request) # Establish that the response is the type that we expect. @@ -21426,6 +21494,7 @@ def test_update_tensorboard_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 @@ -21470,6 +21539,7 @@ def test_list_tensorboards_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_tensorboards(request) @@ -21505,6 +21575,7 @@ def test_list_tensorboards_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_tensorboards(request) # Establish that the response is the type that we expect. @@ -21545,6 +21616,7 @@ def test_list_tensorboards_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 = tensorboard_service.ListTensorboardsResponse.to_json( tensorboard_service.ListTensorboardsResponse() ) @@ -21591,6 +21663,7 @@ def test_delete_tensorboard_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_tensorboard(request) @@ -21621,6 +21694,7 @@ def test_delete_tensorboard_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_tensorboard(request) # Establish that the response is the type that we expect. @@ -21662,6 +21736,7 @@ def test_delete_tensorboard_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 @@ -21708,6 +21783,7 @@ def test_read_tensorboard_usage_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.read_tensorboard_usage(request) @@ -21743,6 +21819,7 @@ def test_read_tensorboard_usage_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.read_tensorboard_usage(request) # Establish that the response is the type that we expect. @@ -21782,6 +21859,7 @@ def test_read_tensorboard_usage_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 = tensorboard_service.ReadTensorboardUsageResponse.to_json( tensorboard_service.ReadTensorboardUsageResponse() ) @@ -21830,6 +21908,7 @@ def test_read_tensorboard_size_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.read_tensorboard_size(request) @@ -21867,6 +21946,7 @@ def test_read_tensorboard_size_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.read_tensorboard_size(request) # Establish that the response is the type that we expect. @@ -21907,6 +21987,7 @@ def test_read_tensorboard_size_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 = tensorboard_service.ReadTensorboardSizeResponse.to_json( tensorboard_service.ReadTensorboardSizeResponse() ) @@ -21953,6 +22034,7 @@ def test_create_tensorboard_experiment_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_tensorboard_experiment(request) @@ -22073,6 +22155,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_tensorboard_experiment(request) # Establish that the response is the type that we expect. @@ -22119,6 +22202,7 @@ def test_create_tensorboard_experiment_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 = gca_tensorboard_experiment.TensorboardExperiment.to_json( gca_tensorboard_experiment.TensorboardExperiment() ) @@ -22167,6 +22251,7 @@ def test_get_tensorboard_experiment_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_tensorboard_experiment(request) @@ -22208,6 +22293,7 @@ def test_get_tensorboard_experiment_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_tensorboard_experiment(request) # Establish that the response is the type that we expect. @@ -22252,6 +22338,7 @@ def test_get_tensorboard_experiment_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 = tensorboard_experiment.TensorboardExperiment.to_json( tensorboard_experiment.TensorboardExperiment() ) @@ -22302,6 +22389,7 @@ def test_update_tensorboard_experiment_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_tensorboard_experiment(request) @@ -22426,6 +22514,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_tensorboard_experiment(request) # Establish that the response is the type that we expect. @@ -22472,6 +22561,7 @@ def test_update_tensorboard_experiment_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 = gca_tensorboard_experiment.TensorboardExperiment.to_json( gca_tensorboard_experiment.TensorboardExperiment() ) @@ -22518,6 +22608,7 @@ def test_list_tensorboard_experiments_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_tensorboard_experiments(request) @@ -22555,6 +22646,7 @@ def test_list_tensorboard_experiments_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_tensorboard_experiments(request) # Establish that the response is the type that we expect. @@ -22596,6 +22688,7 @@ def test_list_tensorboard_experiments_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 = tensorboard_service.ListTensorboardExperimentsResponse.to_json( tensorboard_service.ListTensorboardExperimentsResponse() ) @@ -22644,6 +22737,7 @@ def test_delete_tensorboard_experiment_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_tensorboard_experiment(request) @@ -22676,6 +22770,7 @@ def test_delete_tensorboard_experiment_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_tensorboard_experiment(request) # Establish that the response is the type that we expect. @@ -22719,6 +22814,7 @@ def test_delete_tensorboard_experiment_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 @@ -22765,6 +22861,7 @@ def test_create_tensorboard_run_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_tensorboard_run(request) @@ -22883,6 +22980,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_tensorboard_run(request) # Establish that the response is the type that we expect. @@ -22926,6 +23024,7 @@ def test_create_tensorboard_run_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 = gca_tensorboard_run.TensorboardRun.to_json( gca_tensorboard_run.TensorboardRun() ) @@ -22974,6 +23073,7 @@ def test_batch_create_tensorboard_runs_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.batch_create_tensorboard_runs(request) @@ -23011,6 +23111,7 @@ def test_batch_create_tensorboard_runs_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.batch_create_tensorboard_runs(request) # Establish that the response is the type that we expect. @@ -23052,6 +23153,7 @@ def test_batch_create_tensorboard_runs_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 = tensorboard_service.BatchCreateTensorboardRunsResponse.to_json( tensorboard_service.BatchCreateTensorboardRunsResponse() ) @@ -23100,6 +23202,7 @@ def test_get_tensorboard_run_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_tensorboard_run(request) @@ -23140,6 +23243,7 @@ def test_get_tensorboard_run_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_tensorboard_run(request) # Establish that the response is the type that we expect. @@ -23183,6 +23287,7 @@ def test_get_tensorboard_run_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 = tensorboard_run.TensorboardRun.to_json( tensorboard_run.TensorboardRun() ) @@ -23233,6 +23338,7 @@ def test_update_tensorboard_run_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_tensorboard_run(request) @@ -23353,6 +23459,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_tensorboard_run(request) # Establish that the response is the type that we expect. @@ -23396,6 +23503,7 @@ def test_update_tensorboard_run_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 = gca_tensorboard_run.TensorboardRun.to_json( gca_tensorboard_run.TensorboardRun() ) @@ -23444,6 +23552,7 @@ def test_list_tensorboard_runs_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_tensorboard_runs(request) @@ -23481,6 +23590,7 @@ def test_list_tensorboard_runs_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_tensorboard_runs(request) # Establish that the response is the type that we expect. @@ -23521,6 +23631,7 @@ def test_list_tensorboard_runs_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 = tensorboard_service.ListTensorboardRunsResponse.to_json( tensorboard_service.ListTensorboardRunsResponse() ) @@ -23569,6 +23680,7 @@ def test_delete_tensorboard_run_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_tensorboard_run(request) @@ -23601,6 +23713,7 @@ def test_delete_tensorboard_run_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_tensorboard_run(request) # Establish that the response is the type that we expect. @@ -23642,6 +23755,7 @@ def test_delete_tensorboard_run_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 @@ -23688,6 +23802,7 @@ def test_batch_create_tensorboard_time_series_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.batch_create_tensorboard_time_series(request) @@ -23725,6 +23840,7 @@ def test_batch_create_tensorboard_time_series_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.batch_create_tensorboard_time_series(request) # Establish that the response is the type that we expect. @@ -23768,6 +23884,7 @@ def test_batch_create_tensorboard_time_series_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 = ( tensorboard_service.BatchCreateTensorboardTimeSeriesResponse.to_json( tensorboard_service.BatchCreateTensorboardTimeSeriesResponse() @@ -23820,6 +23937,7 @@ def test_create_tensorboard_time_series_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_tensorboard_time_series(request) @@ -23952,6 +24070,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_tensorboard_time_series(request) # Establish that the response is the type that we expect. @@ -24003,6 +24122,7 @@ def test_create_tensorboard_time_series_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 = gca_tensorboard_time_series.TensorboardTimeSeries.to_json( gca_tensorboard_time_series.TensorboardTimeSeries() ) @@ -24051,6 +24171,7 @@ def test_get_tensorboard_time_series_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_tensorboard_time_series(request) @@ -24094,6 +24215,7 @@ def test_get_tensorboard_time_series_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_tensorboard_time_series(request) # Establish that the response is the type that we expect. @@ -24143,6 +24265,7 @@ def test_get_tensorboard_time_series_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 = tensorboard_time_series.TensorboardTimeSeries.to_json( tensorboard_time_series.TensorboardTimeSeries() ) @@ -24193,6 +24316,7 @@ def test_update_tensorboard_time_series_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_tensorboard_time_series(request) @@ -24327,6 +24451,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_tensorboard_time_series(request) # Establish that the response is the type that we expect. @@ -24378,6 +24503,7 @@ def test_update_tensorboard_time_series_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 = gca_tensorboard_time_series.TensorboardTimeSeries.to_json( gca_tensorboard_time_series.TensorboardTimeSeries() ) @@ -24426,6 +24552,7 @@ def test_list_tensorboard_time_series_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_tensorboard_time_series(request) @@ -24465,6 +24592,7 @@ def test_list_tensorboard_time_series_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_tensorboard_time_series(request) # Establish that the response is the type that we expect. @@ -24506,6 +24634,7 @@ def test_list_tensorboard_time_series_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 = tensorboard_service.ListTensorboardTimeSeriesResponse.to_json( tensorboard_service.ListTensorboardTimeSeriesResponse() ) @@ -24554,6 +24683,7 @@ def test_delete_tensorboard_time_series_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_tensorboard_time_series(request) @@ -24586,6 +24716,7 @@ def test_delete_tensorboard_time_series_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_tensorboard_time_series(request) # Establish that the response is the type that we expect. @@ -24629,6 +24760,7 @@ def test_delete_tensorboard_time_series_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 @@ -24675,6 +24807,7 @@ def test_batch_read_tensorboard_time_series_data_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.batch_read_tensorboard_time_series_data(request) @@ -24714,6 +24847,7 @@ def test_batch_read_tensorboard_time_series_data_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.batch_read_tensorboard_time_series_data(request) # Establish that the response is the type that we expect. @@ -24757,6 +24891,7 @@ def test_batch_read_tensorboard_time_series_data_rest_interceptors(null_intercep 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 = ( tensorboard_service.BatchReadTensorboardTimeSeriesDataResponse.to_json( tensorboard_service.BatchReadTensorboardTimeSeriesDataResponse() @@ -24809,6 +24944,7 @@ def test_read_tensorboard_time_series_data_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.read_tensorboard_time_series_data(request) @@ -24846,6 +24982,7 @@ def test_read_tensorboard_time_series_data_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.read_tensorboard_time_series_data(request) # Establish that the response is the type that we expect. @@ -24889,6 +25026,7 @@ def test_read_tensorboard_time_series_data_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 = ( tensorboard_service.ReadTensorboardTimeSeriesDataResponse.to_json( tensorboard_service.ReadTensorboardTimeSeriesDataResponse() @@ -24939,6 +25077,7 @@ def test_read_tensorboard_blob_data_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.read_tensorboard_blob_data(request) @@ -24977,6 +25116,7 @@ def test_read_tensorboard_blob_data_rest_call_success(request_type): json_return_value = "[{}]".format(json_return_value) response_value.iter_content = mock.Mock(return_value=iter(json_return_value)) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = client.read_tensorboard_blob_data(request) assert isinstance(response, Iterable) @@ -25019,6 +25159,7 @@ def test_read_tensorboard_blob_data_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 = tensorboard_service.ReadTensorboardBlobDataResponse.to_json( tensorboard_service.ReadTensorboardBlobDataResponse() ) @@ -25067,6 +25208,7 @@ def test_write_tensorboard_experiment_data_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.write_tensorboard_experiment_data(request) @@ -25104,6 +25246,7 @@ def test_write_tensorboard_experiment_data_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.write_tensorboard_experiment_data(request) # Establish that the response is the type that we expect. @@ -25147,6 +25290,7 @@ def test_write_tensorboard_experiment_data_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 = ( tensorboard_service.WriteTensorboardExperimentDataResponse.to_json( tensorboard_service.WriteTensorboardExperimentDataResponse() @@ -25197,6 +25341,7 @@ def test_write_tensorboard_run_data_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.write_tensorboard_run_data(request) @@ -25234,6 +25379,7 @@ def test_write_tensorboard_run_data_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.write_tensorboard_run_data(request) # Establish that the response is the type that we expect. @@ -25273,6 +25419,7 @@ def test_write_tensorboard_run_data_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 = tensorboard_service.WriteTensorboardRunDataResponse.to_json( tensorboard_service.WriteTensorboardRunDataResponse() ) @@ -25321,6 +25468,7 @@ def test_export_tensorboard_time_series_data_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.export_tensorboard_time_series_data(request) @@ -25360,6 +25508,7 @@ def test_export_tensorboard_time_series_data_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.export_tensorboard_time_series_data(request) # Establish that the response is the type that we expect. @@ -25402,6 +25551,7 @@ def test_export_tensorboard_time_series_data_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 = ( tensorboard_service.ExportTensorboardTimeSeriesDataResponse.to_json( tensorboard_service.ExportTensorboardTimeSeriesDataResponse() @@ -25452,6 +25602,7 @@ def test_get_location_rest_bad_request(request_type=locations_pb2.GetLocationReq 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_location(request) @@ -25482,6 +25633,7 @@ def test_get_location_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_location(request) @@ -25510,6 +25662,7 @@ def test_list_locations_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_locations(request) @@ -25540,6 +25693,7 @@ def test_list_locations_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_locations(request) @@ -25571,6 +25725,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -25603,6 +25758,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -25634,6 +25790,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -25666,6 +25823,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -25697,6 +25855,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -25729,6 +25888,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -25759,6 +25919,7 @@ def test_cancel_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.cancel_operation(request) @@ -25789,6 +25950,7 @@ def test_cancel_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.cancel_operation(request) @@ -25819,6 +25981,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) @@ -25849,6 +26012,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) @@ -25879,6 +26043,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) @@ -25909,6 +26074,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) @@ -25939,6 +26105,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) @@ -25969,6 +26136,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) @@ -25999,6 +26167,7 @@ def test_wait_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.wait_operation(request) @@ -26029,6 +26198,7 @@ def test_wait_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.wait_operation(request) @@ -26754,6 +26924,7 @@ async def test_create_tensorboard_rest_asyncio_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"} await client.create_tensorboard(request) @@ -26873,6 +27044,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.create_tensorboard(request) # Establish that the response is the type that we expect. @@ -26919,6 +27091,7 @@ async def test_create_tensorboard_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -26967,6 +27140,7 @@ async def test_get_tensorboard_rest_asyncio_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"} await client.get_tensorboard(request) @@ -27017,6 +27191,7 @@ async def test_get_tensorboard_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_tensorboard(request) # Establish that the response is the type that we expect. @@ -27070,6 +27245,7 @@ async def test_get_tensorboard_rest_asyncio_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 = tensorboard.Tensorboard.to_json(tensorboard.Tensorboard()) req.return_value.read = mock.AsyncMock(return_value=return_value) @@ -27122,6 +27298,7 @@ async def test_update_tensorboard_rest_asyncio_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"} await client.update_tensorboard(request) @@ -27245,6 +27422,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.update_tensorboard(request) # Establish that the response is the type that we expect. @@ -27291,6 +27469,7 @@ async def test_update_tensorboard_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -27339,6 +27518,7 @@ async def test_list_tensorboards_rest_asyncio_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"} await client.list_tensorboards(request) @@ -27381,6 +27561,7 @@ async def test_list_tensorboards_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_tensorboards(request) # Establish that the response is the type that we expect. @@ -27426,6 +27607,7 @@ async def test_list_tensorboards_rest_asyncio_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 = tensorboard_service.ListTensorboardsResponse.to_json( tensorboard_service.ListTensorboardsResponse() ) @@ -27476,6 +27658,7 @@ async def test_delete_tensorboard_rest_asyncio_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"} await client.delete_tensorboard(request) @@ -27513,6 +27696,7 @@ async def test_delete_tensorboard_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_tensorboard(request) # Establish that the response is the type that we expect. @@ -27559,6 +27743,7 @@ async def test_delete_tensorboard_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -27609,6 +27794,7 @@ async def test_read_tensorboard_usage_rest_asyncio_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"} await client.read_tensorboard_usage(request) @@ -27651,6 +27837,7 @@ async def test_read_tensorboard_usage_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.read_tensorboard_usage(request) # Establish that the response is the type that we expect. @@ -27695,6 +27882,7 @@ async def test_read_tensorboard_usage_rest_asyncio_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 = tensorboard_service.ReadTensorboardUsageResponse.to_json( tensorboard_service.ReadTensorboardUsageResponse() ) @@ -27747,6 +27935,7 @@ async def test_read_tensorboard_size_rest_asyncio_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"} await client.read_tensorboard_size(request) @@ -27791,6 +27980,7 @@ async def test_read_tensorboard_size_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.read_tensorboard_size(request) # Establish that the response is the type that we expect. @@ -27836,6 +28026,7 @@ async def test_read_tensorboard_size_rest_asyncio_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 = tensorboard_service.ReadTensorboardSizeResponse.to_json( tensorboard_service.ReadTensorboardSizeResponse() ) @@ -27886,6 +28077,7 @@ async def test_create_tensorboard_experiment_rest_asyncio_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"} await client.create_tensorboard_experiment(request) @@ -28013,6 +28205,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.create_tensorboard_experiment(request) # Establish that the response is the type that we expect. @@ -28066,6 +28259,7 @@ async def test_create_tensorboard_experiment_rest_asyncio_interceptors( 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 = gca_tensorboard_experiment.TensorboardExperiment.to_json( gca_tensorboard_experiment.TensorboardExperiment() ) @@ -28118,6 +28312,7 @@ async def test_get_tensorboard_experiment_rest_asyncio_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"} await client.get_tensorboard_experiment(request) @@ -28166,6 +28361,7 @@ async def test_get_tensorboard_experiment_rest_asyncio_call_success(request_type return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_tensorboard_experiment(request) # Establish that the response is the type that we expect. @@ -28217,6 +28413,7 @@ async def test_get_tensorboard_experiment_rest_asyncio_interceptors(null_interce 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 = tensorboard_experiment.TensorboardExperiment.to_json( tensorboard_experiment.TensorboardExperiment() ) @@ -28271,6 +28468,7 @@ async def test_update_tensorboard_experiment_rest_asyncio_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"} await client.update_tensorboard_experiment(request) @@ -28402,6 +28600,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.update_tensorboard_experiment(request) # Establish that the response is the type that we expect. @@ -28455,6 +28654,7 @@ async def test_update_tensorboard_experiment_rest_asyncio_interceptors( 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 = gca_tensorboard_experiment.TensorboardExperiment.to_json( gca_tensorboard_experiment.TensorboardExperiment() ) @@ -28505,6 +28705,7 @@ async def test_list_tensorboard_experiments_rest_asyncio_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"} await client.list_tensorboard_experiments(request) @@ -28549,6 +28750,7 @@ async def test_list_tensorboard_experiments_rest_asyncio_call_success(request_ty return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_tensorboard_experiments(request) # Establish that the response is the type that we expect. @@ -28596,6 +28798,7 @@ async def test_list_tensorboard_experiments_rest_asyncio_interceptors(null_inter 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 = tensorboard_service.ListTensorboardExperimentsResponse.to_json( tensorboard_service.ListTensorboardExperimentsResponse() ) @@ -28648,6 +28851,7 @@ async def test_delete_tensorboard_experiment_rest_asyncio_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"} await client.delete_tensorboard_experiment(request) @@ -28687,6 +28891,7 @@ async def test_delete_tensorboard_experiment_rest_asyncio_call_success(request_t return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_tensorboard_experiment(request) # Establish that the response is the type that we expect. @@ -28737,6 +28942,7 @@ async def test_delete_tensorboard_experiment_rest_asyncio_interceptors( 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.read = mock.AsyncMock(return_value=return_value) @@ -28787,6 +28993,7 @@ async def test_create_tensorboard_run_rest_asyncio_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"} await client.create_tensorboard_run(request) @@ -28912,6 +29119,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.create_tensorboard_run(request) # Establish that the response is the type that we expect. @@ -28960,6 +29168,7 @@ async def test_create_tensorboard_run_rest_asyncio_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 = gca_tensorboard_run.TensorboardRun.to_json( gca_tensorboard_run.TensorboardRun() ) @@ -29012,6 +29221,7 @@ async def test_batch_create_tensorboard_runs_rest_asyncio_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"} await client.batch_create_tensorboard_runs(request) @@ -29056,6 +29266,7 @@ async def test_batch_create_tensorboard_runs_rest_asyncio_call_success(request_t return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.batch_create_tensorboard_runs(request) # Establish that the response is the type that we expect. @@ -29104,6 +29315,7 @@ async def test_batch_create_tensorboard_runs_rest_asyncio_interceptors( 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 = tensorboard_service.BatchCreateTensorboardRunsResponse.to_json( tensorboard_service.BatchCreateTensorboardRunsResponse() ) @@ -29156,6 +29368,7 @@ async def test_get_tensorboard_run_rest_asyncio_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"} await client.get_tensorboard_run(request) @@ -29203,6 +29416,7 @@ async def test_get_tensorboard_run_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_tensorboard_run(request) # Establish that the response is the type that we expect. @@ -29251,6 +29465,7 @@ async def test_get_tensorboard_run_rest_asyncio_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 = tensorboard_run.TensorboardRun.to_json( tensorboard_run.TensorboardRun() ) @@ -29305,6 +29520,7 @@ async def test_update_tensorboard_run_rest_asyncio_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"} await client.update_tensorboard_run(request) @@ -29432,6 +29648,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.update_tensorboard_run(request) # Establish that the response is the type that we expect. @@ -29480,6 +29697,7 @@ async def test_update_tensorboard_run_rest_asyncio_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 = gca_tensorboard_run.TensorboardRun.to_json( gca_tensorboard_run.TensorboardRun() ) @@ -29532,6 +29750,7 @@ async def test_list_tensorboard_runs_rest_asyncio_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"} await client.list_tensorboard_runs(request) @@ -29576,6 +29795,7 @@ async def test_list_tensorboard_runs_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_tensorboard_runs(request) # Establish that the response is the type that we expect. @@ -29621,6 +29841,7 @@ async def test_list_tensorboard_runs_rest_asyncio_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 = tensorboard_service.ListTensorboardRunsResponse.to_json( tensorboard_service.ListTensorboardRunsResponse() ) @@ -29673,6 +29894,7 @@ async def test_delete_tensorboard_run_rest_asyncio_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"} await client.delete_tensorboard_run(request) @@ -29712,6 +29934,7 @@ async def test_delete_tensorboard_run_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_tensorboard_run(request) # Establish that the response is the type that we expect. @@ -29758,6 +29981,7 @@ async def test_delete_tensorboard_run_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -29808,6 +30032,7 @@ async def test_batch_create_tensorboard_time_series_rest_asyncio_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"} await client.batch_create_tensorboard_time_series(request) @@ -29854,6 +30079,7 @@ async def test_batch_create_tensorboard_time_series_rest_asyncio_call_success( return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.batch_create_tensorboard_time_series(request) # Establish that the response is the type that we expect. @@ -29904,6 +30130,7 @@ async def test_batch_create_tensorboard_time_series_rest_asyncio_interceptors( 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 = ( tensorboard_service.BatchCreateTensorboardTimeSeriesResponse.to_json( tensorboard_service.BatchCreateTensorboardTimeSeriesResponse() @@ -29960,6 +30187,7 @@ async def test_create_tensorboard_time_series_rest_asyncio_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"} await client.create_tensorboard_time_series(request) @@ -30099,6 +30327,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.create_tensorboard_time_series(request) # Establish that the response is the type that we expect. @@ -30157,6 +30386,7 @@ async def test_create_tensorboard_time_series_rest_asyncio_interceptors( 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 = gca_tensorboard_time_series.TensorboardTimeSeries.to_json( gca_tensorboard_time_series.TensorboardTimeSeries() ) @@ -30209,6 +30439,7 @@ async def test_get_tensorboard_time_series_rest_asyncio_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"} await client.get_tensorboard_time_series(request) @@ -30259,6 +30490,7 @@ async def test_get_tensorboard_time_series_rest_asyncio_call_success(request_typ return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_tensorboard_time_series(request) # Establish that the response is the type that we expect. @@ -30315,6 +30547,7 @@ async def test_get_tensorboard_time_series_rest_asyncio_interceptors(null_interc 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 = tensorboard_time_series.TensorboardTimeSeries.to_json( tensorboard_time_series.TensorboardTimeSeries() ) @@ -30369,6 +30602,7 @@ async def test_update_tensorboard_time_series_rest_asyncio_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"} await client.update_tensorboard_time_series(request) @@ -30510,6 +30744,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.update_tensorboard_time_series(request) # Establish that the response is the type that we expect. @@ -30568,6 +30803,7 @@ async def test_update_tensorboard_time_series_rest_asyncio_interceptors( 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 = gca_tensorboard_time_series.TensorboardTimeSeries.to_json( gca_tensorboard_time_series.TensorboardTimeSeries() ) @@ -30620,6 +30856,7 @@ async def test_list_tensorboard_time_series_rest_asyncio_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"} await client.list_tensorboard_time_series(request) @@ -30666,6 +30903,7 @@ async def test_list_tensorboard_time_series_rest_asyncio_call_success(request_ty return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_tensorboard_time_series(request) # Establish that the response is the type that we expect. @@ -30713,6 +30951,7 @@ async def test_list_tensorboard_time_series_rest_asyncio_interceptors(null_inter 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 = tensorboard_service.ListTensorboardTimeSeriesResponse.to_json( tensorboard_service.ListTensorboardTimeSeriesResponse() ) @@ -30765,6 +31004,7 @@ async def test_delete_tensorboard_time_series_rest_asyncio_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"} await client.delete_tensorboard_time_series(request) @@ -30804,6 +31044,7 @@ async def test_delete_tensorboard_time_series_rest_asyncio_call_success(request_ return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_tensorboard_time_series(request) # Establish that the response is the type that we expect. @@ -30854,6 +31095,7 @@ async def test_delete_tensorboard_time_series_rest_asyncio_interceptors( 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.read = mock.AsyncMock(return_value=return_value) @@ -30904,6 +31146,7 @@ async def test_batch_read_tensorboard_time_series_data_rest_asyncio_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"} await client.batch_read_tensorboard_time_series_data(request) @@ -30952,6 +31195,7 @@ async def test_batch_read_tensorboard_time_series_data_rest_asyncio_call_success return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.batch_read_tensorboard_time_series_data(request) # Establish that the response is the type that we expect. @@ -31002,6 +31246,7 @@ async def test_batch_read_tensorboard_time_series_data_rest_asyncio_interceptors 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 = ( tensorboard_service.BatchReadTensorboardTimeSeriesDataResponse.to_json( tensorboard_service.BatchReadTensorboardTimeSeriesDataResponse() @@ -31058,6 +31303,7 @@ async def test_read_tensorboard_time_series_data_rest_asyncio_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"} await client.read_tensorboard_time_series_data(request) @@ -31104,6 +31350,7 @@ async def test_read_tensorboard_time_series_data_rest_asyncio_call_success( return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.read_tensorboard_time_series_data(request) # Establish that the response is the type that we expect. @@ -31154,6 +31401,7 @@ async def test_read_tensorboard_time_series_data_rest_asyncio_interceptors( 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 = ( tensorboard_service.ReadTensorboardTimeSeriesDataResponse.to_json( tensorboard_service.ReadTensorboardTimeSeriesDataResponse() @@ -31208,6 +31456,7 @@ async def test_read_tensorboard_blob_data_rest_asyncio_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"} await client.read_tensorboard_blob_data(request) @@ -31251,6 +31500,7 @@ async def test_read_tensorboard_blob_data_rest_asyncio_call_success(request_type json_return_value = "[{}]".format(json_return_value) response_value.content.return_value = mock_async_gen(json_return_value) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.read_tensorboard_blob_data(request) assert isinstance(response, AsyncIterable) @@ -31300,6 +31550,7 @@ async def test_read_tensorboard_blob_data_rest_asyncio_interceptors(null_interce 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 = tensorboard_service.ReadTensorboardBlobDataResponse.to_json( tensorboard_service.ReadTensorboardBlobDataResponse() ) @@ -31352,6 +31603,7 @@ async def test_write_tensorboard_experiment_data_rest_asyncio_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"} await client.write_tensorboard_experiment_data(request) @@ -31398,6 +31650,7 @@ async def test_write_tensorboard_experiment_data_rest_asyncio_call_success( return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.write_tensorboard_experiment_data(request) # Establish that the response is the type that we expect. @@ -31448,6 +31701,7 @@ async def test_write_tensorboard_experiment_data_rest_asyncio_interceptors( 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 = ( tensorboard_service.WriteTensorboardExperimentDataResponse.to_json( tensorboard_service.WriteTensorboardExperimentDataResponse() @@ -31502,6 +31756,7 @@ async def test_write_tensorboard_run_data_rest_asyncio_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"} await client.write_tensorboard_run_data(request) @@ -31546,6 +31801,7 @@ async def test_write_tensorboard_run_data_rest_asyncio_call_success(request_type return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.write_tensorboard_run_data(request) # Establish that the response is the type that we expect. @@ -31592,6 +31848,7 @@ async def test_write_tensorboard_run_data_rest_asyncio_interceptors(null_interce 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 = tensorboard_service.WriteTensorboardRunDataResponse.to_json( tensorboard_service.WriteTensorboardRunDataResponse() ) @@ -31644,6 +31901,7 @@ async def test_export_tensorboard_time_series_data_rest_asyncio_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"} await client.export_tensorboard_time_series_data(request) @@ -31692,6 +31950,7 @@ async def test_export_tensorboard_time_series_data_rest_asyncio_call_success( return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.export_tensorboard_time_series_data(request) # Establish that the response is the type that we expect. @@ -31741,6 +32000,7 @@ async def test_export_tensorboard_time_series_data_rest_asyncio_interceptors( 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 = ( tensorboard_service.ExportTensorboardTimeSeriesDataResponse.to_json( tensorboard_service.ExportTensorboardTimeSeriesDataResponse() @@ -31797,6 +32057,7 @@ async def test_get_location_rest_asyncio_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"} await client.get_location(request) @@ -31834,6 +32095,7 @@ async def test_get_location_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_location(request) @@ -31866,6 +32128,7 @@ async def test_list_locations_rest_asyncio_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"} await client.list_locations(request) @@ -31903,6 +32166,7 @@ async def test_list_locations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_locations(request) @@ -31938,6 +32202,7 @@ async def test_get_iam_policy_rest_asyncio_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"} await client.get_iam_policy(request) @@ -31977,6 +32242,7 @@ async def test_get_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_iam_policy(request) @@ -32012,6 +32278,7 @@ async def test_set_iam_policy_rest_asyncio_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"} await client.set_iam_policy(request) @@ -32051,6 +32318,7 @@ async def test_set_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.set_iam_policy(request) @@ -32086,6 +32354,7 @@ async def test_test_iam_permissions_rest_asyncio_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"} await client.test_iam_permissions(request) @@ -32125,6 +32394,7 @@ async def test_test_iam_permissions_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.test_iam_permissions(request) @@ -32159,6 +32429,7 @@ async def test_cancel_operation_rest_asyncio_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"} await client.cancel_operation(request) @@ -32196,6 +32467,7 @@ async def test_cancel_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.cancel_operation(request) @@ -32230,6 +32502,7 @@ async def test_delete_operation_rest_asyncio_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"} await client.delete_operation(request) @@ -32267,6 +32540,7 @@ async def test_delete_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_operation(request) @@ -32301,6 +32575,7 @@ async def test_get_operation_rest_asyncio_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"} await client.get_operation(request) @@ -32338,6 +32613,7 @@ async def test_get_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_operation(request) @@ -32372,6 +32648,7 @@ async def test_list_operations_rest_asyncio_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"} await client.list_operations(request) @@ -32409,6 +32686,7 @@ async def test_list_operations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_operations(request) @@ -32443,6 +32721,7 @@ async def test_wait_operation_rest_asyncio_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"} await client.wait_operation(request) @@ -32480,6 +32759,7 @@ async def test_wait_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.wait_operation(request) diff --git a/tests/unit/gapic/aiplatform_v1beta1/test_vertex_rag_data_service.py b/tests/unit/gapic/aiplatform_v1beta1/test_vertex_rag_data_service.py index 95d623b61a..d4e40803c2 100644 --- a/tests/unit/gapic/aiplatform_v1beta1/test_vertex_rag_data_service.py +++ b/tests/unit/gapic/aiplatform_v1beta1/test_vertex_rag_data_service.py @@ -5074,6 +5074,7 @@ def test_create_rag_corpus_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_rag_corpus(request) @@ -5126,6 +5127,7 @@ def test_create_rag_corpus_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_rag_corpus(**mock_args) @@ -5257,6 +5259,7 @@ def test_update_rag_corpus_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_rag_corpus(request) @@ -5304,6 +5307,7 @@ def test_update_rag_corpus_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_rag_corpus(**mock_args) @@ -5435,6 +5439,7 @@ def test_get_rag_corpus_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_rag_corpus(request) @@ -5482,6 +5487,7 @@ def test_get_rag_corpus_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_rag_corpus(**mock_args) @@ -5624,6 +5630,7 @@ def test_list_rag_corpora_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_rag_corpora(request) @@ -5677,6 +5684,7 @@ def test_list_rag_corpora_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_rag_corpora(**mock_args) @@ -5876,6 +5884,7 @@ def test_delete_rag_corpus_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_rag_corpus(request) @@ -5921,6 +5930,7 @@ def test_delete_rag_corpus_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_rag_corpus(**mock_args) @@ -6055,6 +6065,7 @@ def test_upload_rag_file_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.upload_rag_file(request) @@ -6121,6 +6132,7 @@ def test_upload_rag_file_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.upload_rag_file(**mock_args) @@ -6266,6 +6278,7 @@ def test_import_rag_files_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.import_rag_files(request) @@ -6322,6 +6335,7 @@ def test_import_rag_files_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.import_rag_files(**mock_args) @@ -6456,6 +6470,7 @@ def test_get_rag_file_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_rag_file(request) @@ -6503,6 +6518,7 @@ def test_get_rag_file_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_rag_file(**mock_args) @@ -6641,6 +6657,7 @@ def test_list_rag_files_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_rag_files(request) @@ -6696,6 +6713,7 @@ def test_list_rag_files_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_rag_files(**mock_args) @@ -6893,6 +6911,7 @@ def test_delete_rag_file_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_rag_file(request) @@ -6938,6 +6957,7 @@ def test_delete_rag_file_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_rag_file(**mock_args) @@ -7601,6 +7621,7 @@ def test_create_rag_corpus_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_rag_corpus(request) @@ -7744,6 +7765,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_rag_corpus(request) # Establish that the response is the type that we expect. @@ -7785,6 +7807,7 @@ def test_create_rag_corpus_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 @@ -7831,6 +7854,7 @@ def test_update_rag_corpus_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_rag_corpus(request) @@ -7976,6 +8000,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_rag_corpus(request) # Establish that the response is the type that we expect. @@ -8017,6 +8042,7 @@ def test_update_rag_corpus_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 @@ -8061,6 +8087,7 @@ def test_get_rag_corpus_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_rag_corpus(request) @@ -8098,6 +8125,7 @@ def test_get_rag_corpus_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_rag_corpus(request) # Establish that the response is the type that we expect. @@ -8140,6 +8168,7 @@ def test_get_rag_corpus_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 = vertex_rag_data.RagCorpus.to_json(vertex_rag_data.RagCorpus()) req.return_value.content = return_value @@ -8184,6 +8213,7 @@ def test_list_rag_corpora_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_rag_corpora(request) @@ -8219,6 +8249,7 @@ def test_list_rag_corpora_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_rag_corpora(request) # Establish that the response is the type that we expect. @@ -8259,6 +8290,7 @@ def test_list_rag_corpora_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 = vertex_rag_data_service.ListRagCorporaResponse.to_json( vertex_rag_data_service.ListRagCorporaResponse() ) @@ -8305,6 +8337,7 @@ def test_delete_rag_corpus_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_rag_corpus(request) @@ -8335,6 +8368,7 @@ def test_delete_rag_corpus_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_rag_corpus(request) # Establish that the response is the type that we expect. @@ -8376,6 +8410,7 @@ def test_delete_rag_corpus_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 @@ -8420,6 +8455,7 @@ def test_upload_rag_file_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.upload_rag_file(request) @@ -8453,6 +8489,7 @@ def test_upload_rag_file_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.upload_rag_file(request) # Establish that the response is the type that we expect. @@ -8492,6 +8529,7 @@ def test_upload_rag_file_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 = vertex_rag_data_service.UploadRagFileResponse.to_json( vertex_rag_data_service.UploadRagFileResponse() ) @@ -8538,6 +8576,7 @@ def test_import_rag_files_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.import_rag_files(request) @@ -8568,6 +8607,7 @@ def test_import_rag_files_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.import_rag_files(request) # Establish that the response is the type that we expect. @@ -8609,6 +8649,7 @@ def test_import_rag_files_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 @@ -8655,6 +8696,7 @@ def test_get_rag_file_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_rag_file(request) @@ -8696,6 +8738,7 @@ def test_get_rag_file_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_rag_file(request) # Establish that the response is the type that we expect. @@ -8742,6 +8785,7 @@ def test_get_rag_file_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 = vertex_rag_data.RagFile.to_json(vertex_rag_data.RagFile()) req.return_value.content = return_value @@ -8786,6 +8830,7 @@ def test_list_rag_files_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_rag_files(request) @@ -8821,6 +8866,7 @@ def test_list_rag_files_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_rag_files(request) # Establish that the response is the type that we expect. @@ -8861,6 +8907,7 @@ def test_list_rag_files_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 = vertex_rag_data_service.ListRagFilesResponse.to_json( vertex_rag_data_service.ListRagFilesResponse() ) @@ -8909,6 +8956,7 @@ def test_delete_rag_file_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_rag_file(request) @@ -8941,6 +8989,7 @@ def test_delete_rag_file_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_rag_file(request) # Establish that the response is the type that we expect. @@ -8982,6 +9031,7 @@ def test_delete_rag_file_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 @@ -9026,6 +9076,7 @@ def test_get_location_rest_bad_request(request_type=locations_pb2.GetLocationReq 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_location(request) @@ -9056,6 +9107,7 @@ def test_get_location_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_location(request) @@ -9084,6 +9136,7 @@ def test_list_locations_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_locations(request) @@ -9114,6 +9167,7 @@ def test_list_locations_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_locations(request) @@ -9145,6 +9199,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -9177,6 +9232,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -9208,6 +9264,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -9240,6 +9297,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -9271,6 +9329,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -9303,6 +9362,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -9333,6 +9393,7 @@ def test_cancel_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.cancel_operation(request) @@ -9363,6 +9424,7 @@ def test_cancel_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.cancel_operation(request) @@ -9393,6 +9455,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) @@ -9423,6 +9486,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) @@ -9453,6 +9517,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) @@ -9483,6 +9548,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) @@ -9513,6 +9579,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) @@ -9543,6 +9610,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) @@ -9573,6 +9641,7 @@ def test_wait_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.wait_operation(request) @@ -9603,6 +9672,7 @@ def test_wait_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.wait_operation(request) @@ -9876,6 +9946,7 @@ async def test_create_rag_corpus_rest_asyncio_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"} await client.create_rag_corpus(request) @@ -10026,6 +10097,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.create_rag_corpus(request) # Establish that the response is the type that we expect. @@ -10072,6 +10144,7 @@ async def test_create_rag_corpus_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -10122,6 +10195,7 @@ async def test_update_rag_corpus_rest_asyncio_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"} await client.update_rag_corpus(request) @@ -10274,6 +10348,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.update_rag_corpus(request) # Establish that the response is the type that we expect. @@ -10320,6 +10395,7 @@ async def test_update_rag_corpus_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -10368,6 +10444,7 @@ async def test_get_rag_corpus_rest_asyncio_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"} await client.get_rag_corpus(request) @@ -10412,6 +10489,7 @@ async def test_get_rag_corpus_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_rag_corpus(request) # Establish that the response is the type that we expect. @@ -10459,6 +10537,7 @@ async def test_get_rag_corpus_rest_asyncio_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 = vertex_rag_data.RagCorpus.to_json(vertex_rag_data.RagCorpus()) req.return_value.read = mock.AsyncMock(return_value=return_value) @@ -10507,6 +10586,7 @@ async def test_list_rag_corpora_rest_asyncio_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"} await client.list_rag_corpora(request) @@ -10549,6 +10629,7 @@ async def test_list_rag_corpora_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_rag_corpora(request) # Establish that the response is the type that we expect. @@ -10594,6 +10675,7 @@ async def test_list_rag_corpora_rest_asyncio_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 = vertex_rag_data_service.ListRagCorporaResponse.to_json( vertex_rag_data_service.ListRagCorporaResponse() ) @@ -10644,6 +10726,7 @@ async def test_delete_rag_corpus_rest_asyncio_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"} await client.delete_rag_corpus(request) @@ -10681,6 +10764,7 @@ async def test_delete_rag_corpus_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_rag_corpus(request) # Establish that the response is the type that we expect. @@ -10727,6 +10811,7 @@ async def test_delete_rag_corpus_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -10775,6 +10860,7 @@ async def test_upload_rag_file_rest_asyncio_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"} await client.upload_rag_file(request) @@ -10815,6 +10901,7 @@ async def test_upload_rag_file_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.upload_rag_file(request) # Establish that the response is the type that we expect. @@ -10859,6 +10946,7 @@ async def test_upload_rag_file_rest_asyncio_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 = vertex_rag_data_service.UploadRagFileResponse.to_json( vertex_rag_data_service.UploadRagFileResponse() ) @@ -10909,6 +10997,7 @@ async def test_import_rag_files_rest_asyncio_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"} await client.import_rag_files(request) @@ -10946,6 +11035,7 @@ async def test_import_rag_files_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.import_rag_files(request) # Establish that the response is the type that we expect. @@ -10992,6 +11082,7 @@ async def test_import_rag_files_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -11042,6 +11133,7 @@ async def test_get_rag_file_rest_asyncio_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"} await client.get_rag_file(request) @@ -11090,6 +11182,7 @@ async def test_get_rag_file_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_rag_file(request) # Establish that the response is the type that we expect. @@ -11141,6 +11234,7 @@ async def test_get_rag_file_rest_asyncio_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 = vertex_rag_data.RagFile.to_json(vertex_rag_data.RagFile()) req.return_value.read = mock.AsyncMock(return_value=return_value) @@ -11189,6 +11283,7 @@ async def test_list_rag_files_rest_asyncio_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"} await client.list_rag_files(request) @@ -11231,6 +11326,7 @@ async def test_list_rag_files_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_rag_files(request) # Establish that the response is the type that we expect. @@ -11276,6 +11372,7 @@ async def test_list_rag_files_rest_asyncio_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 = vertex_rag_data_service.ListRagFilesResponse.to_json( vertex_rag_data_service.ListRagFilesResponse() ) @@ -11328,6 +11425,7 @@ async def test_delete_rag_file_rest_asyncio_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"} await client.delete_rag_file(request) @@ -11367,6 +11465,7 @@ async def test_delete_rag_file_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_rag_file(request) # Establish that the response is the type that we expect. @@ -11413,6 +11512,7 @@ async def test_delete_rag_file_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -11463,6 +11563,7 @@ async def test_get_location_rest_asyncio_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"} await client.get_location(request) @@ -11500,6 +11601,7 @@ async def test_get_location_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_location(request) @@ -11532,6 +11634,7 @@ async def test_list_locations_rest_asyncio_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"} await client.list_locations(request) @@ -11569,6 +11672,7 @@ async def test_list_locations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_locations(request) @@ -11604,6 +11708,7 @@ async def test_get_iam_policy_rest_asyncio_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"} await client.get_iam_policy(request) @@ -11643,6 +11748,7 @@ async def test_get_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_iam_policy(request) @@ -11678,6 +11784,7 @@ async def test_set_iam_policy_rest_asyncio_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"} await client.set_iam_policy(request) @@ -11717,6 +11824,7 @@ async def test_set_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.set_iam_policy(request) @@ -11752,6 +11860,7 @@ async def test_test_iam_permissions_rest_asyncio_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"} await client.test_iam_permissions(request) @@ -11791,6 +11900,7 @@ async def test_test_iam_permissions_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.test_iam_permissions(request) @@ -11825,6 +11935,7 @@ async def test_cancel_operation_rest_asyncio_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"} await client.cancel_operation(request) @@ -11862,6 +11973,7 @@ async def test_cancel_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.cancel_operation(request) @@ -11896,6 +12008,7 @@ async def test_delete_operation_rest_asyncio_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"} await client.delete_operation(request) @@ -11933,6 +12046,7 @@ async def test_delete_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_operation(request) @@ -11967,6 +12081,7 @@ async def test_get_operation_rest_asyncio_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"} await client.get_operation(request) @@ -12004,6 +12119,7 @@ async def test_get_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_operation(request) @@ -12038,6 +12154,7 @@ async def test_list_operations_rest_asyncio_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"} await client.list_operations(request) @@ -12075,6 +12192,7 @@ async def test_list_operations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_operations(request) @@ -12109,6 +12227,7 @@ async def test_wait_operation_rest_asyncio_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"} await client.wait_operation(request) @@ -12146,6 +12265,7 @@ async def test_wait_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.wait_operation(request) diff --git a/tests/unit/gapic/aiplatform_v1beta1/test_vertex_rag_service.py b/tests/unit/gapic/aiplatform_v1beta1/test_vertex_rag_service.py index f93ce8e955..57e83323f5 100644 --- a/tests/unit/gapic/aiplatform_v1beta1/test_vertex_rag_service.py +++ b/tests/unit/gapic/aiplatform_v1beta1/test_vertex_rag_service.py @@ -2262,6 +2262,7 @@ def test_retrieve_contexts_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.retrieve_contexts(request) @@ -2316,6 +2317,7 @@ def test_retrieve_contexts_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.retrieve_contexts(**mock_args) @@ -2449,6 +2451,7 @@ def test_augment_prompt_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.augment_prompt(request) @@ -2495,6 +2498,7 @@ def test_augment_prompt_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.augment_prompt(**mock_args) @@ -2635,6 +2639,7 @@ def test_corroborate_content_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.corroborate_content(request) @@ -2682,6 +2687,7 @@ def test_corroborate_content_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.corroborate_content(**mock_args) @@ -3009,6 +3015,7 @@ def test_retrieve_contexts_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.retrieve_contexts(request) @@ -3042,6 +3049,7 @@ def test_retrieve_contexts_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.retrieve_contexts(request) # Establish that the response is the type that we expect. @@ -3081,6 +3089,7 @@ def test_retrieve_contexts_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 = vertex_rag_service.RetrieveContextsResponse.to_json( vertex_rag_service.RetrieveContextsResponse() ) @@ -3127,6 +3136,7 @@ def test_augment_prompt_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.augment_prompt(request) @@ -3160,6 +3170,7 @@ def test_augment_prompt_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.augment_prompt(request) # Establish that the response is the type that we expect. @@ -3199,6 +3210,7 @@ def test_augment_prompt_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 = vertex_rag_service.AugmentPromptResponse.to_json( vertex_rag_service.AugmentPromptResponse() ) @@ -3245,6 +3257,7 @@ def test_corroborate_content_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.corroborate_content(request) @@ -3280,6 +3293,7 @@ def test_corroborate_content_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.corroborate_content(request) # Establish that the response is the type that we expect. @@ -3320,6 +3334,7 @@ def test_corroborate_content_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 = vertex_rag_service.CorroborateContentResponse.to_json( vertex_rag_service.CorroborateContentResponse() ) @@ -3366,6 +3381,7 @@ def test_get_location_rest_bad_request(request_type=locations_pb2.GetLocationReq 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_location(request) @@ -3396,6 +3412,7 @@ def test_get_location_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_location(request) @@ -3424,6 +3441,7 @@ def test_list_locations_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_locations(request) @@ -3454,6 +3472,7 @@ def test_list_locations_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_locations(request) @@ -3485,6 +3504,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -3517,6 +3537,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -3548,6 +3569,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -3580,6 +3602,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -3611,6 +3634,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -3643,6 +3667,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -3673,6 +3698,7 @@ def test_cancel_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.cancel_operation(request) @@ -3703,6 +3729,7 @@ def test_cancel_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.cancel_operation(request) @@ -3733,6 +3760,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) @@ -3763,6 +3791,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) @@ -3793,6 +3822,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) @@ -3823,6 +3853,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) @@ -3853,6 +3884,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) @@ -3883,6 +3915,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) @@ -3913,6 +3946,7 @@ def test_wait_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.wait_operation(request) @@ -3943,6 +3977,7 @@ def test_wait_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.wait_operation(request) @@ -4057,6 +4092,7 @@ async def test_retrieve_contexts_rest_asyncio_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"} await client.retrieve_contexts(request) @@ -4097,6 +4133,7 @@ async def test_retrieve_contexts_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.retrieve_contexts(request) # Establish that the response is the type that we expect. @@ -4141,6 +4178,7 @@ async def test_retrieve_contexts_rest_asyncio_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 = vertex_rag_service.RetrieveContextsResponse.to_json( vertex_rag_service.RetrieveContextsResponse() ) @@ -4191,6 +4229,7 @@ async def test_augment_prompt_rest_asyncio_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"} await client.augment_prompt(request) @@ -4231,6 +4270,7 @@ async def test_augment_prompt_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.augment_prompt(request) # Establish that the response is the type that we expect. @@ -4275,6 +4315,7 @@ async def test_augment_prompt_rest_asyncio_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 = vertex_rag_service.AugmentPromptResponse.to_json( vertex_rag_service.AugmentPromptResponse() ) @@ -4325,6 +4366,7 @@ async def test_corroborate_content_rest_asyncio_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"} await client.corroborate_content(request) @@ -4367,6 +4409,7 @@ async def test_corroborate_content_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.corroborate_content(request) # Establish that the response is the type that we expect. @@ -4412,6 +4455,7 @@ async def test_corroborate_content_rest_asyncio_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 = vertex_rag_service.CorroborateContentResponse.to_json( vertex_rag_service.CorroborateContentResponse() ) @@ -4464,6 +4508,7 @@ async def test_get_location_rest_asyncio_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"} await client.get_location(request) @@ -4501,6 +4546,7 @@ async def test_get_location_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_location(request) @@ -4533,6 +4579,7 @@ async def test_list_locations_rest_asyncio_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"} await client.list_locations(request) @@ -4570,6 +4617,7 @@ async def test_list_locations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_locations(request) @@ -4605,6 +4653,7 @@ async def test_get_iam_policy_rest_asyncio_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"} await client.get_iam_policy(request) @@ -4644,6 +4693,7 @@ async def test_get_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_iam_policy(request) @@ -4679,6 +4729,7 @@ async def test_set_iam_policy_rest_asyncio_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"} await client.set_iam_policy(request) @@ -4718,6 +4769,7 @@ async def test_set_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.set_iam_policy(request) @@ -4753,6 +4805,7 @@ async def test_test_iam_permissions_rest_asyncio_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"} await client.test_iam_permissions(request) @@ -4792,6 +4845,7 @@ async def test_test_iam_permissions_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.test_iam_permissions(request) @@ -4826,6 +4880,7 @@ async def test_cancel_operation_rest_asyncio_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"} await client.cancel_operation(request) @@ -4863,6 +4918,7 @@ async def test_cancel_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.cancel_operation(request) @@ -4897,6 +4953,7 @@ async def test_delete_operation_rest_asyncio_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"} await client.delete_operation(request) @@ -4934,6 +4991,7 @@ async def test_delete_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_operation(request) @@ -4968,6 +5026,7 @@ async def test_get_operation_rest_asyncio_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"} await client.get_operation(request) @@ -5005,6 +5064,7 @@ async def test_get_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_operation(request) @@ -5039,6 +5099,7 @@ async def test_list_operations_rest_asyncio_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"} await client.list_operations(request) @@ -5076,6 +5137,7 @@ async def test_list_operations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_operations(request) @@ -5110,6 +5172,7 @@ async def test_wait_operation_rest_asyncio_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"} await client.wait_operation(request) @@ -5147,6 +5210,7 @@ async def test_wait_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.wait_operation(request) diff --git a/tests/unit/gapic/aiplatform_v1beta1/test_vizier_service.py b/tests/unit/gapic/aiplatform_v1beta1/test_vizier_service.py index 43872b848f..71259bd737 100644 --- a/tests/unit/gapic/aiplatform_v1beta1/test_vizier_service.py +++ b/tests/unit/gapic/aiplatform_v1beta1/test_vizier_service.py @@ -6172,6 +6172,7 @@ def test_create_study_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_study(request) @@ -6226,6 +6227,7 @@ def test_create_study_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_study(**mock_args) @@ -6356,6 +6358,7 @@ def test_get_study_rest_required_fields(request_type=vizier_service.GetStudyRequ 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_study(request) @@ -6401,6 +6404,7 @@ def test_get_study_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_study(**mock_args) @@ -6539,6 +6543,7 @@ def test_list_studies_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_studies(request) @@ -6592,6 +6597,7 @@ def test_list_studies_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_studies(**mock_args) @@ -6783,6 +6789,7 @@ def test_delete_study_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_study(request) @@ -6826,6 +6833,7 @@ def test_delete_study_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_study(**mock_args) @@ -6962,6 +6970,7 @@ def test_lookup_study_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.lookup_study(request) @@ -7015,6 +7024,7 @@ def test_lookup_study_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.lookup_study(**mock_args) @@ -7156,6 +7166,7 @@ def test_suggest_trials_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.suggest_trials(request) @@ -7285,6 +7296,7 @@ def test_create_trial_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_trial(request) @@ -7341,6 +7353,7 @@ def test_create_trial_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_trial(**mock_args) @@ -7471,6 +7484,7 @@ def test_get_trial_rest_required_fields(request_type=vizier_service.GetTrialRequ 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_trial(request) @@ -7518,6 +7532,7 @@ def test_get_trial_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_trial(**mock_args) @@ -7656,6 +7671,7 @@ def test_list_trials_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_trials(request) @@ -7711,6 +7727,7 @@ def test_list_trials_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_trials(**mock_args) @@ -7911,6 +7928,7 @@ def test_add_trial_measurement_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.add_trial_measurement(request) @@ -8039,6 +8057,7 @@ def test_complete_trial_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.complete_trial(request) @@ -8155,6 +8174,7 @@ def test_delete_trial_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_trial(request) @@ -8200,6 +8220,7 @@ def test_delete_trial_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_trial(**mock_args) @@ -8338,6 +8359,7 @@ def test_check_trial_early_stopping_state_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_trial_early_stopping_state(request) @@ -8458,6 +8480,7 @@ def test_stop_trial_rest_required_fields(request_type=vizier_service.StopTrialRe 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_trial(request) @@ -8582,6 +8605,7 @@ def test_list_optimal_trials_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_optimal_trials(request) @@ -8629,6 +8653,7 @@ def test_list_optimal_trials_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_optimal_trials(**mock_args) @@ -9556,6 +9581,7 @@ def test_create_study_rest_bad_request(request_type=vizier_service.CreateStudyRe 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_study(request) @@ -9753,6 +9779,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_study(request) # Establish that the response is the type that we expect. @@ -9796,6 +9823,7 @@ def test_create_study_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 = gca_study.Study.to_json(gca_study.Study()) req.return_value.content = return_value @@ -9838,6 +9866,7 @@ def test_get_study_rest_bad_request(request_type=vizier_service.GetStudyRequest) 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_study(request) @@ -9876,6 +9905,7 @@ def test_get_study_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_study(request) # Establish that the response is the type that we expect. @@ -9917,6 +9947,7 @@ def test_get_study_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 = study.Study.to_json(study.Study()) req.return_value.content = return_value @@ -9959,6 +9990,7 @@ def test_list_studies_rest_bad_request(request_type=vizier_service.ListStudiesRe 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_studies(request) @@ -9994,6 +10026,7 @@ def test_list_studies_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_studies(request) # Establish that the response is the type that we expect. @@ -10034,6 +10067,7 @@ def test_list_studies_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 = vizier_service.ListStudiesResponse.to_json( vizier_service.ListStudiesResponse() ) @@ -10078,6 +10112,7 @@ def test_delete_study_rest_bad_request(request_type=vizier_service.DeleteStudyRe 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_study(request) @@ -10108,6 +10143,7 @@ def test_delete_study_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_study(request) # Establish that the response is the type that we expect. @@ -10144,6 +10180,7 @@ def test_delete_study_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 = vizier_service.DeleteStudyRequest() metadata = [ @@ -10182,6 +10219,7 @@ def test_lookup_study_rest_bad_request(request_type=vizier_service.LookupStudyRe 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.lookup_study(request) @@ -10220,6 +10258,7 @@ def test_lookup_study_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.lookup_study(request) # Establish that the response is the type that we expect. @@ -10263,6 +10302,7 @@ def test_lookup_study_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 = study.Study.to_json(study.Study()) req.return_value.content = return_value @@ -10307,6 +10347,7 @@ def test_suggest_trials_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.suggest_trials(request) @@ -10337,6 +10378,7 @@ def test_suggest_trials_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.suggest_trials(request) # Establish that the response is the type that we expect. @@ -10378,6 +10420,7 @@ def test_suggest_trials_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 @@ -10420,6 +10463,7 @@ def test_create_trial_rest_bad_request(request_type=vizier_service.CreateTrialRe 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_trial(request) @@ -10557,6 +10601,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_trial(request) # Establish that the response is the type that we expect. @@ -10602,6 +10647,7 @@ def test_create_trial_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 = study.Trial.to_json(study.Trial()) req.return_value.content = return_value @@ -10646,6 +10692,7 @@ def test_get_trial_rest_bad_request(request_type=vizier_service.GetTrialRequest) 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_trial(request) @@ -10688,6 +10735,7 @@ def test_get_trial_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_trial(request) # Establish that the response is the type that we expect. @@ -10731,6 +10779,7 @@ def test_get_trial_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 = study.Trial.to_json(study.Trial()) req.return_value.content = return_value @@ -10773,6 +10822,7 @@ def test_list_trials_rest_bad_request(request_type=vizier_service.ListTrialsRequ 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_trials(request) @@ -10808,6 +10858,7 @@ def test_list_trials_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_trials(request) # Establish that the response is the type that we expect. @@ -10848,6 +10899,7 @@ def test_list_trials_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 = vizier_service.ListTrialsResponse.to_json( vizier_service.ListTrialsResponse() ) @@ -10896,6 +10948,7 @@ def test_add_trial_measurement_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.add_trial_measurement(request) @@ -10938,6 +10991,7 @@ def test_add_trial_measurement_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.add_trial_measurement(request) # Establish that the response is the type that we expect. @@ -10983,6 +11037,7 @@ def test_add_trial_measurement_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 = study.Trial.to_json(study.Trial()) req.return_value.content = return_value @@ -11029,6 +11084,7 @@ def test_complete_trial_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.complete_trial(request) @@ -11071,6 +11127,7 @@ def test_complete_trial_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.complete_trial(request) # Establish that the response is the type that we expect. @@ -11116,6 +11173,7 @@ def test_complete_trial_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 = study.Trial.to_json(study.Trial()) req.return_value.content = return_value @@ -11160,6 +11218,7 @@ def test_delete_trial_rest_bad_request(request_type=vizier_service.DeleteTrialRe 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_trial(request) @@ -11192,6 +11251,7 @@ def test_delete_trial_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_trial(request) # Establish that the response is the type that we expect. @@ -11228,6 +11288,7 @@ def test_delete_trial_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 = vizier_service.DeleteTrialRequest() metadata = [ @@ -11270,6 +11331,7 @@ def test_check_trial_early_stopping_state_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.check_trial_early_stopping_state(request) @@ -11302,6 +11364,7 @@ def test_check_trial_early_stopping_state_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_trial_early_stopping_state(request) # Establish that the response is the type that we expect. @@ -11343,6 +11406,7 @@ def test_check_trial_early_stopping_state_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 @@ -11387,6 +11451,7 @@ def test_stop_trial_rest_bad_request(request_type=vizier_service.StopTrialReques 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_trial(request) @@ -11429,6 +11494,7 @@ def test_stop_trial_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_trial(request) # Establish that the response is the type that we expect. @@ -11474,6 +11540,7 @@ def test_stop_trial_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 = study.Trial.to_json(study.Trial()) req.return_value.content = return_value @@ -11518,6 +11585,7 @@ def test_list_optimal_trials_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_optimal_trials(request) @@ -11551,6 +11619,7 @@ def test_list_optimal_trials_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_optimal_trials(request) # Establish that the response is the type that we expect. @@ -11590,6 +11659,7 @@ def test_list_optimal_trials_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 = vizier_service.ListOptimalTrialsResponse.to_json( vizier_service.ListOptimalTrialsResponse() ) @@ -11636,6 +11706,7 @@ def test_get_location_rest_bad_request(request_type=locations_pb2.GetLocationReq 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_location(request) @@ -11666,6 +11737,7 @@ def test_get_location_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_location(request) @@ -11694,6 +11766,7 @@ def test_list_locations_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_locations(request) @@ -11724,6 +11797,7 @@ def test_list_locations_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_locations(request) @@ -11755,6 +11829,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -11787,6 +11862,7 @@ def test_get_iam_policy_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_iam_policy(request) @@ -11818,6 +11894,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -11850,6 +11927,7 @@ def test_set_iam_policy_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.set_iam_policy(request) @@ -11881,6 +11959,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -11913,6 +11992,7 @@ def test_test_iam_permissions_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.test_iam_permissions(request) @@ -11943,6 +12023,7 @@ def test_cancel_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.cancel_operation(request) @@ -11973,6 +12054,7 @@ def test_cancel_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.cancel_operation(request) @@ -12003,6 +12085,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) @@ -12033,6 +12116,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) @@ -12063,6 +12147,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) @@ -12093,6 +12178,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) @@ -12123,6 +12209,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) @@ -12153,6 +12240,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) @@ -12183,6 +12271,7 @@ def test_wait_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.wait_operation(request) @@ -12213,6 +12302,7 @@ def test_wait_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.wait_operation(request) @@ -12586,6 +12676,7 @@ async def test_create_study_rest_asyncio_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"} await client.create_study(request) @@ -12790,6 +12881,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.create_study(request) # Establish that the response is the type that we expect. @@ -12838,6 +12930,7 @@ async def test_create_study_rest_asyncio_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 = gca_study.Study.to_json(gca_study.Study()) req.return_value.read = mock.AsyncMock(return_value=return_value) @@ -12886,6 +12979,7 @@ async def test_get_study_rest_asyncio_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"} await client.get_study(request) @@ -12931,6 +13025,7 @@ async def test_get_study_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_study(request) # Establish that the response is the type that we expect. @@ -12977,6 +13072,7 @@ async def test_get_study_rest_asyncio_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 = study.Study.to_json(study.Study()) req.return_value.read = mock.AsyncMock(return_value=return_value) @@ -13025,6 +13121,7 @@ async def test_list_studies_rest_asyncio_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"} await client.list_studies(request) @@ -13067,6 +13164,7 @@ async def test_list_studies_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_studies(request) # Establish that the response is the type that we expect. @@ -13112,6 +13210,7 @@ async def test_list_studies_rest_asyncio_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 = vizier_service.ListStudiesResponse.to_json( vizier_service.ListStudiesResponse() ) @@ -13162,6 +13261,7 @@ async def test_delete_study_rest_asyncio_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"} await client.delete_study(request) @@ -13199,6 +13299,7 @@ async def test_delete_study_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_study(request) # Establish that the response is the type that we expect. @@ -13240,6 +13341,7 @@ async def test_delete_study_rest_asyncio_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 = vizier_service.DeleteStudyRequest() metadata = [ @@ -13284,6 +13386,7 @@ async def test_lookup_study_rest_asyncio_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"} await client.lookup_study(request) @@ -13329,6 +13432,7 @@ async def test_lookup_study_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.lookup_study(request) # Establish that the response is the type that we expect. @@ -13377,6 +13481,7 @@ async def test_lookup_study_rest_asyncio_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 = study.Study.to_json(study.Study()) req.return_value.read = mock.AsyncMock(return_value=return_value) @@ -13425,6 +13530,7 @@ async def test_suggest_trials_rest_asyncio_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"} await client.suggest_trials(request) @@ -13462,6 +13568,7 @@ async def test_suggest_trials_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.suggest_trials(request) # Establish that the response is the type that we expect. @@ -13508,6 +13615,7 @@ async def test_suggest_trials_rest_asyncio_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.read = mock.AsyncMock(return_value=return_value) @@ -13556,6 +13664,7 @@ async def test_create_trial_rest_asyncio_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"} await client.create_trial(request) @@ -13700,6 +13809,7 @@ def get_message_fields(field): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.create_trial(request) # Establish that the response is the type that we expect. @@ -13750,6 +13860,7 @@ async def test_create_trial_rest_asyncio_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 = study.Trial.to_json(study.Trial()) req.return_value.read = mock.AsyncMock(return_value=return_value) @@ -13800,6 +13911,7 @@ async def test_get_trial_rest_asyncio_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"} await client.get_trial(request) @@ -13849,6 +13961,7 @@ async def test_get_trial_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_trial(request) # Establish that the response is the type that we expect. @@ -13897,6 +14010,7 @@ async def test_get_trial_rest_asyncio_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 = study.Trial.to_json(study.Trial()) req.return_value.read = mock.AsyncMock(return_value=return_value) @@ -13945,6 +14059,7 @@ async def test_list_trials_rest_asyncio_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"} await client.list_trials(request) @@ -13987,6 +14102,7 @@ async def test_list_trials_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_trials(request) # Establish that the response is the type that we expect. @@ -14032,6 +14148,7 @@ async def test_list_trials_rest_asyncio_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 = vizier_service.ListTrialsResponse.to_json( vizier_service.ListTrialsResponse() ) @@ -14084,6 +14201,7 @@ async def test_add_trial_measurement_rest_asyncio_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"} await client.add_trial_measurement(request) @@ -14133,6 +14251,7 @@ async def test_add_trial_measurement_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.add_trial_measurement(request) # Establish that the response is the type that we expect. @@ -14183,6 +14302,7 @@ async def test_add_trial_measurement_rest_asyncio_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 = study.Trial.to_json(study.Trial()) req.return_value.read = mock.AsyncMock(return_value=return_value) @@ -14233,6 +14353,7 @@ async def test_complete_trial_rest_asyncio_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"} await client.complete_trial(request) @@ -14282,6 +14403,7 @@ async def test_complete_trial_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.complete_trial(request) # Establish that the response is the type that we expect. @@ -14332,6 +14454,7 @@ async def test_complete_trial_rest_asyncio_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 = study.Trial.to_json(study.Trial()) req.return_value.read = mock.AsyncMock(return_value=return_value) @@ -14382,6 +14505,7 @@ async def test_delete_trial_rest_asyncio_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"} await client.delete_trial(request) @@ -14421,6 +14545,7 @@ async def test_delete_trial_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_trial(request) # Establish that the response is the type that we expect. @@ -14462,6 +14587,7 @@ async def test_delete_trial_rest_asyncio_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 = vizier_service.DeleteTrialRequest() metadata = [ @@ -14508,6 +14634,7 @@ async def test_check_trial_early_stopping_state_rest_asyncio_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"} await client.check_trial_early_stopping_state(request) @@ -14547,6 +14674,7 @@ async def test_check_trial_early_stopping_state_rest_asyncio_call_success(reques return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.check_trial_early_stopping_state(request) # Establish that the response is the type that we expect. @@ -14597,6 +14725,7 @@ async def test_check_trial_early_stopping_state_rest_asyncio_interceptors( 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.read = mock.AsyncMock(return_value=return_value) @@ -14647,6 +14776,7 @@ async def test_stop_trial_rest_asyncio_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"} await client.stop_trial(request) @@ -14696,6 +14826,7 @@ async def test_stop_trial_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.stop_trial(request) # Establish that the response is the type that we expect. @@ -14746,6 +14877,7 @@ async def test_stop_trial_rest_asyncio_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 = study.Trial.to_json(study.Trial()) req.return_value.read = mock.AsyncMock(return_value=return_value) @@ -14794,6 +14926,7 @@ async def test_list_optimal_trials_rest_asyncio_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"} await client.list_optimal_trials(request) @@ -14834,6 +14967,7 @@ async def test_list_optimal_trials_rest_asyncio_call_success(request_type): return_value=json_return_value.encode("UTF-8") ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_optimal_trials(request) # Establish that the response is the type that we expect. @@ -14878,6 +15012,7 @@ async def test_list_optimal_trials_rest_asyncio_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 = vizier_service.ListOptimalTrialsResponse.to_json( vizier_service.ListOptimalTrialsResponse() ) @@ -14930,6 +15065,7 @@ async def test_get_location_rest_asyncio_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"} await client.get_location(request) @@ -14967,6 +15103,7 @@ async def test_get_location_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_location(request) @@ -14999,6 +15136,7 @@ async def test_list_locations_rest_asyncio_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"} await client.list_locations(request) @@ -15036,6 +15174,7 @@ async def test_list_locations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_locations(request) @@ -15071,6 +15210,7 @@ async def test_get_iam_policy_rest_asyncio_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"} await client.get_iam_policy(request) @@ -15110,6 +15250,7 @@ async def test_get_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_iam_policy(request) @@ -15145,6 +15286,7 @@ async def test_set_iam_policy_rest_asyncio_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"} await client.set_iam_policy(request) @@ -15184,6 +15326,7 @@ async def test_set_iam_policy_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.set_iam_policy(request) @@ -15219,6 +15362,7 @@ async def test_test_iam_permissions_rest_asyncio_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"} await client.test_iam_permissions(request) @@ -15258,6 +15402,7 @@ async def test_test_iam_permissions_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.test_iam_permissions(request) @@ -15292,6 +15437,7 @@ async def test_cancel_operation_rest_asyncio_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"} await client.cancel_operation(request) @@ -15329,6 +15475,7 @@ async def test_cancel_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.cancel_operation(request) @@ -15363,6 +15510,7 @@ async def test_delete_operation_rest_asyncio_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"} await client.delete_operation(request) @@ -15400,6 +15548,7 @@ async def test_delete_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.delete_operation(request) @@ -15434,6 +15583,7 @@ async def test_get_operation_rest_asyncio_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"} await client.get_operation(request) @@ -15471,6 +15621,7 @@ async def test_get_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.get_operation(request) @@ -15505,6 +15656,7 @@ async def test_list_operations_rest_asyncio_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"} await client.list_operations(request) @@ -15542,6 +15694,7 @@ async def test_list_operations_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.list_operations(request) @@ -15576,6 +15729,7 @@ async def test_wait_operation_rest_asyncio_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"} await client.wait_operation(request) @@ -15613,6 +15767,7 @@ async def test_wait_operation_rest_asyncio(request_type): ) req.return_value = response_value + req.return_value.headers = {"header-1": "value-1", "header-2": "value-2"} response = await client.wait_operation(request)